The Deutsch Algorithm

Explore how the Deutsch algorithm efficiently distinguishes constant from balanced binary functions with a quantum advantage in a single oracle query.

In 1985, David Deutsch introduced one of the first quantum algorithms to show an advantage over classical computing algorithms. Many others, including Deutsch himself, subsequently modified the algorithm to make it more efficient and understandable.

Deutsch’s algorithm asks a specific question about mathematical functions for which the independent variable (the input) is a binary digit, that is, 00 or 11, and the dependent variable (the output) is 00 or 11. Since there are only two possible input values and two possible output values, we have four possible functions. Customarily, these are labeled f0f_0, f1f_1, f2f_2, and f3f_3. Of course, you could use any four names you would like. We don’t need to worry about the details of how the functions turn the inputs into the outputs. All we need to do is specify the output for each of the two possible inputs 00 and 11. The following table displays the results.

The functions are divided into two classes: (1) constant functions and (2) balanced functions. Constant means that the output is the same no matter what the input is. The other two give 00 for 5050% of the inputs and 11 for the other 5050% and are called balanced functions. For a one-qubit system, all non-constant functions are balanced, as shown in the table below. For a two-qubit system, we might have a function that gives f(00)=0f(00) = 0 and f(01)=f(10)=f(11)=1f(01) = f(10) = f(11) = 1. That function is non-constant, but not balanced. We will restrict ourselves to constant and balanced functions.

Get hands-on with 1400+ tech skills courses.