Skip to main content
Springer Nature - PMC COVID-19 Collection logoLink to Springer Nature - PMC COVID-19 Collection
. 2020 May 25;12142:465–472. doi: 10.1007/978-3-030-50433-5_36

Generalized Quantum Deutsch-Jozsa Algorithm

Tomasz Arodz 8,
Editors: Valeria V Krzhizhanovskaya8, Gábor Závodszky9, Michael H Lees10, Jack J Dongarra11, Peter M A Sloot12, Sérgio Brissos13, João Teixeira14
PMCID: PMC7304852

Abstract

Quantum computing aims to provide algorithms and hardware that allows for solving computational problems asymptotically faster than on classical computers. Yet, design of new, fast quantum algorithms is not straightforward, and the field faces high barriers of entry for traditional computer scientists. One of the main didactic examples used to introduce speedup resulting from quantum computing is the Deutsch-Jozsa algorithm for discriminating between constant and balanced functions. Here, we show a generalization of the Deutsch-Jozsa algorithm beyond balanced functions that can be used to further illustrate the design choices underpinning quantum algorithms.

Keywords: Quantum speedup, Promise problems, Didactics of quantum computing

Introduction

Quantum computing studies algorithms and hardware for performing computation using systems that exploit quantum physics. In the gate model of quantum computing [6], the information storage and processing are done using tools from linear algebra. The information is stored in a quantum register composed of quantum bits. Each quantum bit is represented as a unit-norm vector in a two-dimensional complex Hilbert space. A multi-qubit register is modeled as a tensor product space arising from the individual quantum bits. The information in the quantum register can evolve in time according to invertible, inner product-preserving transformations, modeled mathematically in the gate model of quantum computing as unitary operators. The information in the quantum register can be accessed, to some extent, through quantum measurement, typically modeled as a randomized projection on vectors from the computational basis of the Hilbert space.

The key promise of quantum computing is to achieve speedup compared to classical computers [10], leading to faster algorithms in many domains, including linear algebra [5], database search [4], or machine learning [1, 3, 9]. The study of quantum algorithms can also lead to more efficient classical methods [7, 11].

One of the first, didactic example of a problem for which a quantum computer abstracted using the gate model shows speedup is a promise problem known as the Deutsch-Jozsa problem [2]. Assume that you are given a Boolean function on n-bits: Inline graphic with a black-box access. That is, on a classical computer, you can call it on any bit string and see the result, but you cannot decompile it. On a quantum computer, you have access to an oracle, a unitary transformation Inline graphic that performs the function using some form of input and output encoding.

In the Deutsch-Jozsa problem, we are promised that the function is of one of two types

  • constant, that is, always returns 0, or always returns 1,

  • balanced, that is, for half of the Inline graphic possible inputs it returns 0, for the remaining Inline graphic inputs, it returns 1.

The task is to use the ability to execute f(x) for any x to figure out if f is constant, or balanced.

Let Inline graphic be the number of distinct inputs x. On a classical computer, we need at least two calls to f to be able to decide if the function is constant or balanced – in the most optimistic scenario when first call returns 0 and the second returns 1, we know the answer after these two calls to f. But if we see zeros all the time, we need Inline graphic calls to have the answer – if value number Inline graphic is also 0, it is a constant function, if the value is 1, it is a balanced function. Thus, pessimistically, we need Inline graphic calls to f to solve the Deutsch-Jozsa problem on a classical computer. It is well-known that on a quantum computer, we can solve the Deutsch-Jozsa problem much quicker, using just one call to the unitary oracle Inline graphic.

The Deutsch-Jozsa algorithm has been recently generalized to include discrimination between balanced functions and almost-constant functions [8], with the query complexity increasing with the distance from a constant function. Here, we show that it can be generalized in a different way, to a family of promise problems involving discrimination between a specific constant function Inline graphic, for example an all-zero function, and a family of functions Inline graphic that have fixed level of imbalance, that is, have exactly k outputs equal to one, as long as Inline graphic. We show that this problem can be solved with only one query to the function oracle.

Quantum Deutsch-Jozsa Algorithm

To define the Deutsch-Jozsa algorithm, we need to have ability to evaluate Boolean functions using unitary operators, and the ability to use Boolean function evaluation to provide the answer whether the function is constant or balanced.

