|q⟩ Bad Qubits

advanced · Programming · Quantum Annealing & Adiabatic Computing

Checkpoint: Anneal to a Ground State

This checkpoint assembles everything in the module into one runnable algorithm: a complete, Trotterized single-qubit anneal that starts in the driver's ground state and finishes in the ground state of the problem Hamiltonian.

The problem

Take the problem Hamiltonian HP=ZH_P = -Z, whose ground state is 0|0\rangle (energy 1-1). The driver is HB=XH_B = -X, with ground state +|{+}\rangle. The linear schedule is

H(s)=(1s)HB+sHP=(1s)XsZ,s=t/T.H(s) = (1-s)\,H_B + s\,H_P = -(1-s)\,X - s\,Z, \qquad s = t/T .

Run slowly enough and the system tracks the instantaneous ground state from +|{+}\rangle at s=0s = 0 all the way to 0|0\rangle at s=1s = 1. From the gap lesson, Δmin=2\Delta_{\min} = \sqrt{2}, so a modest total time TT already makes the evolution comfortably adiabatic.

The recipe

  1. Initialize. Prepare the driver ground state +=H0|{+}\rangle = H|0\rangle.
  2. Discretize. Split T=20T = 20 into N=60N = 60 steps of size dt=T/N=13dt = T/N = \tfrac{1}{3}.
  3. Trotterize each step. At step kk use the midpoint schedule value s=(k+12)/Ns = (k + \tfrac12)/N and apply the first-order Trotter step Uk=RX(2dt(1s))RZ(2dts),U_k = RX\bigl(-2\,dt\,(1-s)\bigr)\,RZ(-2\,dt\,s), i.e. the RZRZ rotation first, then the RXRX rotation.
  4. Measure in the computational basis.

The midpoint rule s=(k+12)/Ns = (k+\tfrac12)/N samples the schedule symmetrically across each interval, a standard improvement over using the left endpoint.

Why the answer concentrates on 0

Because T=201/Δmin2=12T = 20 \gg 1/\Delta_{\min}^2 = \tfrac12, the adiabatic theorem applies: the diabatic transition probability is tiny, so the system stays in the ground state. By s=1s = 1 that ground state is 0|0\rangle, and a computational-basis measurement returns outcome 00 with probability close to 1. The small residual weight on outcome 11 comes from finite TT and the O(dt2)O(dt^2) Trotter error.

Try it

Implement the full anneal exactly as specified and measure. The grader checks the measurement distribution: outcome 00 should dominate.

Run your code to see the quantum state.

After running, the Probabilities tab shows the bar for 00 near 1 and the bar for 11 near 0 — you have annealed into the ground state of HP=ZH_P = -Z.

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