Control and Target
Every controlled gate assigns a distinct job to each qubit: one qubit is the control and another is the target. The control qubit decides whether anything happens, while the target qubit is the one that is actually transformed.
The two roles
For the CNOT gate the rule is simple: if the control qubit is , apply (bit-flip) to the target; if the control is , leave the target alone. Written as a conditional:
where is addition modulo 2. The control qubit is unchanged in every row of the truth table — it reads the signal without absorbing it.
The roles are labels, not qubit indices
Nothing in the physics requires the control to be the lower-numbered qubit. When you write
c.cx(control, target) you specify both roles explicitly. Setting control = 1 and target = 0
is perfectly legal and completely different from c.cx(0, 1) — the two circuits produce different
state vectors whenever qubit 1 and qubit 0 are not in the same state.
Generalising beyond CNOT
The same language applies to every controlled gate in this module. The CZ gate applies to the target when the control is ; a controlled-phase gate applies a phase to the target. In each case the circuit description names two qubit indices and assigns one the control role and one the target role. Keeping those roles straight is the prerequisite for understanding entanglement, phase kickback, and every quantum algorithm that builds on them.
Try it
Start from but this time use qubit 1 as the control and qubit 0 as the target. Flip the control to , then apply the CNOT. If you correctly assign the roles you will reach ; swapping the arguments by mistake will leave the state unchanged and the grader will fail.
Sign in on the full site to ask questions and join the discussion.