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 qubitDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/itsubaki/qasm-playground/llms.txt
Use this file to discover all available pages before exploring further.
psi to qubit t — without ever moving psi itself.
Code
Step-by-step explanation
Gate definitions Three gates are defined using the universalU gate:
h(Hadamard):U(pi/2, 0, pi)— creates superposition.cx(CNOT): controlledU(pi, 0, pi)— entangles qubits and applies corrections.cz(controlled-Z): controlledU(0, pi, 0)— applies a phase correction.
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
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)
psi and a (two classical bits) encode which correction Bob needs to apply.
Corrections on t (Bob’s side)
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, qubitt is in the state:
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.
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 betweena 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.