Controlled-X gate
A two-qubit gate that flips a target conditional on the control being in its computational state 1.
Also called CNOT, CX
On this page
Definition and significance
The controlled-X gate, usually called CNOT or CX, preserves its control and applies X to the target when the control is 1. Its action on a computational-basis pair is (a,b)->(a,b XOR a). That classical-looking rule extends linearly to superpositions, where the operation can create entanglement. The gate does not measure the control to decide what to do.
Mechanism and mathematical treatment
Using |control,target> order, CX=|0><0| tensor I+|1><1| tensor X. It is its own inverse. Conjugation tracks the propagation of Pauli operators: X on the control becomes X on both qubits; Z on the target becomes Z on both; Z on the control and X on the target remain local. These statements describe propagation through the ideal unitary and are used in stabilizer reasoning and fault-tolerant circuit design.
The matrix depends on tensor ordering. In |00>,|01>,|10>,|11> order it is [[1,0,0,0],[0,1,0,0],[0,0,0,1],[0,0,1,0]]. A software display that orders qubits differently may present a different matrix for the same labeled gate.
Fully worked reference example
With target |0> and control |+>, CX maps (|00>+|10>)/sqrt(2) to (|00>+|11>)/sqrt(2). The reduced target state is I/2, so this operation has not copied an unknown pure state |+> into another |+>. Indeed |+>|+> contains four nonzero computational amplitudes; the actual output contains only two.
With target |->, the target is an X eigenstate of eigenvalue -1. Therefore CX[(a|0>+b|1>)|->]=(a|0>-b|1>)|->. The target is unchanged while the control acquires a Z transformation. This phase-kickback example follows from coherent control and would be lost if the control were measured first.
Limitations and common misconceptions
CNOT can entangle but does not entangle every input. CX|00>=|00>, and CX|+>|+>=|+>|+>. Also, physical CNOT availability, direction and duration are device-dependent. A calibrated native interaction may synthesize CX through multiple pulses. Do not infer the physical error propagation solely from an ideal textbook symbol.
Scientific relationships
Three appropriately oriented controlled-X gates implement SWAP.
Controlled-X is a basic component in decompositions of reversible multi-control logic.
A parity-computation gadget with a solved phase action
Use three data qubits q0,q1,q2 and an ancilla a initialized to zero. Apply CNOT q0->a, then q1->a, then q2->a. On a basis input x0x1x2 the ancilla becomes the parity p=x0 XOR x1 XOR x2. Apply R_Z(theta) to a and reverse the three CNOTs. The ancilla returns to zero, while the data basis state acquires exp[-i theta(-1)^p/2]. Since (-1)^p is the eigenvalue of Z tensor Z tensor Z, the net data operation is exp[-i theta Z tensor Z tensor Z/2].
This derivation explains both the sign and the half-angle in a common multiqubit rotation gadget. For theta=pi/2, even-parity inputs gain exp(-i pi/4), and odd-parity inputs gain exp(i pi/4). Starting from |+++>, all eight computational probabilities remain 1/8, yet a relative phase of pi/2 separates the two parity sectors. Replacing R_Z by the phase gate P(theta) changes the overall scalar of this unconditioned gadget but can matter if the entire gadget is later coherently controlled.
The displayed construction uses six CNOTs, one single-qubit rotation, and one clean ancilla. If parity is computed directly into a selected data qubit and then undone, an ancilla-free implementation can use four CNOTs for a three-body Z rotation. The target then participates in the parity rather than starting at zero. These two designs have different connectivity and workspace requirements; counting only the central rotation would conceal most of the work.
Propagating an error through the gadget
Suppose an X error occurs on a immediately before its R_Z rotation. It does not simply remain a harmless ancillary bit flip. X R_Z(theta)=R_Z(-theta)X, so commuting it through the rotation reverses the rotation angle. After the reverse CNOTs, X on the common target stays local on a, but the incorrect angle has already changed the data operation. If the ancilla is checked at the end, the bit flip can be detected; if it is silently reset, that diagnostic information is lost.
For a Z error on a immediately after the forward parity computation, the reverse CNOTs propagate Z from the target onto each data control. The final operator is Z on a times Z on all three data qubits. Since a ends in |0>, its own Z is invisible, leaving a three-qubit Z string on the data. This is an ideal Pauli-propagation calculation. A continuous noisy interaction can produce additional effects not captured by inserting one discrete error at one boundary.
For a concrete input |+++> and theta=0, the error-free circuit returns the data to |+++>. The inserted ancilla Z instead returns |--->. Measuring all three data qubits in the X basis yields 000 in the first case and 111 in the second, with the convention that zero denotes eigenvalue +1. The full correlated effect is therefore observable even though the ancilla itself has returned to its expected computational value.
A remote CNOT without treating labels as locations
On a line of three physical qubits A-B-C, consider the chronological sequence CX(A,B), CX(B,C), CX(A,B), CX(B,C). On classical labels (a,b,c), the first two operations give (a,b XOR a,c XOR b XOR a). The third restores B to b, and the fourth leaves C as c XOR a. Hence the sequence implements a CNOT from A to C while restoring the intermediate qubit B, even when B was not initialized to zero. Basis linearity extends the identity to arbitrary entangled inputs.
This four-CNOT bridge differs from a SWAP-based route. It does not permanently exchange logical labels, and it needs the specified directed interactions. Whether it is preferable depends on native gate directions, calibrated durations, concurrent operations, and later circuit structure. The identity supplies a correct candidate transformation; it does not prove that four physical pulses are available or that its noise is smaller than a routed alternative.
A manual reference check can use the eight basis triples. A stronger algebraic check records the three output Boolean expressions and verifies that they are a, b, and c XOR a. For a circuit built entirely from CNOTs, these expressions form an invertible matrix over the binary field. That matrix representation tests the permutation exactly with polynomial storage, avoiding an eight-by-eight matrix here and an exponentially larger matrix for more qubits.
Sources
Verification scope
Selected source text checked ·
Source anchors gate-decomposition conventions. New worked instances are independent mathematical constructions, not reported experiments.
Verification scope
Recorded source check ·
Full ordering guide retrieved; statevector/integer/string conventions and explicit object-level result distinctions inspected.
Conceptual reference semantics only. No code execution or universal backend support claim.