The Controlled Z-gate

Learn about the controlled Z-gate.

We'll cover the following

When we apply the ZZ-gate on separate qubits, we usually see the phase shift for those states where the respective qubit is in state 1|1\rangle. When both qubits are in-state 1|1\rangle, the phase shift adds up. Since the ZZ-gate accounts for a phase shift by half a wavelength, applying it twice results in the initial phase. Hence, the state 11|11\rangle has the same phase as a state 00|00\rangle.

Sometimes we don’t want this effect. We might want to switch the phase of a single state. This is where, the controlled ZZ-gate comes in handy. Like its controlled peers, the controlled ZZ-gate applies the ZZ-gate on the target qubit only if the control qubit is in state 1|1\rangle.

The controlled ZZ-gate has the following transformation matrix.

CZ=[1000010000100001]CZ=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix}

As a result of the CZCZ-gate, we see state 11|11\rangle has a different phase than the other three states. The qubit at position 0 must be in-state 1|1\rangle, for it is the control qubit. The qubit at position 1 must be on state 1|1\rangle because the ZZ-gate applies the phase to this part of the qubit state.

The CZCZ-gate induces a phase shift for states where both qubits are in-state 1|1\rangle. It does not matter if we use qubit 0 or qubit 1 as the control qubit. Therefore, in Qiskit, we use a drawing that does not indicate the control qubit.

Get hands-on with 1400+ tech skills courses.