Superdense Coding
Superdense Coding
Superdense coding is the quantum-classical dual of teleportation: where teleportation sends 1 qubit using 2 classical bits, superdense coding sends 2 classical bits using only 1 qubit — provided Alice and Bob share a pre-established Bell pair.
This result is remarkable: no classical protocol can transmit 2 bits of information by sending a single bit. Entanglement is the resource that makes it possible.
The Bell Pair
Alice and Bob start by sharing the Bell state:
Alice holds qubit 0 (the first qubit); Bob holds qubit 1.
Encoding
Alice encodes two classical bits by applying a gate to her qubit only:
| Alice's gate | Resulting shared state | |
|---|---|---|
| $\frac{|00\rangle + |11\rangle}{\sqrt{2}} = | ||
| $\frac{|10\rangle + |01\rangle}{\sqrt{2}} = | ||
| $\frac{|00\rangle - |11\rangle}{\sqrt{2}} = | ||
| $\frac{|10\rangle - |01\rangle}{\sqrt{2}} = |
The four resulting states are the four Bell states — an orthonormal basis.
Decoding
Bob receives Alice's qubit and applies:
- CNOT (Alice's qubit as control, Bob's as target)
- Hadamard on Alice's qubit
This uncomputes the Bell circuit and leaves the two qubits in one of , , , , which Bob measures directly.
State-Vector Convention
Index the 2-qubit computational basis as:
so state[i] is the amplitude of the basis state whose binary representation is .
Verifying the Decode Circuit
For each encoded Bell state, CNOT maps and (swaps entries 2 and 3), then on qubit 0 maps:
You can verify all four cases in the solution walkthrough above.
Your Task
Implement two functions:
encode_superdense(b0, b1)— return the 4-element complex state vector after Alice applies her encoding gate to .decode_superdense(state)— apply the CNOT + H decode circuit and return the recovered bits as a tuple(b0, b1).