Computing Library › Quantum Logic Gates
Quantum Logic Gates

ABC Decomposition of Controlled Gates

The construction that realizes any controlled single-qubit gate with only two CNOTs plus single-qubit rotations.

The construction

Barenco and coworkers showed that any single-qubit unitary U factors as U = e^{iα}·A·X·B·X·C, where A, B, C are single-qubit gates satisfying A·B·C = I. This ABC factorization is the key to building controlled-U cheaply: the two X gates become the targets of two CNOTs.

Building controlled-U

Kronos motion — thermal gate

Controlled-U is realized as: apply C to the target, then CNOT (control→target), apply B, then CNOT again, apply A, and finally apply a phase gate P(α) to the control line. When the control is |0⟩ the CNOTs vanish and A·B·C = I acts trivially; when it is |1⟩ the two X insertions reconstruct A·X·B·X·C = U with the leading phase.

Identity that makes it work
ABC = Iwhen control = 0A·X·B·X·C = U/e^{iα}when control = 1

Why the phase goes on the control

The factor e^{iα} is a global phase of U, invisible for a standalone U, but under control it becomes a relative phase applied only when the control is |1⟩. That is exactly a phase gate P(α) on the control line, and omitting it produces the wrong controlled gate. This is the classic subtlety of controlled-gate synthesis.

python
# controlled-U circuit order (target ops read right-to-left as matrices)
# target: C ; CNOT ; B ; CNOT ; A
# control: P(alpha)
def abc_cnot_count():
    return 2

Finding A, B, C

Start from the ZYZ angles of U: U = e^{iα}·RZ(β)·RY(γ)·RZ(δ). Then A = RZ(β)·RY(γ/2), B = RY(-γ/2)·RZ(-(δ+β)/2), C = RZ((δ-β)/2), which satisfy ABC = I and the X-conjugation identity. See ZYZ decomposition and controlled-U.