Skip to content

Quantum Algorithms and Complexity

Quantum algorithms arrange interference so that a measurement reveals useful information about a problem. The gain depends on the problem’s structure and on how its input is supplied. Searching for a marked item, estimating an eigenphase, preparing a solution state and estimating an energy have different outputs and different costs.

This chapter explains the main algorithmic ideas and the limits of their speedups. Begin by asking three questions: what is the input, what output is needed, and what operations are available? Then follow the probability calculation and count the resources required to obtain that output reliably.

Helpful background. The circuit model supplies gates, measurements and classical control. Classical information explains probability and fair comparisons, while quantum oracles distinguishes different ways to access an input.

For a first encounter, begin with algorithmic primitives. Follow Grover search into amplitude amplification to see how reflections rotate amplitude toward useful outcomes. For the second recurring idea, review phase kickback and the Fourier transform before phase estimation: controlled evolution writes a phase into a register, and inverse-Fourier interference decodes it.

Read phase estimation before amplitude estimation, which joins these two routes by estimating the eigenphases of an amplitude-amplification operator. A probability becomes a rotation angle to be inferred, rather than only an outcome to be sampled. The later pages compare the access, precision and repetition costs that make this distinction useful.

What would you like to understand? Pages to read
How an oracle query becomes interference Algorithmic primitives, query complexity
The first exact oracle algorithms Deutsch–Jozsa, Bernstein–Vazirani, Simon
Search and probability estimation Grover search, amplitude amplification, amplitude estimation
Phases, periods and factoring Phase estimation, Shor’s algorithm
Evolution, matrices and graph structure Hamiltonian simulation algorithms, quantum linear algebra, block encodings and QSVT, quantum walks
Optimization with a quantum–classical loop Variational algorithms, QAOA, VQE
Algorithms for scientific and data tasks Quantum machine learning, chemistry and materials, optimization
What speedups are proved or still unknown Quantum complexity classes, lower bounds and limitations

For applications, also ask whether the encoded physical model is appropriate: quantum simulation separates model error from error in solving that model.

A promise states which inputs the algorithm must handle. A worst-case guarantee applies to every promised input; an average over a selected distribution is weaker. For an estimate z^\widehat z of zz, a common requirement is

Pr⁡[∣z^−z∣≤ϵ]≥1−δ.\Pr[|\widehat z-z|\leq\epsilon]\geq1-\delta.

The accuracy ϵ\epsilon and failure probability δ\delta are different parameters. Reducing either can increase the required work. An algorithm returning a quantum state proportional to a solution vector does not automatically return a classical list of all its components. Likewise, one sample from a distribution is different from learning that distribution or estimating an expectation to high precision.

The input description matters just as much. A classical table, a reversible lookup, a prepared state and controlled Hamiltonian evolution are distinct resources. An algorithm may legitimately assume one is supplied, but a practical application must also account for constructing it.

Suppose exactly one of sixteen positions is marked. Both algorithms can query its Boolean predicate; the quantum version can use the reversible query coherently. A target ancilla in ∣−⟩| -\rangle converts that query into a phase flip on the marked address.

Starting from the uniform four-qubit state, three Grover iterations give marked-item probability

P3=sin⁡2(7θ)=0.9613189697265625,sin⁡θ=14.P_3=\sin^2(7\theta)=0.9613189697265625, \qquad \sin\theta=\frac14.

Each iteration uses one predicate query and one diffusion reflection. A final measurement returns one index. The result is not certain, and this one-shot procedure does not include verification or retry.

For a uniformly located mark, three distinct classical queries followed by a guess among the unqueried positions succeed with probability

316+1316113=14.\frac3{16}+\frac{13}{16}\frac1{13}=\frac14.

The extra 1/161/16 comes from the final guess; omitting it would give an unfair finite comparison. These are query-model probabilities. They do not count oracle construction, state preparation, diffusion synthesis, error correction or elapsed time. The Grover page derives the rotation and explains the optimal asymptotic query scaling.

Why three powered calls can cost seven time units

Section titled “Why three powered calls can cost seven time units”

Suppose a supplied eigenstate obeys U∣u⟩=e2πi(3/8)∣u⟩U|u\rangle=e^{2\pi i(3/8)}|u\rangle. Ideal phase estimation uses three controls with controlled powers UU, U2U^2, U4U^4, then an inverse Fourier transform. In most-significant-bit-first notation, the result is 011, representing 3/83/8, with probability one.

