Site Tools


ccz-gate

Table of Contents

CCZ gate

CCZ gate (doubly-controlled Z) is a three-qubit gate that applies a Pauli Z to the target qubit if and only if both control qubits are , and does nothing otherwise. Because Z acts as a phase flip, the CCZ gate is fully symmetric: any permutation of the three qubits produces the same unitary.

The gate maps , flipping the sign of and leaving all other computational basis states unchanged. Its matrix is the identity with the bottom-right entry negated (basis ordered through ):

Relation to CCX

CCZ and CCX are locally equivalent: applying a Hadamard to the target qubit before and after a CCX gives CCZ, and vice versa. The identity is . In practice, most frameworks implement CCZ by wrapping CCX with Hadamard layers rather than providing a separate decomposition.

Properties

The CCZ gate is its own inverse: . Its three-qubit symmetry means that, unlike CX and CCX, there is no notion of a designated target — every qubit plays an equal role. CCZ appears in quantum phase-kickback constructions, Grover oracle implementations, and as a building block in fault-tolerant gate sets where the T-count of its decomposition (six T gates, same as CCX) is the relevant cost metric.

List of code implementations

ccz-gate.md · Last modified: