Quantum Circuits
A comprehensive lesson on how quantum gates are organized into circuits, how circuits transform quantum states, how to read and construct circuit diagrams, and how circuits form the operational foundation of quantum algorithms.
Lesson 10: Quantum Circuits
Learning Objectives
By the end of this lesson, you will be able to:
- Explain what a quantum circuit is and how it differs from a classical logic circuit
- Read a quantum circuit diagram, including qubit wires, gates, and measurement symbols
- Understand the role of wires and qubit lines in representing time evolution
- Understand gate placement, ordering, and why order matters
- Apply a sequence of gates to a quantum state and compute the result
- Distinguish circuit depth from circuit width
- Construct simple single-qubit circuits
- Construct simple multi-qubit circuits, including controlled operations
- Understand how CNOT and other controlled gates are represented and used
- Understand how measurement is incorporated into a circuit
- Understand the role of initialization in a circuit
- Calculate the output state (and measurement probabilities) of simple circuits by hand
- Understand the connection between quantum circuits and quantum algorithms
1. What Is a Quantum Circuit?
A quantum circuit is a structured sequence of quantum operations — gates — applied to a fixed number of qubits, typically ending in measurement. It is the standard way of specifying "what a quantum computer should do" in an operational, step-by-step form, much as a flowchart specifies an algorithm.
Formally, a quantum circuit describes three stages:
- Initialization — preparing the qubits in a known starting state, almost always the computational basis state for each qubit.
- Quantum operations — applying a sequence of unitary gates (single-qubit and multi-qubit) that evolve the state.
- Measurement — converting the final quantum state into classical information (bits) by sampling according to the Born rule probabilities.
A useful (but imperfect) analogy is a classical logic circuit, where wires carry bit values and gates like AND/OR/NOT transform them. Quantum circuits share the diagrammatic style — wires and boxes — but the underlying computation is fundamentally different:
- Classical wires carry definite bits (0 or 1); quantum wires represent a qubit's evolving state, which may be a superposition.
- Classical gates are generally not reversible (e.g., AND loses information); quantum gates (before measurement) are unitary and therefore always reversible.
- Classical circuits produce deterministic outputs; quantum circuits generally produce probabilistic outputs upon measurement.
- Classical bits can be freely copied (fanned out); qubits in an unknown state cannot be perfectly copied (no-cloning theorem, see Section 24).