Deutsch–Jozsa algorithm

From HandWiki
Short description: Deterministic quantum algorithm

The Deutsch–Jozsa algorithm is a deterministic quantum algorithm proposed by David Deutsch and Richard Jozsa in 1992 with improvements by Richard Cleve, Artur Ekert, Chiara Macchiavello, and Michele Mosca in 1998.[1][2] Although of little practical use, it is one of the first examples of a quantum algorithm that is exponentially faster than any possible deterministic classical algorithm.[3]

The Deutsch–Jozsa problem is specifically designed to be easy for a quantum algorithm and hard for any deterministic classical algorithm. It is a black box problem that can be solved efficiently by a quantum computer with no error, whereas a deterministic classical computer would need a exponential number of queries to the black box to solve the problem. More formally, it yields an oracle relative to which EQP, the class of problems that can be solved exactly in polynomial time on a quantum computer, and P are different.[4]

Since the problem is easy to solve on a probabilistic classical computer, it does not yield an oracle separation with BPP, the class of problems that can be solved with bounded error in polynomial time on a probabilistic classical computer. Simon's problem is an example of a problem that yields an oracle separation between BQP and BPP.

Problem statement

In the Deutsch–Jozsa problem, we are given a black box quantum computer known as an oracle that implements some function:

[math]\displaystyle{ f\colon\{0,1\}^n\rightarrow \{0,1\} }[/math]

The function takes n-bit binary values as input and produces either a 0 or a 1 as output for each such value. We are promised that the function is either constant (0 on all inputs or 1 on all inputs) or balanced (1 for exactly half of the input domain and 0 for the other half).[1] The task then is to determine if [math]\displaystyle{ f }[/math] is constant or balanced by using the oracle.

Classical solution

For a conventional deterministic algorithm where [math]\displaystyle{ n }[/math] is the number of bits, [math]\displaystyle{ 2^{n-1} + 1 }[/math] evaluations of [math]\displaystyle{ f }[/math] will be required in the worst case. To prove that [math]\displaystyle{ f }[/math] is constant, just over half the set of inputs must be evaluated and their outputs found to be identical (because the function is guaranteed to be either balanced or constant, not somewhere in between). The best case occurs where the function is balanced and the first two output values are different. For a conventional randomized algorithm, a constant [math]\displaystyle{ k }[/math] evaluations of the function suffices to produce the correct answer with a high probability (failing with probability [math]\displaystyle{ \epsilon \leq 1/2^{k} }[/math] with [math]\displaystyle{ k \geq 1 }[/math]). However, [math]\displaystyle{ k=2^{n-1} + 1 }[/math] evaluations are still required if we want an answer that has no possibility of error. The Deutsch-Jozsa quantum algorithm produces an answer that is always correct with a single evaluation of [math]\displaystyle{ f }[/math].

History

The Deutsch–Jozsa algorithm generalizes earlier (1985) work by David Deutsch, which provided a solution for the simple case where [math]\displaystyle{ n = 1 }[/math].
Specifically, given a boolean function whose input is one bit, [math]\displaystyle{ f: \{0,1\} \rightarrow \{0,1\} }[/math], is it constant?[5]

The algorithm, as Deutsch had originally proposed it, was not deterministic. The algorithm was successful with a probability of one half. In 1992, Deutsch and Jozsa produced a deterministic algorithm which was generalized to a function which takes [math]\displaystyle{ n }[/math] bits for its input. Unlike Deutsch's algorithm, this algorithm required two function evaluations instead of only one.

Further improvements to the Deutsch–Jozsa algorithm were made by Cleve et al.,[2] resulting in an algorithm that is both deterministic and requires only a single query of [math]\displaystyle{ f }[/math]. This algorithm is still referred to as Deutsch–Jozsa algorithm in honour of the groundbreaking techniques they employed.[2]

Algorithm

For the Deutsch–Jozsa algorithm to work, the oracle computing [math]\displaystyle{ f(x) }[/math] from [math]\displaystyle{ x }[/math] must be a quantum oracle which does not decohere [math]\displaystyle{ x }[/math]. It also must not make a copy of [math]\displaystyle{ x }[/math], because that would violate the no cloning theorem.

Deutsch-Jozsa algorithm quantum circuit

