← Atlas

Gates · Controlled gate

Controlled-Z gate

A diagonal two-qubit entangling gate that applies a -1 phase exactly when both qubits are |1⟩, and is symmetric between the two qubits it acts on.

Exact & formalUpdated

View frozen graph

A small worked example, computed in your browser. It is not a result from this record's papers.

CZ entangles without moving any probability

Two qubits, both put into |+⟩, so all four outcomes are equally likely before the gate.

q0q1Step 1 of 3 · HHStep 2 of 3 · HHStep 3 of 3 · CZCZ

Step 1 of 3 · H

Probability of each outcome after this step

  • 0050%
  • 0150%
  1. Qubit 0 into an equal superposition.

    Probability spreads from 1 outcome to 2. All 2 are equally likely.

  2. Qubit 1 as well, so all four two-bit outcomes are equally likely.

    Probability spreads from 2 outcomes to 4. All 4 are equally likely.

  3. Flips the sign of the one branch where both qubits are 1, and leaves the other three alone. Not one outcome changes probability, and the two qubits are entangled afterwards — which is why a bar chart is the wrong instrument for this gate.

    The outcome probabilities do not move at all. What this step changes is phase — 2 distinct relative phases across the state now — which no measurement can see until a later step turns it back into probability. This is the step that entangles the qubits: from here on no single qubit has a state of its own, only the register as a whole does.

Readout All four outcomes stay equally likely, before and after. CZ is symmetric in its two qubits — unlike CX there is no telling which one was the control — and it is the gate that builds graph states and cluster states.

Open in Studio
  • Steps1
  • Wires2
  • Qubits2
  • Depth1 gate
  • Outcomesphase-only, basis-preserving
  • Papers1

Definition

CZ=(100001000010000−1)\mathrm{CZ} = \begin{pmatrix} 1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&-1 \end{pmatrix}

in the ordered basis {∣00⟩,∣01⟩,∣10⟩,∣11⟩}\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\}. The matrix is diagonal and, unlike CX\mathrm{CX}, symmetric under exchanging the two qubits: CZ\mathrm{CZ} has no distinguished "control" wire.

Action on basis states

CZ∣c,t⟩=(−1)c⋅t∣c,t⟩\mathrm{CZ}|c,t\rangle = (-1)^{c\cdot t}|c,t\rangle

Only the ∣11⟩|11\rangle component picks up a sign; all other basis states are untouched. Applied to a product of superpositions it creates entanglement by correlating the relative phase with both qubits simultaneously, e.g. CZ(∣0⟩+∣1⟩2⊗∣0⟩+∣1⟩2)=12(∣00⟩+∣01⟩+∣10⟩−∣11⟩)\mathrm{CZ}\big(\tfrac{|0\rangle+|1\rangle}{\sqrt2}\otimes\tfrac{|0\rangle+|1\rangle}{\sqrt2}\big) = \tfrac12(|00\rangle+|01\rangle+|10\rangle-|11\rangle).

Key identities

  • CZ=(I⊗H) CX (I⊗H)\mathrm{CZ} = (I\otimes H)\,\mathrm{CX}\,(I\otimes H): conjugating the target of CX\mathrm{CX} by Hadamard converts the bit-flip entangler into the phase-flip entangler and vice versa.
  • CZ2=I⊗I\mathrm{CZ}^2 = I\otimes I: CZ\mathrm{CZ} is its own inverse (it is a Clifford involution).
  • CZ\mathrm{CZ} is the λ=π\lambda=\pi special case of the controlled-phase gate CP(λ)\mathrm{CP}(\lambda).
  • Applying CZ\mathrm{CZ} to every edge of a graph on qubits initialized in ∣+⟩|+\rangle prepares the corresponding cluster/graph state, the resource state for measurement-based quantum computation.

References

Exact & formal
  • Basis-state truth table
  • Unitary / matrix equivalence
  • Textbook / standard citation
Method
Apply CZ to all four computational-basis inputs and confirm the matrix is diagonal and symmetric under control/target exchange.
Result
Pass · CZ|11⟩ = -|11⟩ and all other basis states are unchanged; swapping control and target leaves the gate identical.
OpenQASM 3 standard gate set ↗
Kind
curated reference
Reviewed by
Leona Quantum curation pass
License
CC BY 4.0-compatible reference metadata
controlled gateentanglementtwo qubitclifford

Atlas stars stay in the public catalog. Saving this entry to your workspace starts an unstarred private copy.