Checkpoint: Simulate a Quantum Walk
This checkpoint consolidates everything from Module 8. You will build a complete one-step discrete-time quantum walk from scratch: a coin toss followed by a coherent conditional shift. The result will show the walker's position spread in a single step — the hallmark of quantum ballistic transport.
Recap: the structure of one walk step
A discrete-time quantum walk on a line operates on a joint register
A single step applies two operations in sequence.
Step 1 — Coin toss. The Hadamard gate acts on the coin qubit alone:
After the coin toss the walker is in a superposition of moving left and moving right. No position update has happened yet.
Step 2 — Conditional shift. The shift operator moves the position register left when the coin reads and right when it reads :
For this decrements the position; for it increments. On a 4-node cycle (, two position bits ) both operations are implemented with a Toffoli and a CNOT, each conditioned on the coin qubit .
What the circuit does, step by step
Start with coin at position , so the initial joint state is .
After the Hadamard coin toss:
The branch still has position (will move left); the branch still has position (will move right).
The conditional decrement moves the branch from position to position :
The conditional increment moves the branch from position to position :
The final state before measurement is:
Measuring all three qubits yields bitstring 000 (coin , position ) and bitstring 110 (coin , position ), each with probability .
Encoding the shift as a controlled binary increment/decrement
For a 2-bit position register, a cyclic increment adds 1 modulo 4. The binary ripple-carry circuit is:
Reading left to right: first propagate the carry into the high bit with , then flip the low bit with . Both gates trigger only when , so the operation is controlled on the coin.
A cyclic decrement reverses the carry order — first flip the low bit, then propagate the carry — and wraps the result in gates on the coin:
Flipping the coin converts "active when " into "active when ", which is precisely the left-move condition.
Try it
Complete the circuit: add the coin toss, the conditional decrement, and the conditional increment. Measure all qubits. The grader checks the output distribution — you should see equal probability on bitstrings 000 and 110 and zero probability everywhere else.
After pressing Run, open the Probabilities tab. Two equal bars at 000 and 110 confirm that the walker has spread from position 1 to positions 0 and 2 in a single coherent step. This coherent superposition is what enables the quantum walk's ballistic spreading over many steps — a dramatic speedup over the diffusive () spreading of its classical counterpart.
Sign in on the full site to ask questions and join the discussion.