An ancillary qubit is an extra qubit used to hold intermediate information rather than serving as a computation’s enduring input or output. It commonly begins in |0⟩, receives a temporary result, and must be handled so that leftover entanglement does not corrupt later work. section 6.5.1 section 4.6.2
For a parity measurement, CNOT gates XOR each input qubit into one ancillary target. Measuring that target reveals parity without changing the input when every basis state in the superposition has the same parity; the ancillary qubit then remains unentangled with the inputs. section 4.6.1 section 4.6.2
Table 4.2 The steps of performing a parity measurement on a two-qubit state
| The input state | \(0.8 |00\rangle + 0.6 |11\rangle\) | \(0.8 |01\rangle + 0.6 |10\rangle\) |
|---|---|---|
| Parity of the input state | 0 | 1 |
| Allocate auxiliary qubit (last bit) | \(0.8 |00\rangle|0\rangle + 0.6 |11\rangle|0\rangle\) | \(0.8 |01\rangle|0\rangle + 0.6 |10\rangle|0\rangle\) |
| Apply CNOT (first qubit as control) | \(0.8 |00\rangle|0\rangle + 0.6 |11\rangle|1\rangle\) | \(0.8 |01\rangle|0\rangle + 0.6 |10\rangle|1\rangle\) |
| Apply CNOT (second qubit as control) | \(0.8 |00\rangle|0\rangle + 0.6 |11\rangle|0\rangle\) | \(0.8 |01\rangle|1\rangle + 0.6 |10\rangle|1\rangle\) |
| State of the auxiliary qubit | \(|0\rangle\) | \(|1\rangle\) |
Trace two even- and odd-parity superpositions through ancillary-qubit allocation and two CNOT operations. section 4.6.1
Ancillary storage is essential for reversible Boolean evaluation because AND and OR are computed out-of-place. Clause results can be stored in auxiliary qubits before a final AND, but on superpositions those qubits may become entangled and cannot simply be discarded. Bennett’s trick preserves the final result while returning auxiliary storage to |0⟩. section 6.5.1
In Qiskit, ancillary qubits impose circuit-layout constraints:
- Allocate every required qubit when constructing the circuit; temporary allocation and release during execution are unavailable. section 4.6.2
- Keep auxiliary-qubit positions explicit when composing circuits or interpreting measurement results. section 6.5.2
- Reuse a phase-kickback qubit in later subcircuits when appropriate, since it remains part of the complete circuit. section 7.1.2
Clause-result workspace
A conjunctive-normal-form evaluator allocates one auxiliary qubit per clause, writes each OR-clause result there, and uses those values as inputs to the final AND. The input qubits come first in the register, auxiliary qubits follow, and the output occupies the last position. section 6.5.2
