Controlled gate

On this page 7

A controlled gate is a multi-qubit quantum logic gate that applies a unitary operation U to one or more target qubits only when its control qubits are in a specified state, usually |1>, and leaves the targets unchanged otherwise. In quantum computing, controlled gates are the main tool for making qubits interact, and they appear throughout quantum gates & circuits as the building blocks of entanglement, arithmetic and oracles.

Because the control can itself be in superposition, a controlled gate does not simply branch like a classical if statement. It correlates the target with the control, which is exactly how entangled states such as Bell states are produced from separable inputs.

How a controlled gate acts on control and target qubits

A controlled gate with one control and a single-qubit operation U is written C-U or controlled-U. Its matrix is block diagonal: an identity block acting when the control is |0> and the U block acting when the control is |1>. In compact form, C-U equals |0><0| tensor I plus |1><1| tensor U, written here in words to keep the notation readable.

Linearity makes the behavior on superpositions follow automatically. If the control is in a|0> + b|1>, the output is a|0>|t> + b|1>U|t>, which is generally entangled unless U leaves the target unchanged up to a phase. This is why controlled gates are called entangling gates.

The table below lists frequently used controlled gates and their targets.

GateControlsOperation on targetTypical role
CNOT gate1Pauli X (bit flip)Entanglement, parity, copying basis states
Controlled-Z gate1Pauli Z (phase flip)Native entangler on many devices
Controlled phase1Phase rotation by angle phiQuantum Fourier transform
Controlled rotation1Rx, Ry or Rz by angle thetaVariational and amplitude encoding circuits
Toffoli gate2Pauli XReversible AND, arithmetic
Fredkin gate1SWAP of two targetsControlled swap tests
Common controlled gates

Control conditions, symmetry and phase kickback

Controls need not trigger on |1>. A negative control, drawn as an open circle, triggers on |0> and is implemented by surrounding a normal control with X gates. Multi-controlled gates can mix positive and negative controls to match any classical bit pattern.

The distinction between control and target is basis dependent. The controlled-Z gate is fully symmetric, so either qubit can be called the control. A CNOT viewed in the Hadamard basis reverses roles: conjugating both qubits with Hadamard gates swaps control and target.

Phase kickback is the most important consequence of this symmetry. When the target is an eigenstate of U with eigenvalue e^(i phi), the phase moves onto the control qubit instead of changing the target. Quantum phase estimation, Shor’s algorithm and the Deutsch–Jozsa algorithm all rely on this effect.

VariantTriggers whenImplementation note
Positive controlControl is |1>Standard filled dot
Negative controlControl is |0>X gates before and after
Multi-controlAll controls match patternNeeds decomposition or ancillas
Classical controlMeasured bit equals 1Uses mid-circuit measurement result
Control variants and their behavior

Decomposing controlled gates into native operations

Hardware rarely implements arbitrary controlled gates directly, so compilers decompose them into a native gate set. Any controlled-U on one target can be built from at most two CNOT gates and single-qubit rotations, using the decomposition of U into rotations and a global phase that becomes a controlled phase.

Multi-controlled gates are more expensive. A Toffoli gate needs six CNOT gates in its standard decomposition with T and Hadamard gates, and an n-controlled gate grows to a linear number of Toffolis when ancilla qubits are available, or to a quadratic count without them. On error-corrected hardware, the T-gate count often dominates cost.

The following table gives typical decomposition costs; exact numbers depend on connectivity and the native gate set.

GateCNOT countAncillasNotes
Controlled-Z1NoneCNOT conjugated by Hadamard gates
Controlled-U, single targetUp to 2NonePlus single-qubit rotations
Toffoli6NoneSeven T or T-dagger gates
n-controlled XLinear in nAbout n minus 2Toffoli ladder with uncomputation
n-controlled XQuadratic in nNoneSlower but saves qubits
Typical cost of decomposing controlled gates

Role in universality and quantum algorithms

Controlled gates are essential for universal quantum computation. Single-qubit gates alone cannot create entanglement, but adding any one entangling two-qubit gate, such as CNOT or controlled-Z, yields a universal gate set capable of approximating any unitary to arbitrary precision.

In algorithms, controlled gates implement oracles, arithmetic and controlled evolution. Grover’s algorithm uses a multi-controlled Z as its diffusion core, while phase estimation applies controlled powers of U to read out eigenvalues. Note that the Clifford group including CNOT is efficiently simulable classically under the Gottesman–Knill theorem, so non-Clifford controlled gates such as Toffoli supply the computational power.

Errors and practical pitfalls

Two-qubit controlled gates are typically the noisiest operations on current hardware, with error rates often ten times higher than single-qubit gates. Minimizing their number is therefore a primary objective of circuit optimization.

SymptomLikely causeMitigation
Low fidelity in deep circuitsToo many two-qubit gatesGate cancellation, better synthesis
Unexpected phase errorsIgnored global phase of UImplement it as controlled phase
Extra SWAP overheadControl and target not adjacentQubit routing and layout optimization
Wrong results after reuseAncillas left entangledUncompute ancillas before reuse
Common problems with controlled gates

The short version

A controlled gate is a quantum switch with a condition: it changes one qubit only if another qubit says yes. Think of a light that turns on only when a separate key is turned.

The surprising part is that the key can be half turned and half not at the same time. Then the light ends up linked to the key, so checking one tells you about the other. This link is called entanglement, and controlled gates are the main way quantum computers create it.

Where it makes a difference

A software engineer is preparing a three-qubit quantum Fourier transform for a superconducting processor whose native two-qubit gate is the controlled-Z. The textbook circuit contains three controlled phase gates with angles of pi/2, pi/4 and pi/2, plus Hadamard gates and a final swap.

The compiler rewrites each controlled phase as two CNOT-equivalent controlled-Z gates with single-qubit rotations, and routes qubits to avoid extra SWAPs on the device layout. The optimized version uses six two-qubit gates instead of nine in a naive compilation. On hardware with roughly one percent two-qubit error, this cut raises the measured success probability noticeably, showing why counting controlled gates is central to practical circuit design.