Controlled-U Gate
The general recipe for conditioning any single-qubit unitary on a control, the parent of every controlled single-qubit gate.
Definition
Given any single-qubit unitary U, the controlled-U gate applies U to the target when the control is |1⟩ and the identity when it is |0⟩. Every specific controlled gate — CNOT, CY, CZ, CRX, CH — is a special case obtained by choosing U.
Matrix
The ABC decomposition
Barenco and coworkers proved that any single-qubit U can be written U = e^{iα} A X B X C where A, B, C are single-qubit rotations with ABC = I. Then controlled-U = (phase gate on control by α)·(I⊗A)·CNOT·(I⊗B)·CNOT·(I⊗C). This realizes any controlled-U with just two CNOTs plus single-qubit gates. See ABC decomposition.
The leading phase e^{iα} is not a global phase here — it is a relative phase seen only when the control is |1⟩ — so it must be applied as a phase gate on the control line, not ignored.
import numpy as np
def controlled_u(U):
m = np.eye(4, dtype=complex)
m[2:,2:] = U
return m
Multi-controlled generalization
Adding more controls gives controlled-controlled-U, up to multi-controlled-U with n controls. These are built recursively: a controlled-V where V² = U, together with a Toffoli-style network, reduces an n-control gate to (n-1)-control gates. See multi-controlled X for the canonical example.
Controlled-U is the abstraction behind quantum phase estimation, where controlled powers of a target unitary imprint its eigenphase onto an ancilla register.