Grover's algorithm

Last updated

In quantum computing, Grover's algorithm, also known as the quantum search algorithm, is a quantum algorithm for unstructured search that finds with high probability the unique input to a black box function that produces a particular output value, using just evaluations of the function, where is the size of the function's domain. It was devised by Lov Grover in 1996. [1]

Contents

The analogous problem in classical computation cannot be solved in fewer than evaluations (because, on average, one has to check half of the domain to get a 50% chance of finding the right input). Charles H. Bennett, Ethan Bernstein, Gilles Brassard, and Umesh Vazirani proved that any quantum solution to the problem needs to evaluate the function times, so Grover's algorithm is asymptotically optimal. [2] Since classical algorithms for NP-complete problems require exponentially many steps, and Grover's algorithm provides at most a quadratic speedup over the classical solution for unstructured search, this suggests that Grover's algorithm by itself will not provide polynomial-time solutions for NP-complete problems (as the square root of an exponential function is an exponential, not polynomial, function). [3]

Unlike other quantum algorithms, which may provide exponential speedup over their classical counterparts, Grover's algorithm provides only a quadratic speedup. However, even quadratic speedup is considerable when is large, and Grover's algorithm can be applied to speed up broad classes of algorithms. [3] Grover's algorithm could brute-force a 128-bit symmetric cryptographic key in roughly 264 iterations, or a 256-bit key in roughly 2128 iterations. It may not be the case that Grover's algorithm poses a significantly increased risk to encryption over existing classical algorithms, however. [4]

Applications and limitations

Grover's algorithm, along with variants like amplitude amplification, can be used to speed up a broad range of algorithms. [5] [6] [7] In particular, algorithms for NP-complete problems which contain exhaustive search as a subroutine can be sped up by Grover's algorithm. [6] The current best algorithm for 3SAT is one such example. Generic constraint satisfaction problems also see quadratic speedups with Grover. [8] These algorithms do not require that the input be given in the form of an oracle, since Grover's algorithm is being applied with an explicit function, e.g. the function checking that a set of bits satisfies a 3SAT instance.

Grover's algorithm can also give provable speedups for black-box problems in quantum query complexity, including element distinctness [9] and the collision problem [10] (solved with the Brassard–Høyer–Tapp algorithm). In these types of problems, one treats the oracle function f as a database, and the goal is to use the quantum query to this function as few times as possible.

Cryptography

Grover's algorithm essentially solves the task of function inversion. Roughly speaking, if we have a function that can be evaluated on a quantum computer, Grover's algorithm allows us to calculate when given . Consequently, Grover's algorithm gives broad asymptotic speed-ups to many kinds of brute-force attacks on symmetric-key cryptography, including collision attacks and pre-image attacks. [11] However, this may not necessarily be the most efficient algorithm since, for example, the parallel rho algorithm is able to find a collision in SHA2 more efficiently than Grover's algorithm. [12]

Limitations

Grover's original paper described the algorithm as a database search algorithm, and this description is still common. The database in this analogy is a table of all of the function's outputs, indexed by the corresponding input. However, this database is not represented explicitly. Instead, an oracle is invoked to evaluate an item by its index. Reading a full database item by item and converting it into such a representation may take a lot longer than Grover's search. To account for such effects, Grover's algorithm can be viewed as solving an equation or satisfying a constraint. In such applications, the oracle is a way to check the constraint and is not related to the search algorithm. This separation usually prevents algorithmic optimizations, whereas conventional search algorithms often rely on such optimizations and avoid exhaustive search. [13] Fortunately, fast Grover's oracle implementation is possible for many constraint satisfaction and optimization problems. [14]

The major barrier to instantiating a speedup from Grover's algorithm is that the quadratic speedup achieved is too modest to overcome the large overhead of near-term quantum computers. [15] However, later generations of fault-tolerant quantum computers with better hardware performance may be able to realize these speedups for practical instances of data.

Problem description

