Deutsch's Algorithm Notes.
Deutsch's Algorithm Notes.
Introduction
Imagine the following: you are given a function f:B→B where B={0,1}. So this function
takes zero or one and returns zero or one.
Notice that for the first and the fourth combinations, the output doesn’t change irrespective of
the input. The output is constant; hence the function is said to be constant in both
combinations. The second and the third combinations though are different: the number of
zeros in the output is the same as the number of ones. There is a balance in the output; hence
we call it balanced in both combinations.
Without being told which one or being allowed to look inside, we are asked if it is balanced
or constant. This is called Deutsch’s problem.
On a classical computer the only thing to do is to evaluate the function for both values of x
and compare them, i.e. we need to make two calls to the function. However, we shall see that
we can answer this question on a quantum computer with only one call to the function. We
get less information than classically, because we don’t determine the individual values of f (0)
and f (1), but we do determine whether or not f is constant. Hence Deutsch’s problem may be
thought of as determining whether a coin to be tossed is honest or not with just one toss of the
coin.
can be seen since , the identity. If this is not obvious note that y ⊕ f (x) ⊕ f (x) = y.
(Adding 0 to 0 gives 0 and adding 1 to 1 mod 2 also gives 0.)
The blackbox routine Uf for a function f (x) which takes a 1-qubit input x and computes a 1-
qubit function f (x). Here x and y are computational basis states |0 〉 or |1〉. However, to
gain a quantum speedup, we will input superpositions, generated by Hadamard gates, as
shown in Fig. 2. We obtain the result of inputing a superposition from the results of inputing
computational basis states by using linearity. Recall that time runs from left to right in circuit
diagrams.
Circuit for Deutsch’s algorithm. The initial state (on left) has |0 〉in the upper (input) qubit
and |1〉in the lower (output) qubit. Hadamard gates are applied to both qubits both before
and after the function Uf (which we assume to be an unknown black box). In the final state
the lower qubit is unchanged at |1. A measurement is made of the final value (on right) of the
upper qubit. If this is unchanged, i.e. x = 0, then the function is constant, while if the upper
qubit has flipped, i.e. x = 1, then the function is not constant. One can also start with the
upper qubit as |1〉 and find the same conclusion: if the upper qubit is unchanged the function
is constant whereas if it has flipped the function is not constant.