Controlled-U Gates

Almost everything a quantum computer does that a classical one cannot comes from making an operation conditional on quantum information — and the controlled-UU gate is the primitive that does exactly this. Take any single-qubit unitary U∈U(2)U\in\mathrm{U}(2), hand it a second qubit called the control, and CU\mathrm{C}U runs UU on the target in the branch where the control reads ∣1⟩\lvert 1\rangle and leaves it alone in the ∣0⟩\lvert 0\rangle branch. Because the control can itself be in superposition, the two branches coexist and the result is generically entangled. This one construction contains CNOT (U=XU=X), controlled-ZZ (U=ZU=Z), the controlled phase rotations that build the quantum Fourier transform, and — stacked into multi-control form — the Toffoli gate and quantum oracles. The structure is deceptively simple: CU\mathrm{C}U is block-diagonal in the control basis, an identity block above a copy of UU, and from that one fact everything follows. Feed the target an eigenstate of UU and the eigenvalue detaches from the target and reappears as a relative phase on the control — phase kickback, the engine of phase estimation, Shor's algorithm, and HHL. Ask how to build CU\mathrm{C}U from hardware-native CNOTs and single-qubit rotations and the Z–Y decomposition answers with an exact two-CNOT circuit, while exposing a trap: the global phase of UU, invisible for a lone gate, becomes physically real the moment UU is controlled.

Key takeaways
  • A controlled-UU gate applies a single-qubit unitary UU to a target qubit only when the control is ∣1⟩\lvert 1\rangle, and does nothing when the control is ∣0⟩\lvert 0\rangle.
  • Its operator is block-diagonal, CU=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗U\mathrm{C}U=\lvert 0\rangle\langle 0\rvert\otimes I+\lvert 1\rangle\langle 1\rvert\otimes U, which specializes to CNOT (U=XU=X), controlled-ZZ (U=ZU=Z) and controlled phase (U=RzU=R_z).
  • On an eigenstate U∣u⟩=eiθ∣u⟩U\lvert u\rangle=e^{i\theta}\lvert u\rangle the target is untouched and the eigenphase kicks back onto the control — the mechanism behind phase estimation.
  • Any CU\mathrm{C}U compiles into exactly two CNOTs via the ABC identity U=eiαAXBXCU=e^{i\alpha}AXBXC with ABC=IABC=I, plus a phase gate diag(1,eiα)\mathrm{diag}(1,e^{i\alpha}) on the control — and dropping that control-phase gate is the classic compilation bug.
  • Multi-controlled gates CnU\mathrm{C}^{n}U (Toffoli, oracles) are built recursively from two-qubit controlled gates using V=UV=\sqrt{U}.
  • Key idea: controlled-UU writes a single-qubit unitary into the ∣1⟩⟨1∣\lvert 1\rangle\langle 1\rvert block of a block-diagonal two-qubit operator, CU=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗U\mathrm{C}U=\lvert 0\rangle\langle 0\rvert\otimes I+\lvert 1\rangle\langle 1\rvert\otimes U — phase kickback, the two-CNOT compilation, and multi-controlled gates all follow from this one structure.
The core insight

Controlled-UU writes a single-qubit unitary into the ∣1⟩⟨1∣\lvert 1\rangle\langle 1\rvert block of a block-diagonal two-qubit operator: CU=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗U\mathrm{C}U=\lvert 0\rangle\langle 0\rvert\otimes I+\lvert 1\rangle\langle 1\rvert\otimes U. Everything else — phase kickback, the ABC compilation, and multi-controlled extensions — follows from this single structure.

Where this lives today

Controlled-UU is not a textbook idealization — it is what quantum hardware spends most of its time doing. Superconducting processors from IBM and Google expose a two-qubit entangler (a controlled-ZZ, an echoed cross-resonance CNOT, or a tunable controlled-phase) plus single-qubit rotations, and every higher-level operation is transpiled into those primitives using exactly the two-CNOT ABC construction; IBM's native X\sqrt X gate is the VV of Worked Example 2, while trapped-ion and neutral-atom machines use Mølmer–Sørensen and Rydberg-blockade interactions. At the algorithm layer, controlled powers CU2j\mathrm{C}U^{2^j} drive quantum phase estimation — the heart of Shor's factoring, HHL, and quantum-chemistry energy estimation — and the controlled rotations CRk\mathrm{C}R_k are the rungs of every quantum Fourier transform. Fault-tolerant architectures spend heavily synthesizing controlled non-Clifford gates by distilling magic states, and open problems stay sharp: optimal CNOT- and TT-count synthesis of a given CU\mathrm{C}U, and efficient block-encoding of controlled unitaries for qubitization — refinements of the primitive introduced here.

The physical picture

