Amplitude amplification

Amplitude amplification is a technique in quantum computing which generalizes the idea behind Grover's search algorithm, and gives rise to a family of quantum algorithms. It was discovered by Gilles Brassard and Peter Høyer in 1997, and independently rediscovered by Lov Grover in 1998.

In a quantum computer, amplitude amplification can be used to obtain a quadratic speedup over several classical algorithms.

Algorithm
The derivation presented here roughly follows the one given by Brassard et al. in 2000. Assume we have an $$N$$-dimensional Hilbert space $$\mathcal{H}$$ representing the state space of a quantum system, spanned by the orthonormal computational basis states $$B := \{| k \rangle \}_{k=0}^{N-1}$$. Furthermore assume we have a Hermitian projection operator $$P\colon \mathcal{H} \to \mathcal{H}$$. Alternatively, $$P$$ may be given in terms of a Boolean oracle function $$\chi\colon\mathbb{Z} \to \{0,1\}$$ and an orthonormal operational basis $$B_{\text{op}} := \{|\omega_k\rangle \}_{k=0}^{N-1}$$, in which case
 * $$P := \sum_{\chi(k)=1} |\omega_k \rangle \langle \omega_k|$$.

$$P$$ can be used to partition $$\mathcal{H}$$ into a direct sum of two mutually orthogonal subspaces, the good subspace $$\mathcal{H}_1$$ and the bad subspace $$\mathcal{H}_0$$:$$ \begin{align} \mathcal{H}_1 &:= \text{Image}\; P &= \operatorname{span}\{|\omega_k\rangle \in B_{\text{op}} \;|\; \chi(k) = 1\},\\ \mathcal{H}_0 &:= \text{Ker} \; P &= \operatorname{span}\{|\omega_k\rangle \in B_{\text{op}} \;|\; \chi(k) = 0\}. \end{align} $$In other words, we are defining a "good subspace" $$\mathcal H_1$$ via the projector $$P$$. The goal of the algorithm is then to evolve some initial state $$|\psi\rangle \in \mathcal{H}$$ into a state belonging to $$\mathcal H_1$$.

Given a normalized state vector $$|\psi\rangle \in \mathcal{H}$$ with nonzero overlap with both subspaces, we can uniquely decompose it as


 * $$|\psi\rangle = \sin(\theta) |\psi_1\rangle +\cos(\theta) |\psi_0\rangle$$,

where $$\theta = \arcsin\left( \left| P |\psi\rangle \right| \right) \in [0, \pi/2]$$, and $$|\psi_1\rangle$$ and $$|\psi_0\rangle$$ are the normalized projections of $$|\psi\rangle$$ into the subspaces $$\mathcal{H}_1$$ and $$\mathcal{H}_0$$, respectively. This decomposition defines a two-dimensional subspace $$\mathcal{H}_\psi$$, spanned by the vectors $$|\psi_0\rangle$$ and $$|\psi_1\rangle$$.

The probability of finding the system in a good state when measured is $$\sin^2(\theta)$$.

Define a unitary operator $$Q(\psi, P) := -S_\psi S_P \,\!$$, where

\begin{align} S_\psi &= I -2|\psi\rangle \langle\psi|\quad \text{and}\\ S_P   &= I -2 P. \end{align} $$ $$S_P$$ flips the phase of the states in the good subspace, whereas $$S_\psi$$ flips the phase of the initial state $$|\psi\rangle$$.

The action of this operator on $$\mathcal{H}_\psi$$ is given by
 * $$Q |\psi_0\rangle = -S_\psi |\psi_0\rangle = (2\cos^2(\theta)-1)|\psi_0\rangle +2 \sin(\theta) \cos(\theta) |\psi_1\rangle$$ and
 * $$Q |\psi_1\rangle = S_\psi |\psi_1\rangle = -2 \sin(\theta) \cos(\theta) |\psi_0\rangle +(1-2\sin^2(\theta))|\psi_1\rangle$$.

