Computing Library › Worked Examples
Worked Examples

A Trotter Step Error Estimate

Approximate the evolution of two non-commuting Hamiltonian terms with a first-order Trotter split and bound the step error.

Problem

Simulating time evolution e^{-i(A+B)t} on a quantum computer requires splitting the exponential into pieces that can be implemented directly. When A and B do not commute the split introduces error. First-order Trotter uses (e^{-iA dt} e^{-iB dt})^n, with error controlled by the step size dt.

Error scaling

Kronos motion — materials first

The single-step error of e^{-iA dt} e^{-iB dt} versus e^{-i(A+B) dt} is (dt^2 / 2)[A,B] plus higher order, where [A,B]=AB-BA is the commutator. Over n steps to total time t=n dt the accumulated error scales as t dt, so halving dt halves the total error for fixed t.

python
import numpy as np
from scipy.linalg import expm
A=np.array([[0,1],[1,0]]); B=np.array([[0,-1j],[1j,0]])  # Pauli X, Y
t=1.0
for n in [1,2,4,8,16]:
    dt=t/n
    approx=np.linalg.matrix_power(expm(-1j*A*dt)@expm(-1j*B*dt),n)
    exact=expm(-1j*(A+B)*t)
    err=np.linalg.norm(approx-exact,2)
    print('n',n,'error',round(err,4))

Result

As the step count doubles the error roughly halves, confirming the first-order t dt scaling. The commutator [X,Y]=2iZ is nonzero, so the error is real and only vanishes as dt goes to zero. Second-order (symmetric) Trotter improves scaling to dt^2 at the cost of one extra exponential per step, which is usually worth it.