Use a reversible circuit to compute an -bit representation of the angle into a workspace register, with all additional work bits retained:
Write that representation as , with known binary place values (including the fixed scale and any integer bit). On the target, apply a controlled unitary gate controlled by each angle bit . Rotations about the same axis add their angles, so their product is
Finally apply to perform uncomputation. The workspace returns to zero while the control register and rotated target remain unchanged; the construction works coherently on every superposition of .
A polynomial time classical calculation has a polynomial-size reversible circuit with Toffoli gates, and each Toffoli gate has a constant-size decomposition into one-qubit and two-qubit gates. The controlled rotations are themselves two-qubit gates. Thus the total quantum circuit size is . This is the binary-angle implementation of a quantum variable rotation; the stipulated angle precision is understood.
Implement the assumed efficient classical algorithm for as a reversible circuit. On input , it computes an -bit binary expansion of the angle in a work register using Toffoli gates and elementary reversible gates. Write the computed angle as a sum of binary-weighted angles. For each angle bit, apply the corresponding controlled single-qubit rotation to the target. These rotations have the same axis, so their angles add and produce
Finally apply uncomputation to erase the work register. Each Toffoli gate and controlled rotation has a constant-size decomposition into one- and two-qubit gates when arbitrary one-qubit rotations are available. Ignoring the stipulated precision costs, the resulting circuit has size and returns every quantum ancilla to zero.
Write . Since the marked word is , the required oracle is a single Toffoli gate with and as its two controls and the answer qubit as its target:
The target flips exactly when both controls are one, which is exactly when .
Reversible circuit Created 2026-09-25 Updated 2026-10-03
A reversible circuit is composed of bijective gates. The Toffoli gate is universal for reversible Boolean computation when ancillary bits are available.