There are three calls if each controlled power is an available primitive. If powers are implemented sequentially from base-UU evolution, the total interrogation is 1+2+4=71+2+4=7 time units, while the longest individual block lasts four. Preparation and decoding add further work. The standard circuit must preserve the phase relationships needed for interference across its schedule; a single hardware coherence-time requirement cannot be inferred from the longest power alone. The target must also remain in the relevant eigenphase sector.

One exactly representable phase tests a finite circuit identity. It establishes no asymptotic speedup, and a classical comparison depends on how UU is specified and accessed.

Query count, gate count, circuit depth, memory, number of preparations and physical time measure different resources. For unique-mark search over N=2nN=2^n addresses, Θ(N)\Theta(\sqrt N) queries are a quadratic improvement in NN but still exponential in the address length nn.

An upper bound shows that an algorithm exists. Proving a speedup over every classical algorithm also requires a suitable lower bound. Factoring has a polynomial-time quantum algorithm, but no classical superpolynomial lower bound is known. BQP and BPP have not been proved unequal. Oracle separations answer questions about specified black-box models and do not automatically settle those unrelativized classes.

Hybrid methods add measurement and classical optimization costs. A low VQE training energy alone does not bound the ground-state error: finite sampling, ansatz restrictions, optimization and model errors remain. Selecting the best of many runs also requires counting all those runs and assessing the selected parameters with fresh measurements.

Use algorithmic benchmarking for comparisons at matched output quality, resource estimation tools to translate logical operations into implementation costs, and verification of quantum advantage to distinguish mathematical results from experimental demonstrations. Montanaro’s survey provides a broad introduction to the algorithm families in this chapter.

Rewrite N\sqrt N when N=2nN=2^n. Does Grover search become polynomial in nn?

Solution

N=2n/2\sqrt N=2^{n/2}, which is exponential in nn. The improvement is from a number of queries proportional to NN to one proportional to N\sqrt N, under the unstructured-search assumptions. It is not a general polynomial-time solution of exponentially large search spaces.

For one uniformly located mark among NN positions, query q<Nq<N distinct positions and, after all negative answers, guess uniformly among the rest. Find the total success probability.

Solution

A queried position is marked with probability q/Nq/N. Otherwise the final guess succeeds with conditional probability 1/(N−q)1/(N-q). Thus the total is (q+1)/N(q+1)/N. At q=N−1q=N-1 the promise identifies the last item with certainty without querying it.

If four control qubits use U,U2,U4,U8U,U^2,U^4,U^8, compare the powered-call count, repeated-base-UU count and maximum block duration.

Solution

They are four calls, fifteen base-UU units and eight units respectively. None includes state preparation or inverse-Fourier decoding. These counts coincide neither with one another nor with a hardware runtime unless an implementation model connects them.

A circuit produces one nn-bit sample from q(x)q(x). Has it returned a classical description of all 2n2^n probabilities?

Solution

No. It returns one outcome, not the probability attached to every possible outcome. Reconstructing the distribution or estimating selected observables is a different statistical task requiring additional samples and assumptions. A speedup comparison must give both methods the same requested output.

  • C. H. Bennett, E. Bernstein, G. Brassard, and U. Vazirani, “Strengths and Weaknesses of Quantum Computing,” SIAM Journal on Computing 26, 1510–1523 (1997), doi:10.1137/S0097539796300933.
  • L. K. Grover, “A Fast Quantum Mechanical Algorithm for Database Search,” in Proceedings of the 28th Annual ACM Symposium on Theory of Computing, 212–219 (1996), doi:10.1145/237814.237866.
  • A. Montanaro, “Quantum Algorithms: An Overview,” npj Quantum Information 2, 15023 (2016), doi:10.1038/npjqi.2015.23.
  • M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th Anniversary Edition, Cambridge University Press (2010), doi:10.1017/CBO9780511976667.
  • P. W. Shor, “Algorithms for Quantum Computation: Discrete Logarithms and Factoring,” in Proceedings of the 35th Annual Symposium on Foundations of Computer Science, 124–134 (1994), doi:10.1109/SFCS.1994.365700.