|q⟩ Bad Qubits

beginner · Programming · Mini-Projects: Coin Flips, RNG & Bell Tests

Project: Two-Qubit Correlations

A single quantum coin flip yields a random 0 or 1, but with two entangled qubits something more striking becomes visible: the two outcomes are not merely random — they are perfectly correlated. Measuring one qubit instantly determines the other, even though, on its own, each qubit looks completely random.

Building the Bell pair

The entangled state at the center of this project is the Bell state

Φ+=12(00+11).|\Phi^+\rangle = \frac{1}{\sqrt{2}}\big(|00\rangle + |11\rangle\big).

It is created by two gates acting on 00|00\rangle. First a Hadamard gate puts qubit 0 into an equal superposition:

H00=12(0+1)0=12(00+10).H|0\rangle \otimes |0\rangle = \frac{1}{\sqrt{2}}\big(|0\rangle + |1\rangle\big) \otimes |0\rangle = \frac{1}{\sqrt{2}}\big(|00\rangle + |10\rangle\big).

Then a CNOT gate flips qubit 1 whenever qubit 0 is 1|1\rangle, entangling the two:

CNOT0112(00+10)=12(00+11).\text{CNOT}_{0\to1}\,\frac{1}{\sqrt{2}}\big(|00\rangle + |10\rangle\big) = \frac{1}{\sqrt{2}}\big(|00\rangle + |11\rangle\big).

The result cannot be written as a product of two independent single-qubit states — it is genuinely entangled.

Reading the correlations

Applying the Born rule to Φ+|\Phi^+\rangle gives the measurement probabilities for all four computational-basis outcomes:

P(00)=122=12,P(01)=0,P(10)=0,P(11)=122=12.P(00) = \left|\tfrac{1}{\sqrt{2}}\right|^2 = \tfrac{1}{2}, \quad P(01) = 0, \quad P(10) = 0, \quad P(11) = \left|\tfrac{1}{\sqrt{2}}\right|^2 = \tfrac{1}{2}.

Only the two "matching" outcomes carry any weight. Every run produces either both 0s or both 1s — never a mismatch. If you know qubit 0 came out 1, qubit 1 must also be 1. The correlation is total and guaranteed by the structure of the entangled state, not by any classical pre-arrangement between the qubits.

Try it

Prepare the Bell state Φ+|\Phi^+\rangle and measure both qubits. The grader checks the full probability distribution: it must place probability 12\tfrac{1}{2} on "00", probability 12\tfrac{1}{2} on "11", and zero on "01" and "10".

Run your code to see the quantum state.

After running, open the Probabilities panel. You should see two bars of equal height at "00" and "11", with the "01" and "10" bars completely absent. That pattern — all weight on matching outcomes, none on mismatching ones — is the measurable fingerprint of entanglement in the Bell state.

Sign in on the full site to ask questions and join the discussion.