Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2021/ii/paper-2/10d/solution

Apply a Hadamard gate to every qubit. The amplitude of becomes
It equals in case (I) and in case (II). A computational-basis measurement therefore returns with certainty in case (I) and never returns it in case (II). This is the Deutsch-Jozsa algorithm.
For the distributed problem, Alice prepares
using one query to her quantum oracle, and sends these qubits to Bob. Bob applies his phase oracle, producing
The function is constant zero in case (1) and balanced in case (2). Bob applies and measures as above: outcome identifies case (1), while every other outcome identifies case (2), with certainty.

New to topics? Read the docs here!