L18§4 · Build Something Real🔧 Section 4 Begins
~16 min
What Is a Quantum Circuit?
In Section 3 you learned what quantum computers can do. Now you learn how to tell one what to do. The quantum circuit is the language — a diagram so universal that every algorithm ever invented is written in it. Once you can read one, you can read them all.
✦ One IdeaA quantum circuit is a diagram where horizontal wires carry qubits through time, labelled boxes are gates that transform them, and reading left to right is reading forward in time. It is both a description of an algorithm and an instruction set for a real machine.
Think before reading — this connects to something you already understand.
In a quantum circuit, what does a horizontal wire represent?
You now understand three things precisely: superposition, entanglement, and interference. You know they combine to produce quantum advantage. You know the five-step recipe — initialise, superpose, entangle, interfere, measure.
But how do you actually write down a quantum computation? How do you tell a quantum computer — a physical machine sitting in a dilution refrigerator at 15 millikelvin — exactly what operations to perform and in what order?
The answer is the quantum circuit. It is a diagram — deceptively simple, extraordinarily powerful — that specifies a complete quantum computation from start to finish. Every quantum algorithm ever invented, from Grover's search to Shor's factoring to quantum error correction, is written as a quantum circuit.
📐
Why this is the most important lesson in Section 4
The circuit diagram is the universal language of quantum computing. IBM Quantum, Google Cirq, Microsoft Azure Quantum, Amazon Braket, Qiskit, PennyLane, Cirq — every platform uses it. Every research paper uses it. Every textbook uses it. Once you can read a circuit, you can follow any quantum algorithm ever published. This is the key that opens every door in quantum computing.
Section 02
② Intuition
The Sheet Music Analogy
Before any quantum notation, consider this everyday parallel — one that is not just a loose metaphor but structurally exact.
🎵 Sheet Music for Qubits
A piece of sheet music tells musicians exactly what to play and when. It has four key features:
Lines (staves) = instruments. Each horizontal line carries one instrument's part through the piece.
Symbols on the lines = instructions. Notes, rests, dynamics — each symbol tells the musician what to do at that moment in time.
Left to right = time. You read sheet music the same way you read a sentence. What is on the left happens first.
Vertical alignment = simultaneous events. Notes stacked above each other sound at the same time.
A quantum circuit is sheet music for qubits. Horizontal lines carry qubits. Symbols (boxes) are gates. Left to right is time. Vertically aligned gates happen simultaneously.
This is not a loose analogy — it is structurally exact. The notation physicists invented for quantum circuits maps perfectly onto the structure of musical notation. Once you see it, you cannot unsee it.
💡
A second analogy — a flowchart for qubits
If sheet music feels abstract, think of it as a flowchart. Classical flowcharts have boxes (operations) connected by arrows (data flow). A quantum circuit is the same — except the "data" flowing along the arrows is a qubit in superposition, and the boxes are quantum gates that transform its complex amplitude. The circuit is the complete plan. Running it on a quantum computer is executing the plan on physical qubits.
Section 03
③ Framework
Anatomy of a Quantum Circuit
There are exactly four things to recognise in any quantum circuit. Master these four and no diagram will ever be unreadable.
➖
The Wire
A horizontal line — one qubit's journey through time
Each horizontal line represents a single qubit travelling left to right through the computation. A 3-qubit circuit has 3 stacked wires. At the far left, each wire begins in state $|0\rangle$ by convention. The qubit's state transforms as it passes through gates. Wires never merge or split.
▭
The Gate
A labelled box — a reversible operation on the qubit
A box drawn on a wire is a quantum gate — an operation that transforms the qubit's state. The letter inside identifies the gate: H for Hadamard, X for NOT/flip, Z for phase flip. Gates are always reversible (you can undo them by applying the same or a related gate). They are the verbs of the quantum circuit language.
⊕
The Multi-Qubit Gate
A connected symbol spanning two or more wires
Some gates act on two qubits simultaneously. The CNOT gate shows a filled dot (control qubit) connected by a vertical line to a ⊕ symbol (target qubit). If the control is $|1\rangle$, the target flips; if $|0\rangle$, nothing happens. Multi-qubit gates are how entanglement is created. The vertical connection is the visual signature of qubits interacting.
⊠
The Measurement
A meter symbol — collapses the qubit to a classical 0 or 1
A measurement symbol (a box with a dial, or written ⊠) marks the point where a qubit's superposition collapses. The output is a classical bit — 0 or 1. After measurement, the qubit no longer holds quantum information. Measurement is the only irreversible operation. In most circuits it appears at the very end of each wire, after all quantum processing is complete.
Initial and final states
By convention, every quantum circuit begins with all qubits in state $|0\rangle$, labelled at the left of each wire. The circuit specifies every gate that transforms those qubits. Measurement at the right extracts classical results. This gives circuits a natural reading direction: left is initialisation, right is output.
Key Insight
The power of quantum circuits as a notation is that they are simultaneously a description and an instruction set. When you draw a circuit on paper, you are describing an algorithm. When you submit it to IBM Quantum or Google Cirq, you are sending instructions. Same diagram, two uses — this is what makes the circuit notation so universal across every quantum computing platform in the world.
Section 04
④ Theory
The Five Rules
Every valid quantum circuit everywhere in the world follows these five rules without exception. Learn them and you can read any circuit ever written — from a student exercise to a Nature paper.
R1
Time flows left to right
The left side of the circuit is the beginning of the computation. Gates applied earlier appear further left. The rightmost operation (usually measurement) is the last. This matches the direction you read text in English — intentional, consistent, universal across all quantum computing platforms and all textbooks worldwide. Never right-to-left, never top-to-bottom.
R2
Each wire carries exactly one qubit
Wires do not merge, split, or share qubits. Each horizontal line tracks precisely one qubit through the entire computation. A circuit with $n$ qubits has exactly $n$ wires. Qubits influence each other through multi-qubit gates, but they remain distinct throughout. There is no classical "copying" of information between wires — which connects directly to the No-Cloning theorem from L16.
R3
All gates are reversible — except measurement
Every quantum gate must be reversible — there is always a gate that undoes it. This is a deep physical requirement: quantum mechanics is time-reversible (unitary evolution preserves information). The Hadamard is its own inverse. The X gate is its own inverse. The only irreversible step is measurement, which collapses the superposition and extracts a classical answer — destroying the quantum information in the process.
R4
Vertically aligned gates execute simultaneously
If two gates appear at the same horizontal position in the circuit, they execute at the same time step on their respective qubits. This represents the quantum computer operating on multiple qubits in parallel. Qubits that have no gate at a given time step pass through unchanged. Vertical alignment is the visual language of parallelism in quantum circuits.
R5
All qubits begin in $|0\rangle$ unless stated otherwise
By strong convention, every qubit starts in the ground state $|0\rangle$. This is the quantum analogue of initialising all variables to 0 before running a program. Some circuits explicitly note different starting states on the left of the wire, but the default is always $|0\rangle$. You will later meet the Reset gate, which returns a qubit to $|0\rangle$ mid-circuit if needed.
⚗️
Why reversibility is not just a rule but a physical law
Quantum evolution is governed by unitary matrices — transformations that preserve the total probability (the norm of the state vector). Unitarity is equivalent to reversibility: every unitary has an inverse. Measurement breaks unitarity because it is a thermodynamic process — information leaks from the quantum system into the measuring device and the environment. This is not a design choice. It is a fundamental constraint of quantum mechanics, which is why measurement is the only irreversible step in any quantum computation.
Section 05
⑤ Interactive
Build Your First Circuit
Click a gate from the palette, then click any slot on the circuit grid to place it. Build circuits up to 3 qubits × 5 time steps. Press Run to simulate what happens step by step. Load a pre-built example to see a real circuit in action.
⚙️ QubitDecoded Circuit Builder
Select gate → click grid slot to place · Run to simulate · Try an example
INTERACTIVE
Gate Palette — select a gate, then click a circuit slot to place it
H
X
Z
M
✕
H
Hadamard
X
Pauli-X
Z
Pauli-Z
M
Measure
●⊕
CNOT
H — Hadamard Gate
Puts a qubit into perfect superposition: $|0\rangle \rightarrow \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ and $|1\rangle \rightarrow \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$. Applying H twice returns the qubit to its original state ($H^2 = I$). It is the gate that opens every quantum algorithm's search space — the "coin flip" that creates all possibilities at once. You will study it in depth in L19.
Select a gate from the palette above and click any slot on the circuit grid to place it. Then press Run to simulate. Load an example to see a pre-built circuit.
Every circuit you can build here follows all five rules: time flows left to right, each row is one qubit, gates are reversible (except Measure), aligned gates act simultaneously, and all qubits start in $|0\rangle$. You have just written your first quantum programs.
Section 06
③ Framework
Reading a Circuit Like a Pro
Now that you know the rules, here is how experts actually approach an unfamiliar circuit. They do not just scan left to right — they ask five focused questions in sequence.
①
How many qubits? Count the wires.
The number of horizontal wires is the system size. One wire = one qubit. Three wires = three qubits = $2^3 = 8$ states simultaneously in superposition. This tells you the scale of the computation and how much classical memory would be needed to simulate it.
②
What are the initial states?
Look at the far left of each wire. By default it is $|0\rangle$. Some circuits start qubits in $|1\rangle$ or in superposition — these are labelled explicitly on the left. Noting initial states before reading any gates is essential for understanding what the circuit is doing.
③
What is the first column of gates?
Identify the leftmost column. In most algorithms, this is a column of Hadamard gates creating the initial superposition — expanding all $|0\rangle$s into all $2^n$ possibilities simultaneously. A column of H gates on every wire is the classic "open the search space" move at the start of Grover's, Deutsch-Jozsa, and the QFT.
④
Which gates span multiple wires?
Look for vertical connections between wires — filled dots connected by lines to ⊕ symbols. These are multi-qubit gates (CNOT, CZ, Toffoli) marking where entanglement is being created. Entanglement is the sign that qubits are working together as a system, not independently. Count the entangling gates to gauge the algorithm's quantum complexity.
⑤
Where does measurement happen?
Find the measurement symbols (meter dials or ⊠). They tell you which qubits yield classical results and when. Most circuits measure all qubits at the very end. Some use mid-circuit measurement (an advanced technique for quantum error correction or adaptive algorithms). The measurement step is where the quantum computation becomes a classical answer.
🔭
What the next four lessons build toward
In L19 you will meet the Hadamard gate in full detail — its exact mathematical effect and why it appears at the start of almost every quantum algorithm. In L20, the CNOT gate — the entanglement maker. In L21, you will use H + CNOT to build a Bell pair from scratch. In L22, you will run the circuit and collect statistics. Each lesson adds one more piece to the circuit you are now learning to read and write. By L22, you will have built and run a real quantum program.
Lesson Summary
What You Now Know About Quantum Circuits
📐
A quantum circuit is the universal language of quantum computing
Every quantum algorithm — Grover's, Shor's, error correction, quantum chemistry — is expressed as a circuit. It is simultaneously a description on paper and an instruction set for a real quantum machine. Every platform in the world uses this notation.
➖
Wires carry qubits, boxes are gates, time goes left to right
Each horizontal line is one qubit's journey through the computation. Each box drawn on a wire is an operation that transforms the qubit's state. Reading left to right is reading forward in time. That is the complete grammar — three things, infinitely composable.
📋
Five rules govern every valid circuit
Time L→R, one qubit per wire, reversible gates (except measurement), simultaneous = vertically aligned, all qubits start in $|0\rangle$. These rules are universal across all platforms, all papers, all textbooks. Master them and no circuit will ever be unreadable.
⊠
Measurement is the only irreversible step — and it always comes last
All quantum gates are reversible (unitary). Measurement is not — it collapses the superposition and extracts a classical bit. This is a physical law, not a design choice. Quantum mechanics is time-reversible; measurement involves thermodynamic information leakage into the environment. This is why measurement always ends the circuit.
🔗
Multi-qubit gates create entanglement — the vertical connection is the visual signature
When you see a vertical line connecting two wires in a circuit, a multi-qubit gate is creating correlations between qubits. The CNOT gate (filled dot → ⊕) is the most common. These connections are how the three superpowers from Section 3 are implemented in real circuits.
Quick Check
How clearly does the circuit diagram click for you?
You can read the language.
Now meet its most important word —
the gate that creates superposition,
that opens every quantum algorithm. The Hadamard.
→ The Hadamard Gate — L19
Sources & Further Reading
Nielsen, M. A. & Chuang, I. L. — Quantum Computation and Quantum Information, Cambridge, 2000. §4.1–4.3 "The quantum circuit model" — the canonical reference for circuit formalism, gate sets, and universality.
IBM Qiskit Textbook — "Basics of quantum information: Quantum circuits." learning.quantum.ibm.com — Interactive circuit examples with real hardware execution.
Preskill, J. — Ph219 Lecture Notes, Chapter 5. theory.caltech.edu/~preskill/ph219/ — Detailed treatment of reversibility, unitarity, and the circuit model from first principles.