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
| Word | What it means | Example |
|---|---|---|
| Tensor product | the way two separate states combine into one | |
| CNOT | a gate that flips the second qubit if the first is 1 | |
| Bell state | the two-qubit state with only 00 and 11 | 0.707|00> + 0.707|11> |
| Entangled | tied together so the state cannot be split in two | |
| Product state | a state that is two separate qubit states | |
| Control | the 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 qubit | Second qubit | Joint state | Reads 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
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
| Before | Control (first qubit) | After |
|---|---|---|
| 00 | 0, so nothing happens | 00 |
| 01 | 0, so nothing happens | 01 |
| 10 | 1, so the second flips | 11 |
| 11 | 1, so the second flips | 10 |
The cells students fill in are left blank in this preview.
X on qubit 0, then CNOT
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
docker exec jupyter python3 steps/bell.pyShown 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
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
| State | First x last | Middle x middle | Verdict |
|---|---|---|---|
| [0.5, 0.5, 0.5, 0.5] | 0.25 | 0.25 | Product state |
| [0.707, 0, 0, 0.707] | 0.5 | 0 | Entangled |
| [1, 0, 0, 0] | 0 | 0 | Product state |
The cells students fill in are left blank in this preview.