As input for Grover's algorithm, suppose we have a function . In the "unstructured database" analogy, the domain represent indices to a database, and f(x) = 1 if and only if the data that x points to satisfies the search criterion. We additionally assume that only one index satisfies f(x) = 1, and we call this index ω. Our goal is to identify ω.

We can access f with a subroutine (sometimes called an oracle) in the form of a unitary operator Uω that acts as follows:

This uses the -dimensional state space , which is supplied by a register with qubits. This is often written as

Grover's algorithm outputs ω with probability at least 1/2 using applications of Uω. This probability can be made arbitrarily large by running Grover's algorithm multiple times. If one runs Grover's algorithm until ω is found, the expected number of applications is still , since it will only be run twice on average.

Alternative oracle definition

This section compares the above oracle with an oracle .

Uω is different from the standard quantum oracle for a function f. This standard oracle, denoted here as Uf, uses an ancillary qubit system. The operation then represents an inversion (NOT gate) on the main system conditioned by the value of f(x) from the ancillary system:

or briefly,

These oracles are typically realized using uncomputation.

If we are given Uf as our oracle, then we can also implement Uω, since Uω is Uf when the ancillary qubit is in the state :

So, Grover's algorithm can be run regardless of which oracle is given. [3] If Uf is given, then we must maintain an additional qubit in the state and apply Uf in place of Uω.

Algorithm

Quantum circuit representation of Grover's algorithm Grover's algorithm circuit.svg
Quantum circuit representation of Grover's algorithm

The steps of Grover's algorithm are given as follows:

  1. Initialize the system to the uniform superposition over all states
  2. Perform the following "Grover iteration" times:
    1. Apply the operator
    2. Apply the Grover diffusion operator
  3. Measure the resulting quantum state in the computational basis.

For the correctly chosen value of , the output will be with probability approaching 1 for N ≫ 1. Analysis shows that this eventual value for satisfies .

Implementing the steps for this algorithm can be done using a number of gates linear in the number of qubits. [3] Thus, the gate complexity of this algorithm is , or per iteration.

Geometric proof of correctness

Picture showing the geometric interpretation of the first iteration of Grover's algorithm. The state vector
|
s
> 
{\displaystyle |s\rangle }
is rotated towards the target vector
|
o
> 
{\displaystyle |\omega \rangle }
as shown. Grovers algorithm geometry.png
Picture showing the geometric interpretation of the first iteration of Grover's algorithm. The state vector is rotated towards the target vector as shown.

There is a geometric interpretation of Grover's algorithm, following from the observation that the quantum state of Grover's algorithm stays in a two-dimensional subspace after each step. Consider the plane spanned by and ; equivalently, the plane spanned by and the perpendicular ket .

Grover's algorithm begins with the initial ket , which lies in the subspace. The operator is a reflection at the hyperplane orthogonal to for vectors in the plane spanned by and , i.e. it acts as a reflection across . This can be seen by writing in the form of a Householder reflection:

The operator is a reflection through . Both operators and take states in the plane spanned by and to states in the plane. Therefore, Grover's algorithm stays in this plane for the entire algorithm.

It is straightforward to check that the operator of each Grover iteration step rotates the state vector by an angle of . So, with enough iterations, one can rotate from the initial state to the desired output state . The initial ket is close to the state orthogonal to :

In geometric terms, the angle between and is given by

We need to stop when the state vector passes close to ; after this, subsequent iterations rotate the state vector away from , reducing the probability of obtaining the correct answer. The exact probability of measuring the correct answer is

where r is the (integer) number of Grover iterations. The earliest time that we get a near-optimal measurement is therefore .

Algebraic proof of correctness

To complete the algebraic analysis, we need to find out what happens when we repeatedly apply . A natural way to do this is by eigenvalue analysis of a matrix. Notice that during the entire computation, the state of the algorithm is a linear combination of and . We can write the action of and in the space spanned by as:

So in the basis (which is neither orthogonal nor a basis of the whole space) the action of applying followed by is given by the matrix

This matrix happens to have a very convenient Jordan form. If we define , it is

where

It follows that r-th power of the matrix (corresponding to r iterations) is

