← SnapRecaps

But what is quantum computing? (Grover's Algorithm)

► 3,382,297 views ⏲ 36:54 Watch on YouTube ↗

Summary

Quantum computing doesn't simply parallelize classical calculations; it offers at most a square-root speedup for general search, with exponential gains like Shor's algorithm being rare and special.

Executive Summary

This video clarifies common misconceptions about quantum computing, particularly the false idea that it simply runs classical calculations in parallel to achieve exponential speedups. Using the example of a quantum secret-key search, it shows that the optimal speedup is only O(√n)—for instance, searching a trillion options takes about a million steps—and explains that exponential gains like Shor's algorithm are rare, while Grover's algorithm achieves the proven optimal square-root bound. To build intuition without relying on misleading analogies, it introduces the core formalism: a quantum computer's internal state is a continuous state vector whose squared components define the probability distribution over random bit-string outputs. The lesson emphasizes that sign flips in this vector matter even when probabilities don't, setting up a geometric walkthrough of Grover's algorithm and connecting the puzzle to the broad class of NP problems where solutions are easy to verify but hard to find.

Key Points

  • ▶ 0:00 Pop-science quantum computing claims often imply quantum computers just run classical computations in parallel over every possible bitstring, which leads to misconceptions.
  • ▶ 1:14 For a classical search of a hidden value among n possibilities, the best strategy is guess-and-check, averaging n/2 attempts.
  • ▶ 1:39 This classical search scales as O(n): if n grows by 10x, runtime grows by 10x, since big-O ignores constant factors like the 1/2.
  • ▶ 1:57 The video poses a quantum-computing quiz: find the optimal runtime for a quantum secret-key search, with options including O(√n), O(log n), O(log log n), and O(1).
  • ▶ 2:22 The quiz is framed as a "gut check" of intuition rather than a formal test, since quantum computing hasn't been fully defined yet.
  • ▶ 2:48 Survey results from ~100,000 responses show the most common answers are wrong: O(1) tops the poll, likely from a misconception about superposition and parallel processing, while O(log n) also misleads many into expecting an exponential speedup.
  • ▶ 3:44 Exponential speedups are rare and mostly exemplified by Shor's algorithm; most problems do not achieve such dramatic gains.
  • ▶ 3:54 The typical quantum speedup for this search problem is (O(\sqrt{n})) — e.g., a million options take about a thousand steps, and a trillion take about a million.
  • ▶ 4:02 In 1994, (O(\sqrt{n})) was proven optimal for this task, and in 1996 Grover's algorithm achieved that bound, with a hidden constant of (\pi/4).
  • ▶ 4:32 The mystery-function puzzle is a generic stand-in for real problems where verifying a solution is easy but finding it is hard.
  • ▶ 4:50 This defines the enormous class of NP problems, connecting the puzzle to a major category in computer science.
  • ▶ 4:55 Grover's square-root speedup is far less dramatic than an exponential speedup, and big O runtimes are often less important than other practical factors.
  • ▶ 5:08 Grover's algorithm is framed as a potential catch-all method for speeding up NP problems, with the lesson goal being a step-by-step walkthrough that is "geometric and beautiful."
  • ▶ 5:21 The first two-thirds of the video builds quantum computing fundamentals as mathematics rather than analogies, which the speaker says can lead to misconceptions.
  • ▶ 5:48 A follow-up lesson is planned to cover the underlying physics, helping to motivate the "odd-looking rules" introduced in this section.
  • ▶ 6:04 Classical computing can be understood across abstraction layers: ones and zeros as data types (like integers/text) at a higher level, and as physical states (e.g., voltages) at a lower level.

  • ▶ 6:31 Quantum computing follows the same layered structure: an underlying physical measurement yields a sequence of ones and zeros, which can then represent useful data types like numbers.

  • ▶ 7:00 The discussion deliberately focuses on the middle layer of abstraction, postponing the underlying physics—similar to teaching computer science without dwelling on hardware implementation details.

  • ▶ 7:12 In classical computers, memory state and readout are identical bit sequences, but in quantum computers the internal state and output values are fundamentally different kinds of objects.
  • ▶ 7:23 The central concept is the state vector: a continuous object that the quantum computer operates on, which has an unusual relationship to the discrete bit strings you read out.
  • ▶ 7:36 The readout values from a quantum computer are random sequences of ones and zeros, separating discrete probabilistic outputs from the continuous internal state vector.
  • ▶ 7:51 A quantum program defines a probability distribution across all possible outputs, not a single fixed result.
  • ▶ 8:03 With a 4-qubit computer, the readout is 4 bits, giving 2⁴ = 16 possible outputs.
  • ▶ 8:35 In general, a k-qubit computer has 2ᵏ possible outputs, and every program assigns a probability distribution over them.
  • ▶ 8:51 A quantum program's probability distribution is implicit: you infer it from the program because you never directly observe all bit strings at once, only a single bit string drawn at random.
  • ▶ 9:08 Reading out results is physically a quantum measurement, and the apparent randomness comes from the laws of quantum mechanics.
  • ▶ 9:28 Upon readout, the quantum state collapses: all probability concentrates on the observed value, so repeated reads keep returning the same result.
  • ▶ 10:04 The state of a quantum computer is a large vector (a big list of numbers), with each component corresponding to a possible output bit string.
  • ▶ 10:32 The state vector is not itself the probability distribution; probabilities come from squaring the magnitude of each component.
  • ▶ 10:52 This squared-magnitude rule is famously counterintuitive, raising questions about what the state vector “really is” and why squaring is required.
  • ▶ 11:07 The fundamental probability rule: the probability of observing a bit string equals the square of its state vector entry, e.g., an entry of 0.5 gives a 25% chance.
  • ▶ 11:38 State vector entries can be negative; flipping a sign leaves probabilities unchanged because squaring removes the sign.
  • ▶ 11:54 Despite unchanged probabilities, a sign-flipped vector is a distinct state, and this sign-flipping is central to Grover's algorithm.
  • ▶ 12:02 Scaling down the current four-qubit example addresses the lack of visual clarity.
  • ▶ 12:08 The smallest case uses only two possible outputs, 0 and 1, greatly simplifying the system.
  • ▶ 12:16 The state vector becomes two-dimensional, allowing it to be visualized as an arrow in 2D space.
  • ▶ 12:25 The x-coordinate of the state vector corresponds to outcome 0, and its square gives the probability of reading a 0.
  • ▶ 12:38 The vector's direction determines likely outcome: horizontal favors 0, vertical favors 1.
  • ▶ 12:45 Similarly, the y-coordinate corresponds to outcome 1, and its square gives the probability of reading a 1.
  • ▶ 12:54 The probabilities of a quantum state's outcomes must sum to 1, giving the condition x² + y² = 1.
  • ▶ 13:02 This condition means the state vector has length 1, confining a qubit's state to a unit circle geometrically.
  • ▶ 13:10 The unit-length constraint generalizes: a quantum computer's state always has length 1 and lives on a high-dimensional unit sphere.
  • ▶ 13:18 The two-dimensional example is formally named the qubit, short for quantum bit.
  • ▶ 13:25 Readout yields either 0 or 1 like a classical bit, but the qubit is "a completely different animal" beyond that.
  • ▶ 13:33 Mathematically, a qubit is a unit vector in a two-dimensional space, with axes corresponding to measurement outcomes 0 and 1.
  • ▶ 13:52 Measuring a qubit always yields either 0 or 1, abruptly collapsing the state vector onto that observed outcome.
  • ▶ 14:02 After collapse, the qubit stays in that measured basis state unless deliberately prepared back into a diagonal (superposition-like) direction.
  • ▶ 14:02 Subsequent measurements of the same qubit will always repeat the same result, so measurement locks in the outcome and is not a harmless peek.
  • ▶ 14:18 The bizarre setup described is essentially the postulates of quantum mechanics.
  • ▶ 14:34 The Born rule connects state vectors to measurements: squaring the component magnitudes gives the probability of each outcome.
  • ▶ 14:47 The qubit is an abstraction over many physical systems that behave this way, just as a bit abstracts two-state systems.
  • ▶ 15:04 A ket |...> denotes a unit vector in the state space and is the universal notation in quantum computing.
  • ▶ 15:18 The basis states for a qubit are labeled |0> (unit vector pointing right) and |1> (vertical unit vector), which correspond to deterministic measurement outcomes of 0 and 1.
  • ▶ 15:35 A general qubit is commonly written as a weighted sum of basis states: |ψ> = α|0> + β|1>, where α and β are the amplitudes.
  • ▶ 15:52 Quantum gates are introduced by analogy to classical logic gates like AND, OR, and NOT, which process bits and combine into complex functions.
  • ▶ 16:04 Quantum gates are fundamental operations applied to a single qubit or multiple qubits, serving as the quantum counterpart to classical gates.
  • ▶ 16:13 Quantum gates work geometrically by flipping or rotating the state vector, shifting from discrete bit manipulation to geometric qubit-state transformations.
  • ▶ 16:25 The Hadamard gate is a standard quantum gate that maps basis states to diagonal superpositions: the 0 state to northeast and the 1 state to southeast.
  • ▶ 16:40 It is commonly used to convert a deterministic 0 or 1 state into a 50-50 superposition, and can also reverse the process back to a deterministic state.
  • ▶ 16:54 The art of quantum algorithm design is composing sequences of gates to progressively manipulate the state vector until it points almost entirely toward the basis state encoding the desired answer.
  • ▶ 17:20 A system of k qubits has 2^k distinct coordinate directions, one for each possible bit string, so the state space grows exponentially with qubit count.
  • ▶ 17:43 This exponential size is powerful because the state vector could be manipulated to point along one coordinate direction representing a meaningful answer, such as a prime divisor or a secret key.
  • ▶ 18:11 The crucial catch is that there is no direct access to the state vector; its value can only be used by concentrating probability onto the single component that corresponds to the desired answer.
  • ▶ 18:49 Grover's algorithm starts by initializing all possible outcomes with equal probability, including the secret key's state.
  • ▶ 19:07 By interleaving a targeted sign flip on the secret key's coordinate with another operation, the probability mass gradually concentrates onto that key.
  • ▶ 19:24 After this amplification, reading out the computer almost certainly yields the secret key.
  • ▶ 19:44 Grover’s algorithm applies to any problem where finding a solution is difficult but verifying a solution is quick, such as Sudoku, map coloring, and cryptography.
  • ▶ 20:09 The problem is modeled generically as a function taking an input from 0 to n-1 and returning true for exactly one “secret key,” built from classical logic gates.
  • ▶ 20:31 Crucially, any ensemble of classical logic gates can be translated into quantum gates, enabling the verification process to run in superposition.
  • ▶ 20:44 Classical Boolean gates translate into quantum operations that flip the sign of the quantum state for bit strings that classically output true, while leaving false cases unchanged.
  • ▶ 21:04 Because quantum operations are linear, this sign-flipping applies to superpositions: only the component matching the triggering bit string is flipped.
  • ▶ 21:18 For any NP problem, a quantum gate can be built to act as an oracle that marks valid solution states by flipping their sign, based purely on classical verification logic.
  • ▶ 21:33 Flipping a quantum state's sign alone doesn't change measurement probabilities, since probabilities depend on squared magnitudes.
  • ▶ 21:38 Grover realized the sign flip is not used in isolation—it can be paired with another operation that exploits the flipped sign.
  • ▶ 21:41 This combination of steps gradually amplifies the target value's probability, turning the sign flip into a crucial part of the algorithm.
  • ▶ 21:46 Grover’s algorithm can be visualized using a simplified three-dimensional state space, with axes representing the values 0, 1, and 2.
  • ▶ 21:57 The search problem is modeled as one of these values being a secret key, while the other two are incorrect.
  • ▶ 22:06 The algorithm begins from an equal-balance state called B, where all components have the same value; this state is easily accessible, typically via Hadamard gates.
  • ▶ 22:39 Throughout Grover’s algorithm, the state vector only moves within a single 2D plane spanned by the initial equal-balance vector and the secret-key vector.
  • ▶ 22:50 Projecting the full high-dimensional space onto that 2D slice is a faithful representation, enabling a simple geometric picture.
  • ▶ 23:00 In the slice, the y-axis represents the secret key direction, while the x-axis represents the equal balance of all other non-key states.
  • ▶ 23:36 In higher dimensions, the equal-balance state becomes nearly perpendicular to the secret-key direction, but the angle is never exactly 90° because the balance state always retains a tiny overlap with the secret-key value.

  • ▶ 24:08 The angle is computed via the dot product between the balance state and the key vector: the dot product equals ( \frac{1}{\sqrt{n}} ), which is the cosine of the angle, and is then reframed as ( \sin(\theta) = \frac{1}{\sqrt{n}} ).

  • ▶ 24:50 For large ( n ), the key angle simplifies to ( \theta \approx \frac{1}{\sqrt{n}} ) radians, meaning Grover’s algorithm runtime scales with the inverse square root of the number of elements.

  • ▶ 25:05 The speaker recaps that the source of Grover's algorithm's speedup is a square root in the runtime, and keeps this key point visible on screen for reference.
  • ▶ 25:10 The speaker transitions to introducing the actual procedure, framing it as "surprisingly simple" after the earlier conceptual groundwork.
  • ▶ 25:16 The first key operation is a sign-flip on the key's component, which geometrically reflects the state vector about the x-axis.
  • ▶ 25:45 The second key operation is a reflection around the equal-balance direction, and quantum gates for it do exist.
  • ▶ 26:00 The real insight of Grover's algorithm lies in the geometry of these two reflections, not in gate-level implementation details.
  • ▶ 26:18 Applying the two-flip sequence (around x-axis, then off-diagonal) rotates the state vector to point slightly more in the vertical direction, moving it closer to the secret-key target.
  • ▶ 26:27 This geometric shift increases the measurement probability of the secret key value: each two-flip sequence grows the amplitude and probability of the desired answer.
  • ▶ 26:42 With each repetition of the sequence, the component associated with the target value grows, as visually confirmed by probability bars alongside the state-vector coordinates (e.g., n=100).
  • ▶ 26:50 Grover’s algorithm works by repeating the same sequence of operations over and over until the state vector points as close as possible to the secret key direction.
  • ▶ 27:05 Two successive reflections about two lines produce a single rotation by 2θ, so applying the algorithm’s two operations rotates the state vector by 2θ.
  • ▶ 27:39 The optimal number of repetitions is (π/2)/(2θ) ≈ π/4 · √n, giving Grover’s square-root speedup.
  • ▶ 28:06 The example uses n = 2^20 (about one million options), requiring at least 20 qubits to search for a secret key.
  • ▶ 28:12 The algorithm prescribes repeating the two key operations about π/4 × √n ≈ 804 times.
  • ▶ 28:31 The state vector is invisible; its position must be inferred through geometric reasoning, and after ~804 repetitions it should point almost entirely toward the secret key.
  • ▶ 28:55 Quantum algorithm does not guarantee the correct output; there is a small chance of reading out a wrong result.
  • ▶ 29:02 The answer can be quickly verified on a classical computer, assuming a fast check exists.
  • ▶ 29:12 In the worst case, rerun the whole procedure; repeating makes the chance of continued failure vanishingly small.
  • ▶ 29:18 In practice, the algorithm only needs to be run a couple of times, and the wrap-up covers a key "lie," the source of the speedup, and a surprising analogy.
  • ▶ 29:34 Creating visualized lessons takes enormous time; the speaker avoids in-video sponsorships to keep videos better.
  • ▶ 29:57 The channel's sustainability relies on direct Patreon support, which gives backers early access and other perks.
  • ▶ 30:12 The earlier "lie" was an omission: state vector components were shown as real positive/negative numbers, but in full quantum theory they are complex numbers.
  • ▶ 30:24 Complex numbers encode both amplitude/magnitude and phase; changing phase doesn't change measurement probabilities, but it does change the quantum state and its evolution.
  • ▶ 31:03 Ignoring complex numbers was safe for Grover's algorithm because only positive and negative real values appear, but complex phases are essential for other algorithms like Shor's algorithm.
  • ▶ 31:27 The speedup is often mistakenly attributed to parallelism, but the video says this "doesn't feel right" and misleads, since that first step alone doesn't reveal the searched value.
  • ▶ 31:58 Two interpretations of the initial step are offered: applying the function to many inputs at once, or viewing the equal balance state as a new kind of input that is still processed one at a time; the video favors the second view.
  • ▶ 32:17 A better one-word summary for the source of the speedup is "Pythagoras": the real advantage comes from rotations and reflections in the geometric space of states, not naive parallel evaluation.
  • ▶ 32:24 The video introduces a geometric analogy: allowed paths through a space determine travel distance—on a unit square, moving along edges takes 2 units, while a diagonal shortcut takes √2.

  • ▶ 32:49 This maps onto quantum mechanics: observable states are perpendicular directions in state space; classical worlds move only along pure coordinate directions, while quantum states can access diagonal combinations.

  • ▶ 33:05 Computation is described as walking through a series of available states, so runtime is the number of steps through the state space; quantum's diagonal movement explains its square-root speedup over classical linear scaling.

  • ▶ 33:27 Quantum computing provides access to “diagonal directions” in state space—movements along combinations of states, not just single coordinate axes.
  • ▶ 33:41 Grover’s algorithm traces a quarter-circle arc from initial to target state, a path entirely unavailable when restricted to pure coordinate directions.
  • ▶ 33:32 The geometric analogy shouldn’t be taken literally, but it’s genuinely useful: diagonal directions enable the algorithm’s “square-root-sized shortcut” ▶ 33:53, the source of Grover’s speedup.
  • ▶ 34:14 Grover's algorithm is mathematically identical to the colliding-blocks pi problem, as both involve a point bouncing around a circle in a two-dimensional state space.
  • ▶ 34:36 A direct tutorial built on the colliding-blocks analogy was abandoned because it only made sense if you already understood Grover's algorithm.
  • ▶ 34:49 The video leaves the analogy as an open homework puzzle, with Adam Brown's paper linked as an answer key.
  • ▶ 35:08 Andy Matuszczak and Michael Nielsen's resource on quantum computing fundamentals is recommended for its unique, memorable approach to learning.
  • ▶ 35:23 For quantum mechanics, the speaker recommends Mithina Yoganathan's beginner-friendly course on the YouTube channel Looking Glass Universe.
  • ▶ 35:31 The speaker credits Yoganathan with personally teaching them Grover's algorithm and influencing much of this video's content.
  • ▶ 35:39 Scott Aaronson proposes a sci-fi climax where heroes run Grover’s algorithm to find a cryptographic key while villains close in.
  • ▶ 36:17 The key dilemma: measuring now gives only a 30% chance of success, but waiting another minute increases the odds—yet failure forces a full restart.
  • ▶ 36:36 This tension is uniquely quantum because measurement is probabilistic and irreversible, unlike any classical algorithm.

Video Sections

  • ▶ 0:00 Introduction and Classical Search Warmup (0:00 - 1:57) - Introduces the pop-science misconception, the mystery-function setup, and how classical runtime scales with input size.
  • ▶ 1:57 The Quantum Search Quiz (1:57 - 3:44) - Poses the quantum version of the search problem and surveys viewers' intuitions about the best runtime.
  • ▶ 3:44 Grover's Answer and Quantum Foundations (3:44 - 12:02) - Reveals the O(√n) answer, lays out the roadmap, and explains state vectors, probability readout, the Born rule, and negative amplitudes.
  • ▶ 12:02 Qubits, Gates, and Grover's Algorithm (12:02 - 36:40) - Scales down to qubits, covers measurement, Dirac notation, and gates, then gives a geometric walkthrough of Grover's algorithm and its square-root runtime.

Exact Transcript

Load the full timestamped transcript on demand and click any time to jump in the video.