PricingOpen Lab
Chapter 10 of 14 · ~25 min

CNOT and controlled operations

CX (CNOT) flips its target qubit inside exactly those components of the joint state where the control qubit is 1 — a conditional applied per component, with no measurement and no runtime branch. The operand order [control, target] is part of the program: swap it and you run a different circuit.

A controlled operation is a two-qubit gate that applies some action to one qubit — the target — only on those parts of the state where another qubit — the control — has the value 1. The workhorse is CX, also called CNOT (controlled-NOT): its action is an X flip of the target.

For plain 0/1 inputs, CX is fully described by a truth table — a list of every input and its output. With control q0 and target q1 (displayed as the string q1q0, rightmost bit q0):

  • 00 → 00 — control is 0, nothing happens
  • 01 → 11 — control is 1, target flips from 0 to 1
  • 10 → 10 — control is 0, nothing happens
  • 11 → 01 — control is 1, target flips from 1 to 0

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

Continue this chapter

You’ve read the opening of chapter 107 more sections follow, with worked examples and circuits you can run on the page. A free account unlocks every chapter of every course (paid plans aren’t live yet — early readers get everything free).

Create a free accountAll chaptersStart with the free chapters
CNOT and controlled operations · QPU137