Fermionic creation/annihilation operators must anti-commute (Pauli exclusion), but qubit operators on different qubits naturally commute. The Jordan-Wigner transform fixes this by attaching a "parity string" of Z gates to every fermionic operator:
a†_p = ( ⊗_{k<p} Z_k ) ⊗ σ⁺_p , σ⁺ = (X - iY)/2
a_p = ( ⊗_{k<p} Z_k ) ⊗ σ⁻_p , σ⁻ = (X + iY)/2
Parity: P = Z_0 Z_1 … Z_{N-1} = (-1)^(Σ n_k)
Applying a single excitation a†paq (move one electron from occupied orbital q into empty orbital p) needs the strings of both operators; the Z factors on qubits strictly between p and q survive and the ones coincident with p, q collapse into the ladder operators. The net result on a computational-basis occupation state is:
a†_p a_q |...n_q...n_p...⟩ = 0 if n_q=0 or n_p=1
= (-1)^(Σ_{min<k<max} n_k) |...n_q→0...n_p→1...⟩ otherwise
That alternating sign — one minus sign per occupied orbital sitting between p and q — is exactly the fermionic exchange phase, and it is why every real quantum-chemistry circuit (VQE/UCCSD ansatze, quantum phase estimation on a molecular Hamiltonian) needs a ladder of CNOTs or a literal Z-string threaded between the two qubits it excites between, not just a two-qubit gate on p and q alone. The lower circuit-diagram panel draws that string live as a shaded bracket with a Z box on every occupied qubit strictly between p and q, and the top register shows the same string as a glowing arc.
- N slider — size of the spin-orbital / qubit register (a minimal active space, e.g. N=4 for H₂ in a minimal STO-3G basis: 2 bonding + 2 antibonding spin-orbitals).
- Hartree-Fock ref. — fills the lowest N/2 orbitals, the standard starting reference determinant.
- p / q selectors + Apply excitation — runs a†paq on the current state; the highlighted bracket is the Jordan-Wigner Z-string, and the readouts show its length and the resulting sign.
- Auto-demo — cycles through random valid excitations so you can watch the string and sign change without manual input.
- Click a disc — toggle any orbital's occupation directly to explore parity and string length for any bitstring.