Picture the control qubit as a quantum switch wired to the target: "off" applies the identity II, "on" applies UU. What makes it quantum is that the switch itself can be placed in superposition. When the control is 12(∣0⟩+∣1⟩)\tfrac{1}{\sqrt2}(\lvert 0\rangle+\lvert 1\rangle), both settings fire at once into orthogonal branches and the gate produces 12(∣0⟩∣ψ⟩+∣1⟩U∣ψ⟩)\tfrac{1}{\sqrt2}(\lvert 0\rangle\lvert\psi\rangle+\lvert 1\rangle U\lvert\psi\rangle) — a coherent superposition of "did nothing" and "applied UU." That output is entangled unless U∣ψ⟩∝∣ψ⟩U\lvert\psi\rangle\propto\lvert\psi\rangle, which is why the controlled gate is the workhorse for making entanglement. The first figure fixes this switch picture together with the block-diagonal operator it produces.

Figure
Controlled-U as a quantum switch: the control-0 branch runs the identity I, the control-1 branch runs U, so the operator is block-diagonal with I above U — and a control in superposition entangles the two branches into the output shown, where CU equals P₀ ⊗ I + P₁ ⊗ U with P₀, P₁ the control projectors
Control = quantum switch: |0⟩ runs I, |1⟩ runs U — a block-diagonal two-qubit gate |c⟩ |t⟩ U controlled-U CU = 1 0 0 0 0 1 0 0 0 0 u₀₀ u₀₁ 0 0 u₁₀ u₁₁ I U block Superposition control → entanglement CU · ½^½ (|0⟩ + |1⟩)|ψ⟩ ½^½ ( |0⟩|ψ⟩ + |1⟩ U|ψ⟩ ) entangled unless U|ψ⟩ ∝ |ψ⟩

Now suppose the target starts in an eigenstate of UU, say U∣u⟩=eiθ∣u⟩U\lvert u\rangle=e^{i\theta}\lvert u\rangle. The gate cannot change ∣u⟩\lvert u\rangle — it may only multiply it by eiθe^{i\theta} — but that scalar sits in front of the ∣1⟩\lvert 1\rangle branch only, giving (α∣0⟩+eiθβ∣1⟩)∣u⟩(\alpha\lvert 0\rangle+e^{i\theta}\beta\lvert 1\rangle)\lvert u\rangle: the target is untouched while the eigenphase migrates onto the control. This "phase kickback" lets a quantum computer read out a property of UU by measuring the control, and the second figure carries it through with real numbers, using U=TU=T (whose ∣1⟩\lvert 1\rangle eigenvalue is eiπ/4e^{i\pi/4}) to turn a hidden eigenphase into a concrete pair of measurement probabilities.

Figure
Phase kickback with numbers: control in the plus state, target in the T-eigenstate; controlled-T stamps e^(iπ/4) onto the control, then a Hadamard converts that relative phase into measurement probabilities cos²(π/8) = 0.854 and sin²(π/8) = 0.146, reading off the eigenphase φ = 1/8
The punchline: kickback reads the eigenphase — φ = 1/8 → P(0) = cos²(π/8) = 0.854 |+⟩ |1⟩ T H T|1⟩ = e^{iπ/4}|1⟩, φ = 1/8 ½^½(|0⟩ + e^{iπ/4}|1⟩) 1.0 0 0.854 0.146 measure 0 measure 1 cos²(π/8) P(0) = (1+cos θ)/2 θ = 2πφ = π/4 = cos²(π/8) = 0.854

The core equations

The definition is a single operator, written with the control qubit first. Two orthogonal projectors on the control select which single-qubit operation the target sees: the identity in one branch, UU in the other — and every property of the gate is a corollary of this one line.

CU=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗U(1)\mathrm{C}U=\lvert 0\rangle\langle 0\rvert\otimes I+\lvert 1\rangle\langle 1\rvert\otimes U \qquad (1)

where: ∣0⟩⟨0∣, ∣1⟩⟨1∣\lvert 0\rangle\langle 0\rvert,\ \lvert 1\rangle\langle 1\rvert are the projectors onto the control basis states; II is the 2×22\times2 identity on the target; UU is any single-qubit unitary with U†U=IU^\dagger U=I. Reading it: the control chooses the block, the target lives inside the chosen block. Ordering the two-qubit basis as {∣00⟩,∣01⟩,∣10⟩,∣11⟩}\{\lvert 00\rangle,\lvert 01\rangle,\lvert 10\rangle,\lvert 11\rangle\} with the control most significant, equation (1) becomes a 4×44\times4 block-diagonal matrix — a 2×22\times2 identity in the top-left, the matrix of UU in the bottom-right, zeros off the blocks.

CU=(1000010000u00u0100u10u11)(2)\mathrm{C}U=\begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & u_{00} & u_{01}\\ 0 & 0 & u_{10} & u_{11}\end{pmatrix} \qquad (2)

