Pricing…Open Lab
Chapter 04 of 13 · ~11 min

Multi-Qubit Circuit Patterns

CX copies a sure 0 or 1 into a fresh qubit, and it can work out parity. But when its input is a superposition, it entangles the qubits instead of copying. No circuit can copy an unknown quantum state. SWAP moves a state from one wire to another. It is usually built from three CX gates.

What do multi-qubit patterns give me?

Circuits with several qubits move data around and link qubits together. Three shapes show up again and again. Once you can spot them, bigger circuits get much easier to read.

  • Fan-out: write a known bit's value onto extra qubits.
  • Parity: record whether a group of bits has an even or odd number of 1s. It is done in a way that can be undone, so the inputs are not erased.
  • SWAP: trade the full states of two qubits. On real machines, some gates only exist between qubits that sit next to each other. SWAP moves data so it can reach them.

All three are built from the controlled-NOT, CX. This gate flips its target qubit, but only in the part of the state where its control qubit is 1.

What the rest of this chapter covers
  1. Worked example: how does CX copy a sure bit?
  2. Run the copyINTERACTIVE
  3. Worked example: why can't CX copy a superposition?
  4. Compare: the same CX on a superpositionINTERACTIVE
  5. How does SWAP move a state between wires?
  6. Run the three-CX swapINTERACTIVE
  7. Try this: what if I put the X on the wrong side?INTERACTIVE
  8. What should I remember?
Keep learning with Pro

You’ve read the opening of chapter 4. Pro unlocks the other 8 sections — plus every chapter of every course, with circuits you can run right on the page. That’s $11.99 a month, about the price of a coffee, or $99.99 a year (save 30%). The first chapter of every course, and the whole math course, stay free.

Start learning with ProSee plansRead chapter 1 free
Multi-Qubit Circuit Patterns · QPU137