Solution

ID: past-exam-of-the-computer-science-course-of-the-university-of-oxford/2019/quantum-information/3/f/solution

Use the Bernstein-Vazirani algorithm: initialize n qubits in , apply , query the supplied phase oracle once, apply again, and measure all n computational bits. Immediately after the query the state is
where the dot product in the exponent is taken modulo two. The Walsh-Hadamard transform gives amplitude
Every factor is one if and zero otherwise. Thus the final state is exactly , and the measurement outputs a with certainty after one oracle query. This is the character cancellation behind Bernstein-Vazirani phase kickback; because access here is already to the reduced phase oracle, no extra target ancilla or conversion from a bit-flip oracle is required.

New to topics? Read the docs here!