Classical processors build every computation from logic gates such as AND, OR and NOT. Gate-model quantum computers apply the same idea with different building blocks, acting on qubits. Understanding gates and circuits is the shortest way to see what a quantum algorithm actually does, and why today’s hardware limits it.

What is a quantum gate?

A quantum gate is a controlled operation that takes the state of one or more qubits and turns it into another state. A classical logic gate is a piece of circuitry on a chip; a quantum gate is not a component but an action applied over time. On a superconducting qubit, for example, a precisely shaped microwave pulse acts as a gate, and on a trapped ion a laser pulse typically does.

Two properties of gates matter:

  • They are reversible. Every gate can be undone by another gate, and no information is erased. A classical AND gate is different: if its output is 0, the inputs cannot be recovered.
  • They act on superpositions. A gate affects all components of a state together. This does not mean that many answers can be read out at once; a measurement gives a single result.

Which gates are used most often?

Single-qubit gates:

  • X: the quantum counterpart of the NOT gate; it swaps 0 and 1.
  • Z: leaves the 0 component alone and flips the sign (the phase) of the 1 component. It has no visible effect if the qubit is measured straight away, but changes how the state interferes later.
  • Hadamard (H): turns a definite 0 or 1 into an equal superposition of the two; applied twice, it returns to the starting state.
  • Rotation gates (RX, RY, RZ): turn the state by an adjustable angle. These angles are the parameters tuned by hybrid algorithms.

Two-qubit gates:

  • CNOT (controlled-NOT): flips the target qubit only if the control qubit is 1.
  • CZ (controlled-Z): flips the sign of the state only when both qubits are 1.

When the control qubit is in a superposition, these gates create entanglement. A Hadamard on one qubit followed by a CNOT on the pair is the standard way to prepare an entangled pair.

Are a few gates enough for any computation?

Yes. A small universal gate set is enough to build any quantum computation. Arbitrary single-qubit rotations together with a single entangling two-qubit gate such as CNOT will do. A finite set such as Hadamard, T (a fixed phase rotation) and CNOT can also approximate any computation to whatever accuracy is required. This resembles the way classical logic can be built from NAND gates alone.

What is a quantum circuit?

A quantum circuit is a sequence of gates applied to a set of qubits in a fixed order. In a diagram each qubit is a horizontal line, gates are symbols on those lines, and time runs from left to right. A typical circuit has three stages:

  1. All qubits are prepared in the state 0.
  2. Gates are applied that create superposition, entanglement and interference.
  3. The qubits are measured, each giving 0 or 1.

Because measurement is probabilistic, the circuit is run many times and the answer is taken from the statistics of the results.

Two numbers describe the size of a circuit. Width is the number of qubits used. Depth is the number of gate layers that have to be executed one after another; gates on different qubits can run at the same time in one layer.

Why can circuits not be made deep enough today?

Every gate adds a small error, and two-qubit gates are usually noisier than single-qubit ones. Qubits also lose their state over time through decoherence. Errors accumulate with depth, and beyond a certain number of layers the output is dominated by noise.

Useful circuits today therefore have to be shallow. This is the central constraint of the NISQ era; quantum error correction is being developed as the long-term remedy.

What does compiling a circuit involve?

Each processor can apply only a few native gates directly, and can often run two-qubit gates only between neighbouring qubits. A compiler rearranges the written circuit for the target processor:

  • It rewrites every gate in terms of the processor’s native gates. A CNOT, for example, can be built from a CZ and a few single-qubit gates.
  • It places the circuit’s qubits on physical qubits. Where two qubits that must interact are not connected, it inserts SWAP operations that exchange their states.
  • It simplifies gates that cancel one another or can be merged, in order to reduce depth.

The compiled circuit is often deeper than the original. This is why connectivity and the native gate set deserve as much attention as the number of qubits when choosing a machine.

How Q&Co can help

Q&Co designs and implements quantum algorithms tailored to specific industries, assesses their performance and resource requirements, and also works on quantum hardware selection and superconducting QPU design. If you are considering training for your team or a pilot project, get in touch.