Grover's and Shor's Algorithms
Grover's algorithm searches items in about steps; Shor's factors large numbers fast by finding a period with the quantum Fourier transform.
Needs a step first: 44
Grover's algorithm starts in an equal superposition, flips the sign of the marked item, then reflects every amplitude about the mean; each round moves amplitude towards the answer, and about rounds find it, a square-root speed-up over checking one by one. Shor's algorithm reduces factoring to finding the period of , which the quantum Fourier transform reads off through interference; then usually gives a factor. Since RSA's security rests on factoring being hard, a large enough quantum computer would break it, while Grover only halves the effective key length of symmetric ciphers, which longer keys fix.
Where it shows up: Shor's algorithm is why cryptographers design post-quantum ciphers, and Grover's idea of amplifying amplitudes recurs throughout quantum computing.
How to hold it: In your head
See Grover as repeatedly flipping and reflecting amplitudes towards the answer and Shor as interference revealing a period, and know why one gives only a square-root speed-up while the other breaks RSA.
What knowing it looks like
- Run one Grover iteration on four items by hand and track every amplitude.
- Find the period of and use it to factor 15 as Shor's algorithm would.
- Explain what a square-root speed-up does and does not buy compared with Shor's.
Test yourself
Grover search over items, with item marked. Start in the equal superposition (every amplitude ). Apply the oracle, which flips the sign of the marked amplitude, then the diffusion step, which replaces each amplitude by , where is the mean amplitude. What are the amplitudes now, and what is the probability of measuring ?
Show the worked answer
Needs a step first: 44
Learn it with an AI
Copy this prompt into any AI assistant. It will take you through step by step at your level and finish with the test above.
Be my maths tutor. I'm learning "Grover's and Shor's Algorithms" (Frontier tier): Grover's algorithm searches $N$ items in about $\sqrt N$ steps; Shor's factors large numbers fast by finding a period with the quantum Fourier transform. I already know: Entanglement, The Fourier Transform, Modular Arithmetic and Primes. Teach it Socratically: first ask what I already know; then explain the core idea with one concrete example and why it's true; then give me three problems, one at a time, easy to hard. Wait for my answer, check every step, and point out mistakes without giving the answer away. Finish by testing me with this: Grover search over $N = 4$ items, with item $|11\rangle$ marked. Start in the equal superposition (every amplitude $\tfrac12$). Apply the oracle, which flips the sign of the marked amplitude, then the diffusion step, which replaces each amplitude $\alpha$ by $2\bar\alpha - \alpha$, where $\bar\alpha$ is the mean amplitude. What are the amplitudes now, and what is the probability of measuring $|11\rangle$? Use LaTeX for formulas. When you say where it's used later (machine learning, quantum mechanics), be specific.
Needs first
- EntanglementA state of several systems that cannot be written as a product of separate states, so their measurement results are correlated.Frontier · Quantum Mechanics
- The Fourier TransformThe Fourier series for functions that never repeat: any signal becomes a continuous spread of frequencies.Undergraduate II · Differential Equations & Fourier
- Modular Arithmetic and PrimesArithmetic with remainders ("clock arithmetic"), and the primes: unique factorisation, greatest common divisors and Fermat's little theorem.Core · Proof & Discrete Maths
Leads to
This is the end of a path.
On the way to
Recommended
- The Feynman Lectures on PhysicsCaltech · BookFeynman's three volumes on mechanics, electromagnetism and quantum mechanics, free to read online in Caltech's official edition.
- Quantum CountryAndy Matuschak and Michael Nielsen · InteractiveFree essays on qubits, quantum circuits and the search algorithm with built-in spaced-repetition questions, so what you read stays remembered.
- MIT 8.04 Quantum Physics IBarton Zwiebach, MIT OpenCourseWare · CourseBarton Zwiebach's lecture videos and problem sets on wavefunctions, the Schrödinger equation, the harmonic oscillator and scattering.
- Basics of Quantum InformationIBM Quantum · CourseA free IBM course on states, measurements, circuits, entanglement, teleportation and the CHSH game, with Qiskit code to try each idea.