tutorialcircuitsbeginnerentanglement

How to Build a Bell State Circuit: Step-by-Step with Simulation

quantumcomputer.dev
quantumcomputer.dev
May 17, 2026 · 484 views

The Bell state is often called the "Hello World" of quantum computing. Unlike Hello World, it actually teaches you something fundamental: quantum entanglement, the phenomenon that makes quantum computers qualitatively different from classical ones.

This tutorial builds the Bell state from first principles, explains the mathematics at each step, shows you the circuit, and demonstrates verification.

What We Are Building

The Bell state |Φ⁺⟩ is a two-qubit entangled state:

|Φ⁺⟩ = (|00⟩ + |11⟩) / √2

When you measure both qubits of this state, you always get either both 0 or both 1 — never one 0 and one 1. The probability of each outcome is exactly 50%. Before measurement, neither qubit has a definite value.

The Circuit

q₀: ──H──●──M──
         │
q₁: ─────⊕──M──

Two gates, two qubits, two measurements. This is the complete Bell state preparation circuit.

Step 1: Initialize

Both qubits start in state |0⟩:

|ψ₀⟩ = |00⟩ = |0⟩ ⊗ |0⟩

In vector form:

|00⟩ = [1, 0, 0, 0]ᵀ

Step 2: Apply Hadamard to q₀

The Hadamard gate puts q₀ into superposition:

H = (1/√2) * [[1,  1],
               [1, -1]]

Applied to |0⟩:

H|0⟩ = (1/√2)(|0⟩ + |1⟩)

The full two-qubit state after H on q₀:

|ψ₁⟩ = (1/√2)(|0⟩ + |1⟩) ⊗ |0⟩
      = (1/√2)(|00⟩ + |10⟩)
      = [1/√2, 0, 1/√2, 0]ᵀ

Both |00⟩ and |10⟩ have equal amplitude. The qubits are not yet entangled — this is just q₀ in superposition.

Step 3: Apply CNOT

The CNOT (Controlled-NOT) gate flips the target qubit (q₁) if and only if the control qubit (q₀) is |1⟩.

CNOT matrix:
[[1, 0, 0, 0],
 [0, 1, 0, 0],
 [0, 0, 0, 1],
 [0, 0, 1, 0]]

Applied to our state (1/√2)(|00⟩ + |10⟩):

  • |00⟩: control is 0, target stays 0 → |00⟩

  • |10⟩: control is 1, target flips from 0 to 1 → |11⟩

|ψ₂⟩ = (1/√2)(|00⟩ + |11⟩)

This is the Bell state. The two qubits are now entangled.

Step 4: Measure

When you measure both qubits, you get |00⟩ or |11⟩ each with probability (1/√2)² = 1/2. You never get |01⟩ or |10⟩.

Over 1,000 shots, you expect approximately 500 counts of "00" and 500 counts of "11".

Building It in Qiskit

from qiskit import QuantumCircuit, transpile
from qiskit.primitives import StatevectorSampler
from qiskit.visualization import plot_histogram

# Build the circuit
qc = QuantumCircuit(2, 2)
qc.h(0)           # Hadamard on qubit 0
qc.cx(0, 1)       # CNOT: control=0, target=1
qc.measure([0, 1], [0, 1])

print(qc.draw())

# Simulate
sampler = StatevectorSampler()
job = sampler.run([qc], shots=1024)
result = job.result()
counts = result[0].data.meas.get_counts()
print(counts)
# Expected: {'00': ~512, '11': ~512}

Building It in the Browser

Open the quantumcomputer.dev playground and click "Load Template → Bell State". The circuit is pre-built. Click "Run Simulation" to see the probability bars showing equal amplitude on |00⟩ and |11⟩.

Click "Open in IBM Quantum" to copy the OpenQASM to your clipboard and submit it to real hardware.

The OpenQASM

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];

Verifying Entanglement

On a real quantum computer, results will not be exactly 50/50 due to noise. You might see:

{'00': 489, '11': 503, '01': 18, '10': 14}

The small number of |01⟩ and |10⟩ results are noise — readout errors and gate errors. On IBM's best backends (Eagle, Heron), the fidelity of a Bell state typically exceeds 99%.

To verify genuine entanglement (not just classical correlation), you would run a Bell inequality test — measuring in different bases and checking that the correlations exceed the classical bound of 2 (CHSH inequality). Genuine entanglement produces values up to 2√2 ≈ 2.83.

The Four Bell States

The Bell state we built is one of four maximally entangled two-qubit states:

|Φ⁺⟩ = (|00⟩ + |11⟩) / √2   (H then CNOT)
|Φ⁻⟩ = (|00⟩ - |11⟩) / √2   (H, Z, then CNOT)
|Ψ⁺⟩ = (|01⟩ + |10⟩) / √2   (H, then CNOT, then X on target)
|Ψ⁻⟩ = (|01⟩ - |10⟩) / √2   (H, Z, then CNOT, then X on target)

These four states form a basis for the two-qubit Hilbert space and are used throughout quantum communication (quantum teleportation, superdense coding) and quantum error correction.

What to Build Next

Once you have the Bell state, the natural progression is:

  1. GHZ state: Three-qubit generalization of the Bell state — (|000⟩ + |111⟩)/√2

  2. Quantum teleportation: Uses a Bell pair to transmit a qubit state using two classical bits

  3. Superdense coding: The inverse — uses a Bell pair to transmit two classical bits per qubit

All three are available as templates in the playground.

quantumcomputer.dev
quantumcomputer.dev
The editorial team at quantumcomputer.dev