controlled 3 qubits
Controlled-CZ
Applies a $-1$ phase to $|111\rangle$ and leaves all other basis states unchanged.
The controlled-controlled-$Z$ gate applies a phase of $-1$ to the $|111\rangle$ state and acts as the identity on all others.
$$ \mathrm{CC}Z = \begin{bmatrix} 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{bmatrix} $$
Properties
- Hermitian and self-inverse: $\mathrm{CCZ}^2 = I$.
- Related to Toffoli by Hadamards on the target: $\mathrm{CC}X = (I \otimes I \otimes H)\mathrm{CC}Z(I \otimes I \otimes H)$.
- Symmetric under permutation of all three qubits, unlike Toffoli.
The unitary, drawn
Every entry of the matrix as a disc. The area is the transition probability $|U_{jk}|^2$; the colour and the hand are the phase. Rows are outputs $\langle j|$, columns inputs $|k\rangle$, in the computational basis.
Phase
Disc area $= |U_{jk}|^2$. Hover an entry for its value, or take the JSON.
SDK support
How to call this gate in each framework. Hover a ⓘ for a note; the support matrix compares every gate at once.
| SDK | Name |
|---|---|
| Qiskit | qiskit.circuit.library.CCZGate |
| PennyLane | pennylane.CCZ |
| Cirq | cirq.CCZ |
| Q# | — ⓘ |
| PyQuil | — ⓘ |
| Braket | — ⓘ |
| BQSKit | — ⓘ |
| Qibo | qibo.gates.CCZ |
| pytket | pytket.circuit.OpType.CnZ ⓘ |
| Stim | — |
| OpenQASM | — ⓘ |