grover's search algorithm

Problem: Given N=2n items, find a particular item

This is accomplished by amplifying the amplitude of the vector |z while cancelling the amplitude of |x(xz)

P0 Transformation

We define the conditional phase shift transformation as$$P_0 : |x\rangle \mapsto \begin{cases} |x\rangle &\quad{} x=0 \ -|x\rangle &\quad{} x>0\end{cases}$$$$P_0 = 2|0\rangle\langle0| - I$$

Uf Transformation

Consider the standard oracle setup$$\mathcal{U}_f: |x \rangle |y \rangle \mapsto|x\rangle |y \oplus f(x)\rangle$$

Uf inverts the amplitude of z alone !!

We can generalize this to$$\mathcal{U}_f: |x\rangle | y\rangle \mapsto (-1)^{f(x)} |x\rangle |y\rangle$$Rewriting |x as xαx|x and dropping |y for simplicity we get$$\mathcal{U}_f: \sum_x \alpha_x |x\rangle \mapsto (-1)^{f(x)} \alpha_x |x\rangle$$
Example: $$|s\rangle := |00\rangle + |01\rangle + |10\rangle + |11\rangle \hspace{3em} z:= |10\rangle$$$$\mathcal{U}_f |s\rangle = |00\rangle + |01\rangle - |10\rangle + |11\rangle $$

Us Transformation

Us=HnP0HnUs=Hn(2|00|I)Hn=2|ss|I

Consider an arbitrary ket |ψ $$|\psi\rangle = \sum a_x|x\rangle$$ $$\begin{array}{ll}\langle s|\psi\rangle &= \displaystyle \frac{1}{\sqrt 2^n} \sum_{x,x'} a_x \langle x|x'\rangle \ &= \displaystyle \frac{1}{\sqrt 2^n} \sum_x a_x\end{array}$$

a¯=12nxaxs|ψ=2na¯

Action of Us arbitrary 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 |ψ=xαx|x. Let's compare the Amplitude w.r.t mean

Before After
axa¯ 2a¯axa¯=(axa¯)
Thus Us inverts the amplitude w.r.t. the mean of an arbitrary ket

Grover's Operator

G=UsUf

Grover's operator causes a rotation of 2θ where π2θ is the angle between |s and |z

Thus, we can perform this operation m times to align the ket's together. Since each operation of this operator rotates it by 2θ and we want to align it with π2θ $$\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 θsinθ=1N


Example: Consider the 3 qubit case wherein we are interested in z=|4 from |ψ=122x|x.In the standard ket |s each basis has an amplitude of 18
Consider the application of Uf:$$\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 a¯ becomes:$$\bar{a} = \frac{1}{8}[\frac{7}{\sqrt8} - \frac{1}{\sqrt8}] = \frac{3}{8 \sqrt2}$$Now, consider the application of Us: