The Controlled Z-gate
Learn about the controlled Z-gate.
We'll cover the following
When we apply the -gate on separate qubits, we usually see the phase shift for those states where the respective qubit is in state . When both qubits are in-state , the phase shift adds up. Since the -gate accounts for a phase shift by half a wavelength, applying it twice results in the initial phase. Hence, the state has the same phase as a state .
Sometimes we don’t want this effect. We might want to switch the phase of a single state. This is where, the controlled -gate comes in handy. Like its controlled peers, the controlled -gate applies the -gate on the target qubit only if the control qubit is in state .
The controlled -gate has the following transformation matrix.
As a result of the -gate, we see state has a different phase than the other three states. The qubit at position 0 must be in-state , for it is the control qubit. The qubit at position 1 must be on state because the -gate applies the phase to this part of the qubit state.
The -gate induces a phase shift for states where both qubits are in-state . 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.