Controlled-unitary (or controlled-$U$) gate applies a unitary operation $U$ to target qubits if and only if all control qubits are $|1\rangle$. It generalizes controlled single-qubit gates (like CNOT) and is fundamental to quantum algorithms including phase estimation, Shor's algorithm, and variational quantum algorithms.
For a unitary $U$ acting on $m$ target qubits and $k$ control qubits, the controlled-$U$ gate is:
$$C^k(U) = |0\rangle\langle 0|_c \otimes I_t + |1\rangle\langle 1|_c \otimes U$$
for single control qubit, generalizing to multiple controls:
$$C^{c_1 \cdots c_k}(U) = \sum_{x \in \{0,1\}^k} |x\rangle\langle x|_c \otimes (U^{\delta(x)} \otimes I^{1-\delta(x)})$$
where $\delta(x) = 1$ if all controls are $|1\rangle$, else $\delta(x) = 0$.
Single control, single target:
Multiple controls:
Controlled-X (CNOT):
Controlled-Z:
Controlled-phase ($e^{i\theta}$):
Controlled-rotation (Controlled-$R_z(\theta)$):
Doubly-controlled-X (Toffoli/CCX):
For controlled-$U$ with single control and single target:
$$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}$$
where $U = \begin{pmatrix} u_{00} & u_{01} \\ u_{10} & u_{11} \end{pmatrix}$.
For arbitrary unitary $U$, decompose using Euler angle decomposition:
$$U = e^{i\alpha} A X B X C$$
where $ABC = I$ and $A, B, C$ are single-qubit unitaries. Then:
$$C(U) = e^{i\alpha} A \cdot C_X(B) \cdot C_X(C)$$
using controlled-single-qubit gates (easier to implement).
Gate count for controlled-$U$:
For $k$ control qubits and single target, implement controlled-controlled-…-controlled-$U$:
Naive approach: cascade controls
Optimized approach (e.g., Toffoli-based):
Phase estimation:
Shor's factoring algorithm:
Variational quantum algorithms (VQE, QAOA):
Quantum simulation:
Controlled-$R_x(\theta)$, Controlled-$R_y(\theta)$, Controlled-$R_z(\theta)$:
For $U$ acting on multiple target qubits with single control:
$$C(U) = |0\rangle\langle 0|_c \otimes I_t + |1\rangle\langle 1|_c \otimes U_t$$
The unitary $U_t$ acts on all targets simultaneously. Example: controlled-SWAP (Fredkin gate).
Approximate controlled-$U$: drop least significant gates to reduce depth