Build a two-qubit correlation you can inspect
A Bell state is a useful next step after a single-qubit measurement experiment. For the state ( |00> + |11> ) / sqrt(2), computational-basis measurements yield 00 or 11 with equal ideal probability. Each qubit individually looks random, while the pair has a strong correlation.
The goal here is to connect an N/M program to that distribution and then change the program to test your explanation. The experiment runs in a local noiseless simulator; it does not measure a physical quantum processor.
Run the circuit
Paste the following code into the Playground:
module blog_bell;
@seed(23);
fn main() {
let q = qreg[2];
sample 512 {
H(q[0]);
CNOT(q[0], q[1]);
let c0 = measure(q[0]);
let c1 = measure(q[1]);
}
return q;
}Both qubits start at 0. H(q[0]) creates equal amplitudes for the first qubit. CNOT flips the second qubit when the first is 1. The combined state is therefore supported on 00 and 11. The pre-measurement probability display should assign 0.5 to each of those states, with zero probability for 01 and 10 in this ideal model. A single measurement collapses the state; inspect the histogram and pre-measurement distribution separately from that final collapsed state.
The sampled histogram need not split exactly 256/256. Sampling 512 shots produces an estimate of the distribution, not a new exact definition of it. When comparing runs, preserve the program, seed, shot count, simulator settings and version. If a diagram labels bits in a different order, read its ordering convention rather than assuming the leftmost digit always represents the same register index.
Three changes that reveal what the gates do
- Remove the CNOT line. The second qubit remains 0, and the two-qubit distribution no longer has the Bell correlation.
- Restore CNOT and remove the first H. A CNOT with a control initially at 0 leaves the register at 00.
- Restore the original program and add
X(q[1]);after CNOT. The supported outcomes change to 01 and 10, producing anticorrelation in the computational basis.
Write down your expected outcomes before running each change. A prediction that disagrees with the simulator gives you a specific gate or basis convention to investigate.
What the histogram cannot prove
A classical mixture containing equal numbers of 00 and 11 also has this computational-basis histogram. A histogram in one basis alone is therefore insufficient to establish entanglement. The simulator prepares a Bell state because of the state evolution prescribed by the gates; experimental verification requires additional measurements and a suitable analysis.
Entanglement also does not provide faster-than-light communication. An observer who sees only one of these qubits cannot control its random local outcome to send a message. Correlations become useful when measurement records and the experimental setup are compared.
For a more demanding exercise, investigate measurements in another basis and explain why the same classical mixture and the coherent Bell state need not behave identically. Keep that question separate from a complete Bell-inequality experiment, which requires chosen measurement settings and an appropriate statistical treatment.
Next steps and sources
- Bit, qubit and measurement: revisit the distinction between probability and sampling.
- N/M documentation: language syntax and simulation workflow.
- IBM: Quantum circuits: circuit composition and entangling gates.
- IBM Quantum tutorials: further practical experiments, including a CHSH-inequality tutorial.
The expected probabilities in this article concern the stated ideal circuit. Device noise, imperfect preparation and finite-shot uncertainty would need separate treatment in a hardware experiment.