Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2014/iii/paper-61/1/b/ii/solution

The linear decoding must be done coherently, so its output is available inside the next Boolean quantum oracle call. Use registers of qubits and a shared phase ancilla qubit in . Define the Bernstein-Vazirani decoding controlled by a quantum register
The ancilla qubit is implicit. For every computational index , the Walsh-Hadamard transform calculation gives
In particular on these states. Initialize to and to . The three query stages are
The middle equality uses the matching index , not a classical guess of that string. The second performs uncomputation, removing the hidden-string register without losing its phase on . Apply to to obtain
This requires precisely two queries to and one to , and only additional fixed quantum gates. No measurement of is made: such a measurement would spoil the required coherence. Preparing all registers and the phase ancilla qubit uses only the initially available zero states.

New to topics? Read the docs here!