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.
The printed upper summation limit introduces although only qubits were defined. Literally the final term is undefined. Use the natural open-chain repair
This preserves the stated -qubit system and agrees with the supplied sum-of-squares hint. If a cyclic convention was intended instead, it must be stated; the same argument works for its terms when . For , the repaired open chain is empty and the target is the identity.
Here is a product-formula Hamiltonian simulation using exactly the two supplied lemmas. Let and choose an integer . Every is a norm-one Hermitian matrix. One time slice is the product of two-qubit gates
To compare a partial product with , first propagate the previous error through the next unitary gate, which preserves the spectral norm, and then use Lemma A with , . Both norms are at most . Its new error is at most for a universal constant . For an explicit choice, follows from the unitary Taylor bounds and . Induction and the triangle inequality therefore give
Lemma B, the unitary product telescoping bound, now compares the repeated slices with :
Take, for example, . If the sum is zero the product is already exact; otherwise its error is at most . There are two-qubit gates. This explicit lemma-based construction has fourth-degree dependence on for fixed precision:
This is a sufficient polynomial, not an optimality claim. The polynomial-degree statement treats as fixed; the inverse-precision dependence is displayed separately. No first-order term error is accumulated without the required repeated-slice factor.
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.