Parity computation by CNOT gates 2026-10-07
Apply one CNOT gate from each input qubit to the same target. Their actions commute because controls remain unchanged and each contribution is added modulo two. This reversible circuit computes the parity bit with exactly one two-qubit gate per input, and its inverse is the same circuit. Unlike measuring the inputs to compute parity classically, the unitary preserves quantum superposition and can be uncomputed after phase application.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 58 4 b ii Solution Created 2026-10-03 Updated 2026-10-07
Use one target ancilla qubit initially in . Apply a CNOT gate from each data qubit to that same target, for . Each CNOT gate adds its control bit modulo two without changing the control. After all gates the target contains the parity bit . Thus the required circuit is the -gate parity fan-in:This is parity computation by CNOT gates. The circuit also satisfies for either target value, and because all these shared-target CNOT gates commute and individually square to the identity. The action on general superpositions follows by linearity.
Pauli-string phase by parity computation 2026-10-07
The Pauli Z gates give eigenvalue on . Use parity computation by CNOT gates to put the parity bit in a zero ancilla, apply to it, and uncompute. The data acquire exactly , and the ancillary line returns to zero. This compute-phase-uncompute construction needs one- and two-qubit gates. Accumulating parity into the last data line instead uses gates without an extra ancilla. Neither implementation drops the global phase.