Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Entanglement and the Bell state

After this lesson: I can build and explain a Bell state.

60 min lesson3 commandsQuantum simulator lab: qubits, gates and measurement in JupyterLab

Entangled qubits always agree when measured

Entanglement links two qubits so that their results always agree, although each one alone is a fair coin toss. The simplest entangled state is called a Bell state.

It matters because entanglement is a resource that a quantum program uses and an ordinary one cannot. In this lesson you build a Bell state in the lab and in Python, and you test whether a state is entangled.

By the end of this lesson

Note

I can build and explain a Bell state.

Key words

WordWhat it meansExample
Tensor productthe way two separate states combine into one
CNOTa gate that flips the second qubit if the first is 1
Bell statethe two-qubit state with only 00 and 110.707|00> + 0.707|11>
Entangledtied together so the state cannot be split in two
Product statea state that is two separate qubit states
Controlthe qubit that decides whether a gate acts

The cells students fill in are left blank in this preview.

Two separate qubits make four amplitudes

When two qubits are separate, their joint state is the tensor product of the two states. Multiply every amplitude of the first by every amplitude of the second.

For [a0, a1] and [b0, b1] the result is [a0 x b0, a0 x b1, a1 x b0, a1 x b1]. These are the amplitudes of 00, 01, 10 and 11, in that order.

Worked example: combining two qubits

First qubitSecond qubitJoint stateReads as
[1, 0][1, 0][1, 0, 0, 0]|00>
[0, 1][1, 0][0, 0, 1, 0]|10>
[0.707, 0.707][1, 0][0.707, 0, 0.707, 0]0.707|00> + 0.707|10>
[0.6, 0.8][1, 0][0.6, 0, 0.8, 0]0.6|00> + 0.8|10>

The cells students fill in are left blank in this preview.

The tensor product in Python

Code: python
def tensor(a, b):
    result = []
    for x in a:
        for y in b:
            result.append(x * y)
    return result

# Press Run. Then try tensor([1, 0], [0.6, 0.8]) and see which outcomes can appear.
print(tensor([0.6, 0.8], [1, 0]))

CNOT flips one qubit if another is 1

The CNOT gate acts on two qubits. The first is the control. The second is flipped only when the control is 1.

It swaps the amplitudes of 10 and 11 and leaves the other two alone. On a state of certain answers, it works like an if statement.

Worked example: CNOT on each outcome

BeforeControl (first qubit)After
000, so nothing happens00
010, so nothing happens01
101, so the second flips11
111, so the second flips10

The cells students fill in are left blank in this preview.

X on qubit 0, then CNOT

Command
docker exec jupyter python3 -c "from qsim import *; show(CNOT @ apply(X, zero(2), 0))"

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

H then CNOT builds a Bell state

Start from 00. Apply H to the first qubit, which gives 0.707|00> + 0.707|10>. Then apply CNOT.

The 10 term becomes 11, so the state is 0.707|00> + 0.707|11>. That is a Bell state. Only 00 and 11 can appear, each with a chance of 0.5, and 01 and 10 never do.

Run the Bell script

Command
docker exec jupyter python3 steps/bell.py

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

Ten shots of the Bell state, seed 3

Command
docker exec jupyter python3 -c "from qsim import *; print(measure(CNOT @ apply(H, zero(2), 0), 10, 3))"

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

A common mistake

Warning

Many people think entanglement sends a message from one qubit to the other. It does not. Each qubit alone still gives 0 or 1 with a chance of 0.5. Only when two people compare their lists of results do they see that the lists always agree, and comparing needs an ordinary message.

How to tell if a state is entangled

A state of two qubits is a product state if it is the tensor product of two separate states. In that case the first and last amplitudes, multiplied together, equal the middle two multiplied together.

If those two products differ, the state is entangled: no two separate states can make it.

Worked example: two states tested

StateFirst x lastMiddle x middleVerdict
[0.5, 0.5, 0.5, 0.5]0.250.25Product state
[0.707, 0, 0, 0.707]0.50Entangled
[1, 0, 0, 0]00Product state

The cells students fill in are left blank in this preview.

About this lab and its source: Quantum simulator lab: qubits, gates and measurement in JupyterLab

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.