Skip to content
Tutorials Center
My learning

Topics

Lesson 38 of 39 ยท Projects and Practice

Project: Simulating a Bell Test

Sample measurement outcomes of an entangled pair, estimate the CHSH value with error bars, and find how much noise a Bell-test violation can tolerate.

A Bell experiment never delivers the exact quantum value 2โˆš2. It delivers a finite list of ยฑ1 outcomes, taken with imperfect sources and detectors, and the experimenter must decide whether |S| is significantly above 2. In this project you build that experiment in software. You will sample the outcomes that quantum mechanics predicts for a singlet pair, estimate S and its statistical error, and then add noise to find out how good a source must be.

The theory from Entanglement and Bell's Inequality is all we need. In summary: Alice and Bob each choose between two settings (a, a' and b, b'). Each measurement gives ยฑ1. For the singlet the correlation between settings at angle difference ฮ” is E = -cos ฮ”, and each side alone gives +1 or -1 with probability 1/2. Given E, the two outcomes agree with probability (1 + E)/2.

Step 1: sample the data

For each of the four setting pairs, we generate n pairs of outcomes: Alice's outcome A is a fair coin; Bob's outcome B equals A with probability (1 + E)/2 and -A otherwise. Then the estimate of each correlation is the mean of the product AยทB. For n independent trials, each correlation has a standard error

Text
ฯƒ_E = โˆš((1 - Eยฒ)/n)

and since the four settings use different pairs, the four errors add in quadrature: ฯƒ_S = โˆš(ฮฃ ฯƒ_Eยฒ). A result |S| - 2 of several ฯƒ_S is considered a significant violation. Particle physicists usually require 5ฯƒ.

Python Sample a singlet Bell test and estimate S with its error

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Step 2: noise and visibility

A real source is never a perfect singlet. A common simple model is the Werner state

Text
ฯ = V |ฯˆโปโŸฉโŸจฯˆโป| + (1 - V) I/4

a mixture of the singlet with probability V and completely random noise otherwise. The number V between 0 and 1 is the visibility (the contrast of the correlation fringes). Every correlation is multiplied by V: E = -V cos ฮ”, so

Text
S = -2โˆš2 ยท V

and a violation |S| > 2 requires

Text
V > 1/โˆš2 โ‰ˆ 0.7071

Below that, the noisy state is entangled for a wide range of V (the Werner state is entangled for V > 1/3), but its correlations can be reproduced by a local hidden-variable model for these CHSH settings. In other words, a state can be entangled yet fail the simplest Bell test.

The statistical question is how many pairs are needed to prove a violation. With |E| = V/โˆš2 for each term, ฯƒ_S = 2 โˆš((1 - Vยฒ/2)/n), and requiring |S| - 2 โ‰ฅ z ฯƒ_S gives

Text
n โ‰ฅ 4 zยฒ (1 - Vยฒ/2) / (2โˆš2 V - 2)ยฒ       (pairs per setting combination)
Python Visibility threshold and the number of pairs needed

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The numbers show two lessons. First, source quality matters strongly: as V approaches 0.707 the number of pairs needed grows without bound, since the margin 2โˆš2 V - 2 goes to zero. Second, significance requires statistics. A few hundred pairs may be enough for a perfect source, but a visibility of 0.72 needs millions.

What the simulation leaves out

This sampling was for the ideal setup. Real experiments have extra issues that we deliberately skipped:

  • Detection loophole. If many pairs are lost, and the lost ones are not a fair sample, a local model can fake a violation. Experiments need high enough detection efficiency (somewhere between about 2/3 and 83%, depending on the state and the test used).
  • Locality loophole. The settings must be chosen, and the outcomes recorded, so quickly and at such a distance that no light-speed signal can connect them.
  • Freedom of choice. The setting choices should be independent of the source, which is why experiments use random number generators, and even light from distant stars.
  • Coincidence identification. Pairs have to be matched in time.

Loophole-free experiments in 2015 closed the detection and locality loopholes in one run, and later tests have used distant quasars and human choices for the settings.

Extension: test your own local model

The most instructive follow-up is to try to cheat. Write your own local hidden-variable model, a function that takes a setting and a shared random number and returns ยฑ1 for each side, and measure its S with the code above. You will not get past |S| = 2, but you will see how close different strategies come. The deterministic enumeration in the Bell lesson shows why: no assignment of fixed answers can exceed 2.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In the simulation, how does the standard error of each estimated correlation scale with the number of pairs n?

    The mean of n independent ยฑ1 products has standard deviation โˆš((1 - Eยฒ)/n).
  2. 2. For a Werner state with visibility V, CHSH violation requires:

    S = -2โˆš2 V, and |S| > 2 needs V > 2/(2โˆš2) = 1/โˆš2.
  3. 3. If the visibility is 0.72, why does certifying a violation need very many pairs?

    At V = 0.72 the ideal |S| is about 2.04. The error bar must shrink well below 0.04, requiring huge numbers of pairs.
  4. 4. A noisy entangled state with V = 0.5 fails the CHSH test. Does that prove it is unentangled?

    The Bell test is a sufficient but not a necessary condition for entanglement.

Summary

  • A Bell test samples ยฑ1 outcomes for four setting pairs and estimates S = E(a,b) - E(a,b') + E(a',b) + E(a',b') with a statistical error falling like 1/โˆšn.
  • With a perfect singlet |S| = 2โˆš2; a Werner state with visibility V gives |S| = 2โˆš2 V.
  • A violation needs V > 1/โˆš2, and the number of pairs required diverges as V approaches that threshold.
  • Real experiments must also close the detection, locality and freedom-of-choice loopholes.
  • Entangled states can fail this Bell test; violation is sufficient evidence of entanglement, not a necessary one.

Next: Practice Set: Advanced Quantum Mechanics Problems