Action ofarbitrary key$$\begin{array}{ll}\mathcal{U}_s |\psi \rangle &= (2|s\rangle\langle s| - I)|\psi \rangle\&=2|s\rangle\langle s | \psi \rangle - |\psi\rangle\&= (2 \sqrt{2^n} \bar{a})|s\rangle - |\psi\rangle \ &= \displaystyle(2 \sqrt{2^n} ,\bar{a}) \frac{1}{\sqrt{2^n}} \sum_x |x\rangle - \sum_x a_x |x\rangle \ &= \sum_x(2\bar{a} - a_x) |x\rangle\end{array}$$
Compare this to the original value of ket . Let's compare the Amplitude w.r.t mean
Before
After
Thus inverts the amplitude w.r.t. the mean of an arbitrary ket
Grover's Operator
Grover's operator causes a rotation of where is the angle between and
Thus, we can perform this operation times to align the ket's together. Since each operation of this operator rotates it by and we want to align it with $$\begin{array}{ll}m(2\theta) &= \frac{\pi}{2} - \theta \ m &= \frac{\pi}{4\theta} - \frac{1}{2} \ m &\approx\frac{\pi \sqrt N}{4}\end{array}$$ since
Example: Consider the 3 qubit case wherein we are interested in from .In the standard ket each basis has an amplitude of
Consider the application of :$$\mathcal{U}_f | \psi \rangle = \frac{1}{\sqrt 8}( |0\rangle + |1\rangle + \ldots | 8\rangle) - \frac{1}{\sqrt8} |4\rangle$$The new mean amplitude becomes:$$\bar{a} = \frac{1}{8}[\frac{7}{\sqrt8} - \frac{1}{\sqrt8}] = \frac{3}{8 \sqrt2}$$Now, consider the application of :
for every unmarked state the amplitude becomes $$2(\frac{3}{8 \sqrt2}) - \frac{1}{2\sqrt2} = \frac{1}{4\sqrt2}$$
for every marked state the amplitude becomes $$2(\frac{3}{8 \sqrt2}) + \frac{1}{2\sqrt2} = \frac{5}{4\sqrt2}$$