Educatifu
Open menu

Quantum gates and circuits

You compute on qubits by applying quantum gates arranged into circuits — the quantum version of logic gates, but reversible and able to act on superpositions.

CoreQuantum Computing~14 min

Before this lesson

  • Lesson: Entanglement — the spooky one

Classical computers compute by pushing bits through logic gates (AND, OR, NOT). Quantum computers work the same way in spirit — you apply quantum gates to qubits, arranged into a circuit — but with two profound differences: the gates are reversible, and they act on superpositions, transforming all the possibilities a qubit holds at once.

A gate is a rotation

Recall the Bloch sphere from the Foundations track: a qubit's state is a point on a sphere. A quantum gate simply rotates that point. Because a rotation can be undone by rotating back, every quantum gate is reversible — quantum computers never "erase" information mid-computation the way classical AND gates do. A few gates recur everywhere:

  • X (the quantum NOT) flips |0⟩ ↔ |1⟩.
  • Z flips the phase of |1⟩ — invisible to a single measurement, but crucial for interference (next lesson).
  • H, the Hadamard — the workhorse — turns a definite |0⟩ into an equal superposition of |0⟩ and |1⟩. It is how you create superposition on demand.

Circuits, read left to right

A circuit draws each qubit as a horizontal wire and each gate as a box on that wire, with time flowing left to right. Multi-qubit gates span wires. The most important two-qubit gate is the CNOT (controlled-NOT): it flips the target qubit only if the control qubit is 1. On a superposed control, CNOT creates entanglement — it links the two qubits into a joint state.

The little circuit above is the whole Foundations story in three gates: H puts q₀ into superposition, CNOT entangles q₁ with it, and then both are measured. The result is a Bell state — 50% "00", 50% "11", never "01" or "10".

Universality

Remarkably, a small set of gates — say H, T (a phase gate) and CNOT — is universal: any quantum computation whatsoever can be built from them, just as NAND alone is universal for classical logic. So the entire art of quantum programming is arranging these few reversible rotations into a circuit whose final measurement is likely to give the answer you want.

And "likely" is the operative word. A circuit that merely spreads amplitude evenly across every possibility is useless — measuring it is random guessing. The trick that makes quantum computers fast is making the right answers' amplitudes reinforce while the wrong ones cancel. That mechanism — interference — is next.

A two-qubit circuit with a Hadamard on q0, a CNOT to q1, then measurement of both.
A tiny circuit — superpose, entangle, measure — that produces a Bell state.

Key takeaways

  • Quantum gates are reversible operations on qubits; a circuit is a sequence of gates read left to right.
  • The Hadamard gate creates superposition; the CNOT gate creates entanglement; together they are enormously powerful.
  • Every quantum gate is a rotation of the qubit state — computation is steering amplitudes, not flipping bits.

← All Quantum Computing lessons

Bring us the problem, not a perfect specification

Tell us what needs to change, who it affects and any important deadline. We will review the context and reply with useful next questions.

  1. 01Share contextDescribe the workflow, constraint or risk.
  2. 02Clarify togetherWe identify missing facts and useful options.
  3. 03Choose a startAgree a focused assessment or delivery step.
Start a conversation