Circuit Bench 01: The Bell State¶
What this circuit does¶
Two qubits whose measurement results are correlated because they share one quantum state.
The circuit is tiny:
After those two gates, the qubits are in the Bell state
If you measure both qubits in the usual computational basis, you should see only 00 and 11, about half the time each. That is the first visible signature.
It is not the whole story. A classical shared random bit can also produce matching 00/11 outcomes. The quantum content of the Bell state is the coherence between the two branches, and you see that by changing basis before measurement. This circuit note shows both pieces carefully.
Circuit components¶
- 2 qubits
- 1 Hadamard gate (
h) - 1 CNOT gate (
cx) - Measurement
- Optional: 2 more Hadamard gates for the X-basis check
- A Quokka puck or app
If terms like gate, basis, and measurement are new, start with Circuit Bench 00: Reading a Quantum Circuit. Otherwise, this note is self-contained.
Files on the bench¶
Open the source directory on GitHub.
| File | Purpose |
|---|---|
bell.qasm |
Prepare \(\lvert\Phi^+\rangle\) and measure it in the Z basis |
expected.txt |
Ideal probabilities and approximate 1024-shot counts |
circuit.png |
Circuit diagram |
Step 1: Declare qubits and classical bits¶
The two qubits start in \(|00\rangle\).
Step 2: Put the first qubit in superposition¶
The Hadamard turns the first qubit into an equal superposition:
The two-qubit state is now
The first qubit is in superposition; the second is still just \(|0\rangle\).
Step 3: Entangle with CNOT¶
CNOT flips the target qubit when the control qubit is 1:
Because the control qubit is in superposition, both branches are transformed coherently:
This is \(|\Phi^+\rangle\).
Step 4: Measure in the Z basis¶
You should see:
This confirms correlation in the computational basis.
It does not, by itself, prove non-classicality. A classical source that flips one fair coin and copies the result would also produce only 00 and 11. To see the difference, we need to ask a second question.
Optional check: measure in the X basis¶
To measure in the X basis, apply a Hadamard to each qubit immediately before measurement:
For \(|\Phi^+\rangle\), the outcomes are again correlated: 00 and 11.
That is not what a classical 50/50 mixture of 00 and 11 would do. If you took the classical mixture and measured in the X basis, you would get all four outcomes roughly equally. The extra X-basis correlation is evidence that the Bell state is a coherent superposition, not just a hidden coin flip.
This is still not a full Bell test. A Bell test uses several measurement settings and checks a Bell inequality. But the X-basis check is the right next step after the simple 00/11 check.
The complete Z-basis circuit¶
The file bell.qasm contains the simple Z-basis version:
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0], q[1];
measure q[0] -> c[0];
measure q[1] -> c[1];

Run it¶
Run bell.qasm on Quokka. You should see counts concentrated on 00 and 11:
Real shot counts vary, but 01 and 10 should be absent or very rare in a noiseless simulator.
Then try the X-basis version by inserting two Hadamards before measurement. You should again see matching outcomes. That second basis is what tells you there is more here than a copied classical bit.
Extend and experiment¶
- Check coherence in the X basis. Copy
bell.qasmand inserth q[0]; h q[1];immediately before measurement. The outcomes should still match: only00and11ideally. A classical 50/50 mixture of00and11would instead produce all four outcomes in this test. - Remove the entangler. Delete the CNOT and run the original Z-basis measurement. One qubit remains fixed at 0 while the other varies, so the matching Bell correlation disappears.
- Make the relative phase visible. Add
z q[0];after the CNOT. Z-basis counts remain00/11, because that basis cannot see the sign change. Then add the two X-basis Hadamards: the outcomes become anti-correlated (01/10ideally), distinguishing \(|\Phi^-\rangle\) from \(|\Phi^+\rangle\).
Analysis¶
Gate matrices and state evolution¶
The Hadamard gate is
So
The CNOT gate flips the target qubit when the control qubit is 1:
Therefore:
Bell state versus classical mixture¶
The Bell state is
A classical mixture with the same Z-basis statistics is:
These look the same if you only measure in the Z basis.
They differ in the X basis. Applying \(H\) to both qubits maps:
so the outcomes are still correlated.
But the classical mixture becomes a mixture of \(|++\rangle\) and \(|--\rangle\) when written in the X basis, which gives no guaranteed matching bit after Z-basis measurement. Operationally, after the basis-change Hadamards it produces all four bit strings with equal probability.
That is why the second measurement basis matters.
The four Bell states¶
The four Bell states are:
In the Z basis, \(|\Phi^+\rangle\) and \(|\Phi^-\rangle\) both produce matching outcomes. The relative phase is invisible.
In the X basis, that phase becomes visible:
| State | Z-basis pattern | X-basis pattern |
|---|---|---|
| \(\lvert\Phi^+\rangle\) | same | same |
| \(\lvert\Phi^-\rangle\) | same | different |
| \(\lvert\Psi^+\rangle\) | different | same |
| \(\lvert\Psi^-\rangle\) | different | different |
This is why measuring only one basis is not enough to distinguish all four Bell states.
Bell tests¶
A full Bell test is stronger than the checks in this circuit note. It measures entangled qubits in several carefully chosen bases and evaluates an inequality, such as the CHSH inequality.
Classical local-hidden-variable theories obey a bound. Quantum mechanics predicts that Bell states can violate it. That violation is the sharp sense in which Bell-state correlations cannot be explained classically.
This note stops earlier: it prepares a Bell state, shows the obvious Z-basis correlation, and then uses an X-basis check to reveal coherence.
Practical notes¶
- Do not over-read the first histogram. Seeing only
00and11is the start of the story, not the proof of entanglement. - Basis matters. Relative phase is invisible in the computational basis but visible after a basis change.
- This is the first reusable primitive. Bell states are used in teleportation, entanglement swapping, superdense coding, and tests of non-classical correlation.
- Next natural circuit: Teleportation, which uses a Bell pair as a resource.