Deutsch-Jozsa Algorithm

#quantum #qnickel

Part of Womanium Quantum + AI 2024 program


Definition

Deutsch-Jozsa algorithm is a generalization of Deutsch's Algorithm, where we generalize the definition of the function f as:

f:{0,1}{0,1}f:{0,1}n{0,1}

We say f is:

Deutsch-Jozsa Algorithm

The algorithm is very similar to Deutsch's algorithm, in fact it is the same algorithm except that we apply the Hadamard gate on multiple input qubits instead of just one.

DJA.png

Again, we can see that we are still utilizing phase kickback for this algorithm, which works even with multiple qubits as the input.

Before we start applying the algorithm let's define the following:

N=2nHn|0n=1Nx{0,1}n|x

Now we start applying the algorithm on the starting state |0n|0.

|0n|0IX|0n|1HnH1Nx{0,1}n|x|Uf1Nx{0,1}n(1)f(x)|x|

Now let's discard of the ancilla that is |. Now let's define applying n Hadamard gates on a state of multiple qubits as:

Hn|x=12nz{0,1}n(1)xz|z

Now we continue applying the Hadamard gates:

1Nx{0,1}n(1)f(x)x|1Nx{0,1}n(1)f(x)|xHn1Nx{0,1}n1Nz{0,1}n(1)xz+f(x)|z=1Nx{0,1}nz{0,1}n(1)xz+f(x)|z

Now let's look at the amplitude for state state |z=|0n, this also means that xz=0:

1Nx{0,1}n(1)f(x)

If the function is constant then:

1Nx{0,1}n(1)f(x)=1N(N1)=NN=1or=1N(N1)=NN=11Nx{0,1}n(1)f(x)=±1

then we get the probability of measuring that state by squaring the amplitude (α2).

(±1)2=1

That means if the function is constant we will measure the state |0n with 100% probability, and if the function is balanced we will measure any other value.

Measuring |0n with a balanced function

If the function f is balanced then the probability of measuring |0n is 0%, since exactly half of the elements will have an f(x)=0 and the other half f(x)=1, making the summation cancel itself when adding 1 and 1, and we end up with

1N(0)=0

Conclusion

Deutsch-Jozsa algorithm generalizes Deutsch's algorithm to apply to a string of n qubits instead of just one.

After applying the algorithm, which uses a single query only, if we measure |0n, then the function is constant, otherwise it's balanced.


< Prev | Next: Bernstein-Vazirani Algorithm >