Pricing…Open Lab
Chapter 10 of 14 · ~25 min

CNOT and controlled operations

CX (also called CNOT) flips its target qubit only in the parts of the joint state where the control qubit is 1. It works part by part, with no measurement and no if-statement at run time. The order [control, target] is part of the program. Swap it and you run a different circuit.

Why care? Single-qubit gates can't make qubits work together. Controlled gates can. Almost every useful circuit is full of them.

A controlled operation is a two-qubit gate. It acts on one qubit, called the target. But it only acts on the parts of the state where another qubit, called the control, has the value 1.

The most common one is CX, also called CNOT (controlled-NOT). Its action is an X flip of the target. Think of a house rule: "if the porch light is on, flip the hallway light." The porch light is the control. The hallway light is the target. (Unlike a light, a qubit's control can be in a superposition, as you'll see below.)

For plain 0 or 1 inputs, CX is fully described by a truth table, a list of every input and its output. Here the control is q0 and the target is q1. Strings are shown as q1q0, so the rightmost bit is q0:

  • 00 → 00: the control is 0, so nothing happens.
  • 01 → 11: the control is 1, so the target flips from 0 to 1.
  • 10 → 10: the control is 0, so nothing happens.
  • 11 → 01: the control is 1, so the target flips from 1 to 0.

The control never changes. The target flips exactly when the control bit is 1.

What the rest of this chapter covers
  1. Control is 1: the target flipsINTERACTIVE
  2. Why does the order [control, target] matter?
  3. Same gates, transposed operandsINTERACTIVE
  4. What does CX do to a superposition?
  5. CX with a superposed controlINTERACTIVE
  6. Worked exampleINTERACTIVE
  7. Why are two-qubit gates the costly part on hardware?
Keep learning with Pro

You’ve read the opening of chapter 10. Pro unlocks the other 7 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
CNOT and controlled operations · QPU137