This checkpoint asks you to assemble a complete first-order Trotter circuit for a concrete
two-qubit Hamiltonian — combining every skill from this module into a single working program.
The target Hamiltonian
Consider the two-qubit Hamiltonian
H=8πZ⊗Z+8πX⊗I.
The first term couples the two spins through a ZZ interaction; the second drives single-qubit
rotations on qubit 0 alone. Both coefficients equal π/8, which keeps the angles tidy.
Applying the first-order Trotter formula
Because Z⊗Z and X⊗I do not commute — you can verify that
(X⊗I)(Z⊗Z)=(Z⊗Z)(X⊗I) since XZ=ZX — the
exact evolution e−iHt cannot be split naively. The first-order Trotter (Lie–Trotter)
product formula gives the approximation
e−iHt≈e−iH1te−iH2t,H1=8πZZ,H2=8π(X⊗I),
with an error of order t2[H1,H2]. For t=1 and the given coefficients this is a
single Trotter step — enough to demonstrate the structure without needing multiple repetitions.
Compiling each factor to gates
Factor 1 — e−i(π/8)ZZ.
The ZZ eigenvalue of ∣xy⟩ is (−1)x⊕y, so a CNOT from qubit 0 to qubit 1
maps the parity into qubit 1, and a single Rz on qubit 1 applies the phase:
e−iθZZ=CNOT0→1⋅(I⊗Rz(2θ))⋅CNOT0→1,θ=8π.
In code: c.cx(0, 1); c.rz(2 * Math.PI/8, 1); c.cx(0, 1);
Factor 2 — e−i(π/8)(X⊗I).
Only qubit 0 participates. Using e−iθX=Rx(2θ):
e−i(π/8)X⊗I=Rx(4π)⊗I.
In code: c.rx(2 * Math.PI/8, 0);
Try it
Implement both factors in the correct order. The grader checks the full unitary matrix of
your two-qubit circuit, so an empty or partial circuit will not pass.
Run your code to see the quantum state.
Sign in on the full site to ask questions and join the discussion.