# CCZ gate (Controlled-Controlled-Z) **CCZ** (Controlled-Controlled-Z or Doubly-Controlled-Z) is a three-qubit gate: applies a phase to the target qubit if both control qubits are $|1\rangle$. Like CZ but doubly-controlled, it is symmetric in all three qubits and less commonly used than CCX on most platforms. Action: $|c_1 c_2 t\rangle \to (-1)^{c_1 c_2 t}|c_1 c_2 t\rangle$ where only the $|111\rangle$ state gets a $-1$ phase. $$\text{CCZ} = \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 \end{pmatrix}$$ Basis state mapping: identity on all states except $|111\rangle$. Maps $|111\rangle \to -|111\rangle$. ## Properties - **Self-inverse**: $\text{CCZ}^2 = I$ - **Symmetric**: all three qubits play equivalent roles; $\text{CCZ}$ is invariant under qubit permutations - **Diagonal**: only applies phases, like CZ - **Related to CZ**: extends the two-qubit CZ to three qubits ## Uses - **Alternative to CCX**: some algorithms use CCZ instead of CCX for phase-based operations - **Quantum simulation**: simulating Hamiltonians with three-body interactions - **Stabilizer codes**: appears in some error correction schemes - **Graph states**: generates certain entangled graph states ## Decomposition CCZ can be decomposed using CCX and Hadamard gates: $$\text{CCZ} = (I \otimes I \otimes H) \text{CCX} (I \otimes I \otimes H)$$ Alternatively, decompose into CX/CZ chains. Gate count: two Hadamard gates and one CCX, or ~6 CX gates. ## Parametric version - **CCZ($\theta$)**: applies phase $e^{i\theta}$ to $|111\rangle$; $\text{CCZ}(\theta) = \text{diag}(1, 1, 1, 1, 1, 1, 1, e^{i\theta})$ - **Use**: tunable three-body interactions in parametric systems ## Implementation - **Superconducting qubits**: typically decomposed into CX chains or via CCX; native implementation uncommon - **Trapped ions**: three-body interactions possible with laser pulse sequences - **Photonic**: challenging; usually decomposed ## Relations - [[quantum-gate-ccx|CCX]]: doubly-controlled X; related via Hadamard conjugation - [[quantum-gate-ccy|CCY]]: doubly-controlled Y; related to CCZ by phase gate conjugation - [[quantum-gate-cz|CZ]]: two-qubit version; CCZ extends to three qubits - [[quantum-gate-z|Pauli Z]]: the gate applied to target when both controls are $|1\rangle$ - [[quantum-gate-three-qubit|Three-qubit gates]]: general category