Quantum Circuits

A quantum circuit is an ordered series of quantum gates acting on a collection of qubits. By selecting appropriate gates we can create superposition, entangle qubits and ultimately perform a computation. The final measurement step converts the quantum state into classical information.

Mathematically a circuit corresponds to a unitary operator formed by multiplying the matrices of each gate. If U1U_1 acts first and U2U_2 acts second then the overall transformation is U2U1U_2U_1. For an nn‑qubit register this unitary has dimension 2n×2n2^n\times2^n.

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.

Designing a Circuit

A quantum circuit consists of three main steps:

  1. Choose the qubits. Decide how many qubits are required to represent the problem.
  2. Apply gates. Arrange single‑ and multi‑qubit gates to implement the desired transformation.
  3. Measure. Read out the qubits to obtain classical results.

When multiple qubits interact, the overall state grows exponentially with the number of qubits. This large state space is what gives quantum algorithms their power.

Measurements are described by projectors onto the computational basis. Measuring qubit kk collapses the state onto either 0k|0\rangle_k or 1k|1\rangle_k with probabilities given by the squared amplitudes.

Using the Quantum Simulator

The Quantum Simulator (opens in a new tab) offers an interface for constructing circuits. Gates from a library can be placed on any qubit line. As you build, the simulator shows real‑time measurement probabilities and Bloch sphere visualisations. Circuits can be exported to JSON for sharing or further analysis.

Example: Creating a Bell State

The following sequence prepares two qubits in an entangled Bell state. Try these steps in the simulator to see the states evolve:

  1. Start with both qubits in |0⟩.
  2. Apply a Hadamard gate to the first qubit.
  3. Apply a controlled‑NOT with the first qubit as control and the second as target.

After these steps the system is in the state

Φ+=12(00+11).|\Phi^+\rangle = \tfrac{1}{\sqrt{2}}(|00\rangle + |11\rangle).

This circuit is a building block for many algorithms and illustrates how simple gate sequences yield non‑classical correlations. Measuring either qubit produces a random bit, but the outcomes are perfectly correlated between the two qubits.