# Lecture 016 - Geometry of Grover

In Grover, we want to know how much angle in subspace we rotate by doing each "combo" and how many times we should perform the "combo".

## Geometry of Grover and Approximate Sharp-SAT

Reflection operation: quantum operation that is reverse of itself

Rotation operation: quantum operation that is not reverse of itself

### Geometry of Grover's SAT Algorithm

Remember Grover's SAT Algorithm: assuming unique string $x \in \{0, 1\}^n$ satisfy $f(x) = 1$.

1. We prepare uniform superposition
2. We can convert any code into $AND/OR/NOT$ circuit
3. Do If $C(x_1, x_2, ..., x_n)$ then Minus
4. Reflect accross the mean
5. Go to 3.

Now we aim for a geometric interpotation of Grover's algorithm.

Observations: accross a hyperplane (1 dimension lower than the space)

• If ... then Minus: It a reflection (only change 1 bit) accross a $|\phi_\perp\rangle$ since we know the reflection does nothing to $|\phi\rangle, |\phi^\perp\rangle$.

• Reflection accross mean: It is a reflection because the uniform superposition $\begin{bmatrix}1, 1, 1, 1, ..., 1\end{bmatrix}$ is the only vector that doesn't get reflected since every entry's amplitude is mean amplitude.

Imagine the horizontal axis denotes everything else that does not satisfy the the function $f$ (x-coordinate denotes the amplitude). Vertical axis is the bit we sill keep reflecting. We start from uniform position $|\phi\rangle$, and do "If ... then Minus" (reflection across $|\alpha_{\perp}\rangle$), and do "Reflection Accross Mean" (reflection across $\simeq |\phi\rangle$, although not exact)

If we use un-normalized representation, imagine the circle to be length $\sqrt{N}$

If you do too many times of $V$ and $W$, for example, twice of amount, you will go pass our goal. In each combo $V \cdot W$, the angle $\theta$ of the vector got changed by a constant amount. In numerical representation, we observe we get the the goal with slower and slower speed, this is because of how we measure the successfulness: we measure it by probability. At the start, we increase the probability to go to our goal a lot, but it becomes slower and slower as two angle approaches even though we change it by a constant amount every time.

The total amount of rotation is: $90 ^\circ - \theta/2 \simeq \pi/2$ since, according to the graph above $|\alpha_{\perp}\rangle \perp |\alpha\rangle$.

### Knowing the Probability of Success is $\frac{1}{N}$

Assume $|v\rangle = V|\phi\rangle = [1,...,1,-1,1,...,1], |u\rangle = |\phi\rangle = [1,...,1]$

We then ask: how much $\theta$ did we rotate when we do one "combo"?

\begin{align*} \cos \theta =& \langle v' | u' \rangle\\ =& \frac{1}{\sqrt{N}} \frac{1}{\sqrt{N}} \langle v | u \rangle\\ =& \frac{1}{N} ((N - 1)(1) + 1(-1))\\ =& \frac{N - 2}{N}\\ =& 1 - \frac{2}{N}\\ =&1-2p\\ \cos^2 \theta =& (1 - \frac{2}{N})^2\\ =& 1 - \frac{4}{N} + \frac{4}{N^2}\\ \simeq& 1 - \frac{4}{N} \tag{by $\frac{4}{N^2}$ negligible}\\ 1-\sin^2 \theta =& 1 - \frac{4}{N}\\ \sin \theta =& \frac{2}{\sqrt{N}}\\ \theta \simeq& \frac{2}{\sqrt{N}}\tag{by $\theta$ small}\\ \end{align*}

If you want to do $k$ rotations instead of $1$, you will rotate by about $\frac{2k}{\sqrt{N}}$. Therefore, if you want to rotate $\frac{\pi}{2}$, you need $k = \frac{\pi}{4}\sqrt{N}$

### Knowing the Probability of Success is $\frac{m}{N}$

\begin{align*} \cos \theta =& \langle v' | u' \rangle\\ =& \frac{1}{\sqrt{N}} \frac{1}{\sqrt{N}} \langle v | u \rangle \\ =& \frac{1}{N} ((N - m)(1) + m(-1))\\ =& \frac{N - 2m}{N}\\ =& 1 - \frac{2m}{N}\\ \theta =& 2\sqrt{\frac{m}{N}}\\ \end{align*}

If you want to do $k$ rotations instead of $1$, you will rotate by about $2k\sqrt{\frac{m}{N}}$. Therefore, if you want to rotate $\frac{\pi}{2}$, you need $k = \frac{\pi}{4}\sqrt{\frac{N}{m}} \in O(\frac{1}{\sqrt{p}})$

Conclusion: The angle we rotate by doing one "combo" is $\theta = 2\sqrt{p}$. And we need to rotate $\frac{\pi}{4}\sqrt{\frac{1}{p}}$ many times.

Table of Content