๐Ÿงฎ Intermediate Quantum Algorithms

Where Provable Speedups Live, and What Each One Assumes

๐Ÿ“– Reading Time: 20-25 minutes ๐Ÿ“Š Difficulty: Beginner ๐Ÿ’ป Code Examples: 0 ๐Ÿ“ Exercises: 0

๐ŸŒ EN | ๐Ÿ‡ฏ๐Ÿ‡ต JP | Last sync: 2026-08-13

AI Terakoya Topโ€บFundamental Mathematics Dojoโ€บIntermediate Quantum Algorithms

โ† Back to Fundamental Mathematics Dojo

๐ŸŽฏ Series Overview

This series is the sequel to Introduction to Quantum Computing. That course took the shortest honest path from a single qubit to a variational calculation of a molecular ground state, and it was explicit about what it was leaving out: Grover's algorithm, the quantum Fourier transform, phase estimation, Shor's algorithm, the modern Hamiltonian-simulation methods, and QAOA all appeared as names in a table of contents that was never written. This course writes it.

The organizing question is in the subtitle. Quantum algorithms are usually presented as a list of speedups, and the list is misleading, because the speedups are not the same kind of object. Grover's quadratic speedup is provable and optimal, and it is also small enough that constant factors, clock rates and error-correction overhead can eat it entirely. Shor's speedup is superpolynomial, and it applies to one problem with a very particular algebraic structure. Phase estimation with qubitization gives a provable advantage on a problem โ€” the eigenvalues of a many-body Hamiltonian โ€” that a materials researcher actually has. QAOA gives no proven advantage at all. Presenting these as five entries in the same list is the central dishonesty of the popular account, and this course does not commit it: every speedup in these five chapters is stated together with the assumptions it needs, and the assumptions are checked.

The second commitment is that everything runs. The introductory course built a state-vector simulator out of ninety-nine lines of NumPy; every algorithm here is implemented on that same simulator, from Grover on ten qubits to the end-to-end factorization of 15 and 21. There is no SDK, no hardware backend, and no result you cannot reproduce and take apart. Where an algorithm is too large to run โ€” a resource estimate for an industrially relevant Hamiltonian โ€” the estimate is computed from the formulas rather than quoted.

Learning Path