Using this form, we can use trigonometric identities to compute the probability of observing ω after r iterations mentioned in the previous section,

Alternatively, one might reasonably imagine that a near-optimal time to distinguish would be when the angles 2rt and −2rt are as far apart as possible, which corresponds to , or . Then the system is in state

A short calculation now shows that the observation yields the correct answer ω with error .

Extensions and variants

Multiple matching entries

If, instead of 1 matching entry, there are k matching entries, the same algorithm works, but the number of iterations must be instead of

There are several ways to handle the case if k is unknown. [16] A simple solution performs optimally up to a constant factor: run Grover's algorithm repeatedly for increasingly small values of k, e.g., taking k = N, N/2, N/4, ..., and so on, taking for iteration t until a matching entry is found.

With sufficiently high probability, a marked entry will be found by iteration for some constant c. Thus, the total number of iterations taken is at most

Another approach if k is unknown is to derive it via the quantum counting algorithm prior.

If (or the traditional one marked state Grover's Algorithm if run with ), the algorithm will provide no amplification. If , increasing k will begin to increase the number of iterations necessary to obtain a solution. [17] On the other hand, if , a classical running of the checking oracle on a single random choice of input will more likely than not give a correct solution.

A version of this algorithm is used in order to solve the collision problem. [18] [19]

A modification of Grover's algorithm called quantum partial search was described by Grover and Radhakrishnan in 2004. [20] In partial search, one is not interested in finding the exact address of the target item, only the first few digits of the address. Equivalently, we can think of "chunking" the search space into blocks, and then asking "in which block is the target item?". In many applications, such a search yields enough information if the target address contains the information wanted. For instance, to use the example given by L. K. Grover, if one has a list of students organized by class rank, we may only be interested in whether a student is in the lower 25%, 25–50%, 50–75% or 75–100% percentile.

To describe partial search, we consider a database separated into blocks, each of size . The partial search problem is easier. Consider the approach we would take classically – we pick one block at random, and then perform a normal search through the rest of the blocks (in set theory language, the complement). If we don't find the target, then we know it's in the block we didn't search. The average number of iterations drops from to .

Grover's algorithm requires iterations. Partial search will be faster by a numerical factor that depends on the number of blocks . Partial search uses global iterations and local iterations. The global Grover operator is designated and the local Grover operator is designated .

The global Grover operator acts on the blocks. Essentially, it is given as follows:

  1. Perform standard Grover iterations on the entire database.
  2. Perform local Grover iterations. A local Grover iteration is a direct sum of Grover iterations over each block.
  3. Perform one standard Grover iteration.

The optimal values of and are discussed in the paper by Grover and Radhakrishnan. One might also wonder what happens if one applies successive partial searches at different levels of "resolution". This idea was studied in detail by Vladimir Korepin and Xu, who called it binary quantum search. They proved that it is not in fact any faster than performing a single partial search.

Optimality

Grover's algorithm is optimal up to sub-constant factors. That is, any algorithm that accesses the database only by using the operator Uω must apply Uω at least a fraction as many times as Grover's algorithm. [21] The extension of Grover's algorithm to k matching entries, π(N/k)1/2/4, is also optimal. [18] This result is important in understanding the limits of quantum computation.

If the Grover's search problem was solvable with logcN applications of Uω, that would imply that NP is contained in BQP, by transforming problems in NP into Grover-type search problems. The optimality of Grover's algorithm suggests that quantum computers cannot solve NP-Complete problems in polynomial time, and thus NP is not contained in BQP.

It has been shown that a class of non-local hidden variable quantum computers could implement a search of an -item database in at most steps. This is faster than the steps taken by Grover's algorithm. [22]

See also

Notes

  1. Grover, Lov K. (1996-07-01). "A fast quantum mechanical algorithm for database search". Proceedings of the twenty-eighth annual ACM symposium on Theory of computing - STOC '96. Philadelphia, Pennsylvania, USA: Association for Computing Machinery. pp. 212–219. arXiv: quant-ph/9605043 . Bibcode:1996quant.ph..5043G. doi:10.1145/237814.237866. ISBN   978-0-89791-785-8. S2CID   207198067.
  2. Bennett C.H.; Bernstein E.; Brassard G.; Vazirani U. (1997). "The strengths and weaknesses of quantum computation". SIAM Journal on Computing . 26 (5): 1510–1523. arXiv: quant-ph/9701001 . doi:10.1137/s0097539796300933. S2CID   13403194.
  3. 1 2 3 4 Nielsen, Michael A. (2010). Quantum computation and quantum information. Isaac L. Chuang. Cambridge: Cambridge University Press. pp. 276–305. ISBN   978-1-107-00217-3. OCLC   665137861.
  4. Bernstein, Daniel J. (2010). "Grover vs. McEliece" (PDF). In Sendrier, Nicolas (ed.). Post-Quantum Cryptography, Third International Workshop, PQCrypto 2010, Darmstadt, Germany, May 25-28, 2010. Proceedings. Lecture Notes in Computer Science. Vol. 6061. Springer. pp. 73–80. doi:10.1007/978-3-642-12929-2_6.
  5. Grover, Lov K. (1998). "A framework for fast quantum mechanical algorithms". In Vitter, Jeffrey Scott (ed.). Proceedings of the Thirtieth Annual ACM Symposium on the Theory of Computing, Dallas, Texas, USA, May 23–26, 1998. Association for Computing Machinery. pp. 53–62. arXiv: quant-ph/9711043 . doi:10.1145/276698.276712.
  6. 1 2 Ambainis, A. (2004-06-01). "Quantum search algorithms". ACM SIGACT News. 35 (2): 22–35. arXiv: quant-ph/0504012 . doi:10.1145/992287.992296. ISSN   0163-5700. S2CID   11326499.
  7. Jordan, Stephen. "Quantum Algorithm Zoo". quantumalgorithmzoo.org. Retrieved 2021-04-21.
  8. Cerf, Nicolas J.; Grover, Lov K.; Williams, Colin P. (2000-05-01). "Nested Quantum Search and NP-Hard Problems". Applicable Algebra in Engineering, Communication and Computing. 10 (4): 311–338. doi:10.1007/s002000050134. ISSN   1432-0622. S2CID   311132.
  9. Ambainis, Andris (2007-01-01). "Quantum Walk Algorithm for Element Distinctness". SIAM Journal on Computing. 37 (1): 210–239. arXiv: quant-ph/0311001 . doi:10.1137/S0097539705447311. ISSN   0097-5397. S2CID   6581885.
  10. Brassard, Gilles; Høyer, Peter; Tapp, Alain (1998). "Quantum Cryptanalysis of Hash and Claw-Free Functions". In Lucchesi, Claudio L.; Moura, Arnaldo V. (eds.). LATIN '98: Theoretical Informatics, Third Latin American Symposium, Campinas, Brazil, April, 20-24, 1998, Proceedings. Lecture Notes in Computer Science. Vol. 1380. Springer. pp. 163–169. arXiv: quant-ph/9705002 . doi:10.1007/BFb0054319.
  11. Post-quantum cryptography. Daniel J. Bernstein, Johannes Buchmann, Erik, Dipl.-Math Dahmén. Berlin: Springer. 2009. ISBN   978-3-540-88702-7. OCLC   318545517.{{cite book}}: CS1 maint: others (link)
  12. Bernstein, Daniel J. (2021-04-21). "Cost analysis of hash collisions: Will quantum computers make SHARCS obsolete?" (PDF). Conference Proceedings for Special-purpose Hardware for Attacking Cryptographic Systems (SHARCS '09). 09: 105–117.
  13. Viamontes G.F.; Markov I.L.; Hayes J.P. (2005), "Is Quantum Search Practical?" (PDF), Computing in Science and Engineering, 7 (3): 62–70, arXiv: quant-ph/0405001 , Bibcode:2005CSE.....7c..62V, doi:10.1109/mcse.2005.53, S2CID   8929938
  14. Sinitsyn N. A.; Yan B. (2023). "Topologically protected Grover's oracle for the partition problem". Physical Review A. 108 (2): 022412. arXiv: 2304.10488 . doi:10.1103/PhysRevA.108.022412. S2CID   258236417.
  15. Babbush, Ryan; McClean, Jarrod R.; Newman, Michael; Gidney, Craig; Boixo, Sergio; Neven, Hartmut (2021-03-29). "Focus beyond Quadratic Speedups for Error-Corrected Quantum Advantage". PRX Quantum. 2 (1): 010103. arXiv: 2011.04149 . doi: 10.1103/PRXQuantum.2.010103 .
  16. Aaronson, Scott (April 19, 2021). "Introduction to Quantum Information Science Lecture Notes" (PDF).
  17. Nielsen-Chuang
  18. 1 2 Michel Boyer; Gilles Brassard; Peter Høyer; Alain Tapp (1998), "Tight Bounds on Quantum Searching", Fortschr. Phys., 46 (4–5): 493–506, arXiv: quant-ph/9605034 , Bibcode:1998ForPh..46..493B, doi:10.1002/3527603093.ch10, ISBN   9783527603091
  19. Andris Ambainis (2004), "Quantum search algorithms", SIGACT News, 35 (2): 22–35, arXiv: quant-ph/0504012 , Bibcode:2005quant.ph..4012A, doi:10.1145/992287.992296, S2CID   11326499
  20. L.K. Grover; J. Radhakrishnan (2005-02-07). "Is partial quantum search of a database any easier?". arXiv: quant-ph/0407122v4 .
  21. Zalka, Christof (1999-10-01). "Grover's quantum searching algorithm is optimal". Physical Review A. 60 (4): 2746–2751. arXiv: quant-ph/9711070 . Bibcode:1999PhRvA..60.2746Z. doi:10.1103/PhysRevA.60.2746. S2CID   1542077.
  22. Aaronson, Scott. "Quantum Computing and Hidden Variables" (PDF).

Related Research Articles

<span class="mw-page-title-main">Uncertainty principle</span> Foundational principle in quantum physics

The uncertainty principle, also known as Heisenberg's indeterminacy principle, is a fundamental concept in quantum mechanics. It states that there is a limit to the precision with which certain pairs of physical properties, such as position and momentum, can be simultaneously known. In other words, the more accurately one property is measured, the less accurately the other property can be known.

Shor's algorithm is a quantum algorithm for finding the prime factors of an integer. It was developed in 1994 by the American mathematician Peter Shor. It is one of the few known quantum algorithms with compelling potential applications and strong evidence of superpolynomial speedup compared to best known classical algorithms. On the other hand, factoring numbers of practical significance requires far more qubits than available in the near future. Another concern is that noise in quantum circuits may undermine results, requiring additional qubits for quantum error correction.

<span class="mw-page-title-main">Quantum harmonic oscillator</span> Important, well-understood quantum mechanical model

The quantum harmonic oscillator is the quantum-mechanical analog of the classical harmonic oscillator. Because an arbitrary smooth potential can usually be approximated as a harmonic potential at the vicinity of a stable equilibrium point, it is one of the most important model systems in quantum mechanics. Furthermore, it is one of the few quantum-mechanical systems for which an exact, analytical solution is known.

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. 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.

In quantum computing and specifically the quantum circuit model of computation, a quantum logic gate is a basic quantum circuit operating on a small number of qubits. Quantum logic gates are the building blocks of quantum circuits, like classical logic gates are for conventional digital circuits.

<span class="mw-page-title-main">LOCC</span> Method in quantum computation and communication

LOCC, or local operations and classical communication, is a method in quantum information theory where a local (product) operation is performed on part of the system, and where the result of that operation is "communicated" classically to another part where usually another local operation is performed conditioned on the information received.

The hidden subgroup problem (HSP) is a topic of research in mathematics and theoretical computer science. The framework captures problems such as factoring, discrete logarithm, graph isomorphism, and the shortest vector problem. This makes it especially important in the theory of quantum computing because Shor's algorithm for factoring in quantum computing is an instance of the hidden subgroup problem for finite abelian groups, while the other problems correspond to finite groups that are not abelian.

In numerical linear algebra, the method of successive over-relaxation (SOR) is a variant of the Gauss–Seidel method for solving a linear system of equations, resulting in faster convergence. A similar method can be used for any slowly converging iterative process.

<span class="mw-page-title-main">Jaynes–Cummings model</span> Model in quantum optics

The Jaynes–Cummings model is a theoretical model in quantum optics. It describes the system of a two-level atom interacting with a quantized mode of an optical cavity, with or without the presence of light. It was originally developed to study the interaction of atoms with the quantized electromagnetic field in order to investigate the phenomena of spontaneous emission and absorption of photons in a cavity.

In computational complexity theory and quantum computing, Simon's problem is a computational problem that is proven to be solved exponentially faster on a quantum computer than on a classical computer. The quantum algorithm solving Simon's problem, usually called Simon's algorithm, served as the inspiration for Shor's algorithm. Both problems are special cases of the abelian hidden subgroup problem, which is now known to have efficient quantum algorithms.

Quantum walks are quantum analogues of classical random walks. In contrast to the classical random walk, where the walker occupies definite states and the randomness arises due to stochastic transitions between states, in quantum walks randomness arises through: (1) quantum superposition of states, (2) non-random, reversible unitary evolution and (3) collapse of the wave function due to state measurements.

Amplitude amplification is a technique in quantum computing which generalizes the idea behind Grover's search algorithm, and gives rise to a family of quantum algorithms. It was discovered by Gilles Brassard and Peter Høyer in 1997, and independently rediscovered by Lov Grover in 1998.

<span class="mw-page-title-main">Mutually unbiased bases</span>

In quantum information theory, a set of bases in Hilbert space Cd are said to be mutually unbiased to mean, that, if a system is prepared in an eigen state of one of the bases, then all outcomes of the measurement with respect to the other basis are predicted to occur with an equal probability inexorably equal to 1/d.

Quantum complexity theory is the subfield of computational complexity theory that deals with complexity classes defined using quantum computers, a computational model based on quantum mechanics. It studies the hardness of computational problems in relation to these complexity classes, as well as the relationship between quantum complexity classes and classical complexity classes.

In quantum computing, the quantum Fourier transform (QFT) is a linear transformation on quantum bits, and is the quantum analogue of the discrete Fourier transform. The quantum Fourier transform is a part of many quantum algorithms, notably Shor's algorithm for factoring and computing the discrete logarithm, the quantum phase estimation algorithm for estimating the eigenvalues of a unitary operator, and algorithms for the hidden subgroup problem. The quantum Fourier transform was discovered by Don Coppersmith.

The Harrow–Hassidim–Lloyd algorithm or HHL algorithm is a quantum algorithm for numerically solving a system of linear equations, designed by Aram Harrow, Avinatan Hassidim, and Seth Lloyd. The algorithm estimates the result of a scalar measurement on the solution vector to a given linear system of equations.

Quantum counting algorithm is a quantum algorithm for efficiently counting the number of solutions for a given search problem. The algorithm is based on the quantum phase estimation algorithm and on Grover's search algorithm.

In quantum computing, Mølmer–Sørensen gate scheme refers to an implementation procedure for various multi-qubit quantum logic gates used mostly in trapped ion quantum computing. This procedure is based on the original proposition by Klaus Mølmer and Anders Sørensen in 1999-2000.

<span class="mw-page-title-main">Bernstein–Vazirani algorithm</span> Quantum algorithm

The Bernstein–Vazirani algorithm, which solves the Bernstein–Vazirani problem, is a quantum algorithm invented by Ethan Bernstein and Umesh Vazirani in 1997. It is a restricted version of the Deutsch–Jozsa algorithm where instead of distinguishing between two different classes of functions, it tries to learn a string encoded in a function. The Bernstein–Vazirani algorithm was designed to prove an oracle separation between complexity classes BQP and BPP.

In the context of quantum computing, the quantum walk search is a quantum algorithm for finding a marked node in a graph.

References