|q⟩ Bad Qubits

advanced · Physics · Quantum Cryptography & QKD

Checkpoint: Run BB84

This checkpoint ties the protocol together: you will simulate two sifted BB84 rounds — rounds where Alice and Bob already chose the same basis — and watch Bob deterministically recover Alice's bits. It is the operational core of BB84: matched bases ⇒ perfect agreement.

Setup

You build a 2-qubit circuit, one qubit per round:

Measuring in a rotated basis

The simulator measures in the computational (ZZ) basis. To realize an XX-basis measurement, you first rotate the diagonal basis onto the computational one with a Hadamard, then measure:

H+=0,H=1.H|+\rangle = |0\rangle, \qquad H|-\rangle = |1\rangle.

So Bob's XX-basis measurement of qubit 0 is "apply HH, then read ZZ." On round A the qubit's life is 0X1HH1|0\rangle \xrightarrow{X} |1\rangle \xrightarrow{H} |-\rangle \xrightarrow{H} |1\rangle, so Bob reads 11 — exactly Alice's bit. On round B nothing rotates: 0|0\rangle measured in ZZ reads 00.

What the grader checks

Both rounds are deterministic when the bases match, so the joint outcome is the single basis state 10 (qubit 0 1\to 1, qubit 1 0\to 0) with probability 11:

p(10)=1,p(00)=p(01)=p(11)=0.p(\texttt{10}) = 1, \qquad p(\texttt{00}) = p(\texttt{01}) = p(\texttt{11}) = 0.

Bob's sifted key 1,0 equals Alice's transmitted bits 1,0. That perfect agreement on sifted rounds is what makes the key usable — and any deviation from it (the QBER) is exactly the eavesdropping signal you studied earlier. You have now run, end to end, the quantum heart of BB84.

Run your code to see the quantum state.

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