Why Encodings Matter
Quantum simulation of molecular systems is one of the most promising applications of quantum computers. Yet there’s a fundamental obstacle that stands between a chemist’s description of electrons and what a quantum computer can actually execute. This page explains the core problem and why fermionic encodings exist.
The Language Barrier: Qubits vs. Fermions
Quantum computers are built from qubits—two-level quantum systems that can exist in superpositions of $\lvert0\rangle$ and $\lvert1\rangle$. The mathematics governing qubits is elegant: operators acting on different qubits commute with each other. If $X_i$ and $Z_j$ act on qubits $i$ and $j$ respectively, then:
\[X_i Z_j = Z_j X_i \quad \text{(for } i \neq j \text{)}\]This commutativity is baked into the tensor product structure of multi-qubit systems. It’s mathematically convenient and reflects the physical independence of spatially separated qubits.
Electrons, however, play by different rules. Electrons are fermions, particles that obey the Pauli exclusion principle and exhibit fundamentally antisymmetric behavior under exchange. When you swap two identical fermions, the quantum state picks up a minus sign. This antisymmetry isn’t just a curiosity—it’s the reason chemistry exists as we know it. The shell structure of atoms, covalent bonding, and metallic conductivity all trace back to fermionic statistics.
Mathematically, fermions are described by creation and annihilation operators that satisfy anticommutation relations:
\[\{a_i, a_j^\dagger\} = a_i a_j^\dagger + a_j^\dagger a_i = \delta_{ij}\] \[\{a_i, a_j\} = \{a_i^\dagger, a_j^\dagger\} = 0\]Here, $a_j^\dagger$ creates an electron in orbital $j$, and $a_j$ destroys one. The curly braces denote the anticommutator: ${A, B} = AB + BA$.
Notice the critical difference: qubits commute; fermions anticommute. This algebraic mismatch is the heart of the encoding problem.
The Naive Mapping and Why It Fails
The most intuitive approach is to map each orbital directly to a qubit:
- Orbital $j$ occupied → qubit $j$ in state $\lvert1\rangle$
- Orbital $j$ empty → qubit $j$ in state $\lvert0\rangle$
For single-orbital operations, we might try:
\[a_j^\dagger \stackrel{?}{\mapsto} \lvert1\rangle\langle 0 \rvert_j = \frac{1}{2}(X_j - iY_j) \equiv \sigma_j^+\] \[a_j \stackrel{?}{\mapsto} \lvert0\rangle\langle 1 \rvert_j = \frac{1}{2}(X_j + iY_j) \equiv \sigma_j^-\]These are the standard raising and lowering operators for a single two-level system. They correctly handle the local physics: $\sigma^+$ takes $\lvert0\rangle$ to $\lvert1\rangle$ (creates a particle), $\sigma^-$ takes $\lvert1\rangle$ to $\lvert0\rangle$ (destroys one), and double creation/annihilation gives zero.
The problem emerges when we consider two different orbitals. Let’s check the anticommutator for $i \neq j$:
\[\{a_i, a_j^\dagger\} \stackrel{?}{=} \{\sigma_i^-, \sigma_j^+\}\]Using our naive mapping:
\[\sigma_i^- \sigma_j^+ + \sigma_j^+ \sigma_i^- = \sigma_i^- \sigma_j^+ + \sigma_j^+ \sigma_i^-\]Because operators on different qubits commute in the tensor product structure:
\[= 2 \sigma_i^- \sigma_j^+\]But fermions require ${a_i, a_j^\dagger} = 0$ for $i \neq j$. Our naive mapping gives a nonzero result! The tensor product structure of qubits doesn’t naturally encode the nonlocal sign flips that fermions demand.
This failure isn’t a technicality—it would produce physically wrong predictions. Transition amplitudes, energy levels, and dynamics would all be corrupted.
What a Correct Encoding Must Satisfy
Any valid fermionic encoding must preserve the canonical anticommutation relations (CARs):
\[\{a_i, a_j^\dagger\} = \delta_{ij}\] \[\{a_i, a_j\} = 0\] \[\{a_i^\dagger, a_j^\dagger\} = 0\]These relations encode the complete algebra of fermionic operators. An encoding is a map:
\[a_j \mapsto Q_j, \quad a_j^\dagger \mapsto Q_j^\dagger\]where $Q_j$ and $Q_j^\dagger$ are operators constructed from Pauli matrices ($X$, $Y$, $Z$, and $I$) on qubits. The map is valid if and only if the qubit operators $Q_j$ satisfy the same anticommutation relations as the original fermionic operators.
Preserving the CARs guarantees that:
- Spectral properties are preserved: The eigenvalues of encoded Hamiltonians match the original fermionic Hamiltonians.
- Dynamics are correct: Time evolution under the encoded Hamiltonian matches the fermionic system.
- Measurement outcomes correspond: Expectation values of encoded observables give physically meaningful results.
The Jordan-Wigner Solution
The simplest valid encoding is the Jordan-Wigner transformation (1928). The key insight is to introduce a parity string that tracks the cumulative occupation of all preceding orbitals:
\[a_j^\dagger \mapsto \left(\prod_{k < j} Z_k\right) \sigma_j^+\] \[a_j \mapsto \left(\prod_{k < j} Z_k\right) \sigma_j^-\]The string of $Z$ operators acts as a “memory” of the fermionic sign. Each $Z_k$ contributes a factor of $+1$ if qubit $k$ is in $\lvert0\rangle$ (empty orbital) or $-1$ if in $\lvert1\rangle$ (occupied orbital). This accumulated sign exactly compensates for the missing anticommutation.
Let’s verify for $i < j$:
\[\{a_i, a_j^\dagger\} \mapsto \left\{\left(\prod_{k<i} Z_k\right)\sigma_i^-, \left(\prod_{k<j} Z_k\right)\sigma_j^+\right\}\]The $Z_i$ operator in the second product anticommutes with $\sigma_i^-$ (since $Z\sigma^- = -\sigma^- Z$), while all other operators commute appropriately. Working through the algebra confirms the anticommutator vanishes.
The Locality-Weight Tradeoff
Jordan-Wigner works, but at a cost. Consider creating a particle in orbital $j$. The encoded operator involves $j$ Pauli operators: $Z_0 Z_1 \cdots Z_{j-2} Z_{j-1} \sigma_j^+$. For a system with $n$ orbitals, operators near the “end” of the ordering require $O(n)$ Pauli terms.
This has profound implications for quantum algorithms:
- Gate count: Simulating one term of a Hamiltonian may require $O(n)$ gates.
- Circuit depth: The long Pauli strings create serialization bottlenecks.
- Error propagation: Long operator chains spread errors across many qubits.
The fundamental tradeoff in fermionic encodings is between:
| Property | Definition |
|---|---|
| Locality | How many qubits an operator acts on non-trivially |
| Weight | The total number of Pauli matrices in the encoding |
Alternative encodings like Bravyi-Kitaev achieve better asymptotic scaling. Instead of $O(n)$ Pauli weight for each operator, Bravyi-Kitaev achieves $O(\log n)$ weight by cleverly structuring how parity information is stored and accessed. The encoding uses a binary tree structure (a Fenwick tree) to balance the parity computation.
Other encodings offer different tradeoffs:
- Parity encoding: Stores cumulative parity directly, optimizing for certain Hamiltonian structures.
- Ternary tree encoding: Uses a balanced ternary tree for further improvements in specific contexts.
- Compact encodings: Reduce qubit count at the cost of increased operator complexity.
Why This Matters for Quantum Chemistry
Real molecular Hamiltonians contain terms like:
\[H = \sum_{pq} h_{pq} a_p^\dagger a_q + \frac{1}{2}\sum_{pqrs} h_{pqrs} a_p^\dagger a_q^\dagger a_r a_s\]The one-body terms $a_p^\dagger a_q$ describe electron hopping between orbitals. The two-body terms $a_p^\dagger a_q^\dagger a_r a_s$ capture electron-electron interactions.
After encoding, each term becomes a weighted sum of Pauli strings. The total number of terms, and the length of each Pauli string, directly impacts:
- Classical preprocessing: Computing the Pauli coefficients.
- Quantum resource requirements: Gates, qubits, and circuit depth.
- Measurement overhead: The number of distinct Pauli strings to measure for energy estimation.
For a molecule with $n$ spin-orbitals, a naive counting gives $O(n^4)$ two-body terms. Each term, under Jordan-Wigner, might expand to Pauli strings of weight up to $O(n)$. The total gate count for a single Trotter step scales accordingly.
Choosing the right encoding can reduce these costs significantly. The FockMap library provides implementations of multiple encodings, allowing you to select the best tradeoff for your specific Hamiltonian and hardware constraints.
Looking Ahead
The encoding problem connects to deep questions in quantum information:
- What are the minimal resources needed to simulate fermions on qubits?
- Can geometric locality of physical Hamiltonians be exploited?
- How do encodings interact with error correction schemes?
Understanding why encodings exist—and what tradeoffs they offer—is essential for anyone working on quantum simulation of molecular systems. The next pages will develop the mathematical framework in detail, starting with second quantization.