Quantum Boolean Function Evaluation

A Boolean function on n bits returning an m bit string is a function Inline graphic. Consider Inline graphic, and a function Inline graphic that negates all bits of x. It is a permutation - a one-to-one mapping - on the set Inline graphic. Now consider a function Inline graphic XOR Inline graphic, where Inline graphic is a modulo-two addition. If a bit in y is 0, the corresponding bit in x is not changed – an identity mapping, a particular form of permutation, on those bits. If a bit in y is 1, the corresponding bit in x is negated - a permutation on those bits. That is, for arbitrary n-bit y, Inline graphic is a permutation on the set Inline graphic - Inline graphic vectors for all possible x are mutually orthogonal, same as Inline graphic are. Then, a linear mapping Inline graphic will produce Inline graphic when we perform Inline graphic. Since Inline graphic is a permutation on Inline graphic, it is a one-to-one mapping. It also preserves the inner product. The inner product among basis vectors Inline graphic, Inline graphic is null, and the inner products among the outputs Inline graphic are also null. This mapping is inner-product-preserving, and thus compatible with the rules of quantum mechanics.

Not all functions Inline graphic are permutations; a constant function that always returns all bits set to 0 is not a permutation. Consider an arbitrary function Inline graphic. Let us have an Inline graphic-qubit system Inline graphic. Consider a state Inline graphic, where Inline graphic is one of the Inline graphic basis states of Inline graphic, and Inline graphic is one of the Inline graphic basis states of Inline graphic. We wish to have a linear transformation Inline graphic, a unitary operator, that takes the vector, and produces, on output, a state Inline graphic, in particular, for Inline graphic, it produces Inline graphic. For each x, Inline graphic is a permutation on the basis states of Inline graphic, and thus Inline graphic is a permutation on the basis states of Inline graphic. Hence,

graphic file with name 500809_1_En_36_Equ2_HTML.gif

which performs Inline graphic, is a one-to-one mapping that preserves the inner product – and thus can describe unitary evolution of a quantum system.

Consider Inline graphic, arbitrary n, and an Inline graphic-qubit system in an arbitrary state of the form Inline graphic. Let Inline graphic be a Pauli X gate followed by Hadamard gate; it transforms Inline graphic to Inline graphic and Inline graphic to Inline graphic, and is Hermitian. Let Inline graphic denote application of E to the last, Inline graphic qubit. We have

graphic file with name 500809_1_En_36_Equ3_HTML.gif

We obtained the result by seeing that Inline graphic differs by a sign depending on the value of f(x); if Inline graphic, it is Inline graphic, if Inline graphic it is Inline graphic. Then we used phase kickback to the top qubits. Value of Inline graphic is reflected in change of phase of Inline graphic by Inline graphic, whereas Inline graphic results in no change.

We now see two ways of representing the result of applying f(x) as encoded by Inline graphic:

graphic file with name 500809_1_En_36_Equ4_HTML.gif

The first option is to encode the result in the state of the last qubit, the second is to encode it in the phase of the input qubits.

The Deutsch-Jozsa Problem

Consider four query states Inline graphic for arbitrary binary uv. Two are simple, Inline graphic and Inline graphic, and correspond to two possible one-bit constant functions. Two other are entangled, Inline graphic and Inline graphic, and correspond to the two one-bit balanced functions.

If someone prepares a two-qubit system in one of the four query states, can we distinguish whether it is any of these two Inline graphic and Inline graphic, or any of these two Inline graphic and Inline graphic? We have Inline graphic, that is, it is easy to distinguish Inline graphic from Inline graphic, and Inline graphic from Inline graphic. All other inner products of these four states are equal to Inline graphic. Any unitary transformation has to preserve the dimensionality of the space, and the inner products. Thus, there is no mapping that would map Inline graphic to be orthogonal to Inline graphic or Inline graphic; same for Inline graphic. If we want to use orthogonality of any member from one group of states to any member from the other group of states to reliably distinguish states from one group from the other, then a group composed of Inline graphic and Inline graphic cannot be reliably distinguished from group consisting of Inline graphic and Inline graphic.

