Introduction to Quantum Circuits
Quantum computation uses quantum bits, or qubits, to encode and process information. Qubits may exist in superpositions of the |0⟩
and |1⟩
states, and several qubits can be entangled so that measurements on one affect the others. These properties allow quantum algorithms to explore many possibilities simultaneously.
Quantum circuits are the framework for designing quantum algorithms. They consist of sequences of quantum gates that manipulate qubits, creating complex states and enabling computations that are infeasible for classical computers. The final step in a quantum circuit is measurement, which collapses the quantum state into a classical result.
Quantum circuits can be visualised as diagrams where qubits are represented by horizontal lines and gates are applied at discrete time steps. This visual representation helps in understanding how quantum information flows through the circuit.
This documentation introduces the fundamental ideas behind quantum circuits. It explains the role of qubits, how basic gates transform them, and how measurements extract classical results. All of the examples can be recreated on the Quantum Simulator (opens in a new tab), which displays Bloch sphere visualisations as you implement gates onto qubits.
Qubits
A qubit is described by a two-dimensional complex vector. The basis states are written |0⟩
and |1⟩
. A general single‑qubit state can be written as
Here, and are complex coefficients that represent the probability amplitudes of measuring the qubit in the |0⟩
or |1⟩
state, respectively. The condition ensures that the total probability is normalized to 1, as required by quantum mechanics.
The state can also be expressed in matrix form as
This representation allows us to manipulate qubit states using linear algebra. The state vector can be visualised on the Bloch sphere, where the north pole corresponds to |0⟩
, the south pole to |1⟩
, and points on the surface represent superpositions of these states. The angles on the sphere relate to the coefficients and .
The Bloch sphere representation is a powerful tool for visualising single‑qubit states. Any pure state can be represented as a point on the surface of the sphere, with the angles and determining the position. The state vector can be expressed in terms of these angles as:
where is the polar angle (0 to ) and is the azimuthal angle (0 to ). This parameterisation captures all possible pure states of a single qubit.
When a qubit is measured, it collapses to one of the basis states |0⟩
or |1⟩
with probabilities given by the squared magnitudes of the coefficients: and . The measurement process is probabilistic, reflecting the inherent uncertainty in quantum mechanics.
The state of a qubit can also be represented as a point on the Bloch sphere, where the angles and correspond to the position on the sphere. The coefficients and can be expressed in terms of these angles as follows:
This parameterisation allows us to visualize the state of a qubit in terms of spherical coordinates, where is the polar angle and is the azimuthal angle. The Bloch sphere representation provides an intuitive way to understand how quantum gates manipulate qubit states.
Multiple qubits are represented by tensor products of individual qubit states. For two qubits the most general state is
with all amplitudes satisfying . Entangled states cannot be written as a product of single‑qubit states.
Gates
Quantum gates are unitary matrices that evolve qubit states. A single‑qubit gate is represented by a matrix that satisfies . When a gate acts on a qubit, the state is updated via . Common single‑qubit gates include the Pauli operators X
, Y
, Z
, the Hadamard gate H
, and arbitrary rotations. Multi‑qubit gates such as the controlled‑NOT (CNOT
) create entanglement and are written as tensor products of smaller matrices. The Quantum Gates page provides an in-depth description of each gate and its matrix representation.
Quantum gates can be visualised as operations on the Bloch sphere. For example, the Hadamard gate transforms the state to , placing it on the equator of the sphere, while the Pauli gates correspond to rotations around the axes.
Circuits
A quantum circuit is a sequence of gates acting on a set of qubits. The state of the qubits is transformed step by step until a measurement is performed. By arranging gates carefully we can build algorithms that outperform their classical counterparts on certain tasks. See the Quantum Circuits page for detailed examples and a walkthrough of building circuits on the Quantum Simulator.
Algorithms
Quantum algorithms combine gates and measurements in specific patterns. Famous examples include Grover's search, Shor's factoring algorithm and variational algorithms used for chemistry and optimisation. An overview of these algorithms can be found in the Quantum Algorithms section.
This site aims to give an accessible introduction without focusing on any particular software framework. The concepts apply equally to all quantum hardware and simulators, and the Quantum Simulator provides a convenient way to experiment with them interactively.