🖥️ Before we begin — what is a quantum circuit?
A classical computer program is a sequence of instructions — add these two numbers, store the result, compare it to zero. A quantum circuit is the quantum equivalent: a sequence of gates applied to qubits, left to right, one column at a time.

Under the hood, each gate is a matrix, and applying it to the qubit state is matrix multiplication. The full circuit is the product of all gate matrices: C = G₁ × G₂ × ... × Gₙ. The output state = C × (input state).

This means a quantum circuit is pure linear algebra. No loops, no conditionals, no randomness — until the final measurement. Everything in between is deterministic matrix maths operating on a vector of complex amplitudes called the statevector.
🌀 The statevector grows exponentially
A 3-qubit system has 2³ = 8 possible states. The statevector has 8 complex numbers. A 10-qubit system has 2¹⁰ = 1024 numbers. A 50-qubit system has 2⁵⁰ ≈ 10¹⁵ numbers — more than any classical computer can store. This exponential growth is both the power and the challenge of quantum computing.
🖥️ Quantum Circuits · Session 3 · Q9

Circuit Simulator

Build real quantum circuits, watch the statevector update gate by gate, construct Bell states and GHZ states, then design your own circuits in the free-build challenge.

🖥️ Circuit Basics
📊 Statevector
🔔 Build Bell State
👻 GHZ State
🏆 Free Build
🖥️

Quantum Circuit

Gates applied left to right to qubits. Each column is one time step. The circuit = product of all gate matrices.

📊

Statevector

A vector of 2ⁿ complex amplitudes — one per basis state. The complete description of the quantum system at any moment.

🔔

Bell State

(|00⟩+|11⟩)/√2 — two entangled qubits. Created by H on qubit 0, then CNOT(0→1). The simplest entangled state.

👻

GHZ State

(|000⟩+|111⟩)/√2 — three entangled qubits. H on q0, CNOT(0→1), CNOT(0→2). Used in quantum error correction.

🖥️
Wizzy · Quantum Guide
Welcome to your first real quantum circuit! Select a gate from the palette, then click any slot on the circuit to place it. Gates are applied left to right. The Run Circuit button computes the statevector after all gates. Start simple — try placing an X gate on qubit 0.
🌀 Why circuits are the right model
The circuit model captures exactly what quantum computers do — apply unitary operations to qubits, then measure. It is universal: any quantum algorithm can be expressed as a circuit. IBM, Google, and IonQ all run quantum circuits on real hardware.

Step 1 — Build Your First Circuit

Select:
X
H
Z
S
T
Y
Statevector (before running)
Select a gate then click a slot. Press Run to compute the output statevector.
🖥️
Wizzy · Quantum Guide
The statevector is the full quantum state of all qubits at once — a list of 2ⁿ amplitudes, one per basis state. For 3 qubits: 8 amplitudes for |000⟩ through |111⟩. Each gate updates every amplitude simultaneously. Watch the statevector change as you build your circuit gate by gate.
🌀 The statevector cannot be read directly
You cannot look at the statevector during the computation — measuring any qubit collapses it. The simulator shows you what a classical computer would need to track to simulate quantum computation. For 50 qubits, this is 2⁵⁰ amplitudes — impossible to store classically. That's the quantum advantage.

Step 2 — Watch the Statevector Update

Select:
X
H
Z
S
T
Statevector — updates when you run
Apply H to all three qubits and run — you'll see all 8 states become equally likely. Each has amplitude 1/√8 ≈ 0.354 and probability 12.5%.
🖥️
Wizzy · Quantum Guide
Build the Bell state step by step! Place an H gate on qubit 0 in column 1, then a CNOT with control=qubit 0 and target=qubit 1 in column 2. Run the circuit — the statevector should show only |00⟩ and |11⟩ each at 50%. That's entanglement!
🌀 The moment entanglement appears in the circuit
Before CNOT: qubit 0 is in superposition, qubit 1 is |0⟩ — they are independent. After CNOT: the statevector cannot be written as a product of individual qubit states. They are entangled. The CNOT gate is exactly the boundary where entanglement is created.

Step 3 — Build the Bell State (|00⟩+|11⟩)/√2

