2The diffuser as a matrix
Inversion about the mean is not a separate trick. It is exactly what the matrix $U_s$ does when it multiplies $\ket{\psi_1}$. Here it is built and applied row by row.
For me the clearest way to see why a quantum computer can beat a classical one is the smallest non-trivial case of Grover's search.
Imagine a star hidden in one of four drawers, with each drawer equally likely. An oracle is a black-box test that answers a single question: “Is this the marked drawer?” A classical search checks one drawer at a time. The first check finds the star with probability $1/4$. If the answer is “no”, you can still guess among the three remaining drawers. One check followed by a final guess therefore identifies the right drawer with probability $1/4 + (3/4)(1/3) = 1/2$, although that guess has not been verified. Grover's algorithm uses a quantum version of the oracle, followed by interference and a measurement, to identify the marked drawer with certainty after just one query.
With two qubits there are $N = 2^2 = 4$ basis states, $\ket{00}, \ket{01}, \ket{10}, \ket{11}$. One of them, , is marked: the oracle can recognise it and nothing else can. In this special case exactly one Grover iteration finds it with probability $1$. The marked state is drawn in purple and the mean amplitude in green.
Inversion about the mean is not a separate trick. It is exactly what the matrix $U_s$ does when it multiplies $\ket{\psi_1}$. Here it is built and applied row by row.
The oracle only touches $\ket{w}$ and the diffuser treats every unmarked state alike, so the state never leaves a flat plane: the one spanned by $\ket{w}$ and $\ket{s'}$, the even mix of the unmarked states. Everything above is a picture in that plane.
In this plane $\ket{\psi_0} = \cos\theta\,\ket{s'} + \sin\theta\,\ket{w}$, where
$$\sin\theta = \frac{1}{\sqrt N}.$$For $N = 4$, $\sin\theta = \frac12$, so the state starts at $\theta = 30^\circ$ above the $\ket{s'}$ axis.
Negating the $\ket{w}$ component reflects the state in the $\ket{s'}$ axis, from $+30^\circ$ to $-30^\circ$:
$$U_w = \begin{bmatrix}1&0\\0&-1\end{bmatrix}.$$Its length is unchanged and so is every probability. Only the angle has moved.
$U_s = 2\ket{\psi_0}\!\bra{\psi_0} - I$ reflects in the line through $\ket{\psi_0}$:
$$U_s = \begin{bmatrix}\cos2\theta & \sin2\theta\\ \sin2\theta & -\cos2\theta\end{bmatrix}.$$The state sat $60^\circ$ below that line, so it lands $60^\circ$ above it, at $90^\circ$: exactly on $\ket{w}$.
Each iteration turns the state by $2\theta$, so after $k$ of them it is at $(2k+1)\theta$ and
$$P_k = \sin^2\!\big((2k+1)\theta\big).$$For four items one turn of $60^\circ$ takes $30^\circ$ to $90^\circ$ on the nose.
With $N = 64$ items, $\theta = \arcsin\frac18 \approx 7.2^\circ$. Each turn is only about $14.4^\circ$, so it takes six of them to get near the top: $13\theta \approx 93.3^\circ$ and $P_6 \approx 0.997$.
Keep scrolling and the state keeps turning. The number of turns needed is about $\frac{\pi}{4\theta} \approx \frac\pi4\sqrt N$, which is where the square root comes from.
Four items is special because $3\theta$ hits $90^\circ$ exactly. For $N = 8$, $\theta \approx 20.7^\circ$, so one turn reaches $62^\circ$, two reach $103.6^\circ$ and three reach $145^\circ$. Two iterations is best, and a third makes things worse:
In general the best number of iterations is $k \approx \frac\pi4\sqrt N$. That is a quadratic saving, not an exponential one, and no quantum algorithm can do better for unstructured search. It still grows into a large gap:
| $n$ | $N$ | classical, $\approx N/2$ | Grover, $\approx\frac\pi4\sqrt N$ |
|---|---|---|---|
| $2$ | $4$ | $2$ | $1$ |
| $10$ | $1\,024$ | $512$ | $25$ |
| $20$ | $1\,048\,576$ | $524\,288$ | $804$ |
| $40$ | $\approx 1.10\times10^{12}$ | $\approx 5.50\times10^{11}$ | $823\,549$ |