XX+YY Exchange Gate
An excitation-conserving two-qubit gate that mixes the single-excitation states while leaving zero- and double-excitation states fixed.
Definition
The XX+YY gate, sometimes written XY(θ) or (as in Qiskit) XXPlusYYGate, is generated by (X⊗X + Y⊗Y)/2. Its defining property is number conservation: it acts only within the single-excitation subspace {|01⟩, |10⟩} and leaves |00⟩ and |11⟩ untouched.
Matrix
The inner 2×2 block is a partial coherent swap of one excitation between the qubits; at θ = π it becomes a full swap of the single-excitation states (an iSWAP up to phase), and at θ = π/2 it is the √iSWAP-like partial exchange.
Why number conservation matters
In quantum chemistry and the Hubbard model, the number of electrons is fixed. Ansätze built from excitation-conserving gates never leak amplitude into the wrong particle-number sector, which shrinks the search space and improves optimizer stability. The XX+YY gate is the two-qubit primitive for these hardware-efficient, symmetry-preserving circuits.
import numpy as np
def xy_gate(theta):
c, s = np.cos(theta/2), -1j*np.sin(theta/2)
m = np.eye(4, dtype=complex)
m[1,1]=c; m[2,2]=c; m[1,2]=s; m[2,1]=s
return m
Relation to Givens rotations
Restricted to the single-excitation subspace, XX+YY realizes a Givens rotation between two orbital modes. Chains of Givens rotations implement arbitrary orbital basis changes for fermionic simulation. See Givens rotation and iSWAP.