The algorithm begins with the [math]\displaystyle{ n+1 }[/math] bit state [math]\displaystyle{ |0\rangle^{\otimes n} |1\rangle }[/math]. That is, the first n bits are each in the state [math]\displaystyle{ |0\rangle }[/math] and the final bit is [math]\displaystyle{ |1\rangle }[/math]. A Hadamard transform is applied to each bit to obtain the state

[math]\displaystyle{ \frac{1}{\sqrt{2^{n+1}}}\sum_{x=0}^{2^n-1} |x\rangle (|0\rangle - |1\rangle ) }[/math],

where [math]\displaystyle{ x }[/math] runs over all [math]\displaystyle{ n }[/math]-bit strings. We have the function [math]\displaystyle{ f }[/math] implemented as a quantum oracle. The oracle maps its input state [math]\displaystyle{ |x\rangle|y\rangle }[/math] to [math]\displaystyle{ |x\rangle|y\oplus f(x) \rangle }[/math], where [math]\displaystyle{ \oplus }[/math] denotes addition modulo 2. Applying the quantum oracle gives;

[math]\displaystyle{ \frac{1}{\sqrt{2^{n+1}}}\sum_{x=0}^{2^n-1} |x\rangle (|0\oplus f(x)\rangle - |1\oplus f(x)\rangle ) }[/math].

For each [math]\displaystyle{ x, f(x) }[/math] is either 0 or 1. Testing these two possibilities, we see the above state is equal to

[math]\displaystyle{ \frac{1}{\sqrt{2^{n+1}}}\sum_{x=0}^{2^n-1} (-1)^{f(x)} |x\rangle (|0\rangle - |1\rangle ) }[/math].

At this point the last qubit [math]\displaystyle{ \frac{|0\rangle - |1\rangle}{\sqrt{2}} }[/math] may be ignored and the following remains:

[math]\displaystyle{ \frac{1}{\sqrt{2^{n}}}\sum_{x=0}^{2^n-1} (-1)^{f(x)} |x\rangle }[/math].

Next, we will apply the Hadamard transform

[math]\displaystyle{ H^{\otimes n} |k\rangle = \frac{1}{\sqrt{2^n}} \sum_{j = 0}^{2^n - 1} (-1)^{k \cdot j} |j\rangle }[/math]

([math]\displaystyle{ j\cdot k=j_0 k_0\oplus j_1 k_1\oplus\cdots\oplus j_{n-1} k_{n-1} }[/math] is the sum of the bitwise product, where [math]\displaystyle{ \oplus }[/math] is addition modulo 2) over the first register to obtain

[math]\displaystyle{ \frac{1}{\sqrt{2^n}}\sum_{x=0}^{2^n-1}(-1)^{f(x)} \left[ \frac{1}{\sqrt{2^n}} \sum_{y=0}^{2^n-1}(-1)^{x\cdot y} |y\rangle \right] = \sum_{y=0}^{2^n-1} \left[ \frac{1}{2^n} \sum_{x=0}^{2^n-1}(-1)^{f(x)} (-1)^{x\cdot y}\right] |y\rangle }[/math]

From this, we can see that the probability for a state [math]\displaystyle{ k }[/math] to be measured is

[math]\displaystyle{ \left|\frac{1}{2^n} \sum_{x=0}^{2^n-1}(-1)^{f(x)} (-1)^{x\cdot k}\right|^2 }[/math]

The probability of measuring [math]\displaystyle{ k = 0 }[/math], corresponding to [math]\displaystyle{ |0\rangle^{\otimes n} }[/math], is

[math]\displaystyle{ \bigg|\frac{1}{2^n}\sum_{x=0}^{2^n-1}(-1)^{f(x)}\bigg|^2 }[/math]

which evaluates to 1 if [math]\displaystyle{ f(x) }[/math] is constant (constructive interference) and 0 if [math]\displaystyle{ f(x) }[/math] is balanced (destructive interference). In other words, the final measurement will be [math]\displaystyle{ |0\rangle^{\otimes n} }[/math] (all zeros) if and only if [math]\displaystyle{ f(x) }[/math] is constant and will yield some other state if [math]\displaystyle{ f(x) }[/math] is balanced.

Deutsch's algorithm

