|q⟩ Bad Qubits

beginner · Programming · Quantum Teleportation & Superdense Coding

Encoding Two Bits

Superdense coding is a quantum communication protocol that lets one party transmit two classical bits of information by sending a single qubit — but only when the two parties already share an entangled Bell pair. This lesson focuses on Alice's half of that protocol: the encoding step.

The shared resource

Before any message is sent, Alice and Bob prepare and share a Bell pair

Φ+=12(00+11).|\Phi^+\rangle = \frac{1}{\sqrt{2}}\bigl(|00\rangle + |11\rangle\bigr).

Alice holds qubit 0 and Bob holds qubit 1. Neither qubit has a definite state on its own, but together they are maximally entangled: any measurement outcome on one qubit is perfectly correlated with the other.

Four messages, four operations

Alice wants to send one of four two-bit messages: 00, 01, 10, or 11. She encodes her choice by applying a single-qubit operation to her qubit only (qubit 0). The four Pauli operations each transform the shared Bell state into a different, orthogonal Bell state:

| Message | Operation on qubit 0 | Resulting state | |---------|---------------------|-----------------| | 00 | II (do nothing) | 12(00+11)=Φ+\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle) = |\Phi^+\rangle | | 01 | XX | 12(01+10)=Ψ+\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle) = |\Psi^+\rangle | | 10 | ZZ | 12(0011)=Φ\frac{1}{\sqrt{2}}(|00\rangle - |11\rangle) = |\Phi^-\rangle | | 11 | ZXZX (X then Z) | 12(0110)=Ψ\frac{1}{\sqrt{2}}(|01\rangle - |10\rangle) = |\Psi^-\rangle |

Why does this work? The four Bell states {Φ±,Ψ±}\{|\Phi^\pm\rangle, |\Psi^\pm\rangle\} form an orthonormal basis for two-qubit Hilbert space. Bob, upon receiving Alice's qubit, can measure both qubits in the Bell basis — a CNOT followed by a Hadamard and then computational-basis measurement — and read off which of the four states arrived, recovering both of Alice's bits unambiguously.

The Z encoding in detail

Consider the 10 case. Starting from Φ+|\Phi^+\rangle, Alice applies ZZ to qubit 0. The ZZ gate leaves 0|0\rangle unchanged and maps 11|1\rangle \mapsto -|1\rangle, so

= \frac{1}{\sqrt{2}}\bigl(|00\rangle - |11\rangle\bigr) = |\Phi^-\rangle.$$ The relative phase between the two terms is all that changed. Bob can still distinguish this state from $|\Phi^+\rangle$ because they are orthogonal: $\langle\Phi^+|\Phi^-\rangle = 0$. <Callout type="tip"> The remarkable feature here is locality: Alice's operation touches only qubit 0, yet the global two-qubit state changes in a way that encodes a full two-bit message. Entanglement makes the channel twice as efficient as sending one classical bit per qubit. </Callout> ## Try it The starter code prepares $|\Phi^+\rangle$. Add the encoding operation for the message `10` — a $Z$ gate on qubit 0. The grader compares the full two-qubit state vector, so the amplitudes on $|00\rangle$ and $|11\rangle$ must be $+\tfrac{1}{\sqrt{2}}$ and $-\tfrac{1}{\sqrt{2}}$ respectively, with zero amplitude on $|01\rangle$ and $|10\rangle$. <RunnableExample /> After running, check the **Amplitudes** panel: you should see index 0 ($|00\rangle$) at $+0.707$ and index 3 ($|11\rangle$) at $-0.707$. That is $|\Phi^-\rangle$, Alice's encoded message `10`.

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