|q⟩ Bad Qubits

beginner · Programming · Quantum Teleportation & Superdense Coding

Checkpoint: Teleport and Code

Module 13 introduced two protocols that, taken together, reveal the full power of a shared Bell pair as a quantum resource. This checkpoint asks you to implement both from scratch and confirms that you understand how the same entangled state underpins both directions of quantum–classical information exchange.

Teleportation in brief

Quantum teleportation transfers an arbitrary unknown qubit state

ψ=α0+β1|\psi\rangle = \alpha|0\rangle + \beta|1\rangle

from Alice to Bob using one shared Bell pair and two classical bits. Alice performs a joint Bell measurement on ψ|\psi\rangle and her half of the pair, obtaining one of four equally likely two-bit outcomes. She sends those two bits classically; Bob applies the corresponding Pauli correction (II, XX, ZZ, or ZXZX) to his qubit. His qubit then carries exactly ψ|\psi\rangle. The original is destroyed by Alice's measurement, consistent with the no-cloning theorem.

The four Pauli corrections are:

| Alice's bits | Bob applies | |---|---| | 00 | II (nothing) | | 01 | XX | | 10 | ZZ | | 11 | ZXZX |

Superdense coding in brief

Superdense coding runs the resource exchange in the opposite direction: Alice encodes two classical bits into a single qubit and transmits only that qubit to Bob, who then recovers both bits. The key is that both parties again share Φ+=12(00+11)|\Phi^+\rangle = \tfrac{1}{\sqrt{2}}(|00\rangle + |11\rangle) in advance.

Alice's encoding depends on which two-bit message she wants to send. She acts on qubit 0 (her half of the pair) with:

| Message | Alice applies | Resulting Bell state | |---|---|---| | 00 | II | Φ+=12(00+11)|\Phi^+\rangle = \tfrac{1}{\sqrt{2}}(|00\rangle + |11\rangle) | | 01 | XX | Ψ+=12(10+01)|\Psi^+\rangle = \tfrac{1}{\sqrt{2}}(|10\rangle + |01\rangle) | | 10 | ZZ | Φ=12(0011)|\Phi^-\rangle = \tfrac{1}{\sqrt{2}}(|00\rangle - |11\rangle) | | 11 | ZXZX | Ψ=12(0110)|\Psi^-\rangle = \tfrac{1}{\sqrt{2}}(|01\rangle - |10\rangle) |

Bob then decodes with a Bell measurement — CNOT from qubit 0 to qubit 1, followed by HH on qubit 0, followed by measuring both qubits. Because the four Bell states are mutually orthogonal, this measurement deterministically recovers Alice's two bits.

Worked example: encoding "11"

Starting from Φ+=12(00+11)|\Phi^+\rangle = \tfrac{1}{\sqrt{2}}(|00\rangle + |11\rangle), Alice applies XX then ZZ to qubit 0:

X on qubit 0:12(10+01)X \text{ on qubit 0}: \frac{1}{\sqrt{2}}(|10\rangle + |01\rangle)

Z on qubit 0:12(10+01)=12(0110)Z \text{ on qubit 0}: \frac{1}{\sqrt{2}}(-|10\rangle + |01\rangle) = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)

Bob applies CNOT(0→1):

12(0111)\frac{1}{\sqrt{2}}\bigl(|01\rangle - |11\rangle\bigr)

Then HH on qubit 0:

12[(0+1)1(01)1]=12(211)=11\frac{1}{2}\bigl[(|0\rangle+|1\rangle)|1\rangle - (|0\rangle-|1\rangle)|1\rangle\bigr] = \frac{1}{2}(2|11\rangle) = |11\rangle

Measuring gives 11 with probability 1 — the two bits are perfectly recovered.

Try it

Implement the complete superdense coding circuit for the message "11": prepare the Bell pair, apply Alice's encoding for "11", then perform Bob's decoding measurement. The grader checks the probability distribution; measuring 11 with probability 1 is the only passing outcome.

Run your code to see the quantum state.

Once you pass, reflect on the symmetry: teleportation and superdense coding are Heisenberg duals of each other, trading one qubit of quantum communication and two bits of classical communication in opposite directions — both enabled by a single shared Bell pair.

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