Quantum teleportation is a protocol that transfers the exact quantum state of one qubit to another qubit using a shared entangled pair and two classical bits of communication. The original qubit’s state is destroyed in the process (no-cloning theorem), but faithfully reconstructed on the target. This circuit teleports the state 0.92|0⟩ + 0.27(1+i)|1⟩ from qubit psi to qubit t — without ever moving psi itself.
Code
Step-by-step explanation
Gate definitions
Three gates are defined using the universal U gate:
h (Hadamard): U(pi/2, 0, pi) — creates superposition.
cx (CNOT): controlled U(pi, 0, pi) — entangles qubits and applies corrections.
cz (controlled-Z): controlled U(0, pi, 0) — applies a phase correction.
Preparing the state to teleport
U(pi/4, pi/4, pi/4) psi initializes psi to the state 0.92|0⟩ + 0.27(1+i)|1⟩. This is an arbitrary state chosen to demonstrate that the protocol works for any input, not just a computational basis state.
Creating the entangled channel
Qubit a (Alice’s half) and qubit t (Bob’s half) now share a maximally entangled state. t is physically located at the destination.
Bell measurement on psi and a (Alice’s side)
After these two gates, the joint system of psi+a is in one of the four Bell states. The measurement outcomes of psi and a (two classical bits) encode which correction Bob needs to apply.
Corrections on t (Bob’s side)
These two gates are controlled on the classical measurement outcomes through the quantum wires. After both corrections, t holds the original state of psi.
Measuring psi and a
measure psi and measure a collapse Alice’s qubits, providing the two classical bits that drive the corrections. The state of psi is irretrievably altered after measurement — consistent with the no-cloning theorem.
Expected output
After the protocol completes, qubit t is in the state:
This matches the original state of psi exactly, including both the amplitude magnitudes and the complex phase. The measurement results of psi and a will each be 0 or 1 with equal probability across the four combinations (00, 01, 10, 11), but regardless of which pair is measured, the corrections always leave t in the correct state.
The two classical bits sent from Alice to Bob are essential. Without them, Bob cannot determine which correction to apply, and from his perspective, t looks maximally mixed. Classical communication is what makes the protocol work — teleportation does not transmit information faster than light.
Quantum mechanics concepts
No-cloning theorem — Quantum mechanics forbids copying an unknown quantum state. Teleportation circumvents this by destroying the original state during the Bell measurement, transferring the quantum information rather than duplicating it.
Bell measurement — Measuring two qubits in the Bell basis (rather than the computational basis) is achieved by applying a CNOT followed by a Hadamard before measurement. The outcome projects the system onto one of the four Bell states and yields two classical bits.
Entanglement as a resource — The shared Bell pair between a and t is the quantum channel. Teleportation consumes one ebit (unit of entanglement) per qubit teleported. Without pre-shared entanglement, the protocol cannot work.
Classical communication — Two classical bits carry the information about which of the four possible correction operations Bob must apply. This is why teleportation requires a classical channel in addition to the entangled pair — one for quantum correlation, one for the correction instructions.