1
Place H gate on qubit 0 (q0), column 1
2
Place CNOT with control=q0, target=q1 in column 2. (Use CX button below)
3
Press Run — statevector should show |00⟩=50% and |11⟩=50%
4
Congratulations — you just created quantum entanglement in a circuit!
Select:
X
H
Z
CX
CX = CNOT. After selecting CX, first click = control qubit, second click = target qubit
Target: |00⟩ = 50%, |11⟩ = 50%, all others = 0%
Build the Bell state: H on q0, then CNOT(q0→q1). Run to see the entangled statevector!
🖥️
Wizzy · Quantum Guide
The GHZ state extends Bell to 3 qubits: (|000⟩+|111⟩)/√2. It's called "Schrödinger's Cat on steroids" — three particles simultaneously in both all-zero and all-one states. Recipe: H on q0, CNOT(q0→q1), CNOT(q0→q2). The statevector will show only |000⟩ and |111⟩.
🌀 GHZ states are used in quantum error correction
By entangling many qubits into a GHZ-like state, you can spread quantum information across multiple physical qubits. An error on one qubit can be detected and corrected without ever measuring (and collapsing) the logical qubit. This is how quantum computers will eventually become fault-tolerant.

Step 4 — Build the GHZ State (|000⟩+|111⟩)/√2

Select:
X
H
Z
CX
CX: first click = control, second click = target
Target: |000⟩ = 50%, |111⟩ = 50%, all others = 0%
Recipe: H on q0 (col 1), CNOT(q0→q1) (col 2), CNOT(q0→q2) (col 3). Run!
🖥️
Wizzy · Quantum Guide
🎊 Session 3 complete! Now it's free build time — design any circuit you like. Experiment, break things, discover new states. The statevector shows you exactly what's happening. You're now thinking and building like a real quantum programmer!

Free Build — Design Any Circuit

Select:
X
H
Z
Y
S
T
CX
Statevector
Build anything! Try chaining H + X + H on one qubit (= Z). Explore!
🧠 What you actually learned in Session 3
  • Quantum gates are reversible rotations (unitary matrices). Classical gates like AND are irreversible — there is no quantum AND.
  • The Hadamard gate H creates superposition. The CNOT gate creates entanglement. Together they can produce any quantum state.
  • Probability amplitudes can be negative — this enables destructive interference that cancels wrong answers in quantum algorithms.
  • The statevector tracks all 2ⁿ amplitudes simultaneously — this is why quantum computers are hard to simulate classically.
  • Bell state (2 qubits) and GHZ state (3 qubits) are maximally entangled states, foundational to quantum communication and error correction.
🖥️

Circuit Builder Badge!

Session 3 Complete! You can now build real quantum circuits!

🖥️ WhizzStep Quantum Lab · Session 3
This certifies that
Student Name
has completed Quantum Gates Session — Gates, Interference & Circuit Simulation
Circuit Builder
Bell State
GHZ State
Session 3 ✓
📖 Quantum Vocabulary
Statevector KEY

A vector of 2ⁿ complex amplitudes describing the full quantum state of n qubits. Probability of each basis state = amplitude².

Like a superposition scoreboard — one entry for every possible outcome.
Bell state KEY

(|00⟩+|11⟩)/√2 — two maximally entangled qubits. Created by H on q0 then CNOT(q0→q1). Foundation of quantum teleportation and QKD.

GHZ state NEW

(|000⟩+|111⟩)/√2 — three maximally entangled qubits named after Greenberger, Horne, and Zeilinger. Used in quantum error correction.

Circuit depth NEW

The number of sequential gate layers in a circuit. Shorter depth = faster = less decoherence. Minimising depth is a key goal in quantum compiling.

Basis states

For n qubits: all possible bit strings from |00...0⟩ to |11...1⟩. There are 2ⁿ of them. The statevector has one amplitude for each.

Measurement

Reading out the circuit result. Randomly selects one basis state with probability = amplitude². Collapses the statevector. Only done once at the end.

Key Concepts from Q9

Statevector

📊 2ⁿ Amplitudes

Every n-qubit system is fully described by 2ⁿ complex amplitudes. A 50-qubit system needs 2⁵⁰ amplitudes to simulate classically — that's why quantum computers are hard to fake.

Entanglement

⛓️ Created by CNOT

CNOT applied after H creates entanglement — the statevector can no longer be factored into individual qubit states. This is the key gate that unlocks quantum computing's power.

GHZ State

👻 3-Qubit Entanglement

H + CNOT + CNOT creates (|000⟩+|111⟩)/√2. Measuring any one qubit instantly determines the other two. Used in quantum teleportation and error correction.

Session 3

🎓 Gates Complete

You can now build, analyse, and understand quantum circuits. Sessions 4-8 cover algorithms (Grover, Shor), hardware, cryptography, and applications.