Deutsch's algorithm is a special case of the general Deutsch–Jozsa algorithm where n = 1 in [math]\displaystyle{ f\colon\{0,1\}^n\rightarrow \{0,1\} }[/math]. We need to check the condition [math]\displaystyle{ f(0)=f(1) }[/math]. It is equivalent to check [math]\displaystyle{ f(0)\oplus f(1) }[/math] (where [math]\displaystyle{ \oplus }[/math] is addition modulo 2, which can also be viewed as a quantum XOR gate implemented as a Controlled NOT gate), if zero, then [math]\displaystyle{ f }[/math] is constant, otherwise [math]\displaystyle{ f }[/math] is not constant.

We begin with the two-qubit state [math]\displaystyle{ |0\rangle |1\rangle }[/math] and apply a Hadamard transform to each qubit. This yields

[math]\displaystyle{ \frac{1}{2}(|0\rangle + |1\rangle)(|0\rangle - |1\rangle). }[/math]

We are given a quantum implementation of the function [math]\displaystyle{ f }[/math] that maps [math]\displaystyle{ |x\rangle |y\rangle }[/math] to [math]\displaystyle{ |x\rangle |f(x)\oplus y\rangle }[/math]. Applying this function to our current state we obtain

[math]\displaystyle{ \frac{1}{2}(|0\rangle(|f(0)\oplus 0\rangle - |f(0)\oplus 1\rangle) + |1\rangle(|f(1)\oplus 0\rangle - |f(1)\oplus 1\rangle)) }[/math]
[math]\displaystyle{ =\frac{1}{2}((-1)^{f(0)}|0\rangle(|0\rangle - |1\rangle) + (-1)^{f(1)}|1\rangle(|0\rangle - |1\rangle)) }[/math]
[math]\displaystyle{ =(-1)^{f(0)}\frac{1}{2}\left(|0\rangle + (-1)^{f(0)\oplus f(1)}|1\rangle\right)(|0\rangle - |1\rangle). }[/math]

We ignore the last bit and the global phase and therefore have the state

[math]\displaystyle{ \frac{1}{\sqrt 2}(|0\rangle + (-1)^{f(0)\oplus f(1)}|1\rangle). }[/math]

Applying a Hadamard transform to this state we have

[math]\displaystyle{ \frac{1}{2}(|0\rangle + |1\rangle + (-1)^{f(0)\oplus f(1)}|0\rangle - (-1)^{f(0)\oplus f(1)}|1\rangle) }[/math]
[math]\displaystyle{ =\frac{1}{2}((1 +(-1)^{f(0)\oplus f(1)})|0\rangle + (1-(-1)^{f(0)\oplus f(1)})|1\rangle). }[/math]

[math]\displaystyle{ f(0)\oplus f(1)=0 }[/math] if and only if we measure [math]\displaystyle{ |0\rangle }[/math] and [math]\displaystyle{ f(0)\oplus f(1)=1 }[/math] if and only if we measure [math]\displaystyle{ |1\rangle }[/math]. So with certainty we know whether [math]\displaystyle{ f(x) }[/math] is constant or balanced.

See also

References

  1. 1.0 1.1 David Deutsch; Richard Jozsa (1992). "Rapid solutions of problems by quantum computation". Proceedings of the Royal Society of London A 439 (1907): 553–558. doi:10.1098/rspa.1992.0167. Bibcode1992RSPSA.439..553D. 
  2. 2.0 2.1 2.2 R. Cleve; A. Ekert; C. Macchiavello; M. Mosca (1998). "Quantum algorithms revisited". Proceedings of the Royal Society of London A 454 (1969): 339–354. doi:10.1098/rspa.1998.0164. Bibcode1998RSPSA.454..339C. 
  3. Simon, Daniel (November 1994). "On the power of quantum computation". Proceedings 35th Annual Symposium on Foundations of Computer Science. pp. 116–123. doi:10.1109/SFCS.1994.365701. ISBN 0-8186-6580-7. http://citeseer.ist.psu.edu/viewdoc/download?doi=10.1.1.51.5477&rep=rep1&type=pdf. 
  4. Johansson, N.; Larsson, JÅ. (2017). "Efficient classical simulation of the Deutsch–Jozsa and Simon's algorithms". Quantum Inf Process (2017) 16 (9): 233. doi:10.1007/s11128-017-1679-7. Bibcode2017QuIP...16..233J. 
  5. David Deutsch (1985). "Quantum Theory, the Church-Turing Principle and the Universal Quantum Computer". Proceedings of the Royal Society of London A 400 (1818): 97–117. doi:10.1098/rspa.1985.0070. Bibcode1985RSPSA.400...97D. 

External links