where: uiju_{ij} are the matrix elements of U=∑ijuij∣i⟩⟨j∣U=\sum_{ij}u_{ij}\lvert i\rangle\langle j\rvert. The upper block never touches the lower block, so unitarity of CU\mathrm{C}U is exactly unitarity of UU. Acting on a control in superposition, linearity distributes the gate over the two branches — the equation that makes controlled gates entangling rather than merely conditional.

CU (α∣0⟩+β∣1⟩)⊗∣ψ⟩=α∣0⟩∣ψ⟩+β∣1⟩ U∣ψ⟩(3)\mathrm{C}U\,(\alpha\lvert 0\rangle+\beta\lvert 1\rangle)\otimes\lvert\psi\rangle=\alpha\lvert 0\rangle\lvert\psi\rangle+\beta\lvert 1\rangle\,U\lvert\psi\rangle \qquad (3)

where: α,β\alpha,\beta are the control amplitudes with ∣α∣2+∣β∣2=1\lvert\alpha\rvert^2+\lvert\beta\rvert^2=1, and ∣ψ⟩\lvert\psi\rangle is any target state. The output factorizes only when U∣ψ⟩∝∣ψ⟩U\lvert\psi\rangle\propto\lvert\psi\rangle; otherwise the two qubits are entangled. When the target is an eigenstate of UU, it survives untouched and the eigenvalue attaches to the ∣1⟩\lvert 1\rangle amplitude of the control — phase kickback stated as an identity.

U∣u⟩=eiθ∣u⟩ ⇒ CU (α∣0⟩+β∣1⟩)∣u⟩=(α∣0⟩+eiθβ∣1⟩)∣u⟩(4)U\lvert u\rangle=e^{i\theta}\lvert u\rangle\ \Rightarrow\ \mathrm{C}U\,(\alpha\lvert 0\rangle+\beta\lvert 1\rangle)\lvert u\rangle=(\alpha\lvert 0\rangle+e^{i\theta}\beta\lvert 1\rangle)\lvert u\rangle \qquad (4)

where: ∣u⟩\lvert u\rangle is an eigenstate of UU and eiθe^{i\theta} its unit-modulus eigenvalue. A property of the target (θ\theta) has become a relative phase of the control, ready to be read by interference. To build CU\mathrm{C}U from a hardware gate set, start from the Z–Y decomposition U=eiαRz(β)Ry(γ)Rz(δ)U=e^{i\alpha}R_z(\beta)R_y(\gamma)R_z(\delta) and repackage it: choose A,B,CA,B,C whose product is the identity but between which a Pauli-XX reconstructs UU.

U=eiα A X B X C,ABC=I(5)U=e^{i\alpha}\,A\,X\,B\,X\,C,\qquad ABC=I \qquad (5)

where: A,B,CA,B,C are single-qubit gates assembled from zz- and yy-rotations, eiαe^{i\alpha} is the global phase of UU, and each XX is supplied by a CNOT's target action. Control off gives ABC=IABC=I (target untouched); control on inserts the two XX's and yields UU. Turning equation (5) into a circuit, each XX is realized by a CNOT sharing the control, and the leftover eiαe^{i\alpha} is applied as a phase gate on the control — because a global phase becomes a relative phase between branches.

CU=(Φ(α)⊗I)(I⊗A) CX (I⊗B) CX (I⊗C)(6)\mathrm{C}U=\big(\Phi(\alpha)\otimes I\big)(I\otimes A)\,\mathrm{C}X\,(I\otimes B)\,\mathrm{C}X\,(I\otimes C) \qquad (6)

where: Φ(α)=diag(1,eiα)\Phi(\alpha)=\mathrm{diag}(1,e^{i\alpha}) acts on the control and CX\mathrm{C}X is a CNOT with the same control and the working target. Two CNOTs, three single-qubit gates, and one control-phase gate reproduce any CU\mathrm{C}U exactly.

Derivation AWhy controlled-U is block-diagonal and unitary

The goal is to derive the matrix form (2) directly from the operator definition (1), so the block structure is a computed consequence rather than an assertion, and then to read off unitarity for free. We fix a basis ordering, evaluate the four control blocks one by one using the orthogonality of the control projectors, and check that the matrix times its adjoint is the identity exactly when UU is unitary — showing why controlling a unitary can never break unitarity.

Step 1. Order the computational basis as ∣c⟩∣t⟩\lvert c\rangle\lvert t\rangle with the control cc most significant, giving ∣00⟩,∣01⟩,∣10⟩,∣11⟩\lvert 00\rangle,\lvert 01\rangle,\lvert 10\rangle,\lvert 11\rangle. Why: the block structure only looks block-diagonal in this ordering; putting the target first would interleave the entries and hide it.

