Deutsch discovered a problem which the quantum computer could solve faster than a traditional computer, although not exponentially faster. The problem that Deutsch's algorithm solves is not an important problem in Computer Science. It is a contrived problem to see how quantum computers can be used. It is presented here with that purpose.
The problem
Suppose there is a function f that maps {0, 1}into {0, 1}. We wish to know whether the function is one to one or not. Note that there are only four possible functions mapping {0, 1} into {0, 1}. Both f(0) and f(1) can map to either 0 or 1.
The problem could be solved by evaluating f(0) XOR f(1). If the function is one to one, then f(0) XOR f(1) will be equal to 1, and it will be equal to 0 otherwise. This solution to the problem evaluates the function twice in order to determine whether it is one to one or not.
Deutsch's algorithm
The function f has a domain and range of two values. These two values correspond to the possible values of a qubit. Note that in the description of the algorithm and the example below, 00 is shorthand for (0, 0) and means that both qubits have value 0, and likewise for 01, 10, and 11.
Note that the function was only evaluated once during the algorithm. The quantum algorithm only evaluates the function once while the classical algorithm evaluates the function twice. This could make significant difference if the function f is very complicated and takes a great deal of time to compute.
Example
We will show how the algorithm operates with a particular function f. Suppose f(0) = 0 and f(1) = 1.