|q⟩ Bad Qubits

intermediate · Programming · Hamiltonian Simulation & Trotterization

Trotter Error

The first-order Trotter formula replaces the exact joint evolution ei(H1+H2)te^{-i(H_1+H_2)t} with the product eiH1teiH2te^{-iH_1 t}\,e^{-iH_2 t}. These two operators agree only when H1H_1 and H2H_2 commute; in general there is a discrepancy — the Trotter error — and knowing how to bound it is essential for choosing the right number of Trotter steps in a simulation.

Where the error comes from

The Baker–Campbell–Hausdorff (BCH) lemma tells us

eAeB=eA+B+12[A,B]+,e^{A}\,e^{B} = e^{A + B + \frac{1}{2}[A,B] + \cdots},

where [A,B]=ABBA[A,B] = AB - BA is the commutator. Setting A=iH1tA = -iH_1 t and B=iH2tB = -iH_2 t,

eiH1teiH2t=ei(H1+H2)tt22[H1,H2]+O(t3).e^{-iH_1 t}\,e^{-iH_2 t} = e^{-i(H_1+H_2)t - \frac{t^2}{2}[H_1,H_2] + O(t^3)}.

The leading error is the extra term t22[H1,H2]-\frac{t^2}{2}[H_1,H_2] in the exponent. If the terms commute, [H1,H2]=0[H_1,H_2]=0 and the formula is exact at any step size.

Bounding the error in spectral norm

The spectral norm \|\cdot\| (largest singular value) is the natural measure of how far two unitaries are from each other. A standard bound gives

eiH1teiH2tei(H1+H2)t    t22[H1,H2].\bigl\|e^{-iH_1 t}\,e^{-iH_2 t} - e^{-i(H_1+H_2)t}\bigr\| \;\leq\; \frac{t^2}{2}\,\|[H_1,H_2]\|.

This is the first-order Trotter error bound. It has three key consequences:

  1. Quadratic in tt: Halving the step size reduces the error by a factor of four.
  2. Proportional to the commutator: Terms that nearly commute are much cheaper to Trotterise accurately.
  3. Additive over steps: With rr steps of size t/rt/r the total bound becomes t2[H1,H2]/(2r)t^2\|[H_1,H_2]\|/(2r), shrinking as rr grows.

Worked example: H=X+ZH = X + Z

Consider the single-qubit Hamiltonian H=X+ZH = X + Z split as H1=XH_1 = X, H2=ZH_2 = Z. Using the Pauli product identity XZ=iYXZ = -iY and ZX=iYZX = iY:

[X,Z]=XZZX=iYiY=2iY.[X, Z] = XZ - ZX = -iY - iY = -2iY.

The spectral norm of 2iY-2iY is 22 (Pauli YY has eigenvalues ±1\pm 1, so 2Y=2\|-2Y\| = 2). With t=0.5t = 0.5:

ϵ    (0.5)22×2=0.252×2=0.25.\epsilon \;\leq\; \frac{(0.5)^2}{2}\times 2 = \frac{0.25}{2}\times 2 = 0.25.

How the step count controls the error

Dividing total time tt into rr steps of size δ=t/r\delta = t/r, the accumulated error satisfies

ϵtotal    rδ22[H1,H2]=t22r[H1,H2].\epsilon_{\text{total}} \;\leq\; r \cdot \frac{\delta^2}{2}\,\|[H_1,H_2]\| = \frac{t^2}{2r}\,\|[H_1,H_2]\|.

To achieve target accuracy ε\varepsilon we need at least

r    t2[H1,H2]2ε.r \;\geq\; \frac{t^2\,\|[H_1,H_2]\|}{2\varepsilon}.

For the X+ZX+Z example with t=1t=1 and ε=0.01\varepsilon=0.01, that requires r2/(2×0.01)=100r \geq 2/(2\times 0.01) = 100 steps — showing why strongly non-commuting terms are expensive to simulate accurately.

Try it

For H1=ZH_1 = Z, H2=XH_2 = X (single qubit) and step size t=1.0t = 1.0, compute the first-order Trotter error upper bound t22[H1,H2]\frac{t^2}{2}\|[H_1,H_2]\| and return it as a number. The Pauli identity gives [Z,X]=2iY[Z,X] = -2iY, so [Z,X]=2\|[Z,X]\| = 2.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.