Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2018/ii/paper-3/10d/b/ii/solution

If , then
so
In either promised case, construct by the one-query procedure in part (a), apply the Walsh-Hadamard transform to its two qubits, and perform a quantum measurement in the computational basis. The outcome is certainly for case (i) and certainly for case (ii). Therefore
This is a two-bit instance of Bernstein-Vazirani phase kickback, and also a promised Deutsch-Jozsa test.

New to topics? Read the docs here!