We have seen above two ways of representing the result of applying a binary function f(x) given a state Inline graphic: encoding the result as an additional qubit, or as a phase change of the input qubit. Consider a n-bit binary function f. We can construct a state Inline graphic using Hadamard transform. Then, we can construct a state Inline graphic, and apply our two options of evaluating f quantum mechanically to this Inline graphic-qubit state. We will get

graphic file with name 500809_1_En_36_Equ5_HTML.gif

These two options are not equivalent. The four query states we have seen above can be seen as the first option for Inline graphic if we equate Inline graphic and Inline graphic; indeed Inline graphic. We have seen that we cannot use this representation to decide, based on orthogonality, if we got a function that is constant, or that returns equal number of 0’s and 1’s.

On the other hand, consider the second representation, or actually just its first qubit Inline graphic. A constant function will have Inline graphic, while a balanced function will have Inline graphic. We can ignore the global phase, that is, the sign, and we end up with two orthogonal states, Inline graphic for constant and Inline graphic for balanced function. As we can see, while unitary actions after applying the black-box unitary oracle cannot change the distinguishability of states because they must preserve the inner products, differences prior to applying the function oracle can affect our ability to distinguish states.

Generalized Deutsch-Jozsa Problem

We show here that the ability to distinguish all-zeros from all-ones that we get from Inline graphic and the ability to distinguish all-zeros and all-ones from a balanced function that we get from Inline graphic are not the only possibilities for quickly solving promise problems involving two groups of binary functions. We can form a class of single-qubit unitary operators A defined by the condition Inline graphic,

graphic file with name M55.gif

and observe that unitaries I and E are at the extreme ends of the family, with a spectrum of other operators in between. These operators can each solve a different promise problem of discriminating between two classes of functions.

Consider two functions Inline graphic and Inline graphic with the corresponding black-box unitaries Inline graphic and Inline graphic, and let Inline graphic and Inline graphic. Also, let Inline graphic if Inline graphic and Inline graphic otherwise, and Inline graphic; we will use Inline graphic to denote the number of outputs on which the functions agree, and Inline graphic to denote the Hamming distance between the outputs, that is, the number of outputs that differ; we have Inline graphic.

Let Inline graphic denote application of A to the last, Inline graphic-st qubit of an Inline graphic-qubit system. Then, we have

graphic file with name 500809_1_En_36_Equ6_HTML.gif

and a similar expression for Inline graphic, with Inline graphic replaced by Inline graphic.

The inner product of the two states is

graphic file with name 500809_1_En_36_Equ7_HTML.gif

where Inline graphic. Indeed, we have

graphic file with name 500809_1_En_36_Equ8_HTML.gif

The last equality comes from the fact that Inline graphic if and only if Inline graphic, and Inline graphic if and only if Inline graphic.

To achieve perfect distinguishability of the resulting states through quantum measurement, which corresponds to having inner product Inline graphic, we need to set a, b such that Inline graphic becomes Inline graphic. Since Inline graphic for any two unit-norm quantum states, we can do that as long as Inline graphic; the promised functions Inline graphic and Inline graphic must differ on at least half of their outputs to be perfectly distinguishable through orthogonality of the results of Inline graphic and Inline graphic.

For any Inline graphic, we can perfectly distinguish functions Inline graphic with exactly k outputs of 1 from the all-zero constant function Inline graphic using just one oracle access by using unitary defined by Inline graphic; note that here Inline graphic. On a classical computer, the same task can be achieved quickly if Inline graphic, but can take Inline graphic function calls if k is close to Inline graphic.

As an example, consider a problem involving functions defined over Inline graphic bits. Let Inline graphic be an all-zero function, that is, for any of the 16 possible input bitstrings, it returns null. Let Inline graphic be an imbalanced function with exactly Inline graphic out of 16 inputs returning one, and with four null outputs. To discriminate Inline graphic from any possible Inline graphic, we need to find a, b such that Inline graphic and Inline graphic: we can have Inline graphic and Inline graphic.

