Algorithm guide · protocol
E91 (Ekert) key exchange
Generate candidate keys from singlet pairs and test measured correlations with a Bell inequality; compare an intercept-resend attack.
Circuit size: 2 qubits per pair
Singlet anticorrelation · CHSH correlations · Sampling and disclosed data
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
Use entangled pairs to form candidate shared key bits and estimate Bell correlations on separately disclosed settings. Explore the effect of an intercept-resend eavesdropper without treating a teaching session as a finished secure key protocol.
2. How it works
A singlet gives opposite bits when both parties measure along the same axis. Bob can invert his bit to agree with Alice. Other axis pairs test correlations that ideal shared entanglement can produce and simple local models cannot.
Distribute fresh singlets
Prepare one (|01⟩−|10⟩)/√2 per pair.
Choose axes independently
Alice uses 0°,45°,90° and Bob 45°,90°,135° in the XZ plane.
Classify records
Equal-axis settings supply key candidates; four disjoint setting cells supply Bell estimates. Other settings are discarded.
Disclose and compare
Reveal a sample of key positions to estimate QBER, remove disclosed positions, and invert Bob’s candidate bits.
3. The mathematics, one idea at a time
For a singlet, E is the average product of the two ±1 measurement outcomes. Equal axes give E=−1.
For the implemented axes, ideal S=−2√2 and |S|=2√2. Each E must be estimated from its own setting stratum.
Bob’s key bit is 1 XOR his raw measurement bit. An empty sample has no defined QBER.
Work this through by hand
4. One equal-axis pair before a session
Two physical qubits per pair. One pair teaches the key correlation; the session UI requires at least 128 pairs for sampled statistics.
The worked circuit uses Alice A2=45°, Bob B1=45° and Eve off. In the session dialog, start with 128 pairs and inspect individual rounds.
| Stage | Calculation or state | What it means |
|---|---|---|
| Equal axes | α−β=0 ⇒ E=−1 | Raw bits must disagree. |
| Possible raw results | Bob|Alice=01 or 10 | Both have probability 1/2. |
| Invert Bob | Bob_key=1 XOR Bob_raw | The resulting candidate bit equals Alice’s bit. |
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 event | Ideal probability | Interpretation |
|---|---|---|
| 01 | 50% ideal | Bob 0, Alice 1; inverted Bob bit is 1. |
| 10 | 50% ideal | Bob 1, Alice 0; inverted Bob bit is 0. |
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: E91 pair 1 · A2 B1 · Eve off
- Save any current circuit you want to keep, then open the worked example. Loading it does not execute a paid hardware job.
- Trace the preparation, main operations and measurements against the worked table. Check the gate editor for controls, targets and angles.
- Start with an ideal noiseless simulator compatible with the circuit. Mid-circuit measurement, reset and feed-forward require support from the chosen backend.
- 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.
- 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
With Eve off, c1c0 reads Bob|Alice. With Eve on the mapping expands to Bob|Alice|Eve; inspect the round’s labels.
A single pair has no Bell statistic. In a session read all four correlation cells, signed S, |S|, disclosed-sample QBER and remaining candidate strings separately.
Missing Bell strata produce unavailable estimates; a short session’s random |S| is not a security certificate. Authentication, error reconciliation and privacy amplification are outside this demo.
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
- Do not reuse disclosed test bits in the remaining candidate key.
- An apparent finite-sample Bell violation is not a complete security proof or a loophole-free device-independent test.
8. Check your understanding
For equal-axis raw bits Alice=0,Bob=1, what are the candidate bits?
Reveal the reasoning
Alice keeps 0; Bob inverts 1 to 0. They agree.
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.
- E91 pair 1 · A1 B1 · Eve off
- E91 pair 1 · A1 B2 · Eve off
- E91 pair 1 · A1 B3 · Eve off
- E91 pair 1 · A2 B1 · Eve off
- E91 pair 1 · A2 B2 · Eve off
- E91 pair 1 · A2 B3 · Eve off
- E91 pair 1 · A3 B1 · Eve off
- E91 pair 1 · A3 B2 · Eve off
- E91 pair 1 · A3 B3 · Eve off
The E91 session has separate round controls and summary statistics. Open Configure in Algorithms for those controls.
Implementation notes
A two-qubit teaching session with independent measurement settings, disjoint Bell disclosures and candidate key positions. Finite-sample Bell violation is not a complete security certificate.
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.