Simulating how a quantum system evolves over time was the original reason Feynman proposed quantum computers at all in 1982: a classical computer's memory to represent a quantum state grows exponentially with the number of particles, and a quantum computer's doesn't. Hamiltonian simulation is that idea made concrete, and Trotter decomposition is the standard technique that makes it buildable in real gates.
The problem: e^(-iHt) isn't a gate
A quantum system evolves under its Hamiltonian H according to the Schrödinger equation, and the formal solution is the unitary e^(-iHt). If H were a single Pauli string, this would be directly implementable, single-qubit rotations and a chain of CNOTs handle that case cleanly. Real Hamiltonians aren't that simple. A Hamiltonian for an actual system is a sum of many terms, H = H₁ + H₂ + ... + Hₖ, each a different Pauli string acting on different qubits, and in general these terms don't commute with each other.
That non-commutation is the whole obstacle. If A and B commuted, e^(-i(A+B)t) would factor into e^(-iAt)·e^(-iBt), and each term would be implementable separately. They don't, so it doesn't factor cleanly, and there's no exact circuit for the sum as a single unit for an arbitrary Hamiltonian.
The fix: Trotter-Suzuki decomposition
The Lie product formula gives an escape hatch: for any two operators A and B,
e^(-i(A+B)t) = lim(n->inf) [e^(-iAt/n) * e^(-iBt/n)]^n
Split the total evolution time t into n small steps, alternate applying each term's own (easy) evolution for a short slice of time, and repeat. As n grows, the approximation converges to the true evolution. This is first-order Trotterization, and its error scales as O(t²/n): double the number of steps, and the error from non-commuting terms roughly halves.
A more accurate variant, second-order (symmetric) Trotterization, applies the terms in a palindromic order (A, B, ..., B, A) each half-step, cutting the error to O(t³/n²) at the cost of roughly double the gates per step. Which one to use is a real engineering trade-off between circuit depth and simulation accuracy, not a settled question with one right answer.
Building it: a 2-qubit Heisenberg model
The Heisenberg Hamiltonian H = J(XX + YY + ZZ) on two qubits is a standard, small test case: three non-commuting two-qubit terms, small enough to reason about by hand, large enough to show real Trotter error.
import numpy as np
from qiskit import QuantumCircuit
from qiskit.circuit.library import PauliEvolutionGate
from qiskit.quantum_info import SparsePauliOp
J = 1.0
hamiltonian = SparsePauliOp.from_list([
("XX", J),
("YY", J),
("ZZ", J),
])
def trotter_step(qc, dt):
"""One first-order Trotter step: apply each Pauli term's evolution in sequence."""
for pauli, coeff in zip(hamiltonian.paulis, hamiltonian.coeffs):
term = SparsePauliOp(pauli, coeff)
qc.append(PauliEvolutionGate(term, time=dt), range(2))
return qc
def trotterized_evolution(t, steps):
qc = QuantumCircuit(2)
dt = t / steps
for _ in range(steps):
trotter_step(qc, dt)
return qc
circuit = trotterized_evolution(t=1.0, steps=4)
print(circuit.count_ops())
Each of the 4 steps applies 3 Pauli-term evolutions, so this circuit contains 12 PauliEvolutionGate instances before decomposition, each of which expands to a small fixed number of CNOTs and single-qubit rotations once transpiled. Doubling steps to 8 doubles the gate count in exactly the same way: it's a direct, mechanical consequence of the loop structure, not something that needs simulation to verify.
Watching the error-versus-depth trade-off
The error between the Trotterized circuit and the true evolution e^(-iHt) is a real, measurable quantity (compare the Trotterized unitary against scipy.linalg.expm(-1j * H_matrix * t) using qiskit.quantum_info.Operator and process_fidelity), and it shrinks as steps grows, per the O(t²/n) scaling for first-order Trotter derived above. What that scaling means in practice: doubling the step count roughly halves the error for a fixed total time t, but doubles the circuit depth too, so on real noisy hardware there's a real crossover point where adding more Trotter steps to reduce approximation error starts adding more hardware noise than it removes. Finding that crossover for your specific device and Hamiltonian is an empirical exercise worth running yourself on a simulator with a realistic noise model before trusting either extreme.
Where this gets used
Hamiltonian simulation is the substrate underneath several things covered elsewhere on this site. Quantum phase estimation needs controlled powers of e^(-iHt) as its core primitive. The quantum chemistry work simulating a 303-atom protein depends on efficient Trotterized (or better, non-Trotter product-formula) simulation of a molecular Hamiltonian's active space. Materials science and condensed-matter simulation, the use case IonQ's decoder work and several vendors' roadmaps point toward, is fundamentally "run Hamiltonian simulation on a Hamiltonian nobody diagonalizes classically at the sizes that matter."
Try this next
- Compute
process_fidelitybetween the Trotterized circuit above and the exactexpmevolution forstepsin 1, 2, 4, 8, 16 and plot the error curve yourself. It should visibly bend toward the O(t²/n) prediction. - Swap the second-order symmetric ordering in for the first-order loop above and compare gate count against error reduction.
- Read our VQE guide for the companion technique: instead of simulating time evolution, VQE searches directly for a Hamiltonian's ground state.