The Pauli gate is defined by its action on the computational basis states

In PennyLane, you can implement it by calling qml.PauliZ. It has the following circuit element:

Write a QNode that applies qml.PauliZ to the state and returns the state. What state is this? How do the measurement probabilities differ from those of the state

dev = qml.device("default.qubit", wires=1)


@qml.qnode(dev)
def apply_z_to_plus():
"""Write a circuit that applies PauliZ to the |+> state and returns
the state.

Returns:
np.array[complex]: The state of the qubit after the operations.
"""

##################
# YOUR CODE HERE #
##################

# CREATE THE |+> STATE

# APPLY PAULI Z

# RETURN THE STATE
return


print(apply_z_to_plus())

or to submit your code

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

Learning Objectives:

  • Distinguish between global and relative phases.
  • Describe the action of the RZ gate and its matrix representation.
  • Identify 3 special cases of RZ.