In contrast to applying A prior to Inline graphic to help solve the problem of discriminating an all-zero function Inline graphic and a function Inline graphic with k ones and Inline graphic zeros on outputs, we can consider the result of applying Inline graphic or Inline graphic instead. For Inline graphic, we arrive at the state Inline graphic for the all-zero Inline graphic, while for Inline graphic we arrive at Inline graphic, which has inner product Inline graphic. Only the all-one function Inline graphic is distinguishable from the all-zero function Inline graphic. Using Inline graphic instead leads to Inline graphic for Inline graphic and to Inline graphic for Inline graphic. These have inner product of Inline graphic. Here, only setting Inline graphic, that is, using a balanced function Inline graphic as in the original Deutsch-Jozsa problem, leads to the ability to distinguish Inline graphic from Inline graphic without error using a single measurement.

With minor changes, we can also, for any Inline graphic, distinguish a function with k zero outputs from an all-one constant function. The original Deutsch-Jozsa choice of Inline graphic is the only case when we can distinguish Inline graphic from both all-zero and all-one functions Inline graphic.

Conclusion

The Deutsch-Jozsa problem is often used to illustrate basic concepts in the gate model of quantum computing. Here, we show that the balance-vs-constant function promise problem lies at the edge of a family of promise problems involving discriminating between two subclasses of Boolean functions. The analysis of this broader family of problems can provide improved understanding of the conditions that lead to quantum speedup in Deutsch-Jozsa algorithm.

Acknowledgements

TA is supported by NSF grant CCF-1617710.

Contributor Information

Valeria V. Krzhizhanovskaya, Email: V.Krzhizhanovskaya@uva.nl

Gábor Závodszky, Email: G.Zavodszky@uva.nl.

Michael H. Lees, Email: m.h.lees@uva.nl

Jack J. Dongarra, Email: dongarra@icl.utk.edu

Peter M. A. Sloot, Email: p.m.a.sloot@uva.nl

Sérgio Brissos, Email: sergio.brissos@intellegibilis.com.

João Teixeira, Email: joao.teixeira@intellegibilis.com.

Tomasz Arodz, Email: tarodz@vcu.edu.

References

  • 1.Arodz, T., Saeedi, S.: Quantum sparse support vector machines. arXiv preprint arXiv:1902.01879 (2019)
  • 2.Deutsch D, Jozsa R. Rapid solution of problems by quantum computation. Proc. R. Soc. Lond. Ser. A Math. Phys. Sci. 1992;439(1907):553–558. [Google Scholar]
  • 3.Dunjko V, Briegel HJ. Machine learning & artificial intelligence in the quantum domain: a review of recent progress. Rep. Prog. Phys. 2018;81(7):074001. doi: 10.1088/1361-6633/aab406. [DOI] [PubMed] [Google Scholar]
  • 4.Grover, L.K.: A fast quantum mechanical algorithm for database search. arXiv preprint arXiv:quant-ph/9605043 (1996)
  • 5.Harrow AW, Hassidim A, Lloyd S. Quantum algorithm for linear systems of equations. Phys. Rev. Lett. 2009;103(15):150502. doi: 10.1103/PhysRevLett.103.150502. [DOI] [PubMed] [Google Scholar]
  • 6.Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum Information. Cambridge University Press, Cambridge (2011)
  • 7.Panahi, A., Saeedi, S., Arodz, T.: word2ket: space-efficient word embeddings inspired by quantum entanglement. In: International Conference on Learning Representations 2020. Preprint. arXiv:1911.04975 (2019)
  • 8.Qiu D, Zheng S. Generalized Deutsch-Jozsa problem and the optimal quantum algorithm. Phys. Rev. A. 2018;97(6):062331. doi: 10.1103/PhysRevA.97.062331. [DOI] [Google Scholar]
  • 9.Rebentrost P, Mohseni M, Lloyd S. Quantum support vector machine for big data classification. Phys. Rev. Lett. 2014;113(13):130503. doi: 10.1103/PhysRevLett.113.130503. [DOI] [PubMed] [Google Scholar]
  • 10.Rønnow TF, et al. Defining and detecting quantum speedup. Science. 2014;345(6195):420–424. doi: 10.1126/science.1252319. [DOI] [PubMed] [Google Scholar]
  • 11.Tang, E.: A quantum-inspired classical algorithm for recommendation systems. In: Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, pp. 217–228. ACM (2019)

Articles from Computational Science – ICCS 2020 are provided here courtesy of Nature Publishing Group

RESOURCES