# Two-qubit gates **Two-qubit gates** are unitary operations that act on a pair of qubits. They are represented by $4 \times 4$ unitary matrices and form the Lie group $\mathrm{SU}(4)$. Unlike single-qubit gates, which only rotate individual qubits on their own Bloch spheres, two-qubit gates can create entanglement between qubits, which is what makes a quantum computer more than a collection of independent classical bits. A two-qubit gate is applied to a joint state $|\psi\rangle \in \mathbb{C}^4$ to produce $U|\psi\rangle$. Two-qubit gates compose like any other gate (matrix product), and combined with arbitrary [[quantum-gate-single-qubit|single-qubit gates]] they form a universal gate set: any $n$-qubit unitary can be built from single-qubit rotations plus one entangling two-qubit gate, typically [[quantum-gate-cx|CNOT]] or [[quantum-gate-cz|CZ]]. Not every two-qubit gate entangles. A gate that factors as $A \otimes B$ for single-qubit unitaries $A, B$ acts independently on each qubit and creates no correlation. The gates of interest here, CX, CZ, SWAP, and the parametric $\text{XX}$/$\text{YY}$/$\text{ZZ}$ family, are exactly the ones that don't factor this way. ## List of gates - [[quantum-gate-cx|CX (Controlled-NOT)]] - [[quantum-gate-cy|CY (Controlled-Y)]] - [[quantum-gate-cz|CZ (Controlled-Z)]] - [[quantum-gate-swap|SWAP]] - [[quantum-gate-iswap|iSWAP]] - [[quantum-gate-cp|Controlled-Phase]] - [[quantum-gate-xx|XX (Ising coupling)]] - [[quantum-gate-yy|YY (Ising coupling)]] - [[quantum-gate-zz|ZZ (Ising coupling)]] ## Matrix representations **Controlled gates** (control on qubit 1, target on qubit 2): $$\mathrm{CX} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \end{pmatrix} \quad \mathrm{CY} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&-i \\ 0&0&i&0 \end{pmatrix} \quad \mathrm{CZ} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&1&0 \\ 0&0&0&-1 \end{pmatrix}$$ **SWAP family:** $$\mathrm{SWAP} = \begin{pmatrix} 1&0&0&0 \\ 0&0&1&0 \\ 0&1&0&0 \\ 0&0&0&1 \end{pmatrix} \quad \mathrm{iSWAP} = \begin{pmatrix} 1&0&0&0 \\ 0&0&i&0 \\ 0&i&0&0 \\ 0&0&0&1 \end{pmatrix}$$ **Parametric Ising-coupling gates (angle $\theta$):** $$\text{XX}(\theta) = \exp\left(-i\frac{\theta}{2} X \otimes X\right), \quad \text{YY}(\theta) = \exp\left(-i\frac{\theta}{2} Y \otimes Y\right), \quad \text{ZZ}(\theta) = \exp\left(-i\frac{\theta}{2} Z \otimes Z\right)$$ Note: $\mathrm{SWAP} = \mathrm{CX}_{12} \, \mathrm{CX}_{21} \, \mathrm{CX}_{12}$, and $\mathrm{iSWAP} = \text{XX}(\pi/2)\,\text{YY}(\pi/2)$ up to single-qubit phases. ## Group structure Two-qubit gates form $\mathrm{SU}(4)$ (dimension 15); the local subgroup $\mathrm{SU}(2) \otimes \mathrm{SU}(2)$ has dimension 6. The entangling content of a gate, the part that can't be absorbed into surrounding single-qubit gates, lives in the remaining 9-dimensional quotient $\mathrm{SU}(4) / (\mathrm{SU}(2) \otimes \mathrm{SU}(2))$. $\mathrm{SU}(4)$ has no Bloch-sphere-like picture. Instead its entangling content is captured by a small set of **local invariants**, unchanged under pre/post-composition with local gates, and reduces to just three numbers. ## KAK decomposition The intuition: any two-qubit gate can be sorted into "local dressing", single-qubit rotations that don't cost an entangling operation on hardware, wrapped around one irreducible entangling core. KAK decomposition makes this split explicit. Any $U \in \mathrm{SU}(4)$ factors as local gates sandwiching one canonical entangling gate $A \in \mathrm{SU}(4)$, where $K_1, K_2, K_3, K_4 \in \mathrm{SU}(2)$ are single-qubit unitaries, local by construction: $$U = (K_1 \otimes K_2) \; A \; (K_3 \otimes K_4), \quad A = \exp\left(i \left( a\, X{\otimes}X + b\, Y{\otimes}Y + c\, Z{\otimes}Z \right)\right)$$ This is the **Cartan KAK decomposition** of $\mathfrak{su}(4)$: all entangling content is isolated in $(a, b, c)$, since the $K_k$ entangle nothing. The triples $(a,b,c)$ range over the **Weyl chamber**; gates related by local operations map to the same point. CX, CZ, and iSWAP sit at distinct points; SWAP sits at the corner of maximal entanglement. This also bounds circuit cost: any two-qubit unitary needs at most 3 CNOTs, an entangling one at least 1. ## Uses - **Entanglement generation**: Bell pairs, GHZ states, correlated-qubit protocols - **Variational algorithms**: [[cuda-q-vqe|VQE]] and [[cuda-q-qaoa|QAOA]] alternate single-qubit rotations with entangling layers - **Error correction**: CX/CZ entangle data qubits with ancillas to measure stabilizers - **Circuit synthesis**: KAK decomposition is how compilers target native gates - **State transfer**: SWAP moves information between non-adjacent qubits ## Implementation - **Superconducting**: CZ is usually native (~20–60 ns, tunable coupler); CX is synthesized from CZ + Hadamards; fidelity 99–99.9% - **Trapped ions**: native Mølmer-Sørensen gate is effectively $\text{XX}(\theta)$ (~10–200 μs); CX/CZ synthesized from it; fidelity 99.9%+ - **Photonic**: deterministic gates need weak optical nonlinearity, so CZ is often probabilistic/measurement-induced; fidelity limited by photon loss CX is rarely the physically native gate; it's a compiler target synthesized from whatever the hardware actually implements (usually CZ or an $\text{XX}$-type coupling). ## Relations - [[quantum-gate-cx|CX]], [[quantum-gate-cy|CY]], [[quantum-gate-cz|CZ]]: the controlled-Pauli family, interconvertible via single-qubit basis changes - [[quantum-gate-swap|SWAP]], [[quantum-gate-iswap|iSWAP]]: exchange-type gates, at extremal points of the Weyl chamber - [[quantum-gate-xx|XX]], [[quantum-gate-yy|YY]], [[quantum-gate-zz|ZZ]]: parametric Ising-coupling gates, the native form on many platforms - [[quantum-gate-single-qubit|Single-qubit gates]]: plus one entangling two-qubit gate, form a universal gate set - [[quantum-gate-clifford|Clifford gates]]: CX, CY, CZ, SWAP, iSWAP are two-qubit Cliffords - [[quantum-gate-three-qubit|Three-qubit gates]]: built from two-qubit gates plus control logic - $\mathrm{SU}(4)$: group structure of two-qubit unitaries - Weyl chamber: geometric classification of two-qubit gates up to local equivalence