Step 2. Evaluate the control-00 block: ⟨0∣⟨t′∣ CU ∣0⟩∣t⟩=⟨t′∣I∣t⟩=δt′t\langle 0\rvert\langle t'\rvert\,\mathrm{C}U\,\lvert 0\rangle\lvert t\rangle=\langle t'\rvert I\lvert t\rangle=\delta_{t't}, because ∣0⟩⟨0∣\lvert 0\rangle\langle 0\rvert projects onto the first term of (1) and kills the second. Why: this is the mathematical statement that "control off does nothing" — the upper-left 2×22\times2 block is the identity.

Step 3. Evaluate the control-11 block: ⟨1∣⟨t′∣ CU ∣1⟩∣t⟩=⟨t′∣U∣t⟩=ut′t\langle 1\rvert\langle t'\rvert\,\mathrm{C}U\,\lvert 1\rangle\lvert t\rangle=\langle t'\rvert U\lvert t\rangle=u_{t't}, and the two cross blocks vanish since ⟨0∣1⟩=0\langle 0\vert 1\rangle=0. Why: the lower-right block is exactly UU, and orthogonal control projectors guarantee the off-diagonal blocks are strictly zero.

Step 4. Assemble the results into matrix (2) and form CU† CU\mathrm{C}U^\dagger\,\mathrm{C}U; the block-diagonal product is diag(I, U†U)=diag(I,I)\mathrm{diag}(I,\ U^\dagger U)=\mathrm{diag}(I,I). Why: unitarity of CU\mathrm{C}U reduces to unitarity of UU — controlling a valid gate always yields a valid gate. *The block-diagonal matrix follows directly from the {00,01,10,11}\{00,01,10,11\} ordering and the orthogonality of the control projectors; CU†CU=I⇔U†U=I\mathrm{C}U^\dagger\mathrm{C}U=I\Leftrightarrow U^\dagger U=I by direct block multiplication.*

Go deeper · Derivation B · 1 minCompiling controlled-U into two CNOTs and a control-phase gate
Derivation BCompiling controlled-U into two CNOTs and a control-phase gate

The goal is to build an explicit circuit for CU\mathrm{C}U using only CNOTs, single-qubit rotations, and one phase gate — the compilation every real quantum computer must perform, since no hardware executes an arbitrary CU\mathrm{C}U directly. Starting from the Z–Y decomposition of UU, we manufacture three single-qubit gates A,B,CA,B,C whose product is the identity yet whose XX-conjugated combination rebuilds UU, then restore the global phase as a control-phase gate — tracking the two branches separately proves the circuit exact and shows why the global phase, harmless for a lone UU, must be re-inserted.

Step 1. By the Z–Y decomposition write U=eiαRz(β)Ry(γ)Rz(δ)U=e^{i\alpha}R_z(\beta)R_y(\gamma)R_z(\delta) and define A=Rz(β)Ry(γ/2)A=R_z(\beta)R_y(\gamma/2), B=Ry(−γ/2)Rz(−(δ+β)/2)B=R_y(-\gamma/2)R_z(-(\delta+\beta)/2), C=Rz((δ−β)/2)C=R_z((\delta-\beta)/2). Why: these splits are engineered so the yy- and zz-angles cancel in one combination and reinforce in the other — the whole construction hinges on this bookkeeping.

Step 2. Verify the control-off branch: ABC=Rz(β)Ry(γ2)Ry(−γ2)Rz(−δ+β2)Rz(δ−β2)=Rz(β)Rz(−β)=IABC=R_z(\beta)R_y(\tfrac{\gamma}{2})R_y(-\tfrac{\gamma}{2})R_z(-\tfrac{\delta+\beta}{2})R_z(\tfrac{\delta-\beta}{2})=R_z(\beta)R_z(-\beta)=I. Why: the yy-rotations cancel and the zz-angles sum to −β-\beta, so with no CNOTs firing the ∣0⟩\lvert 0\rangle branch is the identity.

Step 3. Verify the control-on branch using XRy(ϕ)X=Ry(−ϕ)XR_y(\phi)X=R_y(-\phi) and XRz(ϕ)X=Rz(−ϕ)XR_z(\phi)X=R_z(-\phi): the two XX's flip the signs of BB's angles, and A(XBX)C=Rz(β)Ry(γ)Rz(δ)=e−iαUA(XBX)C=R_z(\beta)R_y(\gamma)R_z(\delta)=e^{-i\alpha}U. Why: conjugating BB by XX converts the cancelling combination into the reinforcing one, rebuilding the SU(2)SU(2) part of UU; each XX comes from a CNOT whose control is on.

Step 4. Restore the global phase: since the reconstruction gives e−iαUe^{-i\alpha}U, apply Φ(α)=diag(1,eiα)\Phi(\alpha)=\mathrm{diag}(1,e^{i\alpha}) on the control, contributing eiαe^{i\alpha} only in the ∣1⟩\lvert 1\rangle branch. Why: for a lone UU the factor eiαe^{i\alpha} is unobservable, but here it multiplies one branch and not the other — omitting this gate is the most common controlled-UU compilation error. *For a random U∈U(2)U\in\mathrm{U}(2), ABC=IABC=I and eiαAXBXC=Ue^{i\alpha}AXBXC=U hold to machine precision; two CNOTs is optimal for a generic UU.*

Go deeper · Derivation C · 1 minPhase kickback: turning an eigenvalue into a control phase
Derivation CPhase kickback: turning an eigenvalue into a control phase

The goal is to show that controlling a unitary on one of its eigenstates transfers the eigenphase onto the control while leaving the target physically unchanged — the exact mechanism quantum phase estimation, Shor's algorithm, and amplitude estimation all exploit. We prepare the control in an equal superposition and the target in an eigenstate, apply the defining operator branch-by-branch, and watch the eigenvalue factor out onto the control; a final Hadamard turns that phase into a measurable bit, so the target does real work while never actually changing.

Step 1. Prepare the control in ∣+⟩=12(∣0⟩+∣1⟩)\lvert +\rangle=\tfrac{1}{\sqrt2}(\lvert 0\rangle+\lvert 1\rangle) and the target in ∣u⟩\lvert u\rangle with U∣u⟩=e2πiφ∣u⟩U\lvert u\rangle=e^{2\pi i\varphi}\lvert u\rangle, then apply CU\mathrm{C}U branch by branch: CU∣+⟩∣u⟩=12(∣0⟩∣u⟩+∣1⟩U∣u⟩)\mathrm{C}U\lvert +\rangle\lvert u\rangle=\tfrac{1}{\sqrt2}(\lvert 0\rangle\lvert u\rangle+\lvert 1\rangle U\lvert u\rangle). Why: the defining operator acts as identity on the ∣0⟩\lvert 0\rangle branch and as UU on the ∣1⟩\lvert 1\rangle branch, so linearity is all that is used here.

Step 2. Substitute the eigenvalue equation U∣u⟩=e2πiφ∣u⟩U\lvert u\rangle=e^{2\pi i\varphi}\lvert u\rangle so the ∣1⟩\lvert 1\rangle branch becomes e2πiφ∣1⟩∣u⟩e^{2\pi i\varphi}\lvert 1\rangle\lvert u\rangle. Why: because ∣u⟩\lvert u\rangle is an eigenstate, UU is only permitted to multiply by a scalar — the target amplitude is preserved and only a phase appears.

Step 3. Factor the common target: the state is 12(∣0⟩+e2πiφ∣1⟩)⊗∣u⟩\tfrac{1}{\sqrt2}(\lvert 0\rangle+e^{2\pi i\varphi}\lvert 1\rangle)\otimes\lvert u\rangle, a product state. Why: the eigenphase has "kicked back" onto the control and the target is disentangled — you could discard the target and keep the phase, which is what phase estimation effectively does.

Step 4. Read out by interference: a Hadamard on the control gives measurement probability 12(1+cos⁡2πφ)=cos⁡2(πφ)\tfrac12(1+\cos2\pi\varphi)=\cos^2(\pi\varphi) for outcome 00, encoding φ\varphi; a register of controls with powers CU2j\mathrm{C}U^{2^j} plus an inverse QFT extracts φ\varphi bit by bit. Why: interference converts an unobservable relative phase into observable statistics — this is the readout step of the phase-estimation algorithm. *Substituting the eigenvalue equation gives a product state; for U=TU=T (φ=1/8\varphi=1/8) the Hadamard gives P(0)=cos⁡2(π/8)=0.854P(0)=\cos^2(\pi/8)=0.854.*

Limiting cases

Particular choices of the target unitary collapse CU\mathrm{C}U onto the standard named gates — and one choice exposes the global-phase subtlety directly:

CaseResultMeaning
U=IU=ICI=I⊗I\mathrm{C}I=I\otimes Itrivial: the control does nothing, the gate is the identity on both qubits
U=XU=XCX=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗X\mathrm{C}X=\lvert 0\rangle\langle 0\rvert\otimes I+\lvert 1\rangle\langle 1\rvert\otimes Xthe CNOT: flips the target iff the control is ∣1⟩\lvert 1\rangle
U=ZU=ZCZ=diag(1,1,1,−1)\mathrm{C}Z=\mathrm{diag}(1,1,1,-1)controlled-ZZ: diagonal, and symmetric under control↔\leftrightarrowtarget exchange
U=Rz(ϕ)U=R_z(\phi)CRz(ϕ)=diag(1,1,e−iϕ/2,eiϕ/2)\mathrm{C}R_z(\phi)=\mathrm{diag}(1,1,e^{-i\phi/2},e^{i\phi/2})controlled phase rotation — the building block of the quantum Fourier transform
U=eiαIU=e^{i\alpha}IC(eiαI)=diag(1,1,eiα,eiα)\mathrm{C}(e^{i\alpha}I)=\mathrm{diag}(1,1,e^{i\alpha},e^{i\alpha})a pure global phase on UU becomes a real phase gate on the control

Worked examples

1 · Single-bit phase estimation with controlled-T (fully worked)

Take U=T=diag(1,eiπ/4)U=T=\mathrm{diag}(1,e^{i\pi/4}), the π/8\pi/8 gate. Its ∣1⟩\lvert 1\rangle eigenvalue is eiπ/4e^{i\pi/4}, so ∣1⟩\lvert 1\rangle is an eigenstate with phase φ=1/8\varphi=1/8. Prepare the control in ∣+⟩\lvert +\rangle and the target in ∣1⟩\lvert 1\rangle, apply controlled-TT, then Hadamard the control. Find the measurement statistics and show they encode φ\varphi.

Step 1. Apply controlled-TT branch by branch. Since T∣1⟩=eiπ/4∣1⟩T\lvert 1\rangle=e^{i\pi/4}\lvert 1\rangle, kickback (equation 4) gives CT∣+⟩∣1⟩=12(∣0⟩+eiπ/4∣1⟩)⊗∣1⟩\mathrm{C}T\lvert +\rangle\lvert 1\rangle=\tfrac{1}{\sqrt2}(\lvert 0\rangle+e^{i\pi/4}\lvert 1\rangle)\otimes\lvert 1\rangle. The target is untouched; the phase eiπ/4e^{i\pi/4} has moved onto the control. The state factorizes — the target does no visible work yet carries the answer.

Step 2. Hadamard the control. Using H∣0⟩=12(∣0⟩+∣1⟩)H\lvert 0\rangle=\tfrac{1}{\sqrt2}(\lvert 0\rangle+\lvert 1\rangle) and H∣1⟩=12(∣0⟩−∣1⟩)H\lvert 1\rangle=\tfrac{1}{\sqrt2}(\lvert 0\rangle-\lvert 1\rangle), the control becomes 12[(1+eiπ/4)∣0⟩+(1−eiπ/4)∣1⟩]\tfrac12\big[(1+e^{i\pi/4})\lvert 0\rangle+(1-e^{i\pi/4})\lvert 1\rangle\big].

Step 3. Compute the outcome-00 probability: P(0)=14∣1+eiπ/4∣2=14(2+2cos⁡π4)=12(1+cos⁡π4)=cos⁡2(π/8)P(0)=\tfrac14\lvert 1+e^{i\pi/4}\rvert^2=\tfrac14(2+2\cos\tfrac{\pi}{4})=\tfrac12(1+\cos\tfrac{\pi}{4})=\cos^2(\pi/8). Numerically cos⁡2(π/8)=0.854\cos^2(\pi/8)=\mathbf{0.854} and P(1)=sin⁡2(π/8)=0.146P(1)=\sin^2(\pi/8)=\mathbf{0.146}.

Step 4. Interpret. The bias of the coin is set entirely by the eigenphase, P(0)=12(1+cos⁡2πφ)P(0)=\tfrac12(1+\cos2\pi\varphi), so the lopsided result signals a small phase φ=1/8\varphi=1/8. Repeating with controlled powers CT2j\mathrm{C}T^{2^j} and an inverse QFT extracts the bits of φ\varphi exactly — this single gate is one round of phase estimation. P(0)=cos⁡2(π/8)=0.854P(0)=\cos^2(\pi/8)=0.854, P(1)=0.146P(1)=0.146, reading φ=1/8\varphi=1/8.

2 · Assembling a Toffoli from controlled-√X

The Toffoli gate C2X\mathrm{C}^2X flips the target only when both controls are ∣1⟩\lvert 1\rangle. Build it from two-qubit controlled gates using V=XV=\sqrt{X}, the "SX\mathrm{SX}" gate native to superconducting hardware, where V=12(1+i1−i1−i1+i)V=\tfrac12\begin{pmatrix}1+i&1-i\\1-i&1+i\end{pmatrix} and V2=XV^2=X.

Step 1. Confirm the building block: V2=14((1+i)2+(1−i)22⋅22⋅2(1+i)2+(1−i)2)=(0110)=XV^2=\tfrac14\begin{pmatrix}(1+i)^2+(1-i)^2 & 2\cdot 2\\ 2\cdot 2 & (1+i)^2+(1-i)^2\end{pmatrix}=\begin{pmatrix}0&1\\1&0\end{pmatrix}=X, using (1+i)2+(1−i)2=2i−2i=0(1+i)^2+(1-i)^2=2i-2i=0 and (1+i)(1−i)=2(1+i)(1-i)=2. So two applications of the controlled-X\sqrt X equal one controlled-XX.

Step 2. Lay out the Barenco circuit on qubits (control 1, control 2, target 3), read left to right in time: CV2,3\mathrm{C}V_{2,3}, CX1,2\mathrm{C}X_{1,2}, CV2,3†\mathrm{C}V^\dagger_{2,3}, CX1,2\mathrm{C}X_{1,2}, CV1,3\mathrm{C}V_{1,3}.

Step 3. Track the net target operation over the four control settings. Both 00: every gate idle, net II. Controls (0,1)(0,1): target sees VV then V†V^\dagger, net II. Controls (1,0)(1,0): the CNOTs toggle qubit 2 so the target sees V†V^\dagger then VV, net II. Controls (1,1)(1,1): qubit 2 is toggled to 00 before the middle gate, so the target sees VV then VV, net V2=XV^2=X.

Step 4. The target is flipped by XX only when both controls are ∣1⟩\lvert 1\rangle — precisely the Toffoli truth table. C2X=CV1,3 CX1,2 CV2,3† CX1,2 CV2,3\mathrm{C}^2X=\mathrm{C}V_{1,3}\,\mathrm{C}X_{1,2}\,\mathrm{C}V^\dagger_{2,3}\,\mathrm{C}X_{1,2}\,\mathrm{C}V_{2,3} with V=XV=\sqrt X (verified to machine precision). The same V=UV=\sqrt U recursion builds C2U\mathrm{C}^2U for any UU, and iterating gives CnU\mathrm{C}^nU.

Physics of the portrait

Controlled gates are where the idea of a "quantum program" became concrete: a circuit of conditional unitaries on qubits. The person who framed computation that way, and first exhibited a universal controlled-controlled gate, is David Deutsch.

Origins · 1 minDavid Deutsch and how this was discovered
DD
David Deutsch
b. 1953, Haifa / Oxford · founder of the quantum circuit model and universal controlled gates

David Deutsch turned quantum computation from a slogan into a formalism. In 1985 he defined the universal quantum Turing machine and argued, via the Church–Turing–Deutsch principle, that a device built on quantum evolution could do what no classical machine efficiently could. But it was his 1989 paper "Quantum computational networks" that introduced the language used ever since: computation as a network of quantum gates, unitary boxes wired together in time. There Deutsch exhibited a single three-qubit gate — the Deutsch gate D(θ)D(\theta), a controlled-controlled rotation applying iRx(θ)iR_x(\theta) only when two controls are both ∣1⟩\lvert 1\rangle — and proved it universal: any quantum computation can be approximated by that one gate alone (for θ\theta an irrational multiple of π\pi). This is the controlled-UU idea at full stretch, and it set the programme that Barenco, Bennett, Cleve, DiVincenzo and collaborators completed in 1995 with the two-CNOT compilation of an arbitrary CU\mathrm{C}U and the recursive CnU\mathrm{C}^nU construction. Deutsch also gave the field its first algorithm — the Deutsch, later Deutsch–Jozsa, problem — whose speed-up runs entirely on phase kickback. The modern circuit model, in which every conditional operation is some CU\mathrm{C}U, descends directly from his networks.

History
1985
— Deutsch defines the universal quantum Turing machine and the Church–Turing–Deutsch principle
1989
— Deutsch introduces quantum computational networks and the universal controlled-controlled Deutsch gate
1995
— Barenco proves a single two-qubit gate is universal for quantum computation
1995
— Barenco, Bennett, Cleve and collaborators give the two-CNOT controlled-U compilation and the CⁿU recursion
1995
— DiVincenzo shows two-qubit gates suffice for universal quantum computation

Going further

Texts. Nielsen & Chuang, Quantum Computation and Quantum Information, §4.3 (controlled operations) and Fig. 4.6, §5.2 (phase estimation) · Preskill, Lecture Notes for Physics 219, Ch. 5 (classical and quantum circuits) · Barenco, Bennett, Cleve, DiVincenzo, Margolus, Shor, Sleator, Smolin, Weinfurter, "Elementary gates for quantum computation," Phys. Rev. A 52, 3457 (1995) · Watrous, The Theory of Quantum Information, Ch. 2 · Kitaev, Shen, Vyalyi, Classical and Quantum Computation, §8 · Mermin, Quantum Computer Science, Ch. 2. Key checkpoints: the block-diagonal matrix follows from the {00,01,10,11}\{00,01,10,11\} ordering; ABC=IABC=I and eiαAXBXC=Ue^{i\alpha}AXBXC=U via XRy/z(θ)X=Ry/z(−θ)XR_{y/z}(\theta)X=R_{y/z}(-\theta); the kickback factorization gives P(0)=cos⁡2(π/8)=0.854P(0)=\cos^2(\pi/8)=0.854 for controlled-TT; and the Toffoli identity rests on V=XV=\sqrt X, V2=XV^2=X.

Prerequisites. Quantum Circuit Model · Single-Qubit Rotation Gates · Z–Y Decomposition of Single-Qubit Gates · CNOT Gate. Leads to. Controlled-Z Gate · Universal Gate Sets · Circuit Identities and Equivalences · SWAP Gate.

Ask the tutor: Ask me to walk you through the two-CNOT ABC compilation of any specific gate — a controlled-Hadamard, controlled-SS, or a controlled rotation from your own circuit — or to show how phase kickback turns into the bits of a phase-estimation readout.

Is the "control" qubit really more in charge than the target?

Less than the name suggests — the asymmetry lives entirely in UU, not in the construction. For controlled-ZZ the roles are interchangeable: CZ=diag(1,1,1,−1)\mathrm{C}Z=\mathrm{diag}(1,1,1,-1) is symmetric under swapping the qubits, because ZZ is diagonal. Even for CNOT you can move "which qubit is the control" by conjugating with Hadamards, since (H⊗H) CX (H⊗H)(H\otimes H)\,\mathrm{C}X\,(H\otimes H) is a CNOT with control and target exchanged. And under phase kickback it is often the target that supplies the information while the control merely records it. Control and target are labels of convenience, not a fixed hierarchy.

What is phase kickback, intuitively?

A controlled gate acting on an eigenstate of UU cannot change that eigenstate — it may only multiply it by the eigenvalue eiθe^{i\theta} — but that scalar attaches to the ∣1⟩\lvert 1\rangle branch of the control alone. So a property of the target (its eigenphase) is copied onto the control as a relative phase you can read by interference, while the target comes out exactly as it went in. This is why phase estimation feeds UU an eigenstate it never disturbs yet extracts the eigenphase to many bits: the answer was always riding on the control.

Why exactly two CNOTs — can I ever do it in one?

For a generic single-qubit UU, two CNOTs are necessary and sufficient. The ABC construction achieves two, and Barenco et al. proved you cannot generally do better: a single CNOT with surrounding single-qubit gates realizes only a restricted family, because the ABC=IABC=I constraint with one XX insertion cannot reproduce an arbitrary ∣1⟩\lvert 1\rangle-branch unitary while keeping the ∣0⟩\lvert 0\rangle-branch identity. Special cases do better — a gate equivalent to controlled-ZZ up to single-qubit gates costs one entangler, and CI\mathrm{C}I costs none — but "two CNOTs for a generic CU\mathrm{C}U" is the tight bound.

How do I build a controlled gate if my hardware only has CNOT?

You use the two-CNOT ABC circuit (equation 6): decompose U=eiαRz(β)Ry(γ)Rz(δ)U=e^{i\alpha}R_z(\beta)R_y(\gamma)R_z(\delta), form A,B,CA,B,C from those angles, and lay down CC, CNOT, BB, CNOT, AA on the target with a phase gate diag(1,eiα)\mathrm{diag}(1,e^{i\alpha}) on the control. Every gate there is a CNOT or a single-qubit rotation, both native to essentially all hardware — this is exactly what a transpiler emits for an abstract CU\mathrm{C}U. The one thing hand-compilers forget is the control-phase gate Φ(α)\Phi(\alpha); omit it and the gate is wrong by a control-dependent phase.

How does controlled-U scale to many control qubits?

A multiply-controlled gate CnU\mathrm{C}^nU fires only when all nn controls are ∣1⟩\lvert 1\rangle. You build it recursively from two-qubit controlled gates using V=UV=\sqrt U: Worked Example 2 shows C2U\mathrm{C}^2U from three controlled-VV/V†V^\dagger gates and two CNOTs, and the same idea nests upward. With a handful of ancilla qubits CnX\mathrm{C}^nX (the multi-controlled Toffoli) can be done with O(n)O(n) two-qubit gates. These constructions underlie quantum oracles, Grover's diffusion operator, and reversible arithmetic — anywhere a large logical AND of qubits must gate an operation.

Does measuring the control after kickback disturb the target?

No, provided the target was an eigenstate of UU. After kickback the joint state is a product, (α∣0⟩+eiθβ∣1⟩)⊗∣u⟩(\alpha\lvert 0\rangle+e^{i\theta}\beta\lvert 1\rangle)\otimes\lvert u\rangle, so measuring the control leaves ∣u⟩\lvert u\rangle untouched — the same eigenstate can be fed through many controlled powers of UU without being consumed, which is exactly what phase estimation relies on. The story changes if the target is not an eigenstate: the output (equation 3) is then entangled, and measuring the control back-acts on the target, projecting it into ∣ψ⟩\lvert\psi\rangle or U∣ψ⟩U\lvert\psi\rangle.

Before this

Where this leads