\documentclass[11 pt]{article}
\newcommand{\ignore}[1]{}
\include{lecture}
\usepackage{subfigure}
\usepackage{amsfonts}
\usepackage{color}
\definecolor{Red}{rgb}{0.9,0.0,0.0}
\begin{document}
\lecture{9}{9/23/2010}{Phase Estimation}{Hesam Dashti}
Last lecture we reviewed the classical setting of the Fourier Transform over the reals. In this class we discuss the Fourier Transform over finite Abelian groups, and show how to compute it efficiently in the Quantum setting. At the end of this lecture, we start introducing Phase Estimation as an application of the Quantum Fourier Transform.
\section{Fourier Transform over Finite Abelian Groups}
For a general group $G$, the Fourier Transform is an orthonormal basis transformation from the standard basis of delta functions $\delta_g$, $g \in G$, for the space of functions $f: G \rightarrow \mathbb{C}$ such that
convolutions are transformed into pointwise products. Such a transformation exists for any finite group, but the construction is significantly simpler when the group is Abelian. In that case the new orthonormal basis is formed by the normalized characters of the group. A character of $G$ is a homomorphism from $G$ to the group of complex numbers under multiplication, i.e., a function $\chi:G \rightarrow \mathbb{C}$ such that for all $a, b \in G$,
$\chi(ab)=\chi(a).\chi(b)$.
Let us recall the two facts about the characters from the previous lecture:\\
\textbf{Facts:} For any two distinct characters $\chi, \chi'$ and any $g \in G$, the following holds:
\begin{itemize}
\item[1.] $| \chi(g) |$ = 1; this means that range of the $\chi$ function lies on the unit circle in the complex plane.
\item[2.] $\chi$ and $\chi'$ are perpendicular to each other with respect to the inner product
\[(\chi, \chi') = \sum_{g \in G} \overline{\chi(g)} \chi'(g),\]
i.e., $(\chi,\chi')=0$.
\end{itemize}
Recall that orthogonality of nonzero vectors implies linear independence, and that the dimension of the space of functions from $G$ to $\mathbb{C}$ is
$|G|$. Thus, if we can find $|G|$ distinct characters, then they form a basis for that space. By Fact 2, the basis is orthogonal. By Fact 1, $(\chi,\chi)=|G|$, so in order to have an orthnormal basis we need to normalize the characters and use the functions $\frac{1}{\sqrt{G}}\chi$. If we then index the characters as
$\chi_y$ where $y$ ranges over $G$, every function $f: G \rightarrow \mathbb{C}$ can be written as a linear combination of the normalized
characters $\frac{1}{\sqrt{G}}\chi_y$, or equivalently, of the normalized characters $\frac{1}{\sqrt{G}}\overline{\chi_y}$:
\[f(x)=\frac{1}{\sqrt{G}}\sum_{y\in G}\hat{f}(x)\overline{\chi_y(x)}.\]
By taking the inner product with $\bar{\chi}_{y*}$ on both side and using orthonormality, we find the following expression for $\hat{f}$:
\[\hat{f}(y*) = \frac{1}{\sqrt{|G|}} \sum_{x \in G} f(x)\chi_{y*}(x).\]
We wanted our new basis functions to have two properties: they should be orthonormal (as we showed) and the transformation should map convolutions to point-wise products. The new basis functions have this property and we leave the proof as an exercise.
\begin{exercise}
For $(f\ast g)(x)=\sum_{y\in G}f(y)g(x.y^{-1})$ show that $\widehat{f\ast g}$(y) = $\sqrt{|G|} \hat{f}(y).\hat{g}(y)$
\end{exercise}
Next, we show that for Abelian finite groups $G$, the number of distinct characteres is indeed equal to $|G|$, and we find all the characters.
First, let us start with a very simple group: the cyclic group over $N$ elements $G=\mathbb{Z}_{N},+$. In this case, $|G|=N$, so we need to find $N$ characters. Since $\mathbb{Z}_{N},+$ is generated by the element 1, each character of $\mathbb{Z}_{N},+$ is fully determined by its value at 1:
$\chi(x) = \chi(1)^x$. Moreover, the value $\chi(1)$ could be any $z \in\mathbb{C}$ that satisfies $z^N=1$, i.e., any point on the regular $N$-gon
inscribed in the unit circle and containing 1 (see Figure \ref{Fig_09}).
\begin{figure}[h]\label{Fig_09}
\begin{center}
\includegraphics[scale=.18]{09_unit_circle.pdf}
\end{center}
\caption{Choices for $\chi(1)$ for $G=\mathbb{Z}_{8},+$.}
\end{figure}
Since these points are of the form $e^{2\pi i\frac{y}{N}}$ for $y \in \mathbb{Z}_N$, we set $\chi_y(1)=e^{2\pi i\frac{y}{N}}$. This generates the $N$ distinct characters
\[\chi_y(x) = e^{\frac{2\pi iyx}{N}}.\]
which we need for the cyclic group $\mathbb{Z}_N,+$.
Now consider the case of a group $G$ that is the direct product of a finite number of cyclic groups:
\[G=\oplus_{j=1}^k \mathbb{Z}_{m_j},+.\]
Every element of $x \in G$ can be written as a $k$-tuple $x = (x_1, x_2, \ldots, x_k)$ where $x_j \in \mathbb{Z}_{m_j}$, and $|G| = \prod_{j=1}^k m_j$.
In order to find characters of this group, we can pick a character from each of the constituent groups $\mathbb{Z}_{m_j},+$ and multiply them to get a single character of $G$. For example, we can pick ($\chi_{y_1}(x_1), \chi_{y_1}(x_2), \ldots, \chi_{y_k}(x_k)$) and obtain
\[\prod_{j=1}^k \chi_{y_j}(x_j)= e^{2\pi i(\frac{x_1.y_1}{m_1}+\frac{x_2.y_2}{m_2}+\ldots+\frac{x_k.y_k}{m_k})}.\]
For different choices of $(y_1,\ldots,y_k)$ the product gives us different characters of $G$. As the number of distinct choices equals $\prod_{j=1}^k m_j = |G|$, we obtained all characters of $G$ this way.
Since every finite Abelian group is isomorphic to the direct product of cyclic groups, the latter case is the general one.
\section{Quantum Fourier Transform}
By viewing a base state $\ket{x}$ as the delta function $\delta_x$ for
$x\in \{0,1\}^n$, we define the Quantum Fourier transform as mapping $\ket{x}$ onto the Fourier expansion of $\delta_{x}$:
\[F:\ket{x} \rightarrow \sum_{y}\hat{\delta}_x(y)\ket{y}.\]
By linearity, if we apply $F$ to a superposition $\ket{\Psi} = \sum\alpha(x)\ket{x}$ we get:
\[F\ket{\Psi} = \sum_y\hat{\alpha}(y)\ket{y}.\]
For the group $G=\mathbb{Z}_N,+$ this gives
\[F:\ket{x}\rightarrow \frac{1}{\sqrt{N}}\sum_{y=0}^{N-1} e^{\frac{2\pi ixy}{N}} \ket{y}.\]
\subsection{Computing Fourier Transform over $\mathbb{Z}_N$ for $N=2^n$}
Now, we see how we can compute the Fourier Transform in the Quantum Setting
for the special case of $\mathbb{Z}_N,+$ where $N=2^n$ is a power of 2.
Let us start by considering the time complexity of computing the Fourier Transform in the Classical Setting and the Quantum Setting.\vspace{2ex}\\
\textbf{Classical Setting :}\\
The trivial algorithm takes $O(N^2)$ operations. The Fast Fourier Transform takes $O(Nn)$ operations.\vspace{2ex}\\
\textbf{Quantum Setting :}
\begin{itemize}
\item[1.] A simple algorithm that we will develop, takes $O(n^2)$ operations.
\item[2.] A better algorithm takes $O(n(\log(n))^2\log\log(n))$ operations.
\item[3.] An approximate algorithm with an error at most $\epsilon$ takes $O(n\log(\frac{n}{\epsilon}))$ operations.
\end{itemize}
\textbf{The Simple Quantum Algorithm in time $O(n^2)$:}\\
Recall that we can represent the Quantum Fourier Transform by
\begin{equation}\label{eq:FT}
F\ket{x} = \frac{1}{\sqrt{N}}\sum e^{\frac{2\pi ix.y}{N}}\ket{y}.
\end{equation}
Let us start by considering the binary representations
$x=x_1 x_2 \ldots x_n$ and $y=y_1 y_2 \ldots y_n$, where $x_j, y_j \in \{0,1\}$.
Note that we can write $y$ as $y=\sum_{j=1}^n y_j2^{n-j}$ and plug it into
(\ref{eq:FT}). We can rewrite the exponential function in the amplitude as
a product
\[e^{\frac{2\pi ixy}{N}}=\prod_{j=1}^n e^{\frac{2\pi i\textcolor{Red}{x}\cdotp y_j\cdotp\textcolor{Red}{2^{n-j}}}{\textcolor{Red}{2^n}}}
= \prod_{j=1}^n e^{2\pi i(\cdot x_{n-j+1}\ldots x_n) y_j},\]
where the latter step follows because
$\frac{x2^{n-j}}{2^n} = x_1x_2\ldots x_{n-j} \cdot x_{n-j+1}\ldots x_n$
and $e^{2\pi i.(Integer)}=1$.
Using this equation we can write $F \ket{x}$ as the tensor product
$F \ket{x} = \otimes_{j=1}^n \ket{y_j}$, where
\[ \ket{y_j}=\frac{\ket{0}+e^{2\pi i(\cdotp x_{n-j+1}\ldots x_n)}\ket{1}}{\sqrt{2}}.\]
Let us start to compute the first qubit of the output and see what is the value of $\ket{y_1}$:
\[\ket{y_1}=\frac{\ket{0}+e^{2\pi ix_n}\ket{1}}{\sqrt{2}}.\]
If $x_n$ is zero we get $\frac{\ket{0}+\ket{1}}{\sqrt{2}}$ and in another case we get $\frac{\ket{0}-\ket{1}}{\sqrt{2}}$. In fact, this is the Hadamard transform on $\ket{x_n}$, so \[\ket{y_1} = H\ket{x_n}.\]
Now, let us consider the second qubit
\[\ket{y_2}=\frac{1}{\sqrt{2}}(\ket{0}+e^{2\pi i(\cdotp x_{n-1}x_n)}\ket{1}),\]
The Hadamard transform on $\ket{x_{n-1}}$ gives us
\[H\ket{x_{n-1}}=\frac{1}{\sqrt{2}}(\ket{0}+e^{2\pi i(\cdotp x_{n-1})}\ket{1}).\]
When $x_n$ is zero, $H\ket{x_{n-1}}$ is the output. But if $x_n$ is 1 we need to apply the rotation operation $R_{2\pi/4}$ on $H\ket{x_{n-1}}$. Hence, we need to define a conditional rotation ($CR_\theta$) based on the regular rotation ($R_\theta$), as follows.
\[\text{When }R_\theta=
\left[ {\begin{array}{cc}
1 & 0 \\
0 & e^{i\theta} \\
\end{array} } \right]
\text{ then }CR_\theta=
\left[ {\begin{array}{cccc}
1 & 0 & 0 &0 \\
0 & 1 & 0 &0 \\
0 & 0 & 1 &0 \\
0 & 0 & 0 & e^{i\theta} \\
\end{array} } \right]
.\]
For $\ket{y_3}$ we need two conditional rotations based on the values of $x_n$ and $x_{n-1}$.
We can keep going and construct our Quantum circuit as pictured following:\\
\begin{equation*}
\Qcircuit @C=1.5em @R=2.0em
{
& \lstick{x_n} & \qw & \qw & \ctrl{2} & \qw & \ctrl{1} & \gate{H} & \qw &\rstick{\ket{y_1}}\\
& \lstick{x_{n-1}} & \qw & \ctrl{1} & \qw & \gate{H} & \gate{R_{\pi/2}} & \qw & \qw &\rstick{\ket{y_2}}\\
& \lstick{x_{n-2}} & \gate{H} & \gate{R_{\pi/2}} & \gate{R_{\pi/4}} & \qw & \qw & \qw & \qw &\rstick{\ket{y_3}}\\
& \vdots & & & & & & & & \vdots\\
}
\end{equation*}\vspace{3ex}\\
This gives us the correct output except that the $y_j$'s are in the reverse order. We can easily swap them to get them in the right order.
The number of gates to compute $\ket{y_j}$ is $O(j)$. In total, the circuit
contains $O(n^2)$ gates.
We can construct a simpler circuit with a good approximation and lower complexity by ignoring the smaller rotation gates, which have a minor
effect on the outputs.
Thus, we found the Fourier transform for the group $\mathbb{Z}_{N}$, where $N=2^n$. In particular, when $n=1$ the operation of the Fourier transform is the Hadamard transform. The Fourier Transform over $(\mathbb{Z}_2)^n$ is
the tensor product of $n$ Hadamard transforms: $F = H^{\bigotimes n}$. Each time we applied $H^{\bigotimes n}$ in the past, we were really applying the Fourier Transform over $(\mathbb{Z}_2)^n$.
\section{Phase Estimation}
Phase estimation is the following problem.
\textbf{Problem:} For a given \begin{math}\ket{\Psi}=\frac{1}{\sqrt{N}}\sum_{x=0}^{N-1}e^{2\pi i\omega x}\ket{x}\text{, where }0\leq\omega<1\end{math}, the goal is estimate the value of $\omega$.\\
To achieve this goal we consider two cases as follows:\vspace{2ex}\\
\textbf{Case 1:} $\omega$ is of the form $\frac{z}{N}$, where $z\in\{0, \ldots, N-1\}.$\\
In this case, we can find $\omega$ exactly by performing inverse Fourier transform on the superposition $\ket{\Psi}$ and observe the $z$:\[z:= F^{-1}\ket{\Psi} = \ket{z}.\]\vspace{1ex}\\
\textbf{Case 2:} In general, without the constraint on $\omega$, we can find an approximation which is close to $\omega$. We claim that the above procedure yields that with high probability, and now analyze its probability
of success.
\[F^{-1}\ket{\Psi} = \sum_{z=0}^{N-1}\alpha_z\ket{z}, \]
where
\[
\alpha_z=\frac{1}{N}\sum_{j=0}^{N-1}e^{2\pi i\omega y}e^{-\frac{2\pi izy}{N}}
=
\frac{1}{N}\sum_{y=0}^{N-1}(e^{2\pi i(\omega-\frac{z}{N})})^y = \frac{1}{N}.\frac{1-e^{2\pi i(\omega-\frac{z}{N})N}}{1-e^{2\pi i(\omega-\frac{z}{N})}}.\]
The probability of observing $z$ is $|\alpha_z|^2$. Using the above expression for $\alpha_z$ we will show in the next lecture that the probability of obtaining the closest approximation to $\omega$ of the form $\frac{z}{N}$ is high, and that the probability of obtaining one that is far from $\omega$ is small.
We will also discuss an important application of phase estimation, namely estimating the eigenvalues of unitary operations, which are all of the form
$e^{2\pi i\omega}$ for some real $\omega \in [0,1)$.
\end{document}