|q⟩ Bad Qubits

beginner · Programming · Quantum Teleportation & Superdense Coding

Classical Correction

After Alice performs her Bell-basis measurement, she holds two classical bits — call them m0m_0 (from the message qubit) and m1m_1 (from her half of the Bell pair). She sends these two bits to Bob over an ordinary classical channel. Bob's qubit is in some state that depends on the measurement outcome, and he must apply a classical correction to recover the exact quantum state Alice wanted to teleport.

Why corrections are needed

Tracing through the algebra shows that after Alice's measurement the four possible outcomes each leave Bob's qubit in a different state:

| m0m_0 | m1m_1 | Bob's qubit | Correction | |:-----:|:-----:|:-----------:|:----------:| | 0 | 0 | ψ|\psi\rangle | none | | 0 | 1 | XψX|\psi\rangle | apply XX | | 1 | 0 | ZψZ|\psi\rangle | apply ZZ | | 1 | 1 | XZψXZ|\psi\rangle | apply XX then ZZ |

In every case, applying the stated gate(s) restores Bob's qubit to the original state ψ|\psi\rangle. Without the classical bits there is no way to know which correction to apply, which is why teleportation requires a classical side-channel and cannot transmit information faster than light.

The deferred measurement principle

Simulating the correction on a state-vector simulator is simplest via the deferred measurement principle: instead of measuring Alice's qubits and then conditionally applying XX and ZZ, we replace the classical conditioning with controlled quantum gates and postpone the measurement to the very end (or omit it entirely when we only care about the state vector).

Concretely, the two corrections become:

CX(q1,q2)followed byCZ(q0,q2).\text{CX}(q_1, q_2) \quad\text{followed by}\quad \text{CZ}(q_0, q_2).

Here q0q_0 and q1q_1 play the role of the classical bits m0m_0 and m1m_1: the CNOT applies XX to Bob's qubit whenever q1=1q_1 = |1\rangle, and the CZ applies a ZZ phase whenever q0=1q_0 = |1\rangle. The principle guarantees this produces the same final qubit state as the classically-conditioned version.

Putting it all together

The full teleportation circuit for a message qubit ψ|\psi\rangle on q0q_0, with the Bell pair on q1q_1 (Alice) and q2q_2 (Bob), runs in this order:

  1. Prepare the Bell pair: H(q1)H(q_1), CX(q1,q2)\mathrm{CX}(q_1, q_2).
  2. Bell measurement prep: CX(q0,q1)\mathrm{CX}(q_0, q_1), H(q0)H(q_0).
  3. Classical corrections: CX(q1,q2)\mathrm{CX}(q_1, q_2), CZ(q0,q2)\mathrm{CZ}(q_0, q_2).

After step 3, qubit q2q_2 holds exactly ψ|\psi\rangle, regardless of which of the four measurement outcomes would have occurred.

Try it

The starter code prepares the message ψ=1|\psi\rangle = |1\rangle on qubit 0, creates the Bell pair on qubits 1 and 2, and applies the Bell-measurement preparation gates. Your job is to add the two classical correction gates so that qubit 2 ends up in state 1|1\rangle.

Run your code to see the quantum state.

After running, look at the state vector: qubit 2 should have amplitude 11 on 1|1\rangle and 00 on 0|0\rangle in every computational basis state, while qubits 0 and 1 are each in the equal superposition +|{+}\rangle, giving each of the four two-bit outcomes equal probability 14\tfrac{1}{4} when measured. Teleportation is complete.

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