← Atlas

Gates · Multi-qubit gate

CCZ (doubly-controlled Z) gate

The phase-only sibling of the Toffoli gate that applies a -1 phase exactly when all three qubits are |1⟩, symmetric in all three qubits and the natural three-qubit generalization of CZ.

Exact & formalUpdated

View frozen graph

q[0]q[1]q[2]Step 1 of 1 · CCZ · on q[0], q[1], q[2]CCZ

1 step across 3 wires. Hover a step, or press play to go through them in order.

Expected outcomes

  • |111⟩ phase-flipped100%
  • all other 7 inputs unchanged100%
  • Steps1
  • Wires3
  • Qubits3
  • Depth1 native / 3-gate decomposition around Toffoli (H, CCX, H)
  • T-count7 (inherited from Toffoli)
  • Papers2

Definition

CCZ∣a,b,c⟩=(−1)a∧b∧c ∣a,b,c⟩\mathrm{CCZ}|a,b,c\rangle = (-1)^{a\wedge b\wedge c}\,|a,b,c\rangle

As an 8×88\times 8 diagonal matrix, CCZ=diag(1,1,1,1,1,1,1,−1)\mathrm{CCZ} = \mathrm{diag}(1,1,1,1,1,1,1,-1) in the ordered basis ∣000⟩,…,∣111⟩|000\rangle,\dots,|111\rangle — the identity everywhere except a sign flip on ∣111⟩|111\rangle.

Action on basis states and symmetry

Only ∣111⟩|111\rangle picks up a phase; the other seven computational-basis states are completely unaffected. Because the matrix is symmetric under any permutation of the three qubits, CCZ\mathrm{CCZ} has no distinguished "target" — unlike Toffoli, where swapping the target with a control changes the gate.

Decomposition

CCZ=(I⊗I⊗H)  CCX  (I⊗I⊗H)\mathrm{CCZ} = (I\otimes I\otimes H)\;\mathrm{CCX}\;(I\otimes I\otimes H)

exactly mirroring the two-qubit identity CZ=(I⊗H) CX (I⊗H)\mathrm{CZ} = (I\otimes H)\,\mathrm{CX}\,(I\otimes H): conjugating the Toffoli's target by Hadamard converts its controlled bit-flip (XX on the control-11 block) into a controlled phase-flip (HXH=ZHXH=Z on that same block), leaving the control-not-both-1 blocks at identity in both cases.

Key identities

  • CCZ2=I⊗3\mathrm{CCZ}^2 = I^{\otimes 3}: applying the same doubly-controlled phase twice restores the input.
  • CCZ\mathrm{CCZ} is non-Clifford, exactly like Toffoli: it inherits the same resource cost (6 CNOT + 2 H + 7 T-family gates, via the Toffoli decomposition sandwiched by the extra pair of target Hadamards, which cancel two of Toffoli's own Hadamards).
  • CCZ\mathrm{CCZ} is the natural building block for multi-controlled-phase oracles in amplitude amplification and Grover-style search, since its full symmetry across all three qubits makes larger CnZC^nZ constructions compose more uniformly than CnXC^nX ones.

References

Exact & formal
  • Basis-state truth table
  • Unitary / matrix equivalence
  • Textbook / standard citation
Method
Apply CCZ to all eight computational-basis inputs and confirm only |111⟩ picks up a sign flip, with all other seven states unchanged.
Result
Pass · CCZ|111⟩ = -|111⟩ and CCZ leaves all other seven basis states unchanged.
OpenQASM 3 standard gate set ↗
Kind
curated reference
Reviewed by
Leona Quantum curation pass
License
CC BY 4.0-compatible reference metadata
multi-controlledphasethree qubitnon-clifford

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