Thus in the $$\mathcal{H}_\psi$$ subspace $$Q$$ corresponds to a rotation by the angle $$2\theta\,\!$$:
 * $$Q = \begin{pmatrix}

\cos(2\theta) & -\sin(2\theta)\\ \sin(2\theta) & \cos(2\theta) \end{pmatrix}$$. Applying $$Q$$ $$n$$ times on the state $$|\psi\rangle$$ gives
 * $$Q^n |\psi\rangle = \cos((2n+1) \theta) |\psi_0\rangle +\sin((2n+1)\theta) |\psi_1\rangle$$,

rotating the state between the good and bad subspaces. After $$n$$ iterations the probability of finding the system in a good state is $$\sin^2((2n+1)\theta)\,\!$$. The probability is maximized if we choose
 * $$n = \left\lfloor\frac{\pi}{4\theta}\right\rfloor$$.

Up until this point each iteration increases the amplitude of the good states, hence the name of the technique.

Applications
Assume we have an unsorted database with N elements, and an oracle function $$\chi$$ which can recognize the good entries we are searching for, and $$B_{\text{op}} = B$$ for simplicity.

If there are $$G$$ good entries in the database in total, then we can find them by initializing a quantum register $$|\psi\rangle$$ with $$n$$ qubits where $$2^n=N$$ into a uniform superposition of all the database elements $$N$$ such that


 * $$|\psi\rangle = \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} |k\rangle$$

and running the above algorithm. In this case the overlap of the initial state with the good subspace is equal to the square root of the frequency of the good entries in the database, $$\sin(\theta) = |P |\psi\rangle|= \sqrt{G/N}$$. If $$\sin(\theta) \ll 1$$, we can approximate the number of required iterations as


 * $$n = \left\lfloor\frac{\pi}{4\theta}\right\rfloor

\approx \left\lfloor\frac{\pi}{4 \sin(\theta)}\right\rfloor = \left\lfloor\frac{\pi}{4} \sqrt{\frac{N}{G}}\right\rfloor = O(\sqrt{N}). $$

Measuring the state will now give one of the good entries with high probability. Since each application of $$S_P$$ requires a single oracle query (assuming that the oracle is implemented as a quantum gate), we can find a good entry with just $$O(\sqrt{N})$$ oracle queries, thus obtaining a quadratic speedup over the best possible classical algorithm. (The classical method for searching the database would be to perform the query for every $$e \in \{0,1,\dots,N-1\}$$ until a solution is found, thus costing $$O(N)$$ queries.) Moreover, we can find all $$G$$ solutions using $$O(\sqrt{GN})$$ queries.

If we set the size of the set $$G$$ to one, the above scenario essentially reduces to the original Grover search.

Quantum counting
Suppose that the number of good entries is unknown. We aim to estimate $$\tilde{G}$$ such that $$(1-\delta)G \leq \tilde{G} \leq (1+\delta)G$$ for small $$\delta>0$$. We can solve for $$\tilde{G}$$ by applying the quantum phase estimation algorithm on unitary operator $$Q$$.

Since $$e^{2i\theta}$$ and $$e^{-2i\theta}$$ are the only two eigenvalues of $$Q$$, we can let their corresponding eigenvectors be $$|\psi_1\rangle $$ and $$ | \psi_2\rangle $$. We can find the eigenvalue $$ e^{2 i \theta} $$ of $$ |\psi\rangle $$, which in this case is equivalent to estimating the phase $$\theta$$. This can be done by applying Fourier transforms and controlled unitary operations, as described in the quantum phase estimation algorithm. With the estimate $$\tilde{\theta}$$, we can estimate $$\sin{\theta}$$, which in turn estimates $$G$$.

Suppose we want to estimate $$\theta$$ with arbitrary starting state $$|s\rangle $$, instead of the eigenvectors $$|\psi_1\rangle $$ and $$|\psi_2\rangle $$. We can do this by decomposing $$|s\rangle $$ into a linear combination of $$|\psi_1\rangle $$ and $$|\psi_2\rangle $$, and then applying the phase estimation algorithm.