Curriculum / Entanglement & Protocols / Entanglement Swapping
Entanglement Swapping
Simulate entanglement swapping: create long-range entanglement via a relay.
Entanglement Swapping
Entanglement swapping lets two parties (Alice and Bob) become entangled even though they never directly interacted. A relay (Charlie) does a Bell measurement on his two qubits, one entangled with Alice, one with Bob. This is the core operation inside every quantum repeater, a device you will meet later in this track, and in this challenge you build it from four qubits.
Teleportation in Disguise
You already know quantum teleportation: a Bell measurement plus two classical bits moves an unknown qubit state from one place to another. Entanglement swapping is exactly teleportation where the "unknown state" happens to be half of another Bell pair. Charlie teleports his Alice-side qubit into Bob's pair, and the entanglement comes along for the ride. Nothing about teleportation required the input to be a standalone qubit, and swapping is the payoff for that generality.
The Protocol
- Alice has qubit 0, Charlie has qubit 1
- Charlie has qubit 2, Bob has qubit 3
- 1.Charlie prepares two Bell pairs: qubits (0,1) and qubits (2,3)
- 2.Charlie performs a Bell measurement on qubits 1 and 2 (CNOT + H + measure)
- 3.Regardless of Charlie's result, qubits 0 and 3 (Alice and Bob) are now entangled
Reading the Outcome
Charlie's Bell measurement has four outcomes, and each projects Alice and Bob into a different Bell state. In the Z basis only the parity matters: Charlie's CNOT-target outcome (qubit 2) is the parity bit that names the family.
- •Parity bit 0: Alice and Bob share a Φ-family state, their measurements always match
- •Parity bit 1: Alice and Bob share a Ψ-family state, their measurements are always opposite
Charlie's other outcome (qubit 1, the phase bit) distinguishes + from − within each family, which is invisible to Z-basis measurements. The measurement keys follow Qiskit's convention, qubit 0 is the rightmost character, so a key reads [Bob][Charlie_R][Charlie_L][Alice], and the verification code checks every shot against the parity rule above: 100% of outcomes must be consistent, something that cannot happen unless your two TODO steps genuinely entangled Alice with Bob. Remember from Density Matrices and Mixed States that either half of a Bell pair on its own is maximally mixed, so Alice's marginal statistics stay 50/50 no matter what and the swap shows up only in the joint counts.
This is the opening of the lesson. The full walkthrough, the interactive circuit, and the graded challenge continue inside myqubit.
How this lesson works
A hands-on coding challenge. You write Qiskit-compatible Python in the browser editor, run it instantly via WebAssembly, watch the circuit and Bloch sphere react, and pass automatic output checks. The AI tutor Qubitus gives Socratic hints if you get stuck.
Part of: Entanglement & Protocols
Master multi-qubit systems, quantum teleportation, and cryptographic protocols.
This lesson is part of Pro
Unlock Entanglement & Protocols and all 10 tracks with Pro: $12.99/month, $79/year, or $97 lifetime. Start with the free track first if you are new.