flowchart LR P1["Prerequisite
Quantum computing
introduction"] A["Chapter 1
Amplitude
amplification"] B["Chapter 2
QFT and phase
estimation"] C["Chapter 3
Shor's
algorithm"] D["Chapter 4
Hamiltonian
simulation"] E["Chapter 5
QAOA and
optimization"] P1 --> A A --> B B --> C B --> D A --> E B --> E C --> E D --> E style P1 fill:#e2e8f0,stroke:#94a3b8,stroke-width:1px,color:#334155 style A fill:#667eea,stroke:#764ba2,stroke-width:2px,color:#fff style B fill:#7b2cbf,stroke:#764ba2,stroke-width:2px,color:#fff style C fill:#7b2cbf,stroke:#764ba2,stroke-width:2px,color:#fff style D fill:#7b2cbf,stroke:#764ba2,stroke-width:2px,color:#fff style E fill:#9d4edd,stroke:#764ba2,stroke-width:2px,color:#fff

Chapter 1 is self-contained and can be read first or last; it is placed first because the oracle model and the honest accounting it introduces are used in every later chapter. Chapter 2 is the load-bearing one: Chapter 3 cannot be read without its phase-estimation implementation, and Chapter 4's block encodings are built on the same controlled-unitary machinery. Chapter 5 assumes all four, because its closing section is a map of the whole subject.

๐Ÿ“‹ Learning Objectives

On finishing this series you will be able to:

๐Ÿ“– Prerequisites

Required. Introduction to Quantum Computing, or equivalent fluency with: state vectors and unitary gates, the big-endian qubit convention, the ninety-nine-line state-vector simulator of that course's Chapter 2, and the variational eigensolver of its Chapter 3. This course re-lists the simulator functions each chapter needs, but it does not re-derive them.

Required. Linear algebra โ€” eigenvalues and eigenvectors, tensor products, unitary and Hermitian matrices โ€” and enough elementary number theory to be comfortable with modular arithmetic. Chapter 3 develops the number theory it needs from scratch, including continued fractions.

Required. Python 3.8 or later with NumPy, SciPy and Matplotlib. There is no quantum SDK and no hardware backend anywhere in this series.

Recommended. Introduction to Quantum Hardware, for the physical meaning of the gate times and error rates that Chapters 1 and 4 use in their resource estimates. Introduction to Quantum Machine Learning, for the same evaluation discipline applied to a different subfield.


๐Ÿ“š Chapters

Chapter 1: Amplitude Amplification and Grover's Algorithm

The oracle model stated honestly: what a phase oracle is, what it is not, and what happens to the accounting when you write one out as a circuit and count the gates. Grover's algorithm derived as a product of two reflections, which is a rotation by $2\theta$ in the two-dimensional plane spanned by the marked and unmarked states, with the exact optimal iteration count $\lfloor \pi/(4\arcsin\sqrt{M/N}) \rfloor$ and the over-rotation that follows from running longer. The general form โ€” amplitude amplification around any state preparation $A$ โ€” which is the version that appears as a subroutine everywhere else. Closes with the honest assessment: four separate ways in which constant factors, clock rates, imperfect parallelism and error-correction overhead consume a quadratic speedup, why unstructured search is not database search, and what the QRAM problem does to the latter.

Key topics : phase oracle ยท query model ยท oracle as a circuit ยท two reflections ยท optimal iteration count ยท over-rotation ยท amplitude amplification ยท exact amplification ยท quadratic speedup accounting ยท QRAM ยท unknown number of solutions

๐Ÿ’ป 7 Code Examples โฑ๏ธ 45-50 minutes ๐Ÿ“Š Intermediate

Read Chapter 1 โ†’

Chapter 2: QFT and Phase Estimation

The QFT as a circuit of $O(n^2)$ gates, and the crucial difference from the classical FFT: the transform is applied to amplitudes that cannot be read out, so the QFT is never a data-processing routine but always a step that converts a period into a measurable bit string. Phase estimation built on top of it โ€” controlled unitaries, the inverse transform, and the exact relation between the number of ancilla bits and the achievable precision and success probability. The iterative single-ancilla variant, which is the form that a near-term device could actually run. Closes on what phase estimation is for: it is the eigenvalue algorithm, and the eigenvalue problem a materials researcher cares about is electronic structure โ€” the fault-tolerant successor to the variational methods of the introductory course.

Key topics : QFT circuit ยท controlled phase rotations ยท $O(n^2)$ gate count ยท unreadable amplitudes ยท phase estimation ยท precision and ancilla count ยท iterative QPE ยท eigenvalue estimation for electronic structure

๐Ÿ’ป 7 Code Examples โฑ๏ธ 45-50 minutes ๐Ÿ“Š Intermediate

Read Chapter 2 โ†’

Chapter 3: Shor's Algorithm

The classical reduction first: factoring reduces to order finding, and the reduction is elementary number theory that runs on a laptop. The quantum part is then one application of phase estimation to modular multiplication, and the honest observation that the modular exponentiation circuit โ€” not the Fourier transform โ€” is where essentially all of the cost lives. A complete implementation follows: factoring 15 and 21 end to end on the simulator, with the measured probability distribution, the continued-fraction post-processing that turns a measured fraction into a period, and the failure modes that make the algorithm probabilistic. Closes with what this means for cryptography, argued from resource-count scaling rather than from dates, and why the migration to lattice-based schemes is a rational response to a superpolynomial speedup even though no machine can run it yet.

Key topics : factoring to order finding ยท modular exponentiation cost ยท continued fractions ยท end-to-end factorization of 15 and 21 ยท failure modes and repetition ยท resource scaling ยท post-quantum cryptography

๐Ÿ’ป 7 Code Examples โฑ๏ธ 45-50 minutes ๐Ÿ“Š Intermediate

Read Chapter 3 โ†’

Chapter 4: Modern Hamiltonian Simulation

Trotterization revisited from the introductory course, with its error scaling made explicit and its limitations made quantitative. Then the methods that replaced it: linear combinations of unitaries, block encoding, and qubitization, developed to the level of explicit matrices and circuits rather than left as citations, with the optimal query complexity they achieve. Randomized compilation via qDRIFT, and when a random ordering beats a systematic one. Closes with the arithmetic of resource estimation as it is actually practised โ€” counts of T gates and logical qubits โ€” and with why electronic structure of materials and molecules, and not optimization or machine learning, is the application where a fault-tolerant machine has a defensible advantage.

Key topics : Trotter error scaling ยท linear combination of unitaries ยท block encoding ยท qubitization and the quantum walk ยท optimal query complexity ยท qDRIFT ยท T counts and logical qubit counts ยท electronic structure as the target application

๐Ÿ’ป 7 Code Examples โฑ๏ธ 45-50 minutes ๐Ÿ“Š Advanced

Read Chapter 4 โ†’

Chapter 5: QAOA and Optimization

Combinatorial optimization written as an Ising model: MaxCut, spin glasses, and the reason this formulation is familiar to anyone who has looked at a magnetic material. The structure of QAOA โ€” alternating cost and mixer layers, and the adiabatic limit it approaches as the depth grows. A complete implementation on small graphs at depths one to three, with the parameter landscape drawn out. Then the evaluation, conducted with the same discipline the quantum machine learning course applies to its own subject: QAOA against greedy, against simulated annealing, and against the Goemans-Williamson relaxation at equal budget, with the conclusion stated plainly. The chapter closes the series with a map of where provable speedups actually live โ€” Grover-type, Shor-type, and phase-estimation-type โ€” and the preconditions each one carries.

Key topics : Ising formulation ยท MaxCut ยท cost and mixer layers ยท adiabatic limit ยท parameter landscape ยท classical baselines at equal budget ยท approximation ratios ยท the map of provable speedups

๐Ÿ’ป 8 Code Examples โฑ๏ธ 45-50 minutes ๐Ÿ“Š Advanced

Read Chapter 5 โ†’


๐Ÿ”ค Notation and Conventions

Everything is inherited from Introduction to Quantum Computing and never changed, so that code from any chapter of either course can be combined with any other.

Symbol Meaning
$\lvert q_0 q_1 \cdots q_{n-1}\rangle$ big-endian: qubit 0 is leftmost and most significant. The opposite of Qiskit's convention
$N = 2^n$ size of the search space or of the register
$M$ number of marked strings; $\theta = \arcsin\sqrt{M/N}$
$O$, $D$ phase oracle and diffusion operator; $G = DO$ is one Grover iteration
$A$ a state preparation unitary; amplitude amplification uses $Q = (2A\lvert 0\rangle\langle 0\rvert A^{\dagger} - I)\,O$
$\mathrm{QFT}_n$ quantum Fourier transform on $n$ qubits (Chapter 2)
$\varphi$ a phase to be estimated, $U\lvert u\rangle = e^{2\pi i \varphi}\lvert u\rangle$ (Chapters 2-4)
$r$ multiplicative order of $a$ modulo $N$ (Chapter 3)
$\lVert H \rVert_1$ sum of the absolute values of Hamiltonian coefficients, the natural cost parameter (Chapter 4)
$p$ QAOA depth (Chapter 5)
$X, Y, Z, H$, CNOT gate symbols, identical to the introductory course

Query counts versus gate counts. Complexity in this course is quoted in queries when the statement is about the oracle model, and in gates when the statement is about a machine. The two differ by whatever the oracle costs, and Chapter 1 makes a point of the difference because most confusion about quantum speedups lives exactly there.

Reduced units. Where a Hamiltonian appears, $\hbar = 1$.


๐Ÿ” What This Series Is and Is Not

It is not an algorithm zoo. Six algorithms in five chapters, each developed far enough to run and to be taken apart. A catalogue of forty algorithm names with one paragraph each would be shorter to write and useless to read; the useful skill is being able to see, in an algorithm you have never met, which of a small number of mechanisms it is using.

It is not speed bragging. Every speedup is stated with its assumptions. That means saying that Grover's quadratic advantage is real and provably optimal, and that it is small enough to be destroyed by constant factors โ€” both halves, because omitting either one is a distortion. It also means saying that QAOA currently has no proven advantage over classical heuristics, and that phase estimation for electronic structure does.

It is not a hardware course. Gate times, error rates and error-correction overheads appear only as parameters in resource estimates, and always as sweeps over decades rather than as specifications. For where those parameters come from, read Introduction to Quantum Hardware.

It is not a cryptography course. Chapter 3 covers what Shor's algorithm implies for RSA and why post-quantum cryptography exists, from the scaling of resource counts. It does not cover the schemes themselves.

It is not framework documentation. As in the introductory course, everything is NumPy. You will finish knowing what a quantum SDK computes, which is the only durable way to use one.

๐Ÿ“š Recommended Learning Paths

Pattern 1: Complete path (6-7 days)

Pattern 2: The fault-tolerant electronic-structure path (2 days)

Pattern 3: The sceptic's path (half a day)

๐ŸŽฏ Overall Learning Outcomes

Knowledge Level

Practical Skills

Application Ability

๐Ÿ› ๏ธ Technologies and Tools Used

Main Libraries

Development Environment

๐Ÿš€ Next Steps

Deep Dive Learning

Related Series

Practical Projects

โš ๏ธ Disclaimer