Earlier, we learned how to create a gate using and A similar circuit identity can be constructed for the controlled- using controlled- () and

In PennyLane, the controlled- is available as qml.CZ, and can be called in the same way as qml.CNOT.

Complete the function imposter_cz below to reveal the relationship.

or to submit your code

To interact with codercises, please switch to a larger screen size.

Learning Objectives:

  • Define and apply a set of common multi-qubit operations: the controlled-Z, Toffoli, and SWAP gates.
  • Express common 3-qubit operations in terms of 1- and 2-qubit operations.