Level 3 · Algorithms
Quantum Algorithms
About 5,020 words · roughly 23 minute read · sources checked December 2, 2026
A quantum algorithm is a recipe for choosing a circuit so that interference concentrates probability on a useful answer. Dozens of such recipes exist, and they fall into a small number of families. This lesson maps the landscape, works through the foundational ones in enough detail that you can reproduce the arithmetic, and is explicit about which speed-ups are proven, which are conjectured and which come with fine print that popular articles omit.
The next two lessons treat the two most famous algorithms, Shor’s and Grover’s, in full. Here we build the toolkit they rely on: oracles and query complexity, the quantum Fourier transform, and phase estimation. We also look at the two application areas that dominate current research, simulation of quantum systems and variational methods, and at the limits that rule out the most optimistic claims.
You should be comfortable with gates, superposition and entanglement from Level 2. Every numerical example below was checked by computing the circuit with matrices.
What you will learn
- The difference between oracle (query) speed-ups and end-to-end speed-ups.
- The main algorithm families and the size of speed-up each is known or believed to give.
- Deutsch–Jozsa and Simon’s problem, worked by hand.
- The quantum Fourier transform and how phase estimation uses it.
- How Trotterisation simulates dynamics, with its error scaling.
- What variational algorithms do and why they are heuristic.
- The four caveats attached to HHL-type linear-algebra speed-ups.
- What the BBBV theorem says quantum computers cannot do for search.
Helpful first: Quantum Gates, Superposition, Entanglement.
What counts as a quantum algorithm, and what counts as a speed-up
A quantum algorithm specifies a family of circuits, one for each input size, together with a classical rule for interpreting the measurement results. Its cost is counted in the number of gates (time) and the number of qubits (space), as a function of the input size. A speed-up means that this cost grows more slowly than the cost of the best classical algorithm for the same task.
Speed-ups come in several sizes, and it is essential to say which one is meant.
| Kind of speed-up | Meaning | Example |
|---|---|---|
| Exponential or super-polynomial | Quantum cost is polynomial, the best known classical cost is not | Shor’s factoring; simulating some quantum systems |
| Polynomial (often quadratic) | Quantum cost is, say, the square root of the classical cost | Grover search: N versus √N |
| Query separation | Fewer calls to a black-box function, proven for the oracle model | Deutsch–Jozsa, Bernstein–Vazirani, Simon |
| Heuristic or empirical | Works well on some instances, with no proof of a general advantage | Variational algorithms, quantum annealing |
| None | No known advantage | Most everyday computing |
Kinds of quantum advantage. The kind matters more than the headline.
Oracles and query complexity
Many foundational results are stated in the query model. A black box, the oracle, computes a function f. The algorithm may call it, but cannot look inside, and the cost is the number of calls. This model is useful because it lets us prove lower bounds, which are almost impossible to prove for ordinary running time. The price is that the results describe the oracle, not the real world: when the oracle is replaced by an actual circuit, a smart classical algorithm may exploit its structure and the separation can vanish.
Why this matters for headlines
A proven query separation is a mathematical fact about a model. An end-to-end speed-up on a real problem is a separate and harder claim. Shor’s algorithm is notable because it is the rare case where an actual, structured problem, factoring, has an exponential-style gain.
The landscape in one table
Ashley Montanaro’s 2016 survey ‘Quantum algorithms: an overview’ groups the known algorithms by application. It reports that the speed-ups fall into two broad bands. The table below follows its classification.
| Family | Representative algorithms | Stated speed-up | Main caveat |
|---|---|---|---|
| Hidden subgroup, cryptography | Shor’s factoring and discrete logarithm | Super-polynomial: O((log N)³) quantum gates for factoring N, against the best known classical super-polynomial cost | Needs large fault-tolerant machines |
| Search and optimisation | Grover, amplitude amplification, minimum finding | Quadratic: O(N) → O(√N) evaluations | Quadratic gains are easily eaten by quantum overheads |
| Simulation of quantum systems | Digital simulation, Trotter and related methods | Exponential over the best general classical algorithms known | Classical heuristics are strong for many systems |
| Quantum walks | Glued-trees, element distinctness, formula evaluation | Exponential for glued trees; polynomial for most others | Exponential speed-ups need structure or a promise on the input |
| Linear algebra | HHL for linear systems | Exponential in the idealised setting | Sparsity, conditioning, state loading and limited output (see below) |
| Few-qubit applications | Boson sampling, small variational circuits | Experimental demonstrations and heuristics | No proven practical advantage |
A summary of the families in Montanaro’s survey. The survey also notes that exponential query-complexity speed-ups require a promise on the input.
Two observations stand out. First, the number of fundamentally different ideas is small: Fourier transform and phase estimation, amplitude amplification, quantum walks, and simulation. Second, almost every large speed-up depends on the same feature of the problem, a hidden regularity (a period, a symmetry, a Hamiltonian) that interference can pick out. Problems without such structure get at most a quadratic gain.
Deutsch–Jozsa: the first exponential query separation
The Deutsch problem from the previous level asked whether a one-bit function is constant or balanced. Deutsch and Jozsa generalised it to n bits. A function f maps n-bit strings to one bit, and you are promised that it is either constant (the same output for all 2ⁿ inputs) or balanced (output 0 for exactly half the inputs and 1 for the other half). The task is to decide which.
Classically a deterministic algorithm may need 2ⁿ⁻¹ + 1 queries in the worst case, because the first 2ⁿ⁻¹ answers could all agree and still not settle the matter. The quantum circuit needs one query.
- Prepare n qubits in |0…0⟩ and one extra qubit in |1⟩. Apply H to all n + 1 qubits.
- Call the oracle. Because the extra qubit is in |−⟩, phase kickback gives the state (1/√2ⁿ) Σₓ (−1)^f(x) |x⟩.
- Apply H to the n input qubits and measure them. If the result is 0…0, f is constant. Any other result means f is balanced.
Worked example
Why the all-zero outcome signals ‘constant’ (n = 3)
- After the oracle, the amplitude on the string 000 after the final Hadamards is (1/2ⁿ) Σₓ (−1)^f(x), the average of the signs. This is the overlap with the uniform state.
- If f is constant, every sign is the same, so the average is ±1 and the probability of 000 is 1.
- If f is balanced, half the signs are +1 and half are −1, so the average is exactly 0 and the probability of 000 is 0. Any other string is then observed.
- I checked numerically with n = 3: constant functions give P(000) = 1, and the balanced functions f(x) = lowest bit of x, f(x) = parity of x and f(x) = [x < 4] all give P(000) = 0.
- So one query decides, with certainty, a question that needs up to 5 classical queries for n = 3 (2² + 1 = 5) and 2ⁿ⁻¹ + 1 queries in general.
How impressive is it really?
A randomised classical algorithm that queries about 12 random inputs distinguishes constant from balanced functions with error probability below one in a thousand (a balanced function gives 12 equal answers with probability about 2⁻¹¹), which makes the practical gap tiny. The separation is large only against deterministic classical algorithms, and the problem is chosen to showcase the quantum method, not to be useful. Its importance is historical: it showed in 1992 that a quantum computer could beat any deterministic classical algorithm exponentially in the query model.
Simon’s problem: the idea behind Shor
Daniel Simon’s 1994 problem is the first oracle problem where a quantum computer gets an exponential advantage even over randomised classical algorithms. A function f from n bits to n bits has a hidden string s with the property f(x) = f(y) exactly when y = x or y = x ⊕ s. The function is two-to-one, and the collisions are determined by s. The goal is to find s.
Classically you must find a collision, and by the birthday argument this takes about 2^(n/2) queries. The quantum algorithm uses about n queries. Its structure is a template that Shor’s algorithm later reused.
- Prepare (1/√2ⁿ) Σₓ |x⟩|0⟩ with Hadamards.
- Query the oracle to get (1/√2ⁿ) Σₓ |x⟩|f(x)⟩.
- Measure the second register. This leaves the first register in an equal superposition of two strings: (|x₀⟩ + |x₀ ⊕ s⟩)/√2 for a random x₀.
- Apply Hadamards to the first register and measure. The outcome y is uniformly random among strings satisfying y · s = 0 (mod 2).
- Repeat about n times to collect n − 1 independent equations y · s = 0, and solve them to find s.
Worked example
Simon with n = 2 and s = 11
- Take f(00) = f(11) = 0 and f(01) = f(10) = 1. Then f(x) = f(x ⊕ 11) for every x, so s = 11.
- Measure the second register. With outcome 0 the first register is (|00⟩ + |11⟩)/√2. With outcome 1 it is (|01⟩ + |10⟩)/√2.
- Apply H ⊗ H. In both cases the amplitude is concentrated on the strings 00 and 11, each with probability ½. I confirmed this numerically.
- Those are exactly the strings y with y · 11 = y₁ ⊕ y₂ = 0. The outcome 00 tells you nothing, but the outcome 11 gives the equation y · s = 0 with y = 11, which says s₁ ⊕ s₂ = 0, so s = 11 (since s ≠ 00).
- Each run gives a useful equation with probability ½, so a few runs suffice.
The key move is the same as in Shor’s algorithm: build a superposition that has the hidden regularity (the shift s, or a period) built into its structure, then use a Fourier transform, here a Hadamard transform over bit strings, to make the regularity visible. Simon’s algorithm inspired Shor, who replaced the group of bit strings with the integers modulo a large number.
The quantum Fourier transform
The discrete Fourier transform takes a list of N numbers and re-expresses it in terms of waves of different frequencies. The quantum Fourier transform (QFT) does the same to the amplitudes of an n-qubit state, with N = 2ⁿ. It maps the basis state |j⟩ to a uniform superposition of all basis states with phases that wind around the circle at a speed proportional to j.
QFT |j⟩ = (1/√N) Σ_k e^(2πi·jk/N) |k⟩
It is unitary, so it is a legitimate gate. Its great advantage is cost. A classical fast Fourier transform on N = 2ⁿ numbers takes about n·2ⁿ operations. The QFT can be built from about n²/2 gates, namely Hadamards and controlled phase rotations. That is an exponential saving, but with the usual caveat: you cannot read out all N Fourier coefficients. The value of the QFT is that it turns hidden periodicity in the amplitudes into a sharp peak that a measurement can find.
Worked example
The two-qubit QFT as a matrix
- For N = 4 the entries are (1/2)·i^(jk), where ω = e^(2πi/4) = i.
- Row j = 1 is (1/2)(1, i, −1, −i), row j = 2 is (1/2)(1, −1, 1, −1) and row j = 3 is (1/2)(1, −i, −1, i). I confirmed these entries by computing the matrix.
- Apply it to |1⟩, which is the second column of the matrix, (1/2)(1, i, −1, −i)ᵀ. The amplitudes all have size ½, so a measurement gives each outcome with probability ¼, but the phases step around by 90° each time.
- The input |1⟩ and the input |2⟩ give the same probabilities but different phase patterns. The QFT converts frequency information into phase patterns, and the next stage of an algorithm reads them with interference.
What the QFT is for
It is rarely used on its own. It is the final step in algorithms that arrange a state whose amplitudes are periodic, so that the QFT turns the period into a peak. Shor’s algorithm and phase estimation both work this way.
Phase estimation
Many problems reduce to the following. You have a unitary U and an eigenstate |u⟩ with U|u⟩ = e^(2πiφ)|u⟩, and you want the number φ between 0 and 1. Phase estimation finds φ to t binary digits using t extra qubits and one controlled use of U^(2^k) for each k.
- Put t counting qubits in the uniform superposition, and the second register in the eigenstate |u⟩.
- For counting qubit k, apply controlled-U^(2^k). By phase kickback, counting qubit k acquires the phase e^(2πi·2^k·φ).
- The counting register now holds (1/√2ᵗ) Σ_j e^(2πi·φ·j)|j⟩, a Fourier-transform state with frequency φ.
- Apply the inverse QFT and measure the counting register. The result is the integer closest to 2ᵗφ.
Worked example
An exact case: φ = 3/8 with t = 3
- Since 3/8 = 0.011 in binary, 2ᵗφ = 8 × 3/8 = 3 is an integer, so the answer is exactly representable.
- After the controlled powers, the counting register holds (1/√8) Σ_j e^(2πi·3j/8)|j⟩, which is exactly the QFT of |3⟩.
- The inverse QFT therefore maps it to |3⟩ = |011⟩. The probability of reading 011 is 1, as I confirmed numerically.
- Read off the answer: 011 as a binary fraction is 0.011 = 3/8. ✓
Worked example
An inexact case: φ = 1/3 with t = 3 and t = 6
- Now 2ᵗφ = 8/3 ≈ 2.67 is not an integer. The nearest integers are 3 and 2, and the best estimate is 3/8 = 0.375.
- The measured distribution with t = 3 peaks at 011 with probability about 0.69, with weight 0.175 on 010 and smaller weights elsewhere. So one shot gives the best 3-bit answer about 69% of the time.
- With t = 6, 2ᵗφ = 64/3 ≈ 21.3. The result 21 (010101) has probability about 0.68, and the estimate is 21/64 = 0.328 versus the true 0.3333.
- Adding bits sharpens the estimate, and a general result says that with t + O(log(1/δ)) counting qubits the answer is within 2⁻ᵗ of φ with probability at least 1 − δ.
Phase estimation is the workhorse of the field. Shor’s algorithm is phase estimation applied to modular multiplication. Quantum chemistry algorithms apply it to the time-evolution operator e^(−iHt) of a molecule to read out the energy levels. The cost is dominated by the controlled powers of U, whose number doubles with each extra bit of precision, so the total running time grows as 1/precision.
Simulating quantum systems
Feynman’s original motivation remains the most credible use of a quantum computer. The task is to approximate the time-evolution e^(−iHt) of a Hamiltonian H, which lets you study dynamics, or, with phase estimation, find energy levels. Most Hamiltonians are sums of simple pieces, H = H₁ + H₂ + …, where each e^(−iHₖt) is easy to implement but the pieces do not commute, so e^(−i(H₁+H₂)t) differs from e^(−iH₁t)e^(−iH₂t).
The Trotter–Suzuki approach splits the time t into n small steps and applies the pieces one after another in each step. As n grows, the error shrinks.
e^(−i(A+B)t) ≈ ( e^(−iAt/n) e^(−iBt/n) )ⁿ, error = O(t²/n)
Worked example
Trotter error in numbers
- Take A = X, B = Z (which do not commute) and t = 1. Compare the exact e^(−i(X+Z)) with the product formula, measuring the error as the operator norm of the difference.
- First-order formula: n = 1 gives error 0.80, n = 2 gives 0.36, n = 4 gives 0.18, n = 8 gives 0.088, n = 16 gives 0.044 and n = 32 gives 0.022. The error halves each time n doubles, which is the 1/n scaling.
- Second-order (symmetric) formula e^(−iAt/2n) e^(−iBt/n) e^(−iAt/2n): n = 1 gives 0.31, n = 2 gives 0.071, n = 4 gives 0.017 and n = 8 gives 0.0043. The error falls by about 4 each time n doubles, the 1/n² scaling.
- To reach an error of 0.01 the first-order rule needs about n ≈ 70 steps for this toy example (extrapolating 0.022 at n = 32), whereas the second-order rule needs about n ≈ 6. Higher-order formulas and newer methods reduce the cost further.
The simulation cost grows polynomially with the number of qubits, the evolution time and the inverse accuracy, while exact classical simulation grows exponentially in the number of qubits. That is the basis of the claimed exponential advantage. The honest qualification is that classical methods, such as density-functional theory, tensor networks and quantum Monte Carlo, are very strong for many realistic systems, so the advantage is expected mainly for strongly correlated systems. How large the practical advantage will be is an open question, and resource estimates for useful chemistry problems typically require fault-tolerant machines with many logical qubits.
Quantum walks and amplitude estimation
Two more tools appear throughout Montanaro’s survey and are worth knowing by name.
Quantum walks
A random walk on a graph, where a particle moves to a random neighbour at each step, underlies many classical algorithms. Its quantum analogue lets amplitudes spread along the edges and interfere, so the walker can reach distant parts of a graph faster. The survey notes that for some graphs, such as the so-called glued-trees graph, the hitting time of a quantum walk is exponentially smaller than classical, though in the same breath it states that exponential query speed-ups require a promise on the input and that for mixing times quantum walks give at most a quadratic separation. Quantum walks are the basis of polynomial speed-ups for element distinctness and for evaluating Boolean formulas, and they give quadratic gains for speeding up Markov-chain algorithms.
Amplitude estimation
Many practical tasks need a number, not a search: the expected value of a random quantity, the probability of an event, or the integral of a function. Classical Monte Carlo estimates such a number to accuracy ε using about 1/ε² samples. Amplitude estimation combines the Grover iteration with phase estimation and reaches accuracy ε with about 1/ε uses of the underlying procedure, a quadratic improvement. It is the quantum counting idea applied to a general probability, and it is the basis of proposed speed-ups for financial risk calculations.
Worked example
What a quadratic gain means for Monte Carlo
- Suppose a risk estimate needs accuracy ε = 10⁻³. Classical Monte Carlo needs about 1/ε² = 10⁶ samples.
- Amplitude estimation needs about 1/ε = 10³ coherent applications of the sampling circuit, a factor of 1,000 fewer, ignoring constants.
- But each coherent application is a quantum circuit that must run fault-tolerantly and sequentially, perhaps millions of times slower per step than a classical sample on a GPU. If each quantum step is 10⁴ times slower than a classical sample, the net gain is only about 1,000/10⁴ = 0.1, a loss.
- The break-even depends on the ratio of speeds, and on the cost of the circuit that generates the samples. This is why such claims need a careful end-to-end resource estimate before they mean anything for practice.
- I give the 10⁴ ratio only as an illustration of how the comparison works. Real ratios depend on the hardware and the problem.
How to read an algorithm claim
Every speed-up in this lesson comes with fine print, and four questions cover most of it. What is the input model: is it a function given as a black box, or an explicit dataset that must be loaded? What is the comparison: against the best classical algorithm, or against a weak one? What is the size of the gain: exponential, polynomial, or quadratic? And what is the end-to-end cost once error correction, state loading and readout are included? An answer that is clear on all four is worth taking seriously.
Variational algorithms: heuristics for noisy machines
Phase estimation needs long, coherent circuits that today’s devices cannot run. Variational algorithms were proposed to do something useful with short circuits. The first well-known one is the variational quantum eigensolver (VQE), introduced by Peruzzo and colleagues. Their abstract describes it as an alternative to quantum phase estimation that greatly reduces the coherence requirements, combining state preparation based on an ansatz with classical optimisation. They demonstrated it by computing the ground-state energy of the molecule He–H⁺ to within chemical accuracy on a small photonic quantum processor.
The loop has four parts.
- Choose a parameterised circuit (the ansatz) that prepares a trial state |ψ(θ)⟩.
- On the quantum computer, measure the expectation value E(θ) = ⟨ψ(θ)|H|ψ(θ)⟩, estimated from many shots of a few measurement settings.
- On a classical computer, use an optimiser to propose new parameters θ.
- Repeat until the energy stops decreasing.
The variational principle guarantees that E(θ) is never below the true ground-state energy, so a lower estimate is better, and the quantum computer is used only for the part that is hard classically, evaluating the energy of an entangled trial state.
Worked example
A one-parameter variational problem
- Let H = Z + 0.5·X on one qubit and the ansatz |ψ(θ)⟩ = Ry(θ)|0⟩ = cos(θ/2)|0⟩ + sin(θ/2)|1⟩.
- The expectation values are ⟨Z⟩ = cos θ and ⟨X⟩ = sin θ, so E(θ) = cos θ + 0.5 sin θ.
- The minimum is at the angle where the derivative vanishes: −sin θ + 0.5 cos θ = 0, giving tan θ = 0.5 on the branch that gives a minimum, θ = π + arctan(0.5) ≈ 3.605 rad. Then E = −√(1 + 0.25) = −1.118.
- The exact ground-state energy of H is −√(1² + 0.5²) = −1.118 as well, so this one-parameter ansatz is exact here.
- For molecules, the ansatz has many parameters and the energy surface can have many local minima, so the optimiser may get stuck. This is the central difficulty.
What is and is not known
Variational algorithms are heuristics. There is no proof that they beat classical methods on any problem of practical interest, and noise, optimisation difficulties and the number of measurement shots needed are real obstacles. They are best treated as tools for exploring small systems on today’s devices, not as an established path to quantum advantage.
Linear systems and the fine print
In 2008 Harrow, Hassidim and Lloyd (HHL) proposed a quantum algorithm for solving a system of linear equations A x = b. Under certain conditions it runs in time polylogarithmic in the dimension N, an exponential improvement over classical methods that take time polynomial in N. Because linear systems appear throughout science and machine learning, the result generated much excitement and many follow-on claims about quantum machine learning.
The excitement needs context. In a widely read piece on quantum machine learning, Scott Aaronson spelled out the conditions, often called the fine print. From the post and the discussion around it, they are as follows.
- Sparsity. The matrix A must be sparse (few non-zero entries per row), so that the unitary e^(−iAt) can be implemented efficiently.
- Good conditioning. A must be well conditioned: the ratio of its largest to smallest singular value cannot be too large. The running time grows with this condition number.
- State preparation. The input vector b must be loaded as a quantum state |b⟩ efficiently. For a generic classical vector of N numbers, loading takes about N operations and removes the advantage.
- Limited output. The algorithm does not return the solution vector x. It returns a quantum state |x⟩, from which one can estimate certain properties, such as an expectation value ⟨x|M|x⟩. Reading out all N entries would again cost about N.
Worked example
Why the output limitation matters
- Suppose N = 2³⁰ ≈ 10⁹, the solution state |x⟩ lives on 30 qubits, and you want the whole vector of 10⁹ numbers.
- Each measurement of |x⟩ gives one index, sampled with probability |xᵢ|². To estimate all entries to useful accuracy you need at least of order N samples, so the polylogarithmic runtime is lost.
- If instead you need one number, such as the overlap of x with a given vector, a handful of repetitions (inversely proportional to the square of the accuracy) may suffice, and the exponential gain can survive.
- So HHL is a subroutine for questions about the solution, not a general-purpose solver. The same logic applies to the claimed quantum speed-ups in recommendation systems and other machine-learning tasks.
Montanaro’s survey notes the same pattern: the exponential speed-up for linear systems holds under sparsity and condition-number constraints. A further development worth knowing is that several quantum machine-learning speed-ups were later matched by classical algorithms designed with similar data-access assumptions, a development sometimes called dequantisation. The practical lesson is to always ask what the input is, how it is loaded, and what exactly is read out.
What quantum computers provably cannot do
Knowing the limits is as important as knowing the successes. In 1997 Bennett, Bernstein, Brassard and Vazirani proved a basic limit. They asked whether quantum computers could solve NP-complete problems, which would follow if search could be done in polynomial time. Their paper shows that relative to a random oracle, NP cannot be solved on a quantum Turing machine in time o(2^(n/2)) with probability 1. In the black-box setting, searching a space of N = 2ⁿ items needs about √N queries, which is exactly what Grover’s algorithm achieves. So the quadratic speed-up is optimal for unstructured search.
The result is a relativised one. It shows that no algorithm treating the problem as a black box can do better than quadratic. It does not rule out a clever algorithm that exploits the internal structure of a particular NP-complete problem, but nobody knows of one, and the general belief among researchers is that quantum computers do not solve NP-complete problems in polynomial time.
| Common claim | What is actually known |
|---|---|
| Quantum computers solve NP-hard problems quickly | No known polynomial-time algorithm; generic search is limited to a quadratic gain (BBBV, 1997) |
| Quantum computers try all possibilities at once | Measurement returns one outcome; algorithms must use interference |
| Every problem speeds up | Speed-ups need structure; many problems have none known |
| Quantum computing breaks all cryptography | It breaks RSA and elliptic-curve schemes via Shor; symmetric ciphers lose about half their key length against Grover; post-quantum schemes are designed to resist both |
| Quantum computers can solve undecidable problems | No. They compute the same functions as classical computers, only possibly faster |
Another way to put the limits: the class of problems solvable efficiently by a quantum computer, BQP, is believed to lie strictly between P and PSPACE and not to contain the NP-complete problems. The Level 5 lesson on complexity theory explains these classes.
How to evaluate any quantum algorithm claim
The families above give a way to cross-examine a claim. Use these questions.
- Which family is it, and what size of speed-up does that family offer? A quadratic claim is believable for search. An exponential claim for optimisation should raise questions.
- What is the hidden structure? If you cannot name the regularity that interference exploits, be sceptical.
- Is it an oracle result or end-to-end? If an oracle is used, what does it cost to build?
- How is the input loaded, and what is read out? Count these costs. Loading N numbers costs about N.
- What does the best classical algorithm do, including heuristics? A speed-up over brute force is not a speed-up over the best classical method.
- How many logical qubits and operations are needed, and on what error model? An algorithm that needs 10⁹ operations needs error correction.
Worked example
A checklist applied: ‘quantum portfolio optimisation’
- Family: optimisation, so at best a quadratic speed-up from Grover-type amplitude amplification, unless a specific structure is exploited.
- Structure: portfolio problems often reduce to quadratic programs that classical solvers handle at scale. The claim needs a specific hard instance family.
- Input and output: asset data is a classical dataset of manageable size, so loading is not the issue, and the output is a vector of weights, which is a classical object to read.
- Classical baseline: mature convex and integer-programming solvers. A quantum method must beat these on real instances, not on random ones.
- Verdict: possible modest gains on specific large instances in the long run, not a near-term exponential advantage. Ask for the benchmark.
Common misunderstandings
| Misunderstanding | Correction |
|---|---|
| All quantum algorithms give exponential speed-ups | Only a few do. The most general, Grover, gives a quadratic one, which is provably optimal for unstructured search. |
| A query separation is a real-world speed-up | It is a statement about an oracle model. Real problems must supply a concrete oracle circuit. |
| The QFT lets you read an exponentially large spectrum | It converts hidden periodicity into a peak you can sample. It does not output all Fourier coefficients. |
| HHL solves Ax = b exponentially faster | Only under four conditions, and it returns properties of the solution, not the solution vector. |
| Variational algorithms are proven to give quantum advantage | They are heuristics. No general advantage has been proven. |
| Quantum algorithms need no classical computation | Every real algorithm has classical pre- and post-processing, and many are hybrid. |
Practice problems
Check yourself
How many queries does the Deutsch–Jozsa algorithm use for n = 20, and how many does a deterministic classical algorithm need in the worst case?
One query. A deterministic classical algorithm needs 2¹⁹ + 1 = 524,289 queries in the worst case.
In Deutsch–Jozsa the final measurement gives 101. Is f constant or balanced?
Balanced. A constant function would give 000 with certainty.
For Simon’s problem with n = 3, roughly how many quantum queries are needed, and why?
About n = 3, plus repetition: each run gives an equation y · s = 0, and you need n − 1 = 2 independent ones. Classically about 2^(n/2) queries are needed by the birthday argument.
Write the 2-qubit QFT matrix row for j = 2.
(1/2)(1, −1, 1, −1), since ω = i and ω^(2k) = (−1)^k.
In phase estimation with t = 4 counting qubits, φ = 5/16. What is measured?
2ᵗφ = 5, so the outcome is 0101 with probability 1, and the binary fraction 0.0101 = 5/16.
With first-order Trotter steps, the error at n = 10 is 0.08. About what n gives 0.01?
The error scales as 1/n, so n ≈ 80.
Name the four caveats of HHL.
Sparse A, small condition number, efficient preparation of |b⟩, and output limited to properties of the solution state.
What does the BBBV theorem say about searching 2ⁿ items?
Any quantum algorithm needs about 2^(n/2) queries relative to a random oracle, so Grover’s quadratic speed-up is optimal.
Why is VQE called a heuristic?
It has no proof of reaching the true ground state or of beating classical methods. The optimisation can stall in local minima.
References and further reading
The explanations and calculations are written for this site; every numerical example was checked with matrices. I opened the arXiv abstracts of Montanaro’s survey, Bennett–Bernstein–Brassard–Vazirani and the Peruzzo et al. variational paper, and Aaronson’s blog post on the quantum machine learning fine print (the four caveats are taken from that post and its comments; his full essay was not opened). The Deutsch–Jozsa, Simon and Harrow–Hassidim–Lloyd papers were not opened, so their details are given from the standard literature.
- Quantum algorithms: an overview (npj Quantum Information 2, 15023 (2016), A. Montanaro) Opened. Families of algorithms and the stated size of each speed-up.
- Strengths and Weaknesses of Quantum Computing (arXiv quant-ph/9701001, C. H. Bennett, E. Bernstein, G. Brassard, U. Vazirani) Opened. Oracle lower bound for search; tightness via Grover.
- A variational eigenvalue solver on a quantum processor (arXiv:1304.3061, A. Peruzzo et al.; Nature Communications 5, 4213 (2014)) Opened. VQE and the He–H⁺ demonstration on a photonic processor.
- Quantum Machine Learning Algorithms: Read the Fine Print (Scott Aaronson, Shtetl-Optimized blog) Opened. The four caveats attached to HHL-type speed-ups; his full essay was not opened.
- Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer (arXiv, P. W. Shor) Source of the period-finding idea built on the QFT.
- A fast quantum mechanical algorithm for database search (arXiv, L. K. Grover) Quadratic search speed-up.
- What Makes Quantum Computing So Hard to Explain? (Quanta Magazine, Scott Aaronson, June 8, 2021) Interference as the resource; limits of speed-ups.
- Simulating Physics with Computers (International Journal of Theoretical Physics, R. P. Feynman, 1982) Motivation for quantum simulation.
- Physics 219 Quantum Computation: lecture notes (John Preskill, Caltech) Free notes on the Fourier transform, phase estimation and simulation.
Key terms in the dictionary