Skip to documentation
← Algorithm guides

Algorithm guide · protocol

Entanglement swapping

Entangle two qubits that never interacted, by measuring the two in the middle. The repeater primitive.

Circuit size: 4 qubits, 4 classical bits

Before you begin

Two Bell pairs · Bell measurement · Conditional versus unconditional states

Review quantum fundamentals →
Notation used in this lesson
|ψ⟩ and ⟨ψ|
A state vector (ket) and its conjugate transpose (bra). ⟨a|b⟩ is their inner product.
α, β and i
α and β are complex amplitudes; i²=−1. A probability is the squared magnitude |α|².
XOR, · and ⊗
XOR adds bits modulo two. In s·x, multiply corresponding bits and XOR them. ⊗ combines registers or operations on different wires.
U†, Σ and Tr
U† is the adjoint (inverse for a unitary). Σ sums terms. Tr is the matrix trace, the sum of diagonal entries.
Probability, shots and angles
Ideal probabilities describe the model; measured shot frequencies fluctuate. Angles inside trigonometric expressions are in radians unless explicitly labeled turns.

1. The problem

Entangle distant endpoint qubits q0 and q3 by Bell-measuring their partners q1 and q2. The endpoints never interact directly. Identify the conditional Bell state and optionally correct it to Φ+.

2. How it works

The original pairings are not the only way to describe the four-qubit state. A middle Bell measurement selects a corresponding Bell state for the endpoints. Its classical record specifies which Pauli adjustment is needed.

  1. Prepare

    Create Bell pairs (q0,q1) and (q2,q3).

  2. Middle Bell measurement

    Apply CX q1→q2 and H q1; record q1→c0 and q2→c1.

  3. Correct endpoints

    Apply the selected classical X/Z feed-forward to align the remote pair with Φ+.

  4. Verify in a basis

    Measure endpoint q0→c2 and q3→c3 in Z or X.

3. The mathematics, one idea at a time

|Φ+⟩01 |Φ+⟩23 = (1/2) Σ_B |B⟩12 |B_related⟩03

The sum runs over four Bell labels. Conventions can change phases and byproduct order, but every middle label has probability 1/4.

Corrected remote state: |Φ+⟩=(|00⟩+|11⟩)/√2

Endpoints agree in both the Z and X basis experiments. Before correction, ignoring the middle record leaves their joint state I/4.

Work this through by hand

4. Corrections on, Z readout

Four fixed qubits: two endpoints and two middle partners.

Choose Corrections on · Z readout.

StageCalculation or stateWhat it means
Middle outcomeEach c1c0 has probability 1/4No particular Bell branch is postselected.
After correctionEndpoint 00 or 11 each has probability 1/2This holds in every middle branch.
Joint recordEndpoint bits c3c2 precede middle bits c1c0There are eight allowed full strings, each probability 1/8.

Expected outcomes for this example

These are ideal predictions for the stated configuration, not a result already measured by your browser. Rows describing alternative modes or combined events are labeled explicitly.

Outcome or eventIdeal probabilityInterpretation
00mm and 11mm, for mm=00,01,10,1112.5% per full string ideallyEndpoints agree while the middle record varies.

5. Load the worked example in Composer

The worked example can use smaller or simpler inputs than the gallery defaults. The button below loads the exact circuit used in this lesson.

Selected variant: Entanglement swapping · corrections on · Z readout

  1. Save any current circuit you want to keep, then open the worked example. Loading it does not execute a paid hardware job.
  2. Trace the preparation, main operations and measurements against the worked table. Check the gate editor for controls, targets and angles.
  3. Start with an ideal noiseless simulator compatible with the circuit. Mid-circuit measurement, reset and feed-forward require support from the chosen backend.
  4. Inspect the live preview. For a recorded experiment, open Execute, set the available backend options and shots, and Run. Sign in when prompted to retain it in My Jobs.
  5. Read the output as described below before changing one setting and repeating. The guide describes the original example; edits can change the answer.

6. Read the output correctly

Split c3c2c1c0 as endpoint pair | middle record. Sum over the middle bits to get the remote endpoint histogram.

With correction off, endpoint Z parity equals c1 and endpoint X parity equals c0 in their respective experiments.

Endpoint measurement consumes the pair. To compare Z and X, run fresh preparations; do not measure both bases sequentially on the same pair.

A bit label is a register value; its bar height is a probability or count. For S shots and observed count k, the sampled frequency is k/S. A typical sampling scale for probability p is √[p(1−p)/S]; this is not a strict error bound. Finite samples do not have to match the ideal percentages exactly.

7. Common mistakes & limits

  • Ignoring the middle result without correcting is not the same as having a known pure Bell state.
  • A single agreeing Z histogram alone does not certify entanglement.

8. Check your understanding

Without correction, what Z endpoint parity is expected if c1=1?

Reveal the reasoning

Odd parity: endpoint outcomes differ. The middle record tells which Bell correlation branch occurred.

9. Further study

The lesson’s register mappings, supported inputs and loadable example follow Quantket’s implemented circuit. A reference may use different wire names, bit order or resource conventions.

Gallery reference: defaults, definitions & implementation notes

Available example inputs

Choose a named circuit variant in Algorithms. Each variant fixes its preparation, operations and measurement mapping; the worked variant above is one of them.

  • Entanglement swapping · corrections on · Z readout
  • Entanglement swapping · corrections on · X readout
  • Entanglement swapping · corrections off · Z readout
  • Entanglement swapping · corrections off · X readout

Read your saved result

Check the submitted circuit, measured register and execution settings in Run details. Exact results give computed probabilities; sampled results show frequencies from the recorded shots. Edited circuits and noise can change the expected outcome. The algorithm label records the circuit's origin; it does not certify an edited circuit or a measured result.