Learn/Bell State
Beginner5 min read

Bell State: Quantum Entanglement

Create two qubits that are perfectly correlated - the foundation of quantum computing and "spooky action at a distance."

What You'll Learn

  • • How to create quantum superposition with the Hadamard gate
  • • How to entangle qubits using CNOT
  • • Why entangled qubits always give correlated results

The Code

bell.ql
# Bell State - Quantum Entanglement
QUBIT q1, q2
c1 = 0
c2 = 0
 
# Create superposition
H(q1)
 
# Entangle qubits
CNOT(q1, q2)
 
# Measure
MEASURE q1 -> c1
MEASURE q2 -> c2

Step-by-Step Explanation

1. Declare Qubits

QUBIT q1, q2 creates two quantum bits. Unlike classical bits (always 0 or 1), qubits can exist in superposition.

2. Hadamard Gate

H(q1) puts q1 into superposition - it's now both |0⟩ and |1⟩ simultaneously with 50% probability each.

3. CNOT Gate (Entanglement)

CNOT(q1, q2) entangles the qubits. If q1 is |1⟩, q2 flips. Now their fates are linked!

4. Measurement

When measured, you only get 00 or11 - never 01 or 10. Measuring one qubit instantly determines the other!

Key Insight

Einstein called entanglement "spooky action at a distance" because measuring one qubit instantly affects the other - even if they're light-years apart. This is the foundation of quantum cryptography and the quantum internet.

Try It Yourself

python qubitlang_cli.py run bell.ql --shots 10000Request Files