Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Deutsch–Jozsa algorithm
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Deterministic quantum algorithm}} The '''Deutsch–Jozsa algorithm''' is a [[deterministic algorithm|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.<ref name="DJ92">{{cite journal| author = David Deutsch| author-link = David Deutsch| author2 = Richard Jozsa| author2-link = Richard Jozsa| name-list-style = amp| title = Rapid solutions of problems by quantum computation| journal = Proceedings of the Royal Society of London A| volume = 439| issue = 1907| pages = 553–558| year = 1992|bibcode = 1992RSPSA.439..553D |doi = 10.1098/rspa.1992.0167 | citeseerx = 10.1.1.655.5997| s2cid = 121702767}}</ref><ref name="CEMM98">{{cite journal|author1=R. Cleve |author2=A. Ekert |author3=C. Macchiavello |author4=M. Mosca | title = Quantum algorithms revisited| journal = Proceedings of the Royal Society of London A| volume = 454|issue=1969 | pages = 339–354| year = 1998| arxiv = quant-ph/9708016|bibcode = 1998RSPSA.454..339C |doi = 10.1098/rspa.1998.0164 |s2cid=16128238 }}</ref> Although of little practical use, it is one of the first examples of a quantum algorithm that is [[Time complexity|exponentially faster]] than any possible deterministic classical algorithm.<ref>{{Cite book|last=Simon|first=Daniel|title=Proceedings 35th Annual Symposium on Foundations of Computer Science |chapter=On the power of quantum computation |date=November 1994|chapter-url=http://citeseer.ist.psu.edu/viewdoc/download?doi=10.1.1.51.5477&rep=rep1&type=pdf|pages=116–123|doi=10.1109/SFCS.1994.365701|isbn=0-8186-6580-7|s2cid=7457814}}</ref> 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 an exponential number of queries to the black box to solve the problem. More formally, it yields an oracle relative to which '''[[EQP (complexity)|EQP]]''', the class of problems that can be solved exactly in polynomial time on a quantum computer, and '''[[P (complexity)|P]]''' are different.<ref name="Johansson2017"> {{cite journal |author=Johansson, N. |author2=Larsson, JÅ. |year=2017 |title=Efficient classical simulation of the Deutsch–Jozsa and Simon's algorithms |journal=Quantum Inf Process (2017) |volume=16 |issue=9 |pages=233 |arxiv=1508.05027 |bibcode=2017QuIP...16..233J |doi=10.1007/s11128-017-1679-7 |s2cid=28670540}} </ref> Since the problem is easy to solve on a probabilistic classical computer, it does not yield an oracle separation with '''[[BPP (complexity)|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 machine|oracle]] that implements some function: <math display="block">f \colon\{0,1\}^n \to \{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 [[promise problem|promised]] that the function is either [[constant function|constant]] (0 on all inputs or 1 on all inputs) or ''balanced'' (1 for exactly half of the input [[function domain|domain]] and 0 for the other half).<ref name="DJ92" /> The task then is to determine if <math>f</math> is constant or balanced by using the oracle. == Classical solution == For a conventional [[deterministic]] algorithm where <math>n</math> is the number of bits, <math>2^{n-1} + 1</math> evaluations of <math>f</math> will be required in the worst case. To prove that <math>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>k</math> evaluations of the function suffices to produce the correct answer with a high probability (failing with probability <math>\epsilon \leq 1/2^{k}</math> with <math>k \geq 1</math>). However, <math>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>f</math>. ==History== The Deutsch–Jozsa algorithm generalizes earlier (1985) work by David Deutsch, which provided a solution for the simple case where <math> n = 1 </math>. <br />Specifically, finding out if a given [[Boolean function]] whose input is one bit, <math>f: \{0,1\} \to \{0,1\}</math>, is constant.<ref name="Deu85"> {{cite journal |author = David Deutsch |author-link = David Deutsch |title = Quantum Theory, the Church-Turing Principle and the Universal Quantum Computer |journal = Proceedings of the Royal Society of London A |volume = 400 |issue = 1818 |pages = 97–117 |year = 1985 |bibcode = 1985RSPSA.400...97D | doi = 10.1098/rspa.1985.0070 | citeseerx = 10.1.1.41.2382 |s2cid = 1438116 }} </ref> 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>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.,<ref name="CEMM98" /> resulting in an algorithm that is both deterministic and requires only a single query of <math>f</math>. This algorithm is still referred to as Deutsch–Jozsa algorithm in honour of the groundbreaking techniques they employed.<ref name="CEMM98" /> == Algorithm == For the Deutsch–Jozsa algorithm to work, the oracle computing <math>f(x)</math> from <math>x</math> must be a quantum oracle which does not [[Quantum decoherence|decohere]] <math>x</math>. In its computation, it cannot make a copy of <math>x</math>, because that would violate the [[no cloning theorem]]. The point of view of the Deutsch-Jozsa algorithm of <math>f</math> as an oracle means that it does not matter what the oracle does, since it just has to perform its promised transformation. [[Image:Deutsch-Jozsa-algorithm-quantum-circuit.png|thumb|400px|right|Deutsch-Jozsa algorithm [[quantum circuit]]]] The algorithm begins with the <math>n+1</math> bit state <math>|0\rangle^{\otimes n} |1\rangle </math>. That is, the first n bits are each in the state <math>|0\rangle </math> and the final bit is <math>|1\rangle </math>. A [[Quantum_logic_gate#Hadamard_gate|Hadamard gate]] is applied to each bit to obtain the state <math display="block">\frac{1}{\sqrt{2^{n+1}}}\sum_{x=0}^{2^n-1} |x\rangle (|0\rangle - |1\rangle ),</math> where <math>x</math> runs over all <math>n</math>-bit strings, which each may be represented by a number from <math>0</math> to <math>2^n - 1</math>. We have the function <math>f</math> implemented as a quantum oracle. The oracle maps its input state <math> |x\rangle|y\rangle </math> to <math> |x\rangle|y\oplus f(x) \rangle </math>, where <math>\oplus</math> denotes addition modulo 2. Applying the quantum oracle gives; <math display="block">\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>x, f(x)</math> is either 0 or 1. Testing these two possibilities, we see the above state is equal to <math display="block">\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>\frac{|0\rangle - |1\rangle}{\sqrt{2}}</math> may be ignored and the following remains: <math display="block">\frac{1}{\sqrt{2^{n}}}\sum_{x=0}^{2^n-1} (-1)^{f(x)} |x\rangle.</math> Next, we will have each qubit go through a [[Quantum logic gate#Hadamard gate|Hadamard gate]]. The total transformation over all <math>n</math> qubits can be expressed with the following identity: <math display="block">H^{\otimes n} |k\rangle = \frac{1}{\sqrt{2^n}} \sum_{j = 0}^{2^n - 1} (-1)^{k \cdot j} |j\rangle</math> (<math>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). This results in <math display="block">\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} {\left(-1\right)}^{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>k</math> to be measured is <math display="block">\left|\frac{1}{2^n} \sum_{x=0}^{2^n-1} {\left(-1\right)}^{f(x)} {\left(-1\right)}^{x \cdot k} \right|^2</math> The probability of measuring <math>k = 0 </math>, corresponding to <math>|0\rangle^{\otimes n}</math>, is <math display="block">\bigg|\frac{1}{2^n}\sum_{x=0}^{2^n-1}(-1)^{f(x)}\bigg|^2</math> which evaluates to 1 if <math>f(x)</math> is constant ([[constructive interference]]) and 0 if <math>f(x)</math> is balanced ([[destructive interference]]). In other words, the final measurement will be <math>|0\rangle^{\otimes n}</math> (all zeros) if and only if <math>f(x)</math> is constant and will yield some other state if <math>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>f\colon\{0,1\}^n\rightarrow \{0,1\}</math>. We need to check the condition <math>f(0)=f(1)</math>. It is equivalent to check <math>f(0)\oplus f(1)</math> (where <math>\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>f</math> is constant, otherwise <math>f</math> is not constant. We begin with the two-qubit state <math>|0\rangle |1\rangle</math> and apply a [[Quantum_logic_gate#Hadamard_gate|Hadamard gate]] to each qubit. This yields <math display="block">\frac{1}{2}(|0\rangle + |1\rangle)(|0\rangle - |1\rangle).</math> We are given a quantum implementation of the function <math>f</math> that maps <math>|x\rangle |y\rangle</math> to <math>|x\rangle |f(x)\oplus y\rangle</math>. Applying this function to our current state we obtain <math display="block">\begin{align} & \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)) \\ &=\frac{1}{2}((-1)^{f(0)}|0\rangle(|0\rangle - |1\rangle) + (-1)^{f(1)}|1\rangle(|0\rangle - |1\rangle)) \\ &=(-1)^{f(0)}\frac{1}{2}\left(|0\rangle + (-1)^{f(0)\oplus f(1)}|1\rangle\right)(|0\rangle - |1\rangle). \end{align}</math> We ignore the last bit and the global phase and therefore have the state <math display="block">\frac{1}{\sqrt 2}(|0\rangle + (-1)^{f(0)\oplus f(1)}|1\rangle).</math> Applying a Hadamard gate to this state we have <math display="block">\begin{align} &\frac{1}{2} (|0\rangle + |1\rangle + (-1)^{f(0)\oplus f(1)}|0\rangle - (-1)^{f(0)\oplus f(1)}|1\rangle) \\ &=\frac{1}{2} ((1 +(-1)^{f(0)\oplus f(1)}) |0\rangle + (1-(-1)^{f(0)\oplus f(1)}) |1\rangle). \end{align}</math> <math>f(0)\oplus f(1) = 0</math> if and only if we measure <math>|0\rangle</math> and <math>f(0)\oplus f(1)=1</math> if and only if we measure <math>|1\rangle</math>. So with certainty we know whether <math>f(x)</math> is constant or balanced. ==Deutsch–Jozsa algorithm Qiskit implementation== The quantum circuit shown here is from [https://learning.quantum.ibm.com/course/fundamentals-of-quantum-algorithms/quantum-query-algorithms#the-deutsch-jozsa-algorithm a simple example of how the Deutsch–Jozsa algorithm can be implemented in Python] using [[Qiskit]], an open-source quantum computing software development framework by IBM. [[File:Deutsch-Jozsa balanced quantum circuit.png|thumb|Deutsch-Jozsa balanced quantum circuit]] ==See also== * [[Bernstein–Vazirani algorithm]] ==References== {{Reflist}} ==External links== * [http://www.quiprocone.org/Protected/Lecture_5.htm Deutsch's lecture about the Deutsch-Jozsa algorithm] {{Quantum computing}} {{DEFAULTSORT:Deutsch-Jozsa algorithm}} [[Category:Quantum algorithms]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Quantum computing
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)