#LyX 1.4.4 created this file. For more info see http://www.lyx.org/ \lyxformat 245 \begin_document \begin_header \textclass article \language english \inputencoding auto \fontscheme default \graphics default \paperfontsize default \spacing single \papersize default \use_geometry true \use_amsmath 1 \cite_engine basic \use_bibtopic false \paperorientation portrait \leftmargin 1in \topmargin 1in \rightmargin 1in \bottommargin 1in \secnumdepth 3 \tocdepth 3 \paragraph_separation skip \defskip medskip \quotes_language english \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes false \end_header \begin_body \begin_layout Standard COMSW4281 Lecture Notes \end_layout \begin_layout Standard Professor Anargyros Papageorgiou \end_layout \begin_layout Standard Spring 2007 \end_layout \begin_layout Section* Lecture 1 (17 January) \end_layout \begin_layout Subsection* Course Information \end_layout \begin_layout Standard Course email: cs4281@columbia.edu (to contact TA, submit homeworks) \newline Professor email: ap@cs \newline Textbook: Nielsen & Chuang \newline Courseworks \newline Grading: Homework 30%, Midterm 30%, Final 40% \newline Matlab recommended for programming \newline Quizzes might be given, averaged into midterm/final grades \newline Office Hours: Tues 1-2, Wed 12-1 \end_layout \begin_layout Subsection* Why Quantum Computing \end_layout \begin_layout Standard 1. Moore's Law - Density of transistors increases every 18 months, which means within 10-20 years quantum effects will become a barrier \end_layout \begin_layout Standard 2. Quantum Algorithms - Factoring, Search Algorithms \newline \newline Best Classical Factoring Algorithm: Number Field \newline Performance: log \begin_inset Formula $2^{C(\log N)^{1/2}}\left(\log\log N\right)^{2/3}$ \end_inset \newline Quantum Algorithm Discovered 1994 by Peter Shor \newline Performance: \begin_inset Formula $\left(\log N\right)^{3}$ \end_inset w/ probability O(1) (or \begin_inset Formula $>\frac{1}{2}$ \end_inset ) \newline In general, quantum algorithms do not give results with certainty, but if probablity is greater than one half, they can be repeated to get sufficient certainty \newline \newline Discrete Logarithm Problem: given numbers \begin_inset Formula $a$ \end_inset and \begin_inset Formula $b=a^{s}$ \end_inset , find s. \newline Quantum solution: 1 query \begin_inset Formula $O\left(\left(\log s\right)^{2}\right)$ \end_inset \newline When looking at quantum performance, have to look at the number of queries as well as number of operations. \newline \newline Search Algorithm \newline Given binary string length N (for some huge N), find position of subtring \newline Classical Lower Bound O(N), even for randomized algorithms, no success guarantee \newline Quantum Algorithm O( \begin_inset Formula $\sqrt{N}$ \end_inset ) \newline Quantum Algorithm only has polynomial advantage over classical, not exponential as in factoring \newline Grover's Algorithm \newline \newline Boolean mean, Numerical integration - related to search, same polynomial speedup \end_layout \begin_layout Standard 3. Quantum cryptography for key distribution \newline Can replace PKI, which assumes that factoring is hard. Private key distribution over a quantum channel can't be eavesdropped upon without detection. Earliest successes and applications of quantum computing are in this area. \end_layout \begin_layout Standard 4. Study of Quantum Mechanics as a model of computation \newline Church-Turing Thesis - any algorithmic computation can be simulated (efficiently) by a turing machine (which is probabalistic). \newline (efficiently) - part of strong version of thesis, weaker one leaves it out \newline (Thesis) - means conjecture or belief, not a provable theorem. \newline (which is probalistic) - fix for thesis added in 1970s. Solovay Strassev came up with a randomized algorithm for primality testing which can give arbitrary levels of certainty at vastly improved efficiency over deterministic algorithm \newline \newline Deutsch 1985 \newline Came up with quantum model of computati on in order to produce more solid version of CT thesis. Conjectured a Universal Quantum Computer that can simulate any physical process. It isn't known if this is really possible. (His paper is in courseworks, first 3-4 pages are philosophical and accessible, rest is more technical) \newline \newline 5. Study of Entanglement. 2 qubit system that can't be seperated... EPR state... Quantum Teleportation... More later in the course. \end_layout \begin_layout Subsection* Quantum Systems \end_layout \begin_layout Standard Size of quantum system is \begin_inset Formula $C^{N}$ \end_inset where N is number of particles, C is number of coordinates, set of complex numbers used to represent a state. \end_layout \begin_layout Standard Quantum states can be expressed as vectors \newline \begin_inset Formula $x=\left(\begin{array}{c} x_{1}\\ x_{1}\\ \vdots\\ x_{n}\end{array}\right)\in\mathbb{C}^{N}$ \end_inset \end_layout \begin_layout Standard Dirac notation is used in many cases instead of standard linear algebra notation. Dirac \begin_inset Quotes eld \end_inset captures the transpose of a matrix \begin_inset Quotes erd \end_inset ( \begin_inset Formula $X^{H}$ \end_inset - hermetian transpose of X) \end_layout \begin_layout Standard For quantum states, \begin_inset Formula $\left\Vert x\right\Vert =1$ \end_inset . ( \begin_inset Formula $\left\Vert x\right\Vert $ \end_inset - euclidean norm of X, square root of sum of squares) \end_layout \begin_layout Standard States are transformed by unitary matrices \begin_inset Formula $U_{x}$ \end_inset . Unitary means preserves length, that \begin_inset Formula $UU^{H}=I$ \end_inset , or \begin_inset Formula $U^{-1}=U^{H}$ \end_inset . Examples of unitary matrices: identity matrix, any rotation matrix, and the Hausholder matrix \newline ( \begin_inset Formula $P=I-2UU^{H}$ \end_inset , \begin_inset Formula $\left\Vert U\right\Vert =1$ \end_inset ). Hausholder matrix has something to do with mirrors/reflection. \end_layout \begin_layout Subsection* Quantum Computing Nutshell \end_layout \begin_layout Standard \begin_inset Formula $X_{0}$ \end_inset - initial states \newline \begin_inset Formula $Y=V_{T}=U_{3}U_{2}U_{1}X_{0}$ \end_inset - result is unitary matrices applied to input \end_layout \begin_layout Standard Complexity is \begin_inset Formula $n\cdot T$ \end_inset , where \begin_inset Formula $T$ \end_inset is number of matrices, n=log N=number of qubits, and N=length of quantum register \end_layout \begin_layout Section* Lecture 2 (22 January) \end_layout \begin_layout Subsection* Quantum Computation \end_layout \begin_layout Standard Start with \begin_inset Formula $X_{0}$ \end_inset , initial quantum state which is a vector. Apply unitary operations, \begin_inset Formula $U_{1}\ldots U_{t}$ \end_inset (Unitary meaning \begin_inset Formula $U_{j}^{H}U_{j}=I$ \end_inset ). Cost can be measured in terms of number of qubits n, and number of operations t. \end_layout \begin_layout Subsection* Qubits \end_layout \begin_layout Standard Classical computation uses bits with states 0 and 1 \newline Quantum computation uses qubits whose states are superpositions of states \begin_inset Formula $\left|0\right\rangle $ \end_inset and \begin_inset Formula $\left|1\right\rangle $ \end_inset . (pronounced \begin_inset Formula $\texttt{"}$ \end_inset ket zero \begin_inset Formula $\texttt{"}$ \end_inset and \begin_inset Formula $\texttt{"}$ \end_inset ket one. \begin_inset Formula $\texttt{"}$ \end_inset ) \end_layout \begin_layout Standard Superposition states of qubits occur in a variety of physical systems. Simplest example is an electron that can be in a ground state 0 and excited state 1. You can shine light to put electron in excited state and reduce light to put it into ground state, or you can increase and decrease light repeatedly to put electron into superposition state. Other examples of superposition states occur in polarizations of photons, and intermediate angle spins of electrons traveling through magnetic fields \end_layout \begin_layout Standard Mathematical description of qubits. Formally, a qubit is an element of a two dimensional hilbert space \begin_inset Formula $\mathcal{H}$ \end_inset . \end_layout \begin_layout Standard A hilbert space is ___. (couldn't make out word) \end_layout \begin_layout Standard Qubit states can be represented as two complex numbers a and b, in a vector like \newline \begin_inset Formula $\left(\begin{array}{c} a\\ b\end{array}\right)\in\mathbb{C}^{2}$ \end_inset \newline \begin_inset Formula $\left|0\right\rangle =\left(\begin{array}{c} 1\\ 0\end{array}\right)$ \end_inset , \begin_inset Formula $\left|1\right\rangle =\left(\begin{array}{c} 0\\ 1\end{array}\right)$ \end_inset \newline Euclidean norms are 1 ( \begin_inset Formula $\left\Vert \left|0\right\rangle \right\Vert =1$ \end_inset , \begin_inset Formula $\left\Vert \left|1\right\rangle \right\Vert =1$ \end_inset ) \newline \begin_inset Formula $\left|0\right\rangle $ \end_inset and \begin_inset Formula $\left|1\right\rangle $ \end_inset are orthonormal ( \begin_inset Formula $\left|0\right\rangle \cdot\left|1\right\rangle =0$ \end_inset ) \end_layout \begin_layout Subsubsection* Dirac Notation \end_layout \begin_layout Standard \begin_inset Formula $\left|x\right\rangle $ \end_inset called \begin_inset Quotes eld \end_inset ket \begin_inset Quotes erd \end_inset , denotes coordinate vector \begin_inset Formula $\left(\begin{array}{c} x_{1}\\ x_{2}\\ \vdots\\ x_{n}\end{array}\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\left\langle x\right|$ \end_inset called \begin_inset Quotes eld \end_inset bra \begin_inset Quotes erd \end_inset denotes \begin_inset Formula $\left(\begin{array}{cccc} \overline{x_{1}} & \overline{x_{2}} & \cdots & \overline{x_{n}}\end{array}\right)$ \end_inset \newline (where \begin_inset Formula $\bar{n}$ \end_inset is complex conjugate of \begin_inset Formula $n$ \end_inset ) \end_layout \begin_layout Standard \begin_inset Formula $\left\langle x|y\right\rangle $ \end_inset called \begin_inset Quotes eld \end_inset braket \begin_inset Quotes erd \end_inset denotes inner product, magnitude of projection of y on to x. \newline \begin_inset Formula $\left\langle x|y\right\rangle =\left\langle x\right|\cdot\left|y\right\rangle =\left(\begin{array}{cccc} \overline{x_{1}} & \overline{x_{2}} & \cdots & \overline{x_{n}}\end{array}\right)\left(\begin{array}{c} y_{1}\\ y_{2}\\ \vdots\\ y_{n}\end{array}\right)=\sum_{j=1}^{n}\bar{x_{j}}y_{j}$ \end_inset \newline \begin_inset Formula $\left\langle x|x\right\rangle =\left\Vert \left|x\right\rangle \right\Vert ^{2}$ \end_inset \end_layout \begin_layout Standard A qubit is a unitary vector in hilbert space. \newline \begin_inset Formula $\left|y\right\rangle =a\left|0\right\rangle +b\left|1\right\rangle $ \end_inset where \begin_inset Formula $a,b\in\mathbb{C}$ \end_inset and \begin_inset Formula $\left|a\right|^{2}+\left|b\right|^{2}=1$ \end_inset \end_layout \begin_layout Standard A qubit is a linear combination of ket 0 and ket 1. \newline \begin_inset Formula $\left|y\right\rangle =a\left(\begin{array}{c} 1\\ 0\end{array}\right)+b\left(\begin{array}{c} 0\\ 1\end{array}\right)=\left(\begin{array}{c} a\\ b\end{array}\right)$ \end_inset \end_layout \begin_layout Standard Showing qubit y is unitary. \newline \begin_inset Formula $\left\Vert \left|y\right\rangle \right\Vert ^{2}=\left(\begin{array}{cc} \bar{a} & \bar{b}\end{array}\right)\left(\begin{array}{c} a\\ b\end{array}\right)=\bar{a}a+\bar{b}b=\left|a\right|^{2}+\left|b\right|^{2}=1$ \end_inset \end_layout \begin_layout Standard Showing qubit y is unitary in dirac notation. \begin_inset Formula \begin{eqnarray*} \left\Vert \left|y\right\rangle \right\Vert ^{2} & = & \left\langle y|y\right\rangle =\left\langle y\right|\cdot\left|y\right\rangle \\ & = & \left(\bar{a}\left\langle 0\right|+\bar{b}\left\langle 1\right|\right)\cdot\left(a\left|0\right\rangle +b\left|1\right\rangle \right)\\ & = & \bar{a}a\left\langle 0|0\right\rangle +\bar{a}b\left\langle 0|1\right\rangle +\bar{b}a\left\langle 1|0\right\rangle +\bar{b}b\left\langle 1|1\right\rangle \\ & = & \bar{a}a+\bar{b}b=\left|a\right|^{2}+\left|b\right|^{2}=1\end{eqnarray*} \end_inset One feature of dirac notation demonstrated here is that you can treat matrix multiplication as regular multiplication \end_layout \begin_layout Subsection* Bloch Sphere representation of Qubits \end_layout \begin_layout Standard Bloch sphere lets you represent qubits in a picture \newline \begin_inset Formula $\left|\psi\right\rangle =\alpha\left|0\right\rangle +\beta\left|1\right\rangle $ \end_inset \newline Substitute \begin_inset Formula $\alpha=\left|\alpha\right|e^{i\varphi_{\alpha}}$ \end_inset , \begin_inset Formula $\beta=\left|\beta\right|e^{i\varphi_{\beta}}$ \end_inset \newline \begin_inset Formula $\left|\psi\right\rangle =\left|\alpha\right|e^{i\varphi_{\alpha}}\left|0\right\rangle +\left|\beta\right|e^{i\varphi_{\beta}}\left|1\right\rangle $ \end_inset \newline \begin_inset Formula $\left|\psi\right\rangle =e^{i\varphi_{\alpha}}\left(\left|\alpha\right|\left|0\right\rangle +\left|\beta\right|e^{i\left(\varphi_{\beta}-\varphi_{\alpha}\right)}\left|1\right\rangle \right)$ \end_inset \newline Substitute \begin_inset Formula $\varphi=\varphi_{\beta}-\varphi_{\alpha}$ \end_inset , \begin_inset Formula $\gamma=\varphi_{\alpha}$ \end_inset for \begin_inset Formula $\varphi\in\left[0,2\pi\right]$ \end_inset \newline \begin_inset Formula $\left|\psi\right\rangle =e^{i\gamma}\left(\left|\alpha\right|\left|0\right\rangle +\left|\beta\right|e^{i\varphi}\left|1\right\rangle \right)$ \end_inset \newline Substitute \begin_inset Formula $\left|\alpha\right|=\cos\vartheta$ \end_inset , \begin_inset Formula $\left|\beta\right|=\sin\vartheta$ \end_inset , for \begin_inset Formula $\vartheta\in\left[0,\frac{\pi}{2}\right]$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\left|\psi\right\rangle =e^{i\gamma}\left(\cos\vartheta\left|0\right\rangle +\sin\vartheta e^{i\varphi}\left|1\right\rangle \right)$ \end_inset \newline Substitute \begin_inset Formula $\left|\alpha\right|=\cos\frac{\vartheta}{2}$ \end_inset , \begin_inset Formula $\left|\beta\right|=\sin\frac{\vartheta}{2}$ \end_inset , for \begin_inset Formula $\vartheta\in\left[0,\pi\right]$ \end_inset \newline \begin_inset Formula $\left|\psi\right\rangle =e^{i\gamma}\left(\cos\frac{\vartheta}{2}\left|0\right\rangle +\sin\frac{\vartheta}{2}e^{i\varphi}\left|1\right\rangle \right)$ \end_inset \newline Any qubit can be expressed this way, in terms of \begin_inset Formula $\gamma$ \end_inset , \begin_inset Formula $\vartheta$ \end_inset , and \begin_inset Formula $\varphi$ \end_inset . And if you disregard \begin_inset Formula $\gamma$ \end_inset , (global phase which it turns out to be impossible to physically measure anyway), you can take angles \begin_inset Formula $\vartheta$ \end_inset and \begin_inset Formula $\varphi$ \end_inset and use them to plot points on a unit sphere. \end_layout \begin_layout Standard (Drawing bloch spheres \newline - z axis up, y axis right, x axis out \newline - \begin_inset Formula $\vartheta$ \end_inset = angle between point and z axis (latitude, but starting at north pole and extending down) \newline - \begin_inset Formula $\varphi$ \end_inset = angle between projection of point at z=0 and x axis (longitude) \end_layout \begin_layout Standard Textbook Figure 1.3, page 15) \end_layout \begin_layout Subsection* Measuring Qubits \end_layout \begin_layout Standard Attempting to measure a qubit in a superposition state, \begin_inset Formula $\left|y\right\rangle =a\left|0\right\rangle +b\left|1\right\rangle $ \end_inset , will give you state \begin_inset Formula $\left|0\right\rangle $ \end_inset with probability \begin_inset Formula $\left|a\right|^{2}$ \end_inset , and \begin_inset Formula $\left|1\right\rangle $ \end_inset with probability \begin_inset Formula $\left|b\right|^{2}$ \end_inset . After measuring the state, the qubit collapses, it ceases to be a superposition , and it changes to whatever state the measurement gave, either \begin_inset Formula $\left|0\right\rangle $ \end_inset or \begin_inset Formula $\left|1\right\rangle $ \end_inset . \end_layout \begin_layout Standard Collapse is a non-unitary transformation. It can be considered a projection and renormalization. \end_layout \begin_layout Standard Using standard linear algebra notation, you can express measurement of some state \begin_inset Formula $u$ \end_inset (where \begin_inset Formula $u\in\mathbb{C}^{N}$ \end_inset ) from a superposition state \begin_inset Formula $x$ \end_inset as being a projection of \begin_inset Formula $x$ \end_inset onto \begin_inset Formula $u$ \end_inset , followed by the normalization. To compute the result of the projection, you can multiply \begin_inset Formula $x$ \end_inset by a matrix \begin_inset Formula $M$ \end_inset where \begin_inset Formula $M=u\cdot u^{H}$ \end_inset . \begin_inset Formula $M$ \end_inset is called a projection matrix and \begin_inset Formula $Mx$ \end_inset will be the result of projecting \begin_inset Formula $x$ \end_inset onto \begin_inset Formula $u$ \end_inset . You don't actually need to form the matrix, however, since \begin_inset Formula $Mx=uu^{H}x$ \end_inset , and \begin_inset Formula $u^{H}x$ \end_inset can be computed as a simple dot product. \end_layout \begin_layout Standard Using dirac notation, and taking a measurement of \begin_inset Formula $\left|0\right\rangle $ \end_inset as an example: \begin_inset Formula \begin{eqnarray*} M\left|x\right\rangle & = & \left|0\right\rangle \left\langle 0\right|\left|x\right\rangle \\ & = & \left|0\right\rangle \left\langle 0\right|\left(a\left|0\right\rangle +b\left|1\right\rangle \right)\\ & = & a\left|0\right\rangle \left\langle 0\right|\left|0\right\rangle +b\left|0\right\rangle \left\langle 0\right|\left|1\right\rangle \\ & = & a\left|0\right\rangle \end{eqnarray*} \end_inset After normalizing, final state is \begin_inset Formula $\frac{a}{\left|a\right|}\left|0\right\rangle $ \end_inset . Same process can be used for a measurement of \begin_inset Formula $\left|1\right\rangle $ \end_inset to express final state as \begin_inset Formula $\frac{b}{\left|b\right|}\left|1\right\rangle $ \end_inset \end_layout \begin_layout Section* Lecture 3 (24 January) \end_layout \begin_layout Subsection* Course Information \end_layout \begin_layout Standard Midterm - Wednesday, 7 March \newline Midterm Review - Monday before \end_layout \begin_layout Subsection* Lecture 2 Review \end_layout \begin_layout Standard \begin_inset Formula $\left|y\right\rangle =a\left|0\right\rangle +b\left|1\right\rangle =e^{i\gamma}\left(\cos\frac{\vartheta}{2}\left|0\right\rangle +e^{i\varphi}\sin\frac{\vartheta}{2}\left|0\right\rangle \right)$ \end_inset \newline Collapse probability \newline \begin_inset Formula $\left|0\right\rangle $ \end_inset , \begin_inset Formula $p=\left|a\right|^{2}$ \end_inset \newline \begin_inset Formula $\left|1\right\rangle $ \end_inset , \begin_inset Formula $p=\left|b\right|^{2}$ \end_inset \end_layout \begin_layout Subsection* Alternate Basis \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|+\right\rangle & = & \frac{1}{\sqrt{2}}\left(\left|0\right\rangle +\left|1\right\rangle \right)=\cos\left(\frac{\pi}{4}\right)\left|0\right\rangle +e^{i0}\sin\left(\frac{\pi}{4}\right)\left|1\right\rangle \\ \left|-\right\rangle & = & \frac{1}{\sqrt{2}}\left(\left|0\right\rangle -\left|1\right\rangle \right)=\cos\left(\frac{\pi}{4}\right)\left|0\right\rangle +e^{i\pi}\sin\left(\frac{\pi}{4}\right)\left|1\right\rangle \end{eqnarray*} \end_inset Bloch sphere representations \newline \begin_inset Formula $\left|+\right\rangle $ \end_inset , \begin_inset Formula $\vartheta=\pi/2$ \end_inset , \begin_inset Formula $\varphi=0$ \end_inset , on equator at front of sphere \newline \begin_inset Formula $\left|-\right\rangle $ \end_inset , \begin_inset Formula $\vartheta=\pi/2$ \end_inset , \begin_inset Formula $\varphi=\pi$ \end_inset , on equator at back of sphere \end_layout \begin_layout Standard Proving orthogonality of \begin_inset Formula $\left|+\right\rangle $ \end_inset and \begin_inset Formula $\left|-\right\rangle $ \end_inset : \begin_inset Formula \begin{eqnarray*} \left\langle +|-\right\rangle & = & \left(\frac{1}{\sqrt{2}}\left(\left\langle 0\right|+\left\langle 1\right|\right)\right)\cdot\left(\frac{1}{\sqrt{2}}\left(\left|0\right\rangle -\left|1\right\rangle \right)\right)\\ & = & \frac{1}{2}\left(\left\langle 0|0\right\rangle -\left\langle 0|1\right\rangle +\left\langle 1|0\right\rangle -\left\langle 1|1\right\rangle \right)\\ & = & \frac{1}{2}\left(1-0+0-1\right)=0\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Proving \begin_inset Formula $\left|+\right\rangle $ \end_inset is unit vector (proof is similar for \begin_inset Formula $\left|-\right\rangle $ \end_inset ): \begin_inset Formula \begin{eqnarray*} \left\langle +|+\right\rangle & = & \left(\frac{1}{\sqrt{2}}\left(\left\langle 0\right|+\left\langle 1\right|\right)\right)\cdot\left(\frac{1}{\sqrt{2}}\left(\left|0\right\rangle +\left|1\right\rangle \right)\right)\\ & = & \frac{1}{2}\left(\left\langle 0|0\right\rangle +\left\langle 0|1\right\rangle +\left\langle 1|0\right\rangle +\left\langle 1|1\right\rangle \right)\\ & = & \frac{1}{2}\left(1+0+0+1\right)=1\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Equivalences, change of base \begin_inset Formula \begin{eqnarray*} \left|0\right\rangle & = & \frac{1}{\sqrt{2}}\left(\left|+\right\rangle +\left|-\right\rangle \right)\\ \left|1\right\rangle & = & \frac{1}{\sqrt{2}}\left(\left|+\right\rangle -\left|-\right\rangle \right)\end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Hadamard Gate \end_layout \begin_layout Standard Hadamard matrix maps \begin_inset Formula $\left|0\right\rangle $ \end_inset to \begin_inset Formula $\left|+\right\rangle $ \end_inset , \begin_inset Formula $\left|1\right\rangle $ \end_inset to \begin_inset Formula $\left|-\right\rangle $ \end_inset \begin_inset Formula \[ H=\frac{1}{\sqrt{2}}\left(\begin{array}{cc} 1 & 1\\ 1 & -1\end{array}\right)\] \end_inset You can see it by looking at columns. In general when looking at a transformation matrix, the first column shows what first basis vector ( \begin_inset Formula $\left|0\right\rangle $ \end_inset ) is transformed to, second column shows second basis vector ( \begin_inset Formula $\left|1\right\rangle $ \end_inset ), and so on. \end_layout \begin_layout Standard Hadamard mapping for general state \begin_inset Formula $\left|y\right\rangle =a\left|0\right\rangle +b\left|1\right\rangle $ \end_inset \begin_inset Formula \begin{eqnarray*} H\left|y\right\rangle & = & \frac{1}{\sqrt{2}}\left(\left(a+b\right)\left|0\right\rangle +\left(a-b\right)\left|1\right\rangle \right)\\ & = & \frac{1}{\sqrt{2}}\left(a\left(\left|0\right\rangle +\left|1\right\rangle \right)+b\left(\left|0\right\rangle -\left|1\right\rangle \right)\right)\\ & = & a\left|+\right\rangle +b\left|-\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Hadamard transform is unitary and is it's own inverse. \end_layout \begin_layout Standard Example: \begin_inset Formula \begin{eqnarray*} H\left|0\right\rangle & = & \frac{1}{\sqrt{2}}\left(\left|0\right\rangle +\left|1\right\rangle \right)\\ HH\left|0\right\rangle & = & \frac{1}{\sqrt{2}}\left(H\left|0\right\rangle +H\left|1\right\rangle \right)=\frac{1}{2}\left(\left|0\right\rangle +\left|1\right\rangle +\left|0\right\rangle -\left|1\right\rangle \right)=\left|0\right\rangle \end{eqnarray*} \end_inset The two half- \begin_inset Formula $\left|0\right\rangle $ \end_inset kets adding up is called constructive interference. The two half- \begin_inset Formula $\left|1\right\rangle $ \end_inset kets cancelling out is called destructive interference. \end_layout \begin_layout Subsection* Other Gates \end_layout \begin_layout Standard Pauli Matrix: \begin_inset Formula \[ X=\left(\begin{array}{cc} 0 & 1\\ 1 & 0\end{array}\right)\] \end_inset \end_layout \begin_layout Standard X is analogous to NOT gate: \begin_inset Formula \begin{eqnarray*} X\left|0\right\rangle & = & \left|1\right\rangle \\ X\left|1\right\rangle & = & \left|0\right\rangle \\ X\left|y\right\rangle & = & a\left|1\right\rangle +b\left|0\right\rangle \end{eqnarray*} \end_inset in Dirac notation: \begin_inset Formula \begin{eqnarray*} X & = & \left|1\right\rangle \left\langle 0\right|+\left|0\right\rangle \left\langle 1\right|\\ & = & \left(\begin{array}{c} 0\\ 1\end{array}\right)\left(\begin{array}{cc} 1 & 0\end{array}\right)+\left(\begin{array}{c} 1\\ 0\end{array}\right)\left(\begin{array}{cc} 0 & 1\end{array}\right)\\ & = & \left(\begin{array}{cc} 0 & 0\\ 1 & 0\end{array}\right)+\left(\begin{array}{cc} 0 & 1\\ 0 & 0\end{array}\right)=\left(\begin{array}{cc} 0 & 1\\ 1 & 0\end{array}\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard In general, when you have a unitary operation U and you know how it transforms basis states: \newline \begin_inset Formula $U\left|0\right\rangle =\left|s\right\rangle $ \end_inset , \begin_inset Formula $U\left|1\right\rangle =\left|t\right\rangle $ \end_inset , you can express U as: \begin_inset Formula \[ U=\left|s\right\rangle \left\langle 0\right|+\left|t\right\rangle \left\langle 1\right|\] \end_inset Verification: \begin_inset Formula \begin{eqnarray*} U\left|0\right\rangle & = & \left|s\right\rangle \left\langle 0|0\right\rangle +\left|t\right\rangle \left\langle 1|0\right\rangle =\left|s\right\rangle \\ U\left|1\right\rangle & = & \left|s\right\rangle \left\langle 0|1\right\rangle +\left|t\right\rangle \left\langle 1|1\right\rangle =\left|t\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Linear Algebra Review \end_layout \begin_layout Standard Given U is unitary matrix, \begin_inset Formula $\left\langle y|y\right\rangle =1$ \end_inset , \begin_inset Formula $U\left|y\right\rangle =\lambda\left|y\right\rangle $ \end_inset . Eigenvalues \begin_inset Formula $\lambda\in\mathbb{C}$ \end_inset can be expressed as \begin_inset Formula $\lambda=e^{it}$ \end_inset , \begin_inset Formula $t\in\mathbb{R}$ \end_inset . \end_layout \begin_layout Standard Show unitary matrix has eigenvalues of unit length: \begin_inset Formula \begin{eqnarray*} \left\langle y\right|U^{H} & = & \bar{\lambda}\left\langle y\right|\\ \left\langle y|U^{H}U|y\right\rangle & = & \bar{\lambda}\lambda\left\langle y|y\right\rangle \\ 1 & = & \left|\lambda\right|^{2}\end{eqnarray*} \end_inset Because they have unit length, eigenvalues can be written in the form \begin_inset Formula $\lambda=e^{it}.$ \end_inset \end_layout \begin_layout Standard Show a hermitian matrix \begin_inset Formula $A^{H}=A$ \end_inset has eigenvalues that are real numbers: \begin_inset Formula \begin{eqnarray*} A\left|y\right\rangle & = & \lambda\left|y\right\rangle \\ \left\langle y\right|A\left|y\right\rangle & = & \lambda\left\langle y|y\right\rangle =\lambda\\ \left\langle y\right|A^{H} & = & \bar{\lambda}\left\langle y\right|\\ \left\langle y\right|A^{H}\left|y\right\rangle & = & \bar{\lambda}\left\langle y|y\right\rangle =\bar{\lambda}\end{eqnarray*} \end_inset \begin_inset Formula $A=A^{H}$ \end_inset therefore \begin_inset Formula $\lambda=\bar{\lambda}$ \end_inset therefore \begin_inset Formula $\lambda\in\mathbb{R}$ \end_inset \end_layout \begin_layout Subsubsection* Spectral Theorem \end_layout \begin_layout Standard Unitary matrix U can be diagnalized as \begin_inset Formula $U=V\Lambda V^{H}$ \end_inset where \begin_inset Formula \[ \Lambda=\left(\begin{array}{cccc} \lambda_{1} & 0 & 0 & 0\\ 0 & \lambda_{1} & 0 & 0\\ 0 & 0 & \ddots & 0\\ 0 & 0 & 0 & \lambda_{n}\end{array}\right)\] \end_inset and \begin_inset Formula $V=\left(\begin{array}{cccc} Y_{1} & Y_{2} & \cdots & Y_{n}\end{array}\right)$ \end_inset , columns \begin_inset Formula $Y_{i}$ \end_inset are eigenvectors. \end_layout \begin_layout Standard The spectral theorem applies more generally to any Normal matrix. Normal matrices commute with their transpose, \begin_inset Formula $UU^{H}=U^{H}U$ \end_inset . \end_layout \begin_layout Standard (Matrix types \newline Normal - \begin_inset Formula $U^{H}U=UU^{H}$ \end_inset \newline Unitary - \begin_inset Formula $U^{H}U=UU^{H}=I$ \end_inset , type of normal matrix \newline Hermetian - \begin_inset Formula $U^{H}=U$ \end_inset , type of normal matrix) \end_layout \begin_layout Subsection* Pauli Matrices \end_layout \begin_layout Standard \begin_inset Formula \[ X=\left(\begin{array}{cc} 0 & 1\\ 1 & 0\end{array}\right)\] \end_inset \end_layout \begin_layout Standard Eigenvalues are \begin_inset Formula $\lambda_{1}=1$ \end_inset , \begin_inset Formula $\lambda_{2}=-1$ \end_inset . Eigenvectors: \begin_inset Formula \begin{eqnarray*} \left|+\right\rangle & = & \frac{1}{\sqrt{2}}\left(\left|0\right\rangle +\left|1\right\rangle \right)=\frac{1}{\sqrt{2}}\left(\begin{array}{c} 1\\ 1\end{array}\right)\\ \left|-\right\rangle & = & \frac{1}{\sqrt{2}}\left(\left|0\right\rangle -\left|1\right\rangle \right)=\frac{1}{\sqrt{2}}\left(\begin{array}{c} 1\\ -1\end{array}\right)\end{eqnarray*} \end_inset Called X matrix because on Bloch Sphere, eigenvectors are aligned with X axis. \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} Y & = & \left(\begin{array}{cc} 0 & -i\\ i & 0\end{array}\right)\\ Y\left|0\right\rangle & = & i\left|1\right\rangle \\ Y\left|1\right\rangle & = & -i\left|0\right\rangle \\ Y\left|y\right\rangle & = & ia\left|1\right\rangle -ib\left|0\right\rangle \end{eqnarray*} \end_inset Eigenvectors are \end_layout \begin_layout Standard \begin_inset Formula $|\otimes\rangle=\frac{1}{\sqrt{2}}\left(\begin{array}{c} 1\\ i\end{array}\right)=\frac{1}{\sqrt{2}}\left(\left|0\right\rangle +i\left|1\right\rangle \right)$ \end_inset \begin_inset Formula $ $ \end_inset , \begin_inset Formula $\vartheta=\frac{\pi}{2}$ \end_inset , \begin_inset Formula $\varphi=\frac{\pi}{2}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $|\oplus\rangle=\frac{1}{\sqrt{2}}\left(\begin{array}{c} 1\\ -i\end{array}\right)=\frac{1}{\sqrt{2}}\left(\left|0\right\rangle -i\left|1\right\rangle \right)$ \end_inset , \begin_inset Formula $\vartheta=\frac{\pi}{2}$ \end_inset , \begin_inset Formula $\varphi=\frac{3\pi}{2}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} Z & = & \left(\begin{array}{cc} 1 & 0\\ 0 & -1\end{array}\right)\\ Z\left|y\right\rangle & = & a\left|0\right\rangle -b\left|1\right\rangle =a\left|0\right\rangle -e^{i\pi}b\left|1\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Section* Lecture 4 (29 Janary) \end_layout \begin_layout Subsection* Lecture 3 Review \end_layout \begin_layout Standard Hadamard matrix \begin_inset Formula \[ H=\frac{1}{\sqrt{2}}\left(\begin{array}{cc} 1 & 1\\ 1 & -1\end{array}\right)\] \end_inset Pauli Matrices \begin_inset Formula \begin{eqnarray*} X & = & \left(\begin{array}{cc} 0 & 1\\ 1 & 0\end{array}\right)\\ Y & = & \left(\begin{array}{cc} 0 & -i\\ i & 0\end{array}\right)\\ Z & = & \left(\begin{array}{cc} 1 & 0\\ 0 & -1\end{array}\right)=\left(\begin{array}{cc} 1 & 0\\ 0 & e^{i\pi}\end{array}\right)\end{eqnarray*} \end_inset First column of each matrix tells you where \begin_inset Formula $\left|0\right\rangle $ \end_inset maps, second column tells you where \begin_inset Formula $\left|1\right\rangle $ \end_inset maps. \end_layout \begin_layout Subsection* New Gates \end_layout \begin_layout Standard Phase gate \begin_inset Formula \begin{eqnarray*} S & = & \left(\begin{array}{cc} 1 & 0\\ 0 & i\end{array}\right)=\left(\begin{array}{cc} 1 & 0\\ 0 & e^{i\frac{\pi}{2}}\end{array}\right)\\ S^{2} & = & X\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Pi over 8 gate \begin_inset Formula \[ T=\left(\begin{array}{cc} 1 & 0\\ 0 & e^{i\frac{\pi}{4}}\end{array}\right)=e^{i\frac{\pi}{8}}\left(\begin{array}{cc} e^{-i\frac{\pi}{8}} & 0\\ 0 & e^{i\frac{\pi}{8}}\end{array}\right)\] \end_inset \end_layout \begin_layout Standard Homework tip: We are allowed to cite eigenvalues from class. We can also guess and verify other eigenvalues without going through characteri stic equations. Also, for diagonal matrices, eigenvalues can be read off the diagonal and a eigenvectors are \begin_inset Formula $\left|0\right\rangle $ \end_inset and \begin_inset Formula $\left|1\right\rangle $ \end_inset . \end_layout \begin_layout Subsection* Multiple Qubit Systems \end_layout \begin_layout Standard Starting with 2 qubits. 2 qubits mean 4 base states: \begin_inset Formula $\left|00\right\rangle $ \end_inset , \begin_inset Formula $\left|01\right\rangle $ \end_inset , \begin_inset Formula $\left|10\right\rangle $ \end_inset , \begin_inset Formula $\left|11\right\rangle $ \end_inset or, equivalently \begin_inset Formula $\left|0\right\rangle \left|0\right\rangle $ \end_inset , \begin_inset Formula $\left|0\right\rangle \left|1\right\rangle $ \end_inset , \begin_inset Formula $\left|1\right\rangle \left|0\right\rangle $ \end_inset , \begin_inset Formula $\left|1\right\rangle \left|1\right\rangle $ \end_inset . \end_layout \begin_layout Standard An arbitrary state is a superposition \begin_inset Formula \[ \left|y\right\rangle =a_{00}\left|00\right\rangle +a_{01}\left|01\right\rangle +a_{10}\left|10\right\rangle +a_{11}\left|11\right\rangle \] \end_inset constrained by \begin_inset Formula $\sum_{j,k}\left|a_{jk}\right|^{2}=1$ \end_inset , \begin_inset Formula $a_{jk}\in\mathbb{C}$ \end_inset \end_layout \begin_layout Standard Measurement of any outcome j occurs with probability \begin_inset Formula $\left|a_{j}\right|^{2}$ \end_inset . Following measurement \begin_inset Formula $\left|y\right\rangle $ \end_inset collapses to \begin_inset Formula $\left|j\right\rangle $ \end_inset . It is also possible to make partial measurements, measuring some qubits but not others, taking sums as you would expect. (The probabilty of making the partial measurement is just the sum of probabilit ies of the full measurements containing the partial measurement. Following measurement, base states that aren't compatible with the measurement have their coefficients set to 0 and the rest are renormalized.) \end_layout \begin_layout Standard Combining qubit states \begin_inset Formula \begin{eqnarray*} \left|y_{1}\right\rangle & = & a_{1}\left|0\right\rangle +b_{1}\left|1\right\rangle \\ \left|y_{2}\right\rangle & = & a_{2}\left|0\right\rangle +b_{2}\left|1\right\rangle \end{eqnarray*} \end_inset You can combine two independent qubit states to get a state describing the probability of each joint outcome \begin_inset Formula \begin{eqnarray*} \left|y_{1}y_{2}\right\rangle & = & \left|y_{1}\right\rangle \left|y_{2}\right\rangle =\left(a_{1}\left|0\right\rangle +b_{1}\left|1\right\rangle \right)\left(a_{2}\left|0\right\rangle +b_{2}\left|1\right\rangle \right)\\ & = & a_{1}\left|0\right\rangle a_{2}\left|0\right\rangle +a_{1}\left|0\right\rangle b_{2}\left|1\right\rangle +b_{1}\left|1\right\rangle a_{2}\left|0\right\rangle +b_{1}\left|1\right\rangle b_{2}\left|1\right\rangle \\ & = & a_{1}a_{2}\left|00\right\rangle +a_{1}b_{2}\left|01\right\rangle +b_{1}a_{2}\left|10\right\rangle +b_{1}b_{2}\left|11\right\rangle \end{eqnarray*} \end_inset (Note: all the products in the above equations are really tensor products, which are defined below. In previous lecture notes, products inside dirac expressions implied standard matrix multiplication, which makes no sense here.) \end_layout \begin_layout Standard You cannot generally break a multiple qubit state up into separate independent states. Example: EPR state \begin_inset Formula $\frac{1}{\sqrt{2}}\left(\left|00\right\rangle +\left|11\right\rangle \right)$ \end_inset . You can see visually that there are no values for \begin_inset Formula $a_{1}$ \end_inset , \begin_inset Formula $b_{1}$ \end_inset , \begin_inset Formula $a_{2}$ \end_inset , \begin_inset Formula $b_{2}$ \end_inset that will let you write the EPR state in above form. \end_layout \begin_layout Standard For an n-qubit system, each basis state can be expressed as a bitstring \begin_inset Formula $\left|j_{n-1}j_{n-2}\cdots j_{0}\right\rangle $ \end_inset for \begin_inset Formula $j_{m}\in\left\{ 0,1\right\} $ \end_inset . Or, for convenience, it can just be written as a normal number \begin_inset Formula $\left|j\right\rangle $ \end_inset where \begin_inset Formula $j=\sum_{m=0}^{n-1}2^{m}j_{m}$ \end_inset \end_layout \begin_layout Standard Now that we have a notion for multiple qubit states, have to answer 3 questions: \newline Q1: What is the coordinate representation of a state \begin_inset Formula $\left|j\right\rangle $ \end_inset ? \newline Q2: How can you decompose and recompose states? For example, how do you compute \begin_inset Formula $\left|y\right\rangle =\left|y_{1}\right\rangle \left|y_{2}\right\rangle $ \end_inset where \begin_inset Formula $\left|y_{1}\right\rangle $ \end_inset and \begin_inset Formula $\left|y_{2}\right\rangle $ \end_inset are multiple qubit states. \newline Q3: How can you compose operations. Given \begin_inset Formula $\left|y_{1}\right\rangle $ \end_inset and \begin_inset Formula $\left|y_{2}\right\rangle $ \end_inset which are multiple qubit states and unitary operators \begin_inset Formula $U_{1}$ \end_inset and \begin_inset Formula $U_{2}$ \end_inset which apply to \begin_inset Formula $\left|y_{1}\right\rangle $ \end_inset and \begin_inset Formula $\left|y_{2}\right\rangle $ \end_inset , respectively, how can you find a U matrix that satisfies \begin_inset Formula $U\left|y\right\rangle =U_{1}\left|y_{1}\right\rangle U_{2}\left|y_{2}\right\rangle $ \end_inset \end_layout \begin_layout Standard Once you answer these questions you can start looking at algorithms. \end_layout \begin_layout Subsection* Tensor Products \end_layout \begin_layout Standard Tensor products are a new concept. \end_layout \begin_layout Standard Given two matrices, A which has size \begin_inset Formula $m\times n$ \end_inset , and B which has size \begin_inset Formula $p\times q$ \end_inset , the tensor product \begin_inset Formula $A\otimes B$ \end_inset will be a huge matrix of size \begin_inset Formula $mp\times nq$ \end_inset : \begin_inset Formula \[ A\otimes B=\left(\begin{array}{cccc} a_{11}B & a_{12}B & \cdots & a_{1n}B\\ a_{21}B & a_{22}B & \text{ }\cdots & a_{2n}B\\ \vdots & \vdots & \ddots\\ a_{m1}B & a_{m2}B & & a_{mn}B\end{array}\right)\] \end_inset \end_layout \begin_layout Standard Example: \begin_inset Formula \begin{eqnarray*} \left(\begin{array}{ccc} 1 & 2 & 3\\ 4 & 5 & 6\end{array}\right))\otimes\left(\begin{array}{rr} 10 & 0\\ 0 & 20\end{array}\right) & = & \begin{array}{ccc} 1\left(\begin{array}{rr} 10 & 0\\ 0 & 20\end{array}\right) & 2\left(\begin{array}{rr} 10 & 0\\ 0 & 20\end{array}\right) & 3\left(\begin{array}{rr} 10 & 0\\ 0 & 20\end{array}\right)\\ 4\left(\begin{array}{rr} 10 & 0\\ 0 & 20\end{array}\right) & 5\left(\begin{array}{rr} 10 & 0\\ 0 & 20\end{array}\right) & 6\left(\begin{array}{rr} 10 & 0\\ 0 & 20\end{array}\right)\end{array}\\ & = & \left(\begin{array}{rrrrrr} 10 & 0 & 20 & 0 & 30 & 0\\ 0 & 20 & 0 & 40 & 0 & 60\\ 40 & 0 & 50 & 0 & 60 & 0\\ 0 & 80 & 0 & 100 & 0 & 120\end{array}\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Example: (using column vectors): \newline \begin_inset Formula $X=\left(\begin{array}{c} 1\\ 2\\ 3\end{array}\right)$ \end_inset , \begin_inset Formula $Y=\left(\begin{array}{c} 10\\ 100\end{array}\right)$ \end_inset \newline \begin_inset Formula $X\otimes Y=\left(\begin{array}{c} 10\\ 100\\ 20\\ 200\\ 30\\ 300\end{array}\right)$ \end_inset , \begin_inset Formula $Y\otimes X=\left(\begin{array}{c} 10\\ 20\\ 30\\ 100\\ 200\\ 300\end{array}\right)$ \end_inset \end_layout \begin_layout Standard Example: (using qubits) \newline \begin_inset Formula $X=\left(\begin{array}{c} 1\\ 0\end{array}\right)=\left|0\right\rangle $ \end_inset , \begin_inset Formula $Y=\left(\begin{array}{c} 1\\ 0\end{array}\right)=\left|0\right\rangle $ \end_inset \newline \begin_inset Formula $X\otimes Y=\left|0\right\rangle \otimes\left|0\right\rangle =\left|0\right\rangle \left|0\right\rangle =\left|00\right\rangle =\left(\begin{array}{c} 1\\ 0\\ 0\\ 0\end{array}\right)$ \end_inset \end_layout \begin_layout Standard Similarly, \begin_inset Formula $\left|11\right\rangle =\left(\begin{array}{c} 0\\ 0\\ 0\\ 1\end{array}\right)$ \end_inset \newline And more generally, \begin_inset Formula $\left|j\right\rangle =\left|j_{1}j_{0}\right\rangle $ \end_inset will be a column vector which is all zeros except for single \begin_inset Formula $1$ \end_inset entry at position \begin_inset Formula $j+1$ \end_inset (see \begin_inset Quotes eld \end_inset Multiple Qubit Systems \begin_inset Quotes erd \end_inset above, \begin_inset Formula $j=\sum_{m=0}^{n-1}2^{m}j_{m}$ \end_inset ). \end_layout \begin_layout Standard Example: (using qubits again): \begin_inset Formula \begin{eqnarray*} H\left|0\right\rangle & = & \frac{1}{\sqrt{2}}\left(\left|0\right\rangle +\left|1\right\rangle \right)\\ \left(H\left|0\right\rangle \right)\otimes\left(H\left|0\right\rangle \right) & = & \left(\frac{1}{\sqrt{2}}\left(\left(\begin{array}{c} 1\\ 0\end{array}\right)+\left(\begin{array}{c} 0\\ 1\end{array}\right)\right)\right)\otimes\left(\frac{1}{\sqrt{2}}\left(\left(\begin{array}{c} 1\\ 0\end{array}\right)+\left(\begin{array}{c} 0\\ 1\end{array}\right)\right)\right)\\ & = & \frac{1}{\sqrt{2}}\left(\begin{array}{c} 1\\ 1\end{array}\right)\otimes\frac{1}{\sqrt{2}}\left(\begin{array}{c} 1\\ 1\end{array}\right)=\frac{1}{2}\left(\begin{array}{c} 1\\ 1\\ 1\\ 1\end{array}\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Repeat example using dirac notation: \begin_inset Formula \begin{eqnarray*} \left(H\left|0\right\rangle \right))\otimes(\left(H\left|0\right\rangle \right)) & = & \frac{1}{2}\left(\left|0\right\rangle +\left|1\right\rangle \right)\left(\left|0\right\rangle +\left|1\right\rangle \right)\\ & = & \frac{1}{2}\left(|00\rangle+\left|01\right\rangle +\left|10\right\rangle +\left|11\right\rangle \right)\\ & = & \frac{1}{2}\left(\left(\begin{array}{c} 1\\ 0\\ 0\\ 0\end{array}\right)+\left(\begin{array}{c} 0\\ 1\\ 0\\ 0\end{array}\right)+\left(\begin{array}{c} 0\\ 0\\ 1\\ 0\end{array}\right)+\left(\begin{array}{c} 0\\ 0\\ 0\\ 1\end{array}\right)\right)=\frac{1}{2}\left(\begin{array}{c} 1\\ 1\\ 1\\ 1\end{array}\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Associative property of tensor product: \begin_inset Formula \[ \left|x\right\rangle \otimes\left|y\right\rangle \otimes\left|z\right\rangle =\left|x\right\rangle \otimes\left|yz\right\rangle =\left|xy\right\rangle \otimes\left|z\right\rangle =\left|xyz\right\rangle \] \end_inset \end_layout \begin_layout Standard Notation for tensor exponentiation: \begin_inset Formula \[ \left|\psi\right\rangle ^{\otimes k}=\left|\psi\right\rangle \otimes\left|\psi\right\rangle \cdots\otimes\left|\psi\right\rangle \] \end_inset \end_layout \begin_layout Subsection* Powers of \begin_inset Formula $H\left|0\right\rangle $ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ \left(H\left|0\right\rangle \right)^{\otimes k}=\frac{1}{2^{k/2}}\left(\begin{array}{c} 1\\ 1\\ \vdots\\ 1\end{array}\right)\] \end_inset where length of column vector is \begin_inset Formula $2^{k}$ \end_inset . \end_layout \begin_layout Standard The formula is obvious for \begin_inset Formula $k=1$ \end_inset . Proof for rest of cases is by induction, (base case \begin_inset Formula $k=2$ \end_inset was shown in previous section.) Inductive case is: \begin_inset Formula \begin{eqnarray*} \left(\frac{\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}\right)^{\otimes k} & = & \left(\frac{\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}\right)^{\otimes k-1}\otimes\left(\frac{\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}\right)\\ & = & \frac{1}{2^{(k-1)/2}}\left(\begin{array}{c} 1\\ 1\\ \vdots\\ 1\end{array}\right)\otimes\frac{1}{\sqrt{2}}\left(\begin{array}{c} 1\\ 1\end{array}\right)=\frac{1}{2^{k/2}}\left(\begin{array}{c} 1\\ 1\\ \vdots\\ 1\end{array}\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Tensor Products Continued \end_layout \begin_layout Standard [DUNNO] I'm not exactly sure what the following equations are supposed to show. I think I was lost at the time I was taking these notes. \begin_inset Formula \[ \left|j\right\rangle =\left|j_{n-1}j_{n-2}\cdots j_{0}\right\rangle \] \end_inset \end_layout \begin_layout Standard Now make an arbitary split at qubit k. \begin_inset Formula \begin{eqnarray*} \left|j\right\rangle & = & \left|j_{n-1}\cdots j_{k}\right\rangle \left|j_{k-1}\cdots j_{0}\right\rangle \\ & = & \left|j^{(1)}\right\rangle \left|j^{(2)}\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} j & = & \sum_{m=0}^{n-1}2^{m}j_{m}\\ j^{(1)} & = & \sum_{m=k}^{n-1}2^{m-k}j_{m}\\ j^{(2)} & = & \sum_{m=0}^{k-1}2^{m}j_{m}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Known n=1, n=2. \begin_inset Formula \begin{eqnarray*} \left|j\right\rangle & = & \left|j^{(1)}\right\rangle \left|j^{(2)}\right\rangle \\ & = & \left(\begin{array}{c} 0\\ \vdots\\ 1\\ \vdots\\ 0\end{array}\right)\otimes\left(\begin{array}{c} 0\\ \vdots\\ 1\\ \vdots\\ 0\end{array}\right)=\left(\begin{array}{c} 0\\ \vdots\\ \vdots\\ 1\\ \vdots\\ \vdots\\ 0\end{array}\right)\end{eqnarray*} \end_inset \begin_inset Formula $\left|j^{(1)}\right\rangle $ \end_inset has 1 at position \begin_inset Formula $j^{(1)}+1$ \end_inset \newline \begin_inset Formula $\left|j^{(2)}\right\rangle $ \end_inset has 1 at position \begin_inset Formula $j^{(2)}+1$ \end_inset \newline \begin_inset Formula $\left|j\right\rangle $ \end_inset has 1 at position \begin_inset Formula $j+1=j^{(1)}\cdot2^{k}+j^{(2)}+1$ \end_inset \end_layout \begin_layout Subsection* New Course Information \end_layout \begin_layout Standard The class now has a TA: James Li (sp?) \end_layout \begin_layout Section* Lecture 5 (31 January) \end_layout \begin_layout Subsection* Lecture 4 Review \end_layout \begin_layout Standard In n-dimensional qubit systems, basis vectors are \begin_inset Formula $\left(\begin{array}{c} 0\\ \vdots\\ 1\\ \vdots\\ 0\end{array}\right)=\left|j\right\rangle $ \end_inset with the 1 at position \begin_inset Formula $j+1$ \end_inset . \end_layout \begin_layout Standard Any state \begin_inset Formula $\left|j\right\rangle $ \end_inset is a linear combination of j vectors. \end_layout \begin_layout Standard Any outcome \begin_inset Formula $\left|j\right\rangle $ \end_inset has probability \begin_inset Formula $\left|c_{j}\right|^{2}$ \end_inset for \begin_inset Formula $\left|y\right\rangle =\sum_{j=0}^{2^{n-1}}c_{j}\left|j\right\rangle $ \end_inset \end_layout \begin_layout Standard First homework assignment is out today, 3 problems, due 14 Feb. \end_layout \begin_layout Standard Showed last time that \begin_inset Formula \[ \left(H\left|0\right\rangle \right)^{\otimes k}=\left(\frac{\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}\right)^{\otimes k}=\frac{1}{2^{k/2}}\left(\begin{array}{c} 1\\ \vdots\\ 1\end{array}\right)\] \end_inset producing column vector of \begin_inset Formula $2^{k}$ \end_inset rows. Will be generalizing today for inputs other than \begin_inset Formula $\left|0\right\rangle $ \end_inset . \end_layout \begin_layout Subsection* Properties of Tensor Products \end_layout \begin_layout Standard 1. Associative property (see lecture 4) \newline 2. Distributing scalar multiple over tensor product \newline \begin_inset Formula $a\left(\left|x\right\rangle \otimes\left|y\right\rangle \right)=\left(a\left|x\right\rangle \right)\otimes\left|y\right\rangle =\left|x\right\rangle \otimes\left(a\left|y\right\rangle \right)$ \end_inset \newline 3. Distributing tensor product over addition \newline \begin_inset Formula $\left|y\right\rangle \otimes\left(\left|x_{1}\right\rangle +\left|x_{2}\right\rangle \right)=\left|y\right\rangle \otimes\left|x_{1}\right\rangle +\left|0y\right\rangle \otimes\left|x_{2}\right\rangle $ \end_inset \newline 4. Applying tensor products of operations individually to vectors. \newline \begin_inset Formula $\left(A\otimes B\right)\left(\left|x\right\rangle \otimes\left|y\right\rangle \right)=\left(A\left|x\right\rangle \right)\otimes\left(B\left|y\right\rangle \right)$ \end_inset \end_layout \begin_layout Standard Example: \begin_inset Formula \begin{eqnarray*} \left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)^{\otimes k} & = & H\left|0\right\rangle \otimes\cdots\otimes H\left|0\right\rangle \\ & = & \left(H\otimes\cdots\otimes H\right)\left(\left|0\right\rangle \otimes\cdots\otimes\left|0\right\rangle \right)\\ & = & H^{\otimes k}\left|0\right\rangle ^{\otimes k}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Example: \begin_inset Formula \[ \left(X\otimes S\right)\left|00\right\rangle =X\left|0\right\rangle \otimes S\left|0\right\rangle \] \end_inset (X is NOT gate from lecture 3, S is phase gate from lecture 4) \newline Lets you apply transformations to individual inputs instead of applying huge combination operations with big matrices. \end_layout \begin_layout Standard Example: \begin_inset Formula \[ \left(A\otimes B\right)\left(\sum_{j}a_{j}\left|x_{j}\right\rangle \left|y_{j}\right\rangle \right)=\sum_{j}a_{j}\left(A\left|x_{j}\right\rangle \right)\otimes\left(B\left|y_{j}\right\rangle \right)\] \end_inset 6. Distributing Hermitian transpose over tensor product \newline \begin_inset Formula $\left(A\otimes B\right)^{H}=A^{H}\otimes B^{H}$ \end_inset \newline 7. Applying tensor product of operations to other operations. \newline \begin_inset Formula $\left(A\otimes B\right)\left(C\otimes D\right)=AC\otimes BD$ \end_inset \newline Proof can be stated in terms of property 4, just break down C and D into individual column vectors \begin_inset Formula $\left|x\right\rangle $ \end_inset and \begin_inset Formula $\left|y\right\rangle $ \end_inset . This is a useful technique in general, substituting vectors to figure out how matrices work. \newline 8. If A and B are unitary operations, then \begin_inset Formula $A\otimes B$ \end_inset is unitary. \newline Proof: \begin_inset Formula $A^{H}A=I$ \end_inset , \begin_inset Formula $B^{H}B=I$ \end_inset \newline \begin_inset Formula $\left(A\otimes B\right)^{H}\left(A\otimes B\right)=\left(A^{H}\otimes B^{H}\right)\left(A\otimes B\right)=\left(A^{H}A\right)\otimes\left(B^{H}B\right)=I\otimes I=I$ \end_inset \end_layout \begin_layout Subsection* Powers of Hadamard Gate \end_layout \begin_layout Standard Result of applying hadamard transforms to each qubit in some base (non-superposi tion) state \begin_inset Formula $j$ \end_inset , made of \begin_inset Formula $k$ \end_inset qubits. \begin_inset Formula \begin{eqnarray*} H^{\otimes k}\left|j_{k-1}\cdots j_{0}\right\rangle & = & H\left|j_{k-1}\right\rangle \cdots H\left|j_{0}\right\rangle \\ & = & \frac{\left|0\right\rangle +\left(-1\right)^{j_{k-1}}\left|1\right\rangle }{\sqrt{2}}\otimes\cdots\otimes\frac{\left|0\right\rangle +\left(-1\right)^{j_{0}}\left|1\right\rangle }{\sqrt{2}}\\ & = & \bigotimes_{s=k-1}^{0}\frac{\left|0\right\rangle +\left(-1\right)^{j_{s}}\left|1\right\rangle }{\sqrt{2}}\\ & = & \frac{1}{2^{k/2}}\sum_{m=0}^{2^{k-1}}\left(-1\right)^{j\cdot m}\left|m\right\rangle \end{eqnarray*} \end_inset Where \begin_inset Formula $j\cdot m=j_{k-1}m_{k-1}+j_{k-2}m_{k-2}+\cdots+j_{0}m_{0}$ \end_inset . \begin_inset Formula $j_{i},m_{i}\in\left\{ 0,1\right\} $ \end_inset are digits of \begin_inset Formula $j$ \end_inset and \begin_inset Formula $m$ \end_inset expressed as binary strings. \end_layout \begin_layout Standard (Observe that for some single qubit state, \begin_inset Formula $j_{s}$ \end_inset , \begin_inset Formula $H|j_{s}\rangle=\frac{\left|0\right\rangle +\left(-1\right)^{j_{s}}\left|1\right\rangle }{\sqrt{2}}$ \end_inset to see the intuition in the last step. At \begin_inset Formula $k=2$ \end_inset , \begin_inset Formula \begin{eqnarray*} & & \frac{\left|0\right\rangle +\left(-1\right)^{j_{1}}\left|1\right\rangle }{\sqrt{2}}\otimes\frac{\left|0\right\rangle +\left(-1\right)^{j_{0}}\left|1\right\rangle }{\sqrt{2}}\\ & & =\left|00\right\rangle +\left(-1\right)^{j_{0}}\left|01\right\rangle +\left(-1\right)^{j_{1}}\left|10\right\rangle +\left(-1\right)^{j_{0}+j_{1}}\left|11\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard At \begin_inset Formula $k=3$ \end_inset , \begin_inset Formula \begin{eqnarray*} & & \frac{\left|0\right\rangle +\left(-1\right)^{j_{2}}\left|1\right\rangle }{\sqrt{2}}\otimes\frac{\left|0\right\rangle +\left(-1\right)^{j_{1}}\left|1\right\rangle }{\sqrt{2}}\otimes\frac{\left|0\right\rangle +\left(-1\right)^{j_{0}}\left|1\right\rangle }{\sqrt{2}}\\ & & =\left|000\right\rangle +\left(-1\right)^{j_{0}}\left|001\right\rangle +\left(-1\right)^{j_{1}}\left|010\right\rangle +\left(-1\right)^{j_{0}+j}\left|011\right\rangle \\ & & +\left(-1\right)^{j_{2}}\left|100\right\rangle +\left(-1\right)^{j_{0}+j_{2}}\left|101\right\rangle +\left(-1\right)^{j_{1}+j_{2}}\left|110\right\rangle +\left(-1\right)^{j_{0}+j_{1}+j_{2}}\left|111\right\rangle \end{eqnarray*} \end_inset You can see that \begin_inset Formula $\left(-1\right)^{j_{i}}$ \end_inset coefficients follow the \begin_inset Formula $\left|1\right\rangle $ \end_inset 's and get included in the expanded terms where \begin_inset Formula $m_{i}$ \end_inset is 1 instead of 0.) \end_layout \begin_layout Standard For two qubit system, inputs \begin_inset Formula $\left|+\right\rangle $ \end_inset , \begin_inset Formula $\left|+\right\rangle $ \end_inset : \begin_inset Formula \[ \frac{\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}\otimes\frac{\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}\rightarrow\begin{array}{c} \left|00\right\rangle \\ \left|01\right\rangle \\ \left|10\right\rangle \\ \left|11\right\rangle \end{array}\] \end_inset For \begin_inset Formula $n+1$ \end_inset qubit system, inputs: \begin_inset Formula $\left|+\right\rangle $ \end_inset , \begin_inset Formula $\left|y\right\rangle $ \end_inset : \begin_inset Formula $\frac{\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}\left|y\right\rangle =\frac{\left|0y\right\rangle +\left|1y\right\rangle }{\sqrt{2}}$ \end_inset (has \begin_inset Formula $n+1$ \end_inset qubits if \begin_inset Formula $\left|y\right\rangle $ \end_inset has \begin_inset Formula $n$ \end_inset qubits) \end_layout \begin_layout Standard Solution is then made up of terms like \begin_inset Formula $\left|m_{k-1}m_{k-2}\cdots m_{0}\right\rangle $ \end_inset \newline if \begin_inset Formula $m_{k-2}=1$ \end_inset then term has \begin_inset Formula $\left|1\right\rangle $ \end_inset at second cubit, but may be + or - \newline if \begin_inset Formula $j_{k-2}=1$ \end_inset then it's \begin_inset Formula $-\left|1\right\rangle $ \end_inset else if \begin_inset Formula $j_{k-2}=0$ \end_inset then \begin_inset Formula $\left|1\right\rangle $ \end_inset \newline if \begin_inset Formula $m_{k-2}=0$ \end_inset or \begin_inset Formula $j_{k-2}=0$ \end_inset then no problem with + or - since we have 0 at location k-2 \end_layout \begin_layout Standard Summary: \begin_inset Formula $\left(-1\right)^{j_{k-2}m_{k-2}}\left|?\mbox{(0 or 1)}???\right\rangle $ \end_inset \end_layout \begin_layout Standard Repeat for all qubits to get \begin_inset Formula $\left(-1\right)^{j_{k-1}m_{k-1}+\cdots+j_{0}m_{0}}\left|m_{k-1}\cdots m_{0}\right\rangle $ \end_inset \end_layout \begin_layout Standard Upshot: \begin_inset Formula $H^{\otimes k}\left|j\right\rangle =\frac{1}{2^{k/2}}\sum_{m=0}^{2^{k-1}}\left(-1\right)^{m\cdot j}\left|m\right\rangle $ \end_inset \end_layout \begin_layout Standard Homework hint: This is half of work needed to solve one of the problems. It tells you columns of the matrix. Homework asks you to find the whole matrix. \end_layout \begin_layout Subsection* Properties of Tensor Products (continued) \end_layout \begin_layout Standard 9. If you have two states \begin_inset Formula $\left|x\right\rangle $ \end_inset and \begin_inset Formula $\left|y\right\rangle $ \end_inset which you can decompose with same dimensions. \newline \begin_inset Formula $\left|y\right\rangle =\left|y_{1}\right\rangle \left|y_{2}\right\rangle $ \end_inset \newline \begin_inset Formula $\left|x\right\rangle =\left|x_{1}\right\rangle \left|x_{2}\right\rangle $ \end_inset \newline Then \begin_inset Formula $\left\langle x|y\right\rangle =\left\langle x_{1}x_{2}|y_{1}y_{2}\right\rangle =\left\langle x_{1}|y_{1}\right\rangle \left\langle x_{2}|y_{2}\right\rangle $ \end_inset \end_layout \begin_layout Standard Example: \newline \begin_inset Formula $\left|d\right\rangle =|011000\rangle$ \end_inset \newline \begin_inset Formula $\left|k\right\rangle =|011010\rangle$ \end_inset \newline You can tell \begin_inset Formula $\left\langle d|k\right\rangle =0$ \end_inset based solely on the fact that the fifth qubit's inner product ( \begin_inset Formula $\left\langle 0|1\right\rangle $ \end_inset ) is zero. \end_layout \begin_layout Standard Example: \newline \begin_inset Formula $\left\langle z_{1}\right|\left\langle z_{2}\right|X\otimes Y\left|\psi_{1}\right\rangle \left|\psi_{2}\right\rangle =\left\langle z_{1}\right|X\left|\psi_{1}\right\rangle \otimes\left\langle z_{2}\right|Y\left|\psi_{2}\right\rangle $ \end_inset \end_layout \begin_layout Subsection* Completeness Relation \end_layout \begin_layout Standard \begin_inset Formula \[ \left|j\right\rangle \left\langle i\right|=\left(\begin{array}{c} 0\\ \vdots\\ 1\\ \vdots\\ 0\end{array}\right)\left(\begin{array}{ccccc} 0 & \cdots & 1 & \cdots & 0\end{array}\right)=\left(\begin{array}{ccccc} 0 & \cdots & \cdots & \cdots & 0\\ \vdots & \ddots & & .\cdot & \vdots\\ \vdots & & 1 & & \vdots\\ \vdots & .\cdot & & \ddots & \vdots\\ 0 & \cdots & \cdots & \cdots & 0\end{array}\right)\] \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\left|j\right\rangle $ \end_inset is column vector with 1 at position j+1 \newline \begin_inset Formula $\left\langle i\right|$ \end_inset is row vector with 1 at position i+i \newline \begin_inset Formula $\left|j\right\rangle \left\langle i\right|$ \end_inset is projection matrix with 1 at row j+1, col i+i \end_layout \begin_layout Standard Completeness relation \begin_inset Formula \[ \sum_{i=o}^{2^{n-1}}\left|i\right\rangle \left\langle i\right|=I\] \end_inset \end_layout \begin_layout Standard Next lecture will show completeness relation holds on any orthonormal basis, not just \begin_inset Formula $i$ \end_inset . \end_layout \begin_layout Section* Lecture 6 (5 February) \end_layout \begin_layout Subsection* Lecture 5 Review \end_layout \begin_layout Standard 1. \begin_inset Formula $H^{\otimes k}\left|j\right\rangle =\frac{1}{2^{k/2}}\sum_{m=0}^{2^{k-1}}\left(-1\right)^{j\cdot m}\left|m\right\rangle $ \end_inset \newline 2. \begin_inset Formula $\left\langle x_{1}\right|\otimes\left\langle x_{2}\right|\cdot\left|y_{1}\right\rangle \otimes\left|y_{2}\right\rangle =\left\langle x_{1}|y_{1}\right\rangle \otimes\left\langle x_{2}|y_{2}\right\rangle $ \end_inset \newline Example: \newline \begin_inset Formula $\left\langle 01\right|X\otimes A\left|01\right\rangle =\left\langle 0\right|X\left|0\right\rangle \otimes\left\langle 1\right||A\left|1\right\rangle $ \end_inset \newline 3. \begin_inset Formula $I=\sum_{j=0}^{2^{n-1}}\left|j\right\rangle \left\langle j\right|$ \end_inset \end_layout \begin_layout Subsection* Completeness Relation \end_layout \begin_layout Standard A proof of the completeness relation (3 above) was shown last lecture based on adding up projections to get the diagonal matrix. This is another proof: \end_layout \begin_layout Standard An arbitrary state is a linear combination of basis states: \begin_inset Formula \[ \left|y\right\rangle =\sum_{j}c_{j}\left|x_{j}\right\rangle \] \end_inset Each constant is just: \begin_inset Formula \[ c_{j}=\left\langle x_{j}|y\right\rangle \in\mathbb{C}\] \end_inset Substituting \begin_inset Formula $c_{j}$ \end_inset above gives: \begin_inset Formula \[ \left|y\right\rangle =\sum_{j}\left|x_{j}\right\rangle \left\langle x_{j}|y\right\rangle \] \end_inset In general \begin_inset Formula \[ \left|y\right\rangle =A\left|y\right\rangle \rightarrow A=I\] \end_inset So \begin_inset Formula \[ \sum_{j}\left|x_{j}\right\rangle \left\langle x_{j}\right|=I\] \end_inset \end_layout \begin_layout Standard \begin_inset Formula $A=AI=A\sum_{j}\left|x_{j}\right\rangle \left\langle x_{j}\right|=\sum_{j}\left(A\left|x_{j}\right\rangle \right)\left\langle x_{j}\right|$ \end_inset \end_layout \begin_layout Subsection* More Linear Algebra \end_layout \begin_layout Standard An \begin_inset Formula $n\times n$ \end_inset matrix has \begin_inset Formula $n$ \end_inset eigenvalues ( \begin_inset Formula $\lambda_{i}\in\mathbb{C}$ \end_inset ) and orthonormal eigenvectors ( \begin_inset Formula $\left|x_{j}\right\rangle $ \end_inset \begin_inset Formula $j=\left\{ 1\ldots n\right\} $ \end_inset ) iff A is normal ( \begin_inset Formula $A^{H}A=AA^{H}$ \end_inset ). \end_layout \begin_layout Standard \begin_inset Formula $V=\left(\begin{array}{ccc} \left|x_{1}\right\rangle & \cdots & \left|x_{n}\right\rangle \end{array}\right)$ \end_inset , eigenvector matrix, \begin_inset Formula $V^{H}V=I$ \end_inset \newline \begin_inset Formula $\Lambda=\left(\begin{array}{cccc} \lambda_{1} & 0 & 0 & 0\\ 0 & \lambda_{2} & 0 & 0\\ 0 & 0 & \ddots & 0\\ 0 & 0 & 0 & \lambda_{n}\end{array}\right)$ \end_inset , eigenvalue matrix \newline \begin_inset Formula \begin{eqnarray*} A & = & V\Lambda V^{H}=\left(\begin{array}{ccc} \lambda_{1}\left|x_{1}\right\rangle & \ldots & \lambda_{n}\left|x_{n}\right\rangle \end{array}\right)\left(\begin{array}{c} \left\langle x_{1}\right|\\ \vdots\\ \left\langle x_{n}\right|\end{array}\right)\\ & = & \sum_{j=1}^{n}\lambda_{j}\left|x_{j}\right\rangle \left\langle x_{j}\right|\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Eigenvalues and Tensor Products: \end_layout \begin_layout Standard If \begin_inset Formula $A$ \end_inset eigenvalues are \begin_inset Formula $\lambda_{j}$ \end_inset , eigenvectors are \begin_inset Formula $\left|x_{j}\right\rangle $ \end_inset , for j=1..n, \newline and \begin_inset Formula $B$ \end_inset eigenvalues are \begin_inset Formula $\lambda_{k}$ \end_inset , eigenvectors are \begin_inset Formula $\left|x_{k}\right\rangle $ \end_inset , for k=1..n \newline then \begin_inset Formula $A\otimes B$ \end_inset eigenvalues are \begin_inset Formula $\lambda_{j}$ \end_inset \begin_inset Formula $\lambda_{k}$ \end_inset , eigenvectors are \begin_inset Formula $\left|x_{j}\right\rangle $ \end_inset \begin_inset Formula $\left|x_{k}\right\rangle $ \end_inset \end_layout \begin_layout Standard For any matrix A, you can compute \begin_inset Formula $A^{2}$ \end_inset , \begin_inset Formula $A^{3}$ \end_inset , \begin_inset Formula $A^{4}$ \end_inset \newline If A is nonsingular, you can compute \begin_inset Formula $A^{-1}$ \end_inset , \begin_inset Formula $A^{-2}$ \end_inset \newline What about a general f: D \begin_inset Formula $\rightarrow$ \end_inset C, like sin(A), \begin_inset Formula $e^{A}$ \end_inset , f(A) \newline If A is normal and f( \begin_inset Formula $\lambda_{j}$ \end_inset ) is well defined for all eigenvalues \begin_inset Formula \begin{eqnarray*} f(A) & = & \sum_{j}f\left(\lambda_{j}\right)\left|x_{j}\right\rangle \left\langle x_{j}\right|\\ & = & V\left(\begin{array}{cccc} f\left(\lambda_{1}\right) & 0 & 0 & 0\\ 0 & f\left(\lambda_{2}\right) & 0 & 0\\ 0 & 0 & \ddots & 0\\ 0 & 0 & 0 & f\left(\lambda_{n}\right)\end{array}\right)V^{H}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Example: \newline \begin_inset Formula $f(z)=z^{k}$ \end_inset \newline \begin_inset Formula $f(A)=A^{k}=(V\Lambda V^{H})(V\Lambda V^{H})\cdots(V\Lambda V^{H})$ \end_inset [multiplied k times] \newline \begin_inset Formula $=V\Lambda^{k}V^{H}$ \end_inset \end_layout \begin_layout Standard If \begin_inset Formula $A\in\mathbb{R}^{n,n}$ \end_inset and \begin_inset Formula $A=A^{T}$ \end_inset then \begin_inset Formula $e^{iA}$ \end_inset is unitary. Proof: \begin_inset Formula \begin{eqnarray*} \left(e^{iA}\right)^{H}\left(e^{iA}\right) & = & \left(\sum_{j}e^{i\lambda_{j}}\left|x_{j}\right\rangle \left\langle x_{j}\right|\right)^{H}\left(\sum_{j}e^{i\lambda_{j}}\left|x_{j}\right\rangle \left\langle x_{j}\right|\right)\\ & = & \left(\sum_{j}e^{-i\lambda_{j}}\left|x_{j}\right\rangle \left\langle x_{j}\right|\right)\left(\sum_{j}e^{\text{i$\lambda$}_{j}}\left|x_{j}\right\rangle \left\langle x_{j}\right|\right)\\ & = & \sum_{j,k}e^{-i\lambda_{j}}e^{i\lambda_{k}}\left|x_{j}\right\rangle \left\langle x_{j}\right|\left|x_{k}\right\rangle \left\langle x_{k}\right|\\ & = & \sum_{j}1\left|x_{j}\right\rangle \left\langle x_{j}\right|=I\end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Controlled Gates \end_layout \begin_layout Standard Controlled gates have a control input and a normal input. Control output is always the same as the control input. If control input is \begin_inset Formula $\left|0\right\rangle $ \end_inset , normal output is the same as the normal input. If control input \begin_inset Formula $\left|1\right\rangle $ \end_inset , normal output is some function of the normal input, where the function depends on the type of controlled gate. \end_layout \begin_layout Subsubsection* Controlled Not Gate \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|00\right\rangle & \rightarrow & \left|00\right\rangle \\ \left|01\right\rangle & \rightarrow & \left|01\right\rangle \\ \left|10\right\rangle & \rightarrow & \left|11\right\rangle \\ \left|11\right\rangle & \rightarrow & \left|10\right\rangle \end{eqnarray*} \end_inset \begin_inset Formula \[ Q_{\text{CNOT}}\left|i\right\rangle \left|j\right\rangle =\left|i\right\rangle \left|i\oplus j\right\rangle \] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ Q_{\text{CNOT}}=\left(\begin{array}{cccc} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0\end{array}\right)=\left(\begin{array}{cc} I & 0\\ 0 & X\end{array}\right)\] \end_inset \end_layout \begin_layout Standard Each column of matrix is derived directly by writing CNOT mappings listed above for \begin_inset Formula $\left|00\right\rangle $ \end_inset , \begin_inset Formula $\left|01\right\rangle $ \end_inset , \begin_inset Formula $\left|10\right\rangle $ \end_inset , and \begin_inset Formula $\left|11\right\rangle $ \end_inset inputs. Matrix can be shown to be unitary by multipling with its conjugate transpose and getting the identity matrix. \end_layout \begin_layout Standard CNOT for Hadamard inputs: \begin_inset Formula \begin{eqnarray*} \left|+\right\rangle \left|+\right\rangle & \rightarrow & \left|+\right\rangle \left|+\right\rangle \\ \left|-\right\rangle \left|+\right\rangle & \rightarrow & \left|-\right\rangle \left|+\right\rangle \\ \left|+\right\rangle \left|-\right\rangle & \rightarrow & \left|-\right\rangle \left|-\right\rangle \\ \left|-\right\rangle \left|-\right\rangle & \rightarrow & \left|+\right\rangle \left|-\right\rangle \end{eqnarray*} \end_inset When dealing with inputs that aren't 0 and 1, calling the same input the \begin_inset Quotes eld \end_inset control input \begin_inset Quotes erd \end_inset doesn't neccessarily make sense. When superposition states are fed to the CNOT, as above, the state of the second qubit controls a NOT operation on the first. \end_layout \begin_layout Standard Formally: \begin_inset Formula \[ Q_{\text{CNOT}}H\left|i\right\rangle H\left|j\right\rangle =H\left|i\oplus j\right\rangle H\left|j\right\rangle \] \end_inset for \begin_inset Formula $i,j\in0,1$ \end_inset \end_layout \begin_layout Standard Proof: \begin_inset Formula \begin{eqnarray*} Q_{\text{CNOT}}\left(H|i\rangle H|j\rangle\right) & = & Q_{\text{CNOT}}\left(\left(\frac{\left|0\right\rangle +\left(-1\right)^{i}\left|1\right\rangle }{\sqrt{2}}\right)\left(\frac{\left|0\right\rangle +\left(-1\right)^{j}\left|1\right\rangle }{\sqrt{2}}\right)\right)\\ & = & Q_{\text{CNOT}}\left(\frac{1}{2}\left(\left|00\right\rangle +\left(-1\right)^{j}\left|01\right\rangle +\left(-1\right)^{i}\left|10\right\rangle +\left(-1\right)^{i+j}\left|11\right\rangle \right)\right)\\ & = & \frac{1}{2}\left(\left|00\right\rangle +\left(-1\right)^{j}\left|01\right\rangle +\left(-1\right)^{i}\left|11\right\rangle +\left(-1\right)^{i+j}\left|10\right\rangle \right)\\ & = & \frac{1}{2}\left(\left|00\right\rangle +\left(-1\right)^{j}\left|01\right\rangle +\left(-1\right)^{i+j}\left|10\right\rangle +\left(-1\right)^{i}\left|11\right\rangle \right)\\ & = & \frac{1}{2}\left(\left|00\right\rangle +\left(-1\right)^{j}\left|01\right\rangle +\left(-1\right)^{i+j}\left|10\right\rangle +\left(-1\right)^{i+j+j}\left|11\right\rangle \right)\\ & = & \left(\frac{\left|0\right\rangle +\left(-1\right)^{i+j}\left|1\right\rangle }{\sqrt{2}}\right)\left(\frac{\left|0\right\rangle +\left(-1\right)^{j}\left|1\right\rangle }{\sqrt{2}}\right)\\ & = & H\left|i\oplus j\right\rangle H\left|j\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Example circuit: \begin_inset Formula \[ \left(H\otimes H\right)\left(Q_{\text{CNOT}}\right)\left(H\otimes H\right)\left|i\right\rangle \left|j\right\rangle \] \end_inset \begin_inset Formula \[ \left|i\right\rangle \left|j\right\rangle \xrightarrow{H\otimes H}H\left|i\right\rangle H\left|j\right\rangle \xrightarrow{Q_{\text{CNOT}}}H\left|i\oplus j\right\rangle H\left|j\right\rangle \xrightarrow{H\otimes H}H^{\otimes2}\left|i\oplus j\right\rangle H^{\otimes2}\left|j\right\rangle =\left|i\oplus j\right\rangle \left|j\right\rangle \] \end_inset \end_layout \begin_layout Subsubsection* Controlled-U Gate \end_layout \begin_layout Standard Notation looks like \begin_inset Formula $\left|i\right\rangle \left|j\right\rangle \xrightarrow{Q_{C-U}}\left|i\right\rangle U^{i}\left|j\right\rangle $ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|00\right\rangle & \rightarrow & \left|00\right\rangle \\ \left|01\right\rangle & \rightarrow & \left|01\right\rangle \\ \left|10\right\rangle & \rightarrow & \left|1\right\rangle Q\left|0\right\rangle \\ \left|11\right\rangle & \rightarrow & \left|1\right\rangle Q\left|1\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ Q_{C-U}=\left(\begin{array}{cc} I & 0\\ 0 & U\end{array}\right)\] \end_inset \end_layout \begin_layout Section* Lecture 7 (7 February) \end_layout \begin_layout Subsection* Lecture 6 Review \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit: }(\left|A\right\rangle \left|B\right\rangle )=Q_{CNOT}\left|i\right\rangle \left|j\right\rangle \] \end_inset If \begin_inset Formula $i$ \end_inset and \begin_inset Formula $j$ \end_inset are defined on the computational basis, output is \begin_inset Formula $\left|i\right\rangle \left|i\oplus j\right\rangle $ \end_inset , but output in terms of some other set of basis states will be expressed differently. \end_layout \begin_layout Subsection* Controlled Z Gate \end_layout \begin_layout Standard \begin_inset Formula \[ Z=\left(\begin{array}{rr} 1 & 0\\ 0 & -1\end{array}\right)\] \end_inset \begin_inset Formula \[ Q_{Z}\left|i\right\rangle \left|j\right\rangle =\left|i\right\rangle Z^{i}\left|j\right\rangle \] \end_inset \begin_inset Formula \[ \begin{array}{l} Z\left|0\right\rangle =\left|0\right\rangle \\ Z\left|1\right\rangle =-\left|1\right\rangle \end{array}\Rightarrow Z\left|j\right\rangle =\left(-1\right)^{j}\left|j\right\rangle \] \end_inset \begin_inset Formula \[ Q_{Z}\left|i\right\rangle \left|j\right\rangle =\left(-1\right)^{ij}\left|i\right\rangle \left|j\right\rangle \] \end_inset The gate with the control reversed, \begin_inset Formula $Z^{j}\left|i\right\rangle \left|j\right\rangle $ \end_inset , going through the steps above, has the exact same definition, \begin_inset Formula $\left(-1\right)^{ij}\left|i\right\rangle \left|j\right\rangle $ \end_inset . So for the controlled Z gate, it is reasonable to think of either input as being the controlling input on the computational basis. \end_layout \begin_layout Subsection* Swap Gate \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit: }\left(Q_{CNOT}\right)\left({Q'}_{CNOT}\right)\left(Q_{CNOT}\right)\left|i\right\rangle \left|j\right\rangle \] \end_inset where \begin_inset Formula $Q_{CNOT}\left|i\right\rangle \left|j\right\rangle =\left|i\right\rangle X^{i}\left|j\right\rangle $ \end_inset and \begin_inset Formula ${Q'}_{CNOT}\left|i\right\rangle \left|j\right\rangle =X^{j}\left|i\right\rangle \left|j\right\rangle $ \end_inset ) \end_layout \begin_layout Standard \begin_inset Formula \[ \left|i\right\rangle \left|j\right\rangle ^{\underrightarrow{Q_{CNOT}}}\left|i\right\rangle \left|i\oplus j\right\rangle {}^{\underrightarrow{{Q'}_{CNOT}}}\left|i\oplus i\oplus j=j\right\rangle \left|i\oplus j\right\rangle {}^{\underrightarrow{Q_{CNOT}}}\left|j\right\rangle \left|i\right\rangle \] \end_inset \end_layout \begin_layout Subsubsection* For arbitary states: \begin_inset Formula \begin{eqnarray*} \left|x\right\rangle \left|y\right\rangle & = & \left(a\left|0\right\rangle +b\left|1\right\rangle \right)\left(c\left|0\right\rangle +d\left|1\right\rangle \right)\\ & = & ac\left|00\right\rangle +ad\left|01\right\rangle +bc\left|10\right\rangle +bd\left|11\right\rangle \\ Swap\left|x\right\rangle \left|y\right\rangle & = & ac\left|00\right\rangle +ad\left|10\right\rangle +bc\left|01\right\rangle +bd\left|11\right\rangle \\ & = & a\left(c\left|0\right\rangle +d\left|1\right\rangle \right)\left|0\right\rangle +b\left(c\left|0\right\rangle +d\left|1\right\rangle \right)\left|1\right\rangle \\ & = & \left(a\left|0\right\rangle +b\left|1\right\rangle \right)\left(c\left|0\right\rangle +d\left|1\right\rangle \right)\\ & = & \left|y\right\rangle \left|x\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* 1-Qubit Gates as Rotations \end_layout \begin_layout Standard (See also section 4.2 of the textbook) \end_layout \begin_layout Standard \begin_inset Formula \[ X=\left(\begin{array}{rr} 0 & 1\\ 1 & 0\end{array}\right),\quad Y=\left(\begin{array}{rr} 0 & -i\\ i & 0\end{array}\right),\quad Z=\left(\begin{array}{rr} 1 & 0\\ 0 & -1\end{array}\right)\] \end_inset Implementation of all 1-qubit gates can be seen as counterclockwise rotations by an angle \begin_inset Formula $\vartheta$ \end_inset , of points plotted on the Bloch sphere around the X, Y, and Z axes. \begin_inset Formula \begin{eqnarray*} e^{-i\vartheta X/2} & = & R_{X}\left(\vartheta\right)=\cos\left(\frac{\vartheta}{2}\right)I-i\sin\left(\frac{\vartheta}{2}\right)X=\left(\begin{array}{rr} \cos\left(\frac{\vartheta}{2}\right) & -i\sin\left(\frac{\vartheta}{2}\right)\\ -i\sin\left(\frac{\vartheta}{2}\right) & \cos\left(\frac{\vartheta}{2}\right)\end{array}\right)\\ e^{-i\vartheta Y/2} & = & R_{Y}\left(\vartheta\right)=\cos\left(\frac{\vartheta}{2}\right)I-i\sin\left(\frac{\vartheta}{2}\right)Y=\left(\begin{array}{rr} \cos\left(\frac{\vartheta}{2}\right) & -\sin\left(\frac{\vartheta}{2}\right)\\ \sin\left(\frac{\vartheta}{2}\right) & \cos\left(\frac{\vartheta}{2}\right)\end{array}\right)\\ e^{-i\vartheta Z/2} & = & R_{Z}\left(\vartheta\right)=\cos\left(\frac{\vartheta}{2}\right)I-i\sin\left(\frac{\vartheta}{2}\right)Z=\left(\begin{array}{lr} e^{-i\vartheta/2} & 0\\ 0 & e^{i\vartheta/2}\end{array}\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Proof of the equations above will be done in two parts. First, by deriving the matrices from rotations around the axes, and then by showing that the exponential forms are equivalent. \end_layout \begin_layout Standard One general note to make here is that any matrix of the form \begin_inset Formula $\left(\begin{array}{rr} e^{ia} & 0\\ 0 & e^{ib}\end{array}\right)$ \end_inset can be expressed as a rotation around the Z axis by some angle. Just observe: \begin_inset Formula \[ \left(\begin{array}{rr} e^{ia} & 0\\ 0 & e^{ib}\end{array}\right)=e^{i\frac{a+b}{2}}\left(\begin{array}{rr} e^{i\frac{a-b}{2}} & 0\\ 0 & e^{i\frac{b-a}{2}}\end{array}\right)\] \end_inset \end_layout \begin_layout Subsubsection* Rotation around X axis \end_layout \begin_layout Standard Take an arbitrary qubit \begin_inset Formula $\left|y\right\rangle =\cos\frac{\vartheta_{1}}{2}\left|0\right\rangle +e^{i\varphi}\sin\frac{\vartheta_{1}}{2}\left|1\right\rangle $ \end_inset . Trying to find an expression for this qubit after a rotation about the X axis is messy. But for the case where \begin_inset Formula $\varphi=\frac{\pi}{2}$ \end_inset , finding the rotation is easy, and using that case is sufficient for finding the general rotation matrix. So let \begin_inset Formula \[ \left|\widetilde{y}\right\rangle =\cos\frac{\vartheta_{1}}{2}\left|0\right\rangle +e^{i\pi/2}\sin\frac{\vartheta_{1}}{2}\left|1\right\rangle =\cos\frac{\vartheta_{1}}{2}\left|0\right\rangle +i\sin\frac{\vartheta_{1}}{2}\left|1\right\rangle \] \end_inset This is a projection of \begin_inset Formula $\left|y\right\rangle $ \end_inset onto the YZ plane (x=0). Rotating this point \begin_inset Formula $\vartheta$ \end_inset radians counterclockwise around the X axis is the same thing as subtracting \begin_inset Formula $\vartheta$ \end_inset from \begin_inset Formula $\vartheta_{1}$ \end_inset . The rotated point is \begin_inset Formula \[ \left|\widetilde{y}'\right\rangle =\cos\frac{\vartheta_{1}-\vartheta}{2}\left|0\right\rangle +i\sin\frac{\vartheta_{1}-\vartheta}{2}\left|1\right\rangle \] \end_inset In terms of a rotation matrix, the mapping from \begin_inset Formula $\left|\widetilde{y}\right\rangle $ \end_inset to \begin_inset Formula $\left|\widetilde{y}'\right\rangle $ \end_inset looks like: \begin_inset Formula \[ \left(\begin{array}{rr} a & b\\ c & d\end{array}\right)\left(\begin{array}{r} \cos\frac{\vartheta_{1}}{2}\\ i\sin\frac{\vartheta_{1}}{2}\end{array}\right)=\left(\begin{array}{r} \cos\frac{\vartheta_{1}-\vartheta}{2}\\ i\sin\frac{\vartheta_{1}-\vartheta}{2}\end{array}\right)\] \end_inset \end_layout \begin_layout Standard Using the angle sum identies: \begin_inset Formula \begin{eqnarray*} \sin\left(x+y\right) & = & \sin x\cos y+\cos x\sin y\\ \cos\left(x+y\right) & = & \cos x\cos y-\sin x\sin y\end{eqnarray*} \end_inset on the right hand side, and matrix multiplication on the left hand side gives: \end_layout \begin_layout Standard \begin_inset Formula \[ \left(\begin{array}{r} a\cos\frac{\vartheta_{1}}{2}+ib\sin\frac{\vartheta_{1}}{2}\\ c\cos\frac{\vartheta_{1}}{2}+id\sin\frac{\vartheta_{1}}{2}\end{array}\right)=\left(\begin{array}{r} \cos\frac{\vartheta_{1}}{2}\cos\frac{\vartheta}{2}+\sin\frac{\vartheta_{1}}{2}\sin\frac{\vartheta}{2}\\ i\sin\frac{\vartheta_{1}}{2}\cos\frac{\vartheta}{2}-i\cos\frac{\vartheta_{1}}{2}\sin\frac{\vartheta}{2}\end{array}\right)\] \end_inset \end_layout \begin_layout Standard Comparing the two sides of this equation gives you the following solution: \begin_inset Formula \begin{eqnarray*} a & = & \cos\frac{\vartheta}{2}\\ b & = & -\sin\frac{\vartheta}{2}\\ c & = & -i\sin\frac{\vartheta}{2}\\ d & = & \cos\frac{\vartheta}{2}\end{eqnarray*} \end_inset So \begin_inset Formula \[ R_{X}\left(\vartheta\right)=\left(\begin{array}{rr} a & b\\ c & d\end{array}\right)=\left(\begin{array}{rr} \cos\left(\frac{\vartheta}{2}\right) & -i\sin\left(\frac{\vartheta}{2}\right)\\ -i\sin\left(\frac{\vartheta}{2}\right) & \cos\left(\frac{\vartheta}{2}\right)\end{array}\right)\] \end_inset \end_layout \begin_layout Subsubsection* Rotation around Z axis \end_layout \begin_layout Standard Again, start with an arbitrary qubit, \begin_inset Formula $\left|y\right\rangle =\cos\frac{\vartheta}{2}\left|0\right\rangle +e^{i\varphi}\sin\frac{\vartheta}{2}\left|1\right\rangle $ \end_inset . Taking \begin_inset Formula $\vartheta=\frac{\pi}{2}$ \end_inset projects \begin_inset Formula $\left|y\right\rangle $ \end_inset onto the XY plane (on the equator at z=0). \begin_inset Formula \[ \left|\widetilde{y}\right\rangle =\frac{1}{\sqrt{2}}\left|0\right\rangle +e^{i\varphi}\frac{1}{\sqrt{2}}\left|1\right\rangle \] \end_inset \end_layout \begin_layout Standard Rotating that point by \begin_inset Formula $\vartheta$ \end_inset radians counterclockwise gives: \begin_inset Formula \[ \left|\widetilde{y}'\right\rangle =\frac{1}{\sqrt{2}}\left|0\right\rangle +e^{i(\varphi+\vartheta)}\frac{1}{\sqrt{2}}\left|1\right\rangle \] \end_inset Expressed as a rotation matrix: \begin_inset Formula \[ \left(\begin{array}{rr} a & b\\ c & d\end{array}\right)\left(\begin{array}{r} \frac{1}{\sqrt{2}}\\ e^{i\varphi}\frac{1}{\sqrt{2}}\end{array}\right)=\left(\begin{array}{r} \frac{1}{\sqrt{2}}\\ e^{i(\varphi+\vartheta)}\frac{1}{\sqrt{2}}\end{array}\right)\] \end_inset Simplifying: \begin_inset Formula \[ \left(\begin{array}{r} a+be^{i\varphi}\\ c+de^{i\varphi}\end{array}\right)=\left(\begin{array}{r} 1\\ e^{i\varphi_{1}}e^{i\vartheta}\end{array}\right)\] \end_inset \begin_inset Formula \[ R_{Z}\left(\vartheta\right)=\left(\begin{array}{rr} a & b\\ c & d\end{array}\right)=\left(\begin{array}{rr} 1 & 0\\ 0 & e^{i\vartheta}\end{array}\right)=e^{i\vartheta/2}\left(\begin{array}{lr} e^{-i\vartheta/2} & 0\\ 0 & e^{i\vartheta/2}\end{array}\right)\] \end_inset \end_layout \begin_layout Subsubsection* Rotation around Y axis \end_layout \begin_layout Standard This was left as an exercise and not covered in the lecture. But, taking a qubit on the XZ plane so \begin_inset Formula $\varphi=0$ \end_inset gives: \end_layout \begin_layout Standard \begin_inset Formula \[ \left|\widetilde{y}\right\rangle =\cos\frac{\vartheta_{1}}{2}\left|0\right\rangle +\sin\frac{\vartheta_{1}}{2}\left|1\right\rangle \] \end_inset \end_layout \begin_layout Standard Rotating that point by \begin_inset Formula $\vartheta$ \end_inset radians counterclockwise gives: \begin_inset Formula \[ \left|\widetilde{y}'\right\rangle =\cos\frac{\vartheta_{1}+\vartheta}{2}\left|0\right\rangle +\sin\frac{\vartheta_{1}+\vartheta}{2}\left|1\right\rangle \] \end_inset \end_layout \begin_layout Standard Expressed using a rotation matrix this is: \begin_inset Formula \[ \left(\begin{array}{rr} a & b\\ c & d\end{array}\right)\left(\begin{array}{r} \cos\frac{\vartheta_{1}}{2}\\ \sin\frac{\vartheta_{1}}{2}\end{array}\right)=\left(\begin{array}{r} \cos\frac{\vartheta_{1}+\vartheta}{2}\\ \sin\frac{\vartheta_{1}+\vartheta}{2}\end{array}\right)\] \end_inset Which becomes: \begin_inset Formula \[ \left(\begin{array}{r} a\cos\frac{\vartheta_{1}}{2}+b\sin\frac{\vartheta_{1}}{2}\\ c\cos\frac{\vartheta_{1}}{2}+d\sin\frac{\vartheta_{1}}{2}\end{array}\right)=\left(\begin{array}{r} \cos\frac{\vartheta_{1}}{2}\cos\frac{\vartheta}{2}-\sin\frac{\vartheta_{1}}{2}\sin\frac{\vartheta}{2}\\ \sin\frac{\vartheta_{1}}{2}\cos\frac{\vartheta}{2}+\cos\frac{\vartheta_{1}}{2}\sin\frac{\vartheta}{2}\end{array}\right)\] \end_inset So \begin_inset Formula \[ R_{Y}\left(\vartheta\right)=\left(\begin{array}{rr} a & b\\ c & d\end{array}\right)=\left(\begin{array}{rr} \cos\frac{\vartheta}{2} & -\sin\frac{\vartheta}{2}\\ \sin\frac{\vartheta}{2} & \cos\frac{\vartheta}{2}\end{array}\right)\] \end_inset \end_layout \begin_layout Subsection* Rotations as Exponentials of Pauli Matrices \end_layout \begin_layout Standard Theorem 1 (exercise 4.2): If \begin_inset Formula $A^{2}=I$ \end_inset then \begin_inset Formula $e^{ixA}=\cos xI-i\sin x$ \end_inset A \end_layout \begin_layout Standard Proof (using Taylor series expansions from calculus): \begin_inset Formula \begin{eqnarray*} e^{-ixA} & = & \sum_{k=0}^{\infty}\frac{i^{k}x^{k}A^{k}}{k!}=\sum_{k\textrm{ odd}}^{\infty}\frac{i^{k}x^{k}A^{k}}{k!}+\sum_{k\textrm{ even}}^{\infty}\frac{i^{k}x^{k}A^{k}}{k!}\\ e^{-ixA} & = & \sum_{k=0}^{\infty}\frac{i^{\left(2k+1\right)}x^{\left(2k+1\right)}A^{\left(2k+1\right)}}{\left(2k+1\right)!}+\sum_{k=0}^{\infty}\frac{i^{\left(2k\right)}x^{\left(2k\right)}A^{\left(2k\right)}}{\left(2k\right)!}\\ & = & iA\sum_{k=0}^{\infty}\frac{\left(-1\right)^{k}x^{\left(2k+1\right)}}{\left(2k+1\right)!}+I\sum_{k=0}^{\infty}\frac{\left(-1\right)^{k}x^{\left(2k\right)}}{\left(2k\right)!}\\ & = & iA\sin x+I\cos x\end{eqnarray*} \end_inset \end_layout \begin_layout Section* Lecture 8 (12 February) \end_layout \begin_layout Subsection* Z-Y Decomposition \end_layout \begin_layout Standard Theorem 2: Any 1-qubit gate can be decomposed as \begin_inset Formula \[ U=e^{i\alpha}R_{Z}\left(\beta\right)R_{Y}\left(\gamma\right)R_{Z}\left(\delta\right)\] \end_inset (This is theorem 4.1 in textbook) \end_layout \begin_layout Standard Proof: \end_layout \begin_layout Standard Start by expressing U as: \begin_inset Formula \[ U=\left(\begin{array}{cc} X_{11}e^{i\varphi_{11}} & X_{12}e^{i\varphi_{12}}\\ X_{21}e^{i\varphi_{21}} & X_{22}e^{i\varphi_{22}}\end{array}\right)\] \end_inset Because U is orthonormal, vector norm of rows and columns is 1, so: \begin_inset Formula \begin{eqnarray*} X_{11}^{2}+X_{12}^{2} & = & 1\\ X_{21}^{2}+X_{22}^{2} & = & 1\\ X_{11}^{2}+X_{21}^{2} & = & 1\\ X_{12}^{2}+X_{22}^{2} & = & 1\end{eqnarray*} \end_inset Begin decomposing U by pulling out Z rotations (note that in general, post-multi plying with a diagonal matrix gives you multiples of the original columns, pre-multiplying with diagonal matrix gives you multiples of the original rows): \begin_inset Formula \begin{eqnarray*} U & = & \left(\begin{array}{cc} X_{11} & X_{12}\\ X_{21}e^{i\left(\varphi_{21}-\varphi_{11}\right)} & X_{22}e^{i\left(\varphi_{22}{-\varphi}_{12}\right)}\end{array}\right)\left(\begin{array}{cc} e^{i\varphi_{11}} & 0\\ 0 & e^{i\varphi_{12}}\end{array}\right)\\ & = & \left(\begin{array}{cc} 1 & 0\\ 0 & e^{i\left(\varphi_{21}-\varphi_{11}\right)}\end{array}\right)\left(\begin{array}{cl} X_{11} & X_{12}\\ X_{21} & X_{22}e^{i\left(\varphi_{22}{-\varphi}_{12}-\left(\varphi_{21}-\varphi_{11}\right)\right)}\end{array}\right)\left(\begin{array}{cc} e^{i\varphi_{11}} & 0\\ 0 & e^{i\varphi_{12}}\end{array}\right)\end{eqnarray*} \end_inset The two outer matrices are Z rotations, and middle matrix can also be expressed as rotations, but different kinds of rotations, depending on the values inside. \end_layout \begin_layout Standard Case 1: \begin_inset Formula $X_{11}=0\quad\Longrightarrow\quad X_{12}^{2}=1\quad\Longrightarrow\quad X_{22}=0\quad\Longrightarrow\quad X_{21}^{2}=1$ \end_inset \end_layout \begin_layout Standard Case 1.1: \begin_inset Formula $X_{12}$ \end_inset and \begin_inset Formula $X_{21}$ \end_inset have the same sign. In this case, the matrix is the product of Y and Z rotations: \begin_inset Formula \[ \pm\left(\begin{array}{rr} 0 & 1\\ 1 & 0\end{array}\right)=\pm\left(\begin{array}{rr} 0 & -1\\ 1 & 0\end{array}\right)\left(\begin{array}{rr} 1 & 0\\ 0 & -1\end{array}\right)=\pm R_{Y}\left(\pi\right)Z\] \end_inset \end_layout \begin_layout Standard Case 1.2: \begin_inset Formula $X_{12}$ \end_inset and \begin_inset Formula $X_{21}$ \end_inset have different signs. In this case, the matrix is a Y rotation: \begin_inset Formula \[ \pm\left(\begin{array}{rr} 0 & -1\\ 1 & 0\end{array}\right)=\pm R_{Y}\left(\pi\right)\] \end_inset \end_layout \begin_layout Standard Case 2: \begin_inset Formula $X_{12}=0\quad\Longrightarrow\quad X_{22}^{2}=1\quad\Longrightarrow\quad X_{21}=0\quad\Longrightarrow\quad X_{11}^{2}=1$ \end_inset \end_layout \begin_layout Standard Case 2.1: \begin_inset Formula $X_{11}$ \end_inset and \begin_inset Formula $X_{22}$ \end_inset have the same sign. In this case the matrix is just identity: \begin_inset Formula \[ \pm\left(\begin{array}{rr} 1 & 0\\ 0 & 1\end{array}\right)=\pm I\] \end_inset \end_layout \begin_layout Standard Case 2.2: \begin_inset Formula $X_{11}$ \end_inset and \begin_inset Formula $X_{22}$ \end_inset have different signs. In this case the matrix is Z: \begin_inset Formula \[ \pm\left(\begin{array}{rr} 1 & 0\\ 0 & -1\end{array}\right)=\pm Z\] \end_inset \end_layout \begin_layout Standard Case 3: All \begin_inset Formula $X_{ij}\neq0$ \end_inset . Letting \begin_inset Formula ${\varphi=\varphi}_{22}{-\varphi}_{12}-\left(\varphi_{21}-\varphi_{11}\right)$ \end_inset , because the matrix is unitary we know: \begin_inset Formula \begin{eqnarray*} \left(\begin{array}{cc} X_{11} & X_{21}\end{array}\right)\left(\begin{array}{c} X_{12}\\ X_{22}e^{i\varphi}\end{array}\right) & = & 0\\ X_{11}X_{12}+X_{21}X_{22}e^{i\varphi} & = & 0\end{eqnarray*} \end_inset In order for that to be true, the expression \begin_inset Formula $e^{i\varphi}=\cos\varphi+i\sin\varphi$ \end_inset cannot have an imaginary component, so \begin_inset Formula $\sin\varphi=0$ \end_inset and \begin_inset Formula $\varphi=k\pi$ \end_inset . \end_layout \begin_layout Standard [DUNNO: The fact that the matrix is unitary and all entries are real is enough to make it rotation about Y?] \end_layout \begin_layout Standard Theorem 3: \begin_inset Formula $U$ \end_inset can be decomposed as \begin_inset Formula $U=e^{i\alpha}AXBXC$ \end_inset where \begin_inset Formula $ABC=I$ \end_inset . Book has recipe for \begin_inset Formula $ABC$ \end_inset which serves as proof. (Corollary 4.2). In summary, \begin_inset Formula \begin{eqnarray*} A & = & R_{z}R_{Y}\\ B & = & R_{Y}R_{Z}\\ C & = & R_{Z}\end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Controlled U, C(U), From 1-Qubit U \end_layout \begin_layout Standard Use the Theorem 3 decomposition above. Start with just the phase shift, \begin_inset Formula $e^{i\alpha}$ \end_inset . A controlled circuit for the phase shift \begin_inset Formula $C\left(e^{i\alpha}I\right)$ \end_inset should have the following behavior: \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Standard Input \end_layout \end_inset \begin_inset Text \begin_layout Standard Output \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|0\right\rangle \left|j\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|0\right\rangle \left|j\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|1\right\rangle \left|j\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|1\right\rangle e^{i\alpha}\left|j\right\rangle $ \end_inset \end_layout \end_inset \end_inset \end_layout \begin_layout Standard or \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Standard Input \end_layout \end_inset \begin_inset Text \begin_layout Standard Output \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|0\right\rangle \left|0\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|0\right\rangle \left|0\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|0\right\rangle \left|1\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|0\right\rangle \left|1\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|1\right\rangle \left|0\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|1\right\rangle e^{i\alpha}\left|0\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|1\right\rangle \left|1\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|1\right\rangle e^{i\alpha}\left|1\right\rangle $ \end_inset \end_layout \end_inset \end_inset \end_layout \begin_layout Standard The outputs from this controlled gate can be produced by a simple unitary transformation applied to the first qubit: \begin_inset Formula \[ \left(\begin{array}{cc} 1 & 0\\ 0 & e^{i\alpha}\end{array}\right)\] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit: }\left(I\otimes\left(\begin{array}{cc} e^{i\alpha} & 0\\ 0 & e^{i\alpha}\end{array}\right)^{\#1}\right)=\left(\left(\begin{array}{cc} 1 & 0\\ 0 & e^{i\alpha}\end{array}\right)\otimes I\right)\] \end_inset \end_layout \begin_layout Standard (My weird circuit notation would look a lot better in picture form, but it just shows the gates applied to each qubit (from top to bottom) written as tensor products. \begin_inset Formula $I$ \end_inset means no gate operating on a qubit. Variables or matrices stand for real gates. Controlled gates are written with numeric superscripts indicating which qubit they are controlled by. For example, \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $X^{\#1}$ \end_inset is \begin_inset Formula $C_{NOT}$ \end_inset controlled by first qubit.) \end_layout \begin_layout Standard Using the circuit above, you can write the circuit for a general \begin_inset Formula $C\left(U\right)$ \end_inset where \begin_inset Formula $U=e^{i\alpha}AXBXC$ \end_inset and \begin_inset Formula $ABC=I$ \end_inset : \begin_inset Formula \[ \textrm{Circuit: }\left(\left(\begin{array}{cc} 1 & 0\\ 0 & e^{i\alpha}\end{array}\right)\otimes A\right)\left({I\otimes X}^{\#1}\right)\left(I\otimes B\right)\left({I\otimes X}^{\#1}\right)\left(I\otimes C\right)\] \end_inset \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Standard Input \end_layout \end_inset \begin_inset Text \begin_layout Standard Output \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|0\right\rangle \left|j\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|0\right\rangle ABC\left|j\right\rangle =\left|0\right\rangle I\left|j\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|1\right\rangle \left|j\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $e^{i\alpha}\left|1\right\rangle AXBXC\left|j\right\rangle =\left|1\right\rangle U\left|j\right\rangle $ \end_inset \end_layout \end_inset \end_inset \end_layout \begin_layout Standard The circuit works because when \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|i\right\rangle $ \end_inset is 0, the \begin_inset Formula $C_{NOT}$ \end_inset gates have no effect and the output for the second qubit is \family default \series default \shape default \size default \emph default \bar default \noun default \begin_inset Formula $ABC$ \end_inset , exactly the same as the input because \begin_inset Formula $ABC=I$ \end_inset \end_layout \begin_layout Subsection* Controlled U, \begin_inset Formula $C^{n}\left(U\right)$ \end_inset , with multiple control inputs \end_layout \begin_layout Standard Using \begin_inset Formula $n$ \end_inset control qubits to control unitary operation of \begin_inset Formula $k$ \end_inset qubits: \begin_inset Formula \begin{eqnarray*} C^{n}\left(U\right)\left|x\right\rangle \left|y\right\rangle & = & C^{n}\left(U\right)\left|x_{0}\ldots x_{n-1}\right\rangle \left|y_{0}\ldots y_{k-1}\right\rangle \\ & = & \left|x_{0}\ldots x_{n-1}\right\rangle U^{x_{0}\cdot x_{1}\ldots{\cdot x}_{n-1}}\left|y_{0}\ldots y_{k-1}\right\rangle \\ & = & \left|x\right\rangle U^{x_{0}\cdot x_{1}\ldots{\cdot x}_{n-1}}\left|y\right\rangle \end{eqnarray*} \end_inset \begin_inset Formula $U$ \end_inset is controlled by product of bits of \begin_inset Formula $\left|x\right\rangle $ \end_inset , it is only applied when every bit is 1. \end_layout \begin_layout Standard In matrix form, \begin_inset Formula \[ C^{n}\left(U\right)=\left(\begin{array}{cc} I & 0\\ 0 & U\end{array}\right)\] \end_inset \end_layout \begin_layout Standard Size of \begin_inset Formula $C^{n}\left(U\right)$ \end_inset is \begin_inset Formula $2^{n+k}$ \end_inset , size of \begin_inset Formula $I$ \end_inset is \begin_inset Formula $\left(2^{n}-1\right)\left(2^{k}\right)$ \end_inset , size of \begin_inset Formula $U$ \end_inset is \begin_inset Formula $2^{k}$ \end_inset . Each column of the matrix is the output of a basis state. The columns from \begin_inset Formula $\left|0\cdots0\right\rangle \left|0\cdots0\right\rangle $ \end_inset to \begin_inset Formula $\left|1\cdots10\right\rangle \left|1\cdots1\right\rangle $ \end_inset for the first part of the matrix (the bulk of it) just give identify. Then, the last columns from \begin_inset Formula $\left|1\cdots1\right\rangle \left|0\cdots0\right\rangle $ \end_inset to \begin_inset Formula $\left|1\cdots1\right\rangle \left|1\cdots1\right\rangle $ \end_inset apply \begin_inset Formula $U$ \end_inset to the last \begin_inset Formula $k$ \end_inset qubits of the input. \end_layout \begin_layout Subsection* Toffolli Gate \end_layout \begin_layout Standard An example of \begin_inset Formula $C^{n}\left(U\right)$ \end_inset , with \begin_inset Formula $n=2$ \end_inset and \begin_inset Formula $U=X$ \end_inset . \begin_inset Formula \[ X^{x\cdot y}\left|x\right\rangle \left|y\right\rangle \left|z\right\rangle =\left|x\right\rangle \left|y\right\rangle \left|\left(xy\right)\oplus z\right\rangle \] \end_inset \end_layout \begin_layout Standard NAND gate can be implemented in terms of Toffoli: \begin_inset Formula \[ X^{x\cdot y}\left|x\right\rangle \left|y\right\rangle \left|1\right\rangle =\left|x\right\rangle \left|y\right\rangle \left|\left(xy\right)\oplus1\right\rangle =\left|x\right\rangle \left|y\right\rangle \left|\overline{xy}\right\rangle \] \end_inset \end_layout \begin_layout Standard ( \begin_inset Formula $\overline{xy}$ \end_inset is logical inverse of xy) \end_layout \begin_layout Standard Fanout can be implemented with: \begin_inset Formula \[ X^{1\cdot x}\left|1\right\rangle \left|x\right\rangle \left|0\right\rangle =\left|1\right\rangle \left|x\right\rangle \left|\left(1\cdot x\right)\oplus0\right\rangle =\left|1\right\rangle \left|x\right\rangle \left|x\right\rangle \] \end_inset \end_layout \begin_layout Section* Lecture 9 (14 February) \end_layout \begin_layout Subsection* Implementing Controlled 1-Qubit Gate \begin_inset Formula $C^{2}\left(U\right)$ \end_inset with \begin_inset Formula $V^{2}=U$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit: }\left({I\otimes I\otimes U}^{\#1,\#2}\right)=\left(I\otimes I\otimes V^{\#1}\right)\left(I\otimes X^{\#1}\otimes I\right)\left(I\otimes I\otimes{V^{H}}^{\#2}\right)\left(I\otimes X^{\#1}\otimes I\right)\left(I\otimes I\otimes V^{\#2}\right)\] \end_inset \end_layout \begin_layout Standard (Figure 4.8 in book) \end_layout \begin_layout Standard Evaluated: \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{1}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{2}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{3}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{1}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{2}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $V^{x_{2}}\left|x_{3}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{1}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|{x_{1}\oplus x}_{2}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $V^{x_{2}}\left|x_{3}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{1}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|{x_{1}\oplus x}_{2}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula ${V^{H}}^{{x_{1}\oplus x}_{2}}{V^{x_{2}}}\left|x_{3}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{1}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{2}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula ${V^{H}}^{{x_{1}\oplus x}_{2}}{V^{x_{2}}}\left|x_{3}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{1}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|x_{2}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula ${V^{x_{1}}}{V^{H}}^{{x_{1}\oplus x}_{2}}{V^{x_{2}}}\left|x_{3}\right\rangle $ \end_inset \end_layout \end_inset \end_inset \end_layout \begin_layout Standard Evaluate third qubit output case by case \end_layout \begin_layout Standard Case 1: If \begin_inset Formula $X_{1}\oplus X_{2}=1$ \end_inset then \begin_inset Formula ${V^{x_{1}}}V^{H}{V^{x_{2}}}\left|x_{3}\right\rangle $ \end_inset \end_layout \begin_layout Standard Case 1.1: If \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $X_{1}=0$ \end_inset then \family default \series default \shape default \size default \emph default \bar default \noun default \begin_inset Formula $X_{2}=1$ \end_inset and \begin_inset Formula $V^{H}V\left|x_{3}\right\rangle =\left|x_{3}\right\rangle $ \end_inset \end_layout \begin_layout Standard Case 1.2: If \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $X_{2}=0$ \end_inset then \family default \series default \shape default \size default \emph default \bar default \noun default \begin_inset Formula $X_{1}=1$ \end_inset and \begin_inset Formula ${VV}^{H}\left|x_{3}\right\rangle =\left|x_{3}\right\rangle $ \end_inset \end_layout \begin_layout Standard Case 2: If \begin_inset Formula $X_{1}\oplus X_{2}=0$ \end_inset then \begin_inset Formula ${V^{x_{1}}}{V^{x_{2}}}\left|x_{3}\right\rangle $ \end_inset \end_layout \begin_layout Standard Case 2.1: If \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $X_{1}=X_{2}=0$ \end_inset then \family default \series default \shape default \size default \emph default \bar default \noun default \begin_inset Formula $\left|x_{3}\right\rangle $ \end_inset \end_layout \begin_layout Standard Case 2.2: If \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $X_{1}=X_{2}=1$ \end_inset then \family default \series default \shape default \size default \emph default \bar default \noun default \begin_inset Formula $VV\left|x_{3}\right\rangle =U\left|x_{3}\right\rangle $ \end_inset \end_layout \begin_layout Subsubsection* Toffoli Gate \end_layout \begin_layout Standard Using \begin_inset Formula $V=\frac{1-i}{2}\left(I+iX\right)$ \end_inset above gives the tofolli gate. Verify: \begin_inset Formula \begin{eqnarray*} V^{2} & = & \frac{\left(1-2i-1\right)^{2}}{4}\left(I^{2}+2iX-X^{2}\right)\\ & = & \frac{-2i}{4}2iX=X\end{eqnarray*} \end_inset \begin_inset Formula $V$ \end_inset can also be rewritten: \begin_inset Formula \begin{eqnarray*} V & = & \frac{1-i}{2}\left(I+iX\right)\\ & = & \frac{1-i}{\sqrt{2}}\left(\frac{\sqrt{2}}{2}I+\frac{\sqrt{2}}{2}iX\right)\\ & = & \frac{1-i}{\sqrt{2}}e^{i\frac{\pi}{4}X}=\frac{1-i}{\sqrt{2}}R_{X}\left(-\frac{\pi}{2}\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* No Cloning Theorem \end_layout \begin_layout Standard (Box 12.1, Page 532 in book) \end_layout \begin_layout Standard Is there an operator \begin_inset Formula $U$ \end_inset that satisfies \begin_inset Formula $U\left(\left|\psi\right\rangle \left|s\right\rangle \right)=\left|\psi\right\rangle \left|\psi\right\rangle $ \end_inset for arbitrary states \begin_inset Formula $\left|\psi\right\rangle $ \end_inset with some standard input \begin_inset Formula $\left|s\right\rangle $ \end_inset ? \end_layout \begin_layout Standard Assuming there is such an operator, the following will be true for two states \begin_inset Formula $\left|\psi_{1}\right\rangle $ \end_inset and \begin_inset Formula $\left|\psi_{2}\right\rangle $ \end_inset \begin_inset Formula \begin{eqnarray*} U\left(\left|\psi_{1}\right\rangle \left|s\right\rangle \right) & = & \left|\psi_{1}\right\rangle \left|\psi_{1}\right\rangle \\ U\left(\left|\psi_{2}\right\rangle \left|s\right\rangle \right) & = & \left|\psi_{2}\right\rangle \left|\psi_{2}\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Inner product of above equations, left hand side: \begin_inset Formula \[ \left(U\left(\left|\psi_{1}\right\rangle \left|s\right\rangle \right)\right)^{H}\left(U\left(\left|\psi_{2}\right\rangle \left|s\right\rangle \right)\right)\] \end_inset \begin_inset Formula \begin{eqnarray*} & = & \left(\left|\psi_{1}\right\rangle \left|s\right\rangle \right)^{H}U^{H}U\left(\left|\psi_{2}\right\rangle \left|s\right\rangle \right)\\ & = & \left(\left\langle \psi_{1}\right|\left\langle s\right|\right)\left(\left|\psi_{2}\right\rangle \left|s\right\rangle \right)\\ & = & \left\langle \psi_{1}\mid\psi_{2}\right\rangle \left\langle s\mid s\right\rangle \\ & = & \left\langle \psi_{1}\mid\psi_{2}\right\rangle \end{eqnarray*} \end_inset Right hand side: \begin_inset Formula \[ \left(\left|\psi_{1}\right\rangle \left|\psi_{1}\right\rangle \right)^{H}\left(\left|\psi_{2}\right\rangle \left|\psi_{2}\right\rangle \right)\] \end_inset \begin_inset Formula \begin{eqnarray*} & = & \left(\left\langle \psi_{1}\right|\left\langle \psi_{1}\right|\right)\left(\left|\psi_{2}\right\rangle \left|\psi_{2}\right\rangle \right)\\ & = & \left\langle \psi_{1}\mid\psi_{2}\right\rangle \left\langle \psi_{1}\mid\psi_{2}\right\rangle \\ & = & \left\langle \psi_{1}\mid\psi_{2}\right\rangle ^{2}\end{eqnarray*} \end_inset Both sides together: \begin_inset Formula \[ \left\langle \psi_{1}\mid\psi_{2}\right\rangle =\left\langle \psi_{1}\mid\psi_{2}\right\rangle ^{2}\] \end_inset which can only be true in two cases \end_layout \begin_layout Standard Case 1: \begin_inset Formula $\left\langle \psi_{1}\mid\psi_{2}\right\rangle =0$ \end_inset means \begin_inset Formula $\left|\psi_{1}\right\rangle \perp\left|\psi_{2}\right\rangle $ \end_inset \end_layout \begin_layout Standard Case 2: \begin_inset Formula $\left\langle \psi_{1}\mid\psi_{2}\right\rangle =1$ \end_inset means \begin_inset Formula $\left|\psi_{1}\right\rangle =\left|\psi_{2}\right\rangle $ \end_inset \end_layout \begin_layout Standard So a cloning operator \begin_inset Formula $U$ \end_inset will can work for a single state, or for two states that are orthogonal, there is no \begin_inset Formula $U$ \end_inset that can clone states generally. \end_layout \begin_layout Subsection* Implementing Controlled n-Qubit Gates \begin_inset Formula $C^{n}\left(U\right)$ \end_inset (n>2) \end_layout \begin_layout Standard Start off with simple examples and build in complexity \end_layout \begin_layout Subsubsection* U=X, k=1, n=3 \end_layout \begin_layout Standard This just means taking a normal Toffili gate \begin_inset Formula \[ \textrm{Circuit: }\left({I\otimes I\otimes X}^{\#1,\#2}\right)\left|x_{1}\right\rangle \left|x_{2}\right\rangle \left|x_{3}\right\rangle \] \end_inset and extending it to get an additional control line: \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit: }\left({I\otimes I\otimes I\otimes I\otimes X}^{\#3,\#4}\right)\left({I\otimes I\otimes X}^{\#1,\#2}\otimes I\otimes I\right)\left|x_{1}\right\rangle \left|x_{2}\right\rangle \left|0\right\rangle \left|x_{3}\right\rangle \left|x_{4}\right\rangle \] \end_inset \end_layout \begin_layout Standard Output of circuit will be \begin_inset Formula $\left|x_{1}\right\rangle \left|x_{2}\right\rangle \left|x_{1}x_{2}\right\rangle \left|x_{3}\right\rangle \left|\left(x_{1}x_{2}x_{3}\right)\oplus x_{4}\right\rangle $ \end_inset \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none , \family default \series default \shape default \size default \emph default \bar default \noun default and the last qubit has the output we are looking for. \end_layout \begin_layout Subsubsection* U=any, k=1, n=any \end_layout \begin_layout Standard In the general case, if you want to control a 1 qubit \begin_inset Formula $U$ \end_inset with \begin_inset Formula $n$ \end_inset inputs, you need to have \begin_inset Formula $n-1$ \end_inset \begin_inset Formula $\left|0\right\rangle $ \end_inset inputs as well. Add \begin_inset Formula $n-1$ \end_inset toffoli gates, taking the product of the first two qubit lines to the first \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|0\right\rangle $ \end_inset input, the product of the second two lines (#3 and #4) onto the second \begin_inset Formula $\left|0\right\rangle $ \end_inset input, and so on. Halfway down, you reach the first \begin_inset Formula $\left|0\right\rangle $ \end_inset lines, but you keep taking products in the same pattern, and at the end, the last \begin_inset Formula $\left|0\right\rangle $ \end_inset line will have the product of the first \begin_inset Formula $n$ \end_inset qubits. Below that, the unitary operation \begin_inset Formula $U$ \end_inset can be placed it's own line and can it be controlled by the last \begin_inset Formula $\left|0\right\rangle $ \end_inset line, right above it, which holds the product of all the control inputs. An additional \begin_inset Formula $n-1$ \end_inset toffoli gates can be placed after the unitary operation, in the same pattern as before, to make the \begin_inset Formula $\left|0\right\rangle $ \end_inset lines have \begin_inset Formula $\left|0\right\rangle $ \end_inset outputs. \end_layout \begin_layout Subsubsection* U= \begin_inset Formula $U^{\otimes k}$ \end_inset , k=any, n=1 \end_layout \begin_layout Standard \begin_inset Formula \[ Q_{U}\left|c\right\rangle \left|t_{1}t_{2}\cdots t_{k}\right\rangle =\left|c\right\rangle U^{C}\left|t_{1}\right\rangle U^{C}\left|t_{2}\right\rangle \cdots U^{C}\left|t_{k}\right\rangle \] \end_inset \end_layout \begin_layout Standard A special case is \begin_inset Formula $U=X$ \end_inset : \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} Q_{X}\left|c\right\rangle \left|t_{1}t_{2}\cdots t_{k}\right\rangle & = & \left|c\right\rangle \left|{c\oplus t}_{1}\right\rangle \left|{c\oplus t}_{2}\right\rangle \cdots\left|{c\oplus t}_{k}\right\rangle \end{eqnarray*} \end_inset which can be drawn with a single control node, \begin_inset Formula $k$ \end_inset \begin_inset Formula $X$ \end_inset nodes ( \begin_inset Formula $\oplus$ \end_inset ) for each affected qubit, and a line connecting all the nodes. \end_layout \begin_layout Standard In matrix form, \begin_inset Formula \[ C\left(X^{\otimes k}\right)=\left(\begin{array}{cc} I & 0\\ 0 & X^{\otimes k}\end{array}\right)\] \end_inset \end_layout \begin_layout Standard Size of \begin_inset Formula $C\left(X^{\otimes k}\right)$ \end_inset is \begin_inset Formula $2^{k+1}$ \end_inset , size of \begin_inset Formula $I$ \end_inset , \begin_inset Formula $X^{\otimes k}$ \end_inset and the 0 matrices is \begin_inset Formula $2^{k}$ \end_inset . Each column of the matrix is the output of a basis state. The columns from \begin_inset Formula $\left|0\right\rangle \left|0\cdots0\right\rangle $ \end_inset to \begin_inset Formula $\left|0\right\rangle \left|1\cdots1\right\rangle $ \end_inset for the first half of the matrix just give identify. Then, the last columns from \begin_inset Formula $\left|1\right\rangle \left|0\cdots0\right\rangle $ \end_inset to \begin_inset Formula $\left|1\right\rangle \left|1\cdots1\right\rangle $ \end_inset apply \begin_inset Formula $X^{\otimes k}$ \end_inset to the last \begin_inset Formula $k$ \end_inset qubits of the input. \begin_inset Formula $X^{\otimes k}$ \end_inset looks like a reflected identify matrix, with 1s going from the bottom left corner to the top right, and 0s everywhere else. \end_layout \begin_layout Standard Above can be generalized, \begin_inset Formula \begin{eqnarray*} Q_{U}\left|c\right\rangle \left|t_{1}t_{2}\cdots t_{k}\right\rangle & = & \left|c\right\rangle U^{C}\left|t_{1}\right\rangle U^{C}\left|t_{2}\right\rangle \cdots U^{C}\left|t_{k}\right\rangle \\ & = & \left|c\right\rangle \left(U^{C}\right)^{\otimes k}\left|t_{1}\cdots t_{k}\right\rangle \end{eqnarray*} \end_inset And \begin_inset Formula \[ Q_{U}=\left(\begin{array}{cc} I & 0\\ 0 & U^{\otimes k}\end{array}\right)\] \end_inset \end_layout \begin_layout Subsection* 2 Level Matrix Gate \end_layout \begin_layout Standard Acts non-linearly on at most 2 components of a vector, example: \begin_inset Formula \[ \left(U\right)_{dxd}\left(\begin{array}{c} x_{1}\\ x_{2}\\ x_{3}\\ \vdots\\ x_{d}\end{array}\right)=\left(\begin{array}{c} {x'}_{1}\\ {x'}_{2}\\ x_{3}\\ \vdots\\ x_{d}\end{array}\right)\textrm{ or }=\left(\begin{array}{c} {x'}_{1}\\ x_{2}\\ {x'}_{3}\\ \vdots\\ x_{d}\end{array}\right)\textrm{ or }=\left(\begin{array}{c} x_{1}\\ {x'}_{2}\\ {x'}_{3}\\ \vdots\\ x_{d}\end{array}\right)\] \end_inset \end_layout \begin_layout Standard Mentioned: QR Decomposition, Hausholder matrix \end_layout \begin_layout Section* Lecture 10 (19 February) \end_layout \begin_layout Standard [DUNNO: Was late to class, no idea what this is] \end_layout \begin_layout Standard Implementation Topic \end_layout \begin_layout Standard \begin_inset Formula $C^{2}\left(U\right)$ \end_inset , \begin_inset Formula $C^{n}\left(U\right)$ \end_inset \end_layout \begin_layout Standard 2-Level Gates /Matrices \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left(\begin{array}{ccc} \frac{\alpha_{1}}{x} & \frac{\alpha_{2}}{x} & 0\\ \frac{\alpha_{2}}{x} & \frac{\alpha_{1}}{x} & 0\\ 0 & 0 & 1\end{array}\right)\left(\begin{array}{ccc} \alpha_{1} & \beta_{1} & \gamma_{1}\\ \alpha_{2} & \beta_{2} & \gamma_{2}\\ \alpha_{3} & \beta_{3} & \gamma_{3}\end{array}\right) & = & \left(\begin{array}{ccc} \alpha_{1} & \beta_{1} & \gamma_{1}\\ 0 & \beta_{2} & \gamma_{2}\\ \alpha_{3} & \beta_{3} & \gamma_{3}\end{array}\right)\end{eqnarray*} \end_inset \begin_inset Formula \[ x=\sqrt{\left|\alpha_{1}\right|^{2}+\left|\alpha_{2}\right|^{2}}\] \end_inset \begin_inset Formula \[ \left(\begin{array}{cc} \frac{\alpha_{1}}{x} & \frac{{-\alpha}_{2}}{x}\end{array}\right)\left(\begin{array}{c} \frac{{-\alpha}_{2}}{x}\\ \frac{\alpha_{1}}{x}\end{array}\right)=0\] \end_inset \end_layout \begin_layout Standard First matrix is \begin_inset Formula $U_{1}$ \end_inset , second matrix is \begin_inset Formula $U$ \end_inset . \end_layout \begin_layout Standard \begin_inset Formula \[ \left(\begin{array}{ccc} {\bar{\alpha}'}_{1} & 0 & \bar{\gamma}_{1}\\ 0 & 1 & 0\\ {-\alpha}_{3} & 0 & {\gamma'}_{3}\end{array}\right)\left(\begin{array}{ccc} {\alpha''}_{1} & {\beta''}_{1} & {\gamma''}_{1}\\ 0 & {\beta''}_{2} & {\gamma''}_{2}\\ 0 & {\beta''}_{3} & {\gamma''}_{3}\end{array}\right)=\left(\begin{array}{ccc} {\alpha''}_{1} & 0 & 0\\ 0 & {\beta''}_{2} & {\gamma''}_{2}\\ 0 & {\beta''}_{3} & {\gamma''}_{3}\end{array}\right)\] \end_inset Repeat as submatrix \begin_inset Formula $\left|{\alpha''}_{1}\right|=1$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ U_{3}U_{2}U_{1}U=\left(\begin{array}{ccc} {\alpha''}_{1} & 0 & 0\\ 0 & {\beta''}_{2} & 0\\ 0 & 0 & {\gamma''}_{3}\end{array}\right)D\] \end_inset \begin_inset Formula $D$ \end_inset is some diagonal matrix holding relative phases. \end_layout \begin_layout Standard \begin_inset Formula \[ U=U_{1}^{-1}U_{2}^{-1}U_{3}^{-1}D=U_{1}^{H}U_{2}^{H}U_{3}^{H}D\] \end_inset \end_layout \begin_layout Subsection* Measurements \end_layout \begin_layout Standard (Book 2.2.3) Measurements are made with collections of measurement operators, \begin_inset Formula $\left\{ M_{j}\right\} $ \end_inset , where operators are Hermitian matrices, not necessarily unitary. There is one measurement operator \begin_inset Formula $M_{j}$ \end_inset for each possible outcome, \begin_inset Formula $j$ \end_inset . The measurements satisfy the completeness equation: \begin_inset Formula \[ \sum_{j=0}^{k-1}M_{j}^{H}M_{j}=I\] \end_inset Given a state \begin_inset Formula $\left|\psi\right\rangle ,$ \end_inset an outcome \begin_inset Formula $j$ \end_inset occurs with probability \begin_inset Formula \[ p\left(j\right)=\left\langle \psi\right|M_{j}^{H}M_{j}\left|\psi\right\rangle =\left\Vert M_{j}\left|\psi\right\rangle \right\Vert ^{2}\] \end_inset causing the state to collapse to \begin_inset Formula $\frac{M_{j}\left|\psi\right\rangle }{\sqrt{p\left(j\right)}}$ \end_inset . \end_layout \begin_layout Standard The probabilities of all possible outcomes \begin_inset Formula $j$ \end_inset sum to one. Proof \begin_inset Formula \begin{eqnarray*} 1 & = & \left\langle \psi\mid\psi\right\rangle =\left\langle \psi\right|I\left|\psi\right\rangle =\left\langle \psi\right|\sum_{j}M_{j}^{H}M_{j}\left|\psi\right\rangle \\ & = & \sum_{j}\left\langle \psi\right|M_{j}^{H}M_{j}\left|\psi\right\rangle =\sum_{j}p\left(j\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Projective Measurements \end_layout \begin_layout Standard Projective measurements are measurements on the computational basis. \end_layout \begin_layout Standard Example 1: \end_layout \begin_layout Standard \begin_inset Formula $M_{j}=\left|j\right\rangle \left\langle j\right|=\left(\begin{array}{ccccc} & & 0\\ & & \vdots\\ 0 & \ldots & 1 & \ldots & 0\\ & & \vdots\\ & & 0\end{array}\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $M_{j}$ \end_inset is zero matrix with single one row and column \begin_inset Formula $j+1$ \end_inset . \end_layout \begin_layout Standard Observe \begin_inset Formula $M_{j}^{H}=M_{j}$ \end_inset (matrix is Hermitian) and \begin_inset Formula $M_{j}^{H}M_{j}=M_{j}$ \end_inset (because it's a projection matrix and \begin_inset Formula $\left|j\right\rangle \left\langle j\mid j\right\rangle \left\langle j\right|=\left|j\right\rangle \left\langle j\right|$ \end_inset ). \end_layout \begin_layout Standard \begin_inset Formula \[ p\left(j\right)=\left\Vert M_{j}\left|\psi\right\rangle \right\Vert ^{2}=\left\Vert \left|j\right\rangle \left\langle j\mid\psi\right\rangle \right\Vert ^{2}=\left|\left\langle j\mid\psi\right\rangle \right|^{2}\] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ M_{j}\left|\psi\right\rangle =\left|j\right\rangle \left\langle j\mid\psi\right\rangle =\left\langle j\mid\psi\right\rangle \left|j\right\rangle \] \end_inset \begin_inset Formula \[ \left|\psi\right\rangle =\sum_{j}\left|j\right\rangle \left\langle j\mid\psi\right\rangle =\sum_{j}c_{j}\left|j\right\rangle \] \end_inset \begin_inset Formula \[ \sum_{j=0}^{2^{n}-1}M_{j}^{H}M_{j}=\sum_{j}M_{j}=\sum_{j}=\left|j\right\rangle \left\langle j\right|=I\] \end_inset \end_layout \begin_layout Standard Example 2: \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|\psi\right\rangle & = & a\left|0\right\rangle +b\left|1\right\rangle \\ M_{1} & = & \left|+\right\rangle \left\langle +\right|\\ M_{2} & = & \left|-\right\rangle \left\langle -\right|\\ \left|+\right\rangle & = & \frac{\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}\\ \left|-\right\rangle & = & \frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\\ M_{j}^{H} & = & M_{j}\\ M_{j}^{H}M_{j} & = & M_{j}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Completeness relation \end_layout \begin_layout Standard \begin_inset Formula \[ \left|+\right\rangle \left\langle +\right|+\left|-\right\rangle \left\langle -\right|=\frac{1}{2}\left(\begin{array}{rr} 1 & 1\\ 1 & 1\end{array}\right)+\frac{1}{2}\left(\begin{array}{rr} 1 & -1\\ -1 & 1\end{array}\right)=\left(\begin{array}{rr} 1 & 0\\ 0 & 1\end{array}\right)\] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ M_{1}\left|\psi\right\rangle =\left|+\right\rangle \left\langle +\right|\left|\psi\right\rangle =\cdots=\left(\frac{a}{\sqrt{2}}+\frac{b}{\sqrt{2}}\right)\left|+\right\rangle \] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ M_{2}\left|\psi\right\rangle =\left|-\right\rangle \left\langle -\right|\left|\psi\right\rangle =\frac{1}{\sqrt{2}}\left(a-b\right)\left|-\right\rangle \] \end_inset \begin_inset Formula \[ p\left(1\right)=\left\Vert M_{1}\left|\psi\right\rangle \right\Vert ^{2}=\frac{\left|a+b\right|^{2}}{2}\] \end_inset \begin_inset Formula \[ p\left(2\right)=\left\Vert M_{2}\left|\psi\right\rangle \right\Vert ^{2}=\frac{\left|a-b\right|^{2}}{2}\] \end_inset \end_layout \begin_layout Standard Example 3 \end_layout \begin_layout Standard Measuring some qubits and not others. Say measuring \begin_inset Formula $k$ \end_inset qubits in a system of \begin_inset Formula $k+n$ \end_inset qubits. Then \begin_inset Formula $M_{j}=\left|j\right\rangle \left\langle j\right|\otimes I$ \end_inset where \begin_inset Formula $\left|j\right\rangle \left\langle j\right|$ \end_inset is a size \begin_inset Formula $2^{k}$ \end_inset matrix and \begin_inset Formula $I$ \end_inset is size \begin_inset Formula $2^{n}$ \end_inset . \end_layout \begin_layout Standard Properties \end_layout \begin_layout Standard \begin_inset Formula $M_{j}^{H}=M_{j}$ \end_inset \end_layout \begin_layout Standard Means matrix is Hermetian and therefore that it has real eigenvalues. In other words it's observable because eigenvalues are what you observe. \begin_inset Formula \[ M_{j}^{H}M_{j}=\left(\left|j\right\rangle \left\langle j\right|\otimes I\right)\left(\left|j\right\rangle \left\langle j\right|\otimes I\right)=\left|j\right\rangle \left\langle j\mid j\right\rangle \left\langle j\right|\otimes II=\left|j\right\rangle \left\langle j\right|\otimes I=M_{j}\] \end_inset \begin_inset Formula \begin{eqnarray*} M_{j}\left|\psi\right\rangle & = & M_{j}\left|\psi_{1}\right\rangle \left|\psi_{2}\right\rangle \\ & = & \left(\left|j\right\rangle \left\langle j\right|\otimes I\right)\left|\psi_{1}\right\rangle \left|\psi_{2}\right\rangle \\ & = & \left|j\right\rangle \left\langle j\mid\psi_{1}\right\rangle \otimes I\left|\psi_{2}\right\rangle \\ & = & \left\langle j\mid\psi_{1}\right\rangle \left(\left|j\right\rangle \left|\psi_{2}\right\rangle \right)\end{eqnarray*} \end_inset \begin_inset Formula \begin{eqnarray*} p\left(j\right) & = & \left\Vert M_{j}\left|\psi\right\rangle \right\Vert ^{2}\\ & = & \left\Vert \left\langle j\mid\psi_{1}\right\rangle \left(\left|j\right\rangle \left|\psi_{2}\right\rangle \right)\right\Vert ^{2}\\ & = & \left|\left\langle j\mid\psi_{1}\right\rangle \right|^{2}\left\Vert \left|j\right\rangle \left|\psi_{2}\right\rangle \right\Vert ^{2}\\ & = & \left|\left\langle j\mid\psi_{1}\right\rangle \right|^{2}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Reason for last step is that \begin_inset Formula $\left|j\right\rangle $ \end_inset and \begin_inset Formula $\left|\psi_{2}\right\rangle $ \end_inset are both normal: \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left\Vert \left|j\right\rangle \left|\psi_{2}\right\rangle \right\Vert ^{2} & = & \left(\left|j\right\rangle \left|\psi_{2}\right\rangle \right)^{H}\left(\left|j\right\rangle \left|\psi_{2}\right\rangle \right)\\ & = & \left(\left\langle j\right|\left\langle \psi_{2}\right|\right)\left(\left|j\right\rangle \left|\psi_{2}\right\rangle \right)\\ & = & \left\langle j\mid j\right\rangle \left\langle \psi_{2}\mid\psi_{2}\right\rangle \\ & = & 1\cdot1=1\end{eqnarray*} \end_inset \end_layout \begin_layout Section* Lecture 11 (21 February) \end_layout \begin_layout Subsection* Distinguishing states with certainty \end_layout \begin_layout Standard Can we distinguish between two states \begin_inset Formula $\left|\psi_{1}\right\rangle $ \end_inset and \begin_inset Formula $\left|\psi_{2}\right\rangle $ \end_inset with certainty (with probability 1)? (Similar proof page 87, box 2.3) \end_layout \begin_layout Standard Assume it is possible, then there are measurement operators \begin_inset Formula $M_{1},M_{2},\ldots,M_{k}$ \end_inset so that \begin_inset Formula \[ I=\sum_{j}M_{j}^{H}M_{j}\] \end_inset Given states \begin_inset Formula $\left|\psi_{1}\right\rangle $ \end_inset and \begin_inset Formula $\left|\psi_{2}\right\rangle $ \end_inset , then probabilities of outcomes \begin_inset Formula $1$ \end_inset and \begin_inset Formula $2$ \end_inset (respectively) should be: \begin_inset Formula \begin{eqnarray*} p_{\psi_{1}}\left(1\right) & = & \left\langle \psi_{1}\right|M_{1}^{H}M_{1}\left|\psi_{1}\right\rangle =1\\ p_{\psi_{2}}\left(2\right) & = & \left\langle \psi_{2}\right|M_{2}^{H}M_{2}\left|\psi_{2}\right\rangle =1\end{eqnarray*} \end_inset This implies that \begin_inset Formula $M_{1}\left|\psi_{1}\right\rangle $ \end_inset and \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $M_{1}\left|\psi_{2}\right\rangle $ \end_inset are unit vectors. Using the completeness equation, it also implies \family default \series default \shape default \size default \emph default \bar default \noun default \begin_inset Formula $M_{1}\left|\psi_{2}\right\rangle =0$ \end_inset and \begin_inset Formula $M_{2}\left|\psi_{1}\right\rangle =0$ \end_inset . \end_layout \begin_layout Standard (Completeness equation \begin_inset Formula \[ M_{1}^{H}M_{1}+M_{2}^{H}M_{2}=I\] \end_inset \end_layout \begin_layout Standard leads to \begin_inset Formula \[ 1=\left\langle \psi_{1}\right|I\left|\psi_{1}\right\rangle =\left\langle \psi_{1}\right|M_{1}^{H}M_{1}\left|\psi_{1}\right\rangle +\left\langle \psi_{1}\right|M_{2}^{H}M_{2}\left|\psi_{1}\right\rangle \] \end_inset \begin_inset Formula \[ 1=\left\langle \psi_{2}\right|I\left|\psi_{2}\right\rangle =\left\langle \psi_{2}\right|M_{1}^{H}M_{1}\left|\psi_{2}\right\rangle +\left\langle \psi_{2}\right|M_{2}^{H}M_{2}\left|\psi_{2}\right\rangle \] \end_inset and because \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left\langle \psi_{1}\right|M_{2}^{H}M_{2}\left|\psi_{1}\right\rangle =1$ \end_inset and \family default \series default \shape default \size default \emph default \bar default \noun default \begin_inset Formula $\left\langle \psi_{2}\right|M_{2}^{H}M_{2}\left|\psi_{2}\right\rangle =1$ \end_inset the other terms must be 0.) \end_layout \begin_layout Standard State \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\psi_{1}\right\rangle $ \end_inset can be written in using \begin_inset Formula $\left|\psi_{2}\right\rangle $ \end_inset and another vector \begin_inset Formula $\left|Z\right\rangle $ \end_inset as a basis, where \family default \series default \shape default \size default \emph default \bar default \noun default \begin_inset Formula $\left\Vert \left|Z\right\rangle \right\Vert =1$ \end_inset , \begin_inset Formula $\left|Z\right\rangle \perp\left|\psi_{2}\right\rangle $ \end_inset : \end_layout \begin_layout Standard \begin_inset Formula \[ \left|\psi_{1}\right\rangle =\alpha\left|\psi_{2}\right\rangle +\beta\left|Z\right\rangle \] \end_inset \begin_inset Formula \[ M_{1}\left|\psi_{1}\right\rangle =\alpha M_{1}\left|\psi_{2}\right\rangle +\beta M_{1}\left|Z\right\rangle \] \end_inset \end_layout \begin_layout Standard Assume \begin_inset Formula $\left|\psi_{1}\right\rangle $ \end_inset and \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\psi_{2}\right\rangle $ \end_inset are not orthogonal, \family default \series default \shape default \size default \emph default \bar default \noun default then \begin_inset Formula $\left\langle \psi_{1}\mid\psi_{2}\right\rangle \neq0$ \end_inset and \begin_inset Formula $\alpha\neq$ \end_inset 0, so \begin_inset Formula $\left|\beta\right|<1$ \end_inset . Then below, you have a contradiction, proving they must be orthogonal. \begin_inset Formula \[ 1=\left\Vert M_{1}\left|\psi_{1}\right\rangle \right\Vert ^{2}=\left|\beta\right|^{2}\left\Vert M_{1}\left|Z\right\rangle \right\Vert ^{2}\leq\left|\beta\right|^{2}<1\] \end_inset Note that \begin_inset Formula $\left\Vert M_{1}\left|Z\right\rangle \right\Vert ^{2}$ \end_inset just means \color inherit \begin_inset Formula $\left\langle Z\right|M_{1}^{H}M_{1}\left|Z\right\rangle $ \end_inset . \end_layout \begin_layout Subsection* Some Properties of Operators and Completeness \end_layout \begin_layout Standard Given: \begin_inset Formula \[ \left|\psi_{1}\right\rangle \perp\left|\psi_{2}\right\rangle \] \end_inset \begin_inset Formula \[ M_{1}=\left|\psi_{1}\right\rangle \left\langle \psi_{1}\right|\] \end_inset \begin_inset Formula \[ M_{2}=\left|\psi_{2}\right\rangle \left\langle \psi_{2}\right|\] \end_inset \begin_inset Formula $M_{1}$ \end_inset and \begin_inset Formula $M_{2}$ \end_inset are symmetric non-negative definate, which means that for all \begin_inset Formula $\left|x\right\rangle $ \end_inset , \begin_inset Formula $\left\langle x\right|M\left|x\right\rangle \geq0$ \end_inset . This can be verified as follows: \begin_inset Formula \[ \left\langle x\right|M\left|x\right\rangle =\left\langle x\right|M^{H}M\left|x\right\rangle =\left\Vert M\left|x\right\rangle \right\Vert ^{2}\geq0\] \end_inset \end_layout \begin_layout Standard Symmetric non-negative definate matrices have non-negative eigenvalues. \end_layout \begin_layout Standard Define: \end_layout \begin_layout Standard \begin_inset Formula \[ M=I-M_{1}-M_{2}\] \end_inset \end_layout \begin_layout Standard Observe it's symmetric. This means eigenvalues are real. Check that it is positive semi-definite, that for all \begin_inset Formula $\left|\psi\right\rangle $ \end_inset , \begin_inset Formula \[ \left\langle \psi\right|M\left|\psi\right\rangle =\left\langle \psi\mid\psi\right\rangle -\left\langle \psi\right|M_{1}\left|\psi\right\rangle -\left\langle \psi\right|M_{2}\left|\psi\right\rangle \geq0\] \end_inset \begin_inset Formula \[ M_{1}\left|\psi\right\rangle =\left|\psi_{1}\right\rangle \left\langle \psi_{1}\mid\psi\right\rangle \] \end_inset \begin_inset Formula \[ M_{2}\left|\psi\right\rangle =\left|\psi_{2}\right\rangle \left\langle \psi_{2}\mid\psi\right\rangle \] \end_inset \begin_inset Formula \[ \left\langle \psi\right|M_{1}\left|\psi\right\rangle =\left|\left\langle \psi_{1}\mid\psi\right\rangle \right|^{2}\] \end_inset \begin_inset Formula \[ \left\langle \psi\right|M_{2}\left|\psi\right\rangle =\left|\left\langle \psi_{2}\mid\psi\right\rangle \right|^{2}\] \end_inset \begin_inset Formula \[ \left\langle \psi\right|M\left|\psi\right\rangle =1-\left|\left\langle \psi_{1}\mid\psi\right\rangle \right|^{2}-\left|\left\langle \psi_{2}\mid\psi\right\rangle \right|^{2}\overset{?}{=}0\] \end_inset \end_layout \begin_layout Standard Need to find prove that above is \begin_inset Formula $\geq0$ \end_inset . \begin_inset Formula $\left|\psi\right\rangle $ \end_inset can be expressed as \end_layout \begin_layout Standard \begin_inset Formula \[ \left|\psi\right\rangle =\left|\psi_{1}\right\rangle \left\langle \psi_{1}\mid\psi\right\rangle +\left|\psi_{2}\right\rangle \left\langle \psi_{2}\mid\psi\right\rangle +\left|z\right\rangle \] \end_inset For some \begin_inset Formula $\left|z\right\rangle \perp\left|\psi_{1}\right\rangle ,\left|\psi_{2}\right\rangle $ \end_inset . Taking inner product with \begin_inset Formula $\left|\psi\right\rangle $ \end_inset gives: \begin_inset Formula \[ 1=\left\langle \psi\mid\psi\right\rangle =\left|\left\langle \psi_{1}\mid\psi\right\rangle \right|^{2}+\left|\left\langle \psi_{2}\mid\psi\right\rangle \right|^{2}+\left\Vert \left|z\right\rangle \right\Vert ^{2}\geq0\] \end_inset Rearranging, \begin_inset Formula \[ 1-\left|\left\langle \psi_{1}\mid\psi\right\rangle \right|^{2}-\left|\left\langle \psi_{2}\mid\psi\right\rangle \right|^{2}=\left\Vert \left|z\right\rangle \right\Vert ^{2}=\left\langle \psi\right|M\left|\psi\right\rangle \geq0\] \end_inset \end_layout \begin_layout Standard Which tells us \begin_inset Formula $M$ \end_inset is symmetric non-negative definite. This means we can do spectral decomposition: \begin_inset Formula \begin{eqnarray*} M & = & V\left(\begin{array}{cccc} \lambda_{1} & 0 & 0 & 0\\ 0 & \lambda_{2} & 0 & 0\\ 0 & 0 & \ddots & 0\\ 0 & 0 & 0 & \lambda_{4}\end{array}\right)V^{H}\\ & = & V\left(\begin{array}{cccc} \sqrt{\lambda_{1}} & 0 & 0 & 0\\ 0 & \sqrt{\lambda_{2}} & 0 & 0\\ 0 & 0 & \ddots & 0\\ 0 & 0 & 0 & \sqrt{\lambda_{4}}\end{array}\right)V^{H}V\left(\begin{array}{cccc} \sqrt{\lambda_{1}} & 0 & 0 & 0\\ 0 & \sqrt{\lambda_{2}} & 0 & 0\\ 0 & 0 & \ddots & 0\\ 0 & 0 & 0 & \sqrt{\lambda_{4}}\end{array}\right)V^{H}\end{eqnarray*} \end_inset since \begin_inset Formula $V^{H}V=I$ \end_inset . Now, define \begin_inset Formula $M_{3}=\sqrt{M}$ \end_inset \end_layout \begin_layout Standard Results of measuring state \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\psi_{1}\right\rangle $ \end_inset : \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Standard Outcome \end_layout \end_inset \begin_inset Text \begin_layout Standard Probability \end_layout \end_inset \begin_inset Text \begin_layout Standard 1 \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $p_{\psi_{1}}\left(1\right)=1=\left\langle \psi_{1}\right|M_{1}\left|\psi_{1}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard 2 \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $p_{\psi_{1}}\left(2\right)=0=\left\langle \psi_{1}\right|M_{2}\left|\psi_{1}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard 3 \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $p_{\psi_{1}}\left(3\right)=0$ \end_inset (see below) \end_layout \end_inset \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} p_{\psi_{1}}\left(3\right)=0 & = & \left\langle \psi_{1}\right|M_{3}^{H}M_{3}\left|\psi_{1}\right\rangle \\ & = & \left\langle \psi_{1}\right|\left(I-M_{1}-M_{2}\right)\left|\psi_{1}\right\rangle \\ & = & \left\langle \psi_{1}\mid\psi_{1}\right\rangle -\left\langle \psi_{1}\right|M_{1}\left|\psi_{1}\right\rangle -\left\langle \psi_{1}\right|M_{2}\left|\psi_{1}\right\rangle \\ & = & 1-1-0\end{eqnarray*} \end_inset \end_layout \begin_layout Standard For \begin_inset Formula $\left|\psi_{2}\right\rangle $ \end_inset \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Standard Outcome \end_layout \end_inset \begin_inset Text \begin_layout Standard Probability \end_layout \end_inset \begin_inset Text \begin_layout Standard 1 \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $p_{\psi_{2}}\left(1\right)=0$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard 2 \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $p_{\psi_{2}}\left(2\right)=1$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard 3 \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $p_{\psi_{2}}\left(3\right)=0$ \end_inset \end_layout \end_inset \end_inset \end_layout \begin_layout Standard (Review of matrix types: \end_layout \begin_layout Standard Normal - \begin_inset Formula $A^{H}A=AA^{H}$ \end_inset , matrix commutes with it's transpose \end_layout \begin_layout Standard Unitary - \begin_inset Formula $A^{H}A=I$ \end_inset or \begin_inset Formula $A^{H}=A^{-1}$ \end_inset , type of normal matrix, eigenvalues all have absolute value of 1. \end_layout \begin_layout Standard Hermetian - \begin_inset Formula $A=A^{H}$ \end_inset , type of normal matrix, eigenvalues are real \end_layout \begin_layout Standard Positive Definite - hermitian and \begin_inset Formula $x^{H}Ax>0$ \end_inset for all \begin_inset Formula $x$ \end_inset . (if not hermetian, some values of \begin_inset Formula $x^{H}Ax$ \end_inset would be complex) \end_layout \begin_layout Standard Projection matrix - hermetian and \begin_inset Formula $A^{2}=A$ \end_inset , is positive semi-definite, eigenvalues are all 0 or all 1) \end_layout \begin_layout Subsection* EPR States / Bell States \end_layout \begin_layout Standard (page 25) \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit:}\left(I\otimes X^{\#1}\right)\left(H\otimes I\right)\] \end_inset \begin_inset Formula \[ \left|0\right\rangle \left|0\right\rangle ^{\underrightarrow{\left(H\otimes I\right)}}\frac{\left|00\right\rangle +\left|10\right\rangle }{\sqrt{2}}{}^{\underrightarrow{\left(I\otimes X^{\#1}\right)}}\frac{\left|00\right\rangle +\left|11\right\rangle }{\sqrt{2}}=\left|\beta_{00}\right\rangle \] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ \left|i\right\rangle \left|j\right\rangle ^{\underrightarrow{\left(H\otimes I\right)}}\frac{\left|0\right\rangle +\left(-1\right)^{i}\left|1\right\rangle }{\sqrt{2}}\left|j\right\rangle {}^{\underrightarrow{\left(I\otimes X^{\#1}\right)}}\frac{\left|0j\right\rangle +\left(-1\right)^{i}\left|1\bar{j}\right\rangle }{\sqrt{2}}=\left|\beta_{ij}\right\rangle \] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|\beta_{00}\right\rangle & = & \frac{\left|00\right\rangle +\left|11\right\rangle }{\sqrt{2}}\\ \left|\beta_{01}\right\rangle & = & \frac{\left|01\right\rangle +\left|10\right\rangle }{\sqrt{2}}\\ \left|\beta_{10}\right\rangle & = & \frac{\left|00\right\rangle -\left|11\right\rangle }{\sqrt{2}}\\ \left|\beta_{11}\right\rangle & = & \frac{\left|01\right\rangle -\left|10\right\rangle }{\sqrt{2}}\end{eqnarray*} \end_inset Property 1: if you measure first qubit, you know second qubit. \end_layout \begin_layout Standard Property 2: Bell states are entangled, and therefore can't be written as the product of two entangled qubits. \begin_inset Formula \[ \left(a_{1}\left|0\right\rangle +b_{1}\left|1\right\rangle \right)\left(a_{2}\left|0\right\rangle +b_{2}\left|1\right\rangle \right)\] \end_inset \begin_inset Formula \[ a_{1}a_{2}\left|00\right\rangle +a_{1}b_{2}\left|01\right\rangle +b_{1}a_{2}\left|10\right\rangle +b_{1}b_{2}\left|11\right\rangle \] \end_inset \end_layout \begin_layout Standard There are no values of \begin_inset Formula $a_{1}$ \end_inset , \begin_inset Formula $b_{1}$ \end_inset , \begin_inset Formula $a_{2}$ \end_inset , \begin_inset Formula $b_{2}$ \end_inset that can give one of the bell states. \end_layout \begin_layout Standard Property 3: Bell states are pairwise orthogonal. Proof: \begin_inset Formula \begin{eqnarray*} \left\langle \beta_{i_{1}j_{1}}\mid\beta_{i_{2}j_{1}}\right\rangle & = & \left(\frac{\left\langle 0j_{1}\right|+\left(-1\right)^{i_{1}}\left\langle 1\bar{j_{1}}\right|}{\sqrt{2}}\right)\left(\frac{\left|0j_{2}\right\rangle +\left(-1\right)^{i_{2}}\left|1\bar{j_{2}}\right\rangle }{\sqrt{2}}\right)\\ & = & \frac{1}{2}\left(\left\langle 0j_{1}\mid0j_{2}\right\rangle +0+0+\left(-1\right)^{i_{1}+i_{2}}\left\langle 1\bar{j_{1}}\mid1\bar{j_{2}}\right\rangle \right)\\ & = & \frac{1}{2}\left(\left\langle j_{1}\mid j_{2}\right\rangle +\left(-1\right)^{i_{1}+i_{2}}\left\langle \bar{j_{1}}\mid\bar{j_{2}}\right\rangle \right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Case 1: \begin_inset Formula $j_{1}\neq j_{2}$ \end_inset then \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left\langle \beta_{i_{1}j_{1}}\mid\beta_{i_{2}j_{1}}\right\rangle =0$ \end_inset \end_layout \begin_layout Standard Case 2: \begin_inset Formula $j_{1}=j_{2}$ \end_inset \end_layout \begin_layout Standard Case 2.1: \begin_inset Formula $i_{1}\neq i_{2}$ \end_inset then \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left\langle \beta_{i_{1}j_{1}}\mid\beta_{i_{2}j_{1}}\right\rangle =0$ \end_inset (because exponent \family default \series default \shape default \size default \emph default \bar default \noun default \begin_inset Formula $i_{1}+i_{2}$ \end_inset is odd) \end_layout \begin_layout Standard Case 2.2: \begin_inset Formula $i_{1}=i_{2}$ \end_inset then \begin_inset Formula $\left\langle \beta_{i_{1}j_{1}}\mid\beta_{i_{2}j_{1}}\right\rangle =1$ \end_inset \end_layout \begin_layout Standard So inner product is zero unless \begin_inset Formula $i_{1}=i_{2}$ \end_inset and \begin_inset Formula $j_{1}=j_{2}$ \end_inset . \end_layout \begin_layout Standard \begin_inset Formula \[ \left\langle \beta_{i_{1}j_{1}}\mid\beta_{i_{2}j_{1}}\right\rangle =\left(\frac{\left\langle 0j_{2}\right|+\left(-1\right)^{i_{2}}\left\langle 1\bar{j_{2}}\right|}{\sqrt{2}}\right)\left(\frac{\left|0j_{2}\right\rangle +\left(-1\right)^{i_{2}}\left|1\bar{j_{2}}\right\rangle }{\sqrt{2}}\right)\] \end_inset \end_layout \begin_layout Subsection* Quantum Teleportation \end_layout \begin_layout Standard [Book 1.3.7 p27] \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit:}\left(I\otimes I\otimes Z^{M\#1}X^{M\#2}\right)\left(H\otimes I\otimes I\right)\left(I\otimes X^{\#1}\otimes I\right)\left|\psi\right\rangle \left|\beta_{00}\right\rangle \] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|\psi\right\rangle \left|\beta_{00}\right\rangle & = & \left|\psi\right\rangle \frac{\left|00\right\rangle +\left|11\right\rangle }{\sqrt{2}}\\ & ^{\underrightarrow{\left(I\otimes X^{\#1}\otimes I\right)}} & a\left|0\right\rangle \frac{\left|00\right\rangle +\left|11\right\rangle }{\sqrt{2}}+b\left|1\right\rangle \frac{\left|10\right\rangle +\left|01\right\rangle }{\sqrt{2}}\\ & ^{\underrightarrow{\left(H\otimes I\otimes I\right)}} & \frac{a}{2}\left(\left|0\right\rangle +\left|1\right\rangle \right)\left(\left|00\right\rangle +\left|11\right\rangle \right)+\frac{b}{2}\left(\left|0\right\rangle -\left|1\right\rangle \right)\left(\left|10\right\rangle +\left|01\right\rangle \right)\\ & = & \frac{1}{2}\left|00\right\rangle \left(a\left|0\right\rangle +b\left|1\right\rangle \right)+\frac{1}{2}\left|01\right\rangle \left(a\left|1\right\rangle +b\left|0\right\rangle \right)\\ & & +\frac{1}{2}\left|10\right\rangle \left(a\left|0\right\rangle -b\left|1\right\rangle \right)+\frac{1}{2}\left|11\right\rangle \left(a\left|1\right\rangle -b\left|0\right\rangle \right)\\ & = & \frac{1}{2}\left(\left|00\right\rangle \left|\psi\right\rangle +\left|01\right\rangle X\left|\psi\right\rangle +\left|10\right\rangle Z\left|\psi\right\rangle +\left|10\right\rangle XZ\left|\psi\right\rangle \right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard By measuring first two qubits, you can know what \begin_inset Formula $X$ \end_inset and \begin_inset Formula $Z$ \end_inset filters to apply the third qubit in to make it equivalent original input value \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\psi\right\rangle $ \end_inset . This means that if you have two entangled qubits (of the bell state \begin_inset Formula $\beta_{00}$ \end_inset ) in seperate locations, you can use them to transmit an arbitrary qubit over a classical channel. \end_layout \begin_layout Section* Lecture 12 (26 February) \end_layout \begin_layout Subsection* Lecture 11 Review \end_layout \begin_layout Standard EPR States: \begin_inset Formula $\beta_{ij}=\left|0j\right\rangle +-\left(-1\right)^{i}1\left|1\bar{j}\right\rangle $ \end_inset \end_layout \begin_layout Subsection* Superdense Coding \end_layout \begin_layout Standard [Book 2.3, p97] \end_layout \begin_layout Standard Just like in teleportation, Alice and Bob each have 1 qubit of a 2-qubit entangled state, \begin_inset Formula $\beta_{00}$ \end_inset . Alice wants to send 2 classical bits of information by sending Bob a single quantum bit. She can do this by sending Bob her half of the entangled qubit after she applies one of four operations to it, depending on the classical bits she wants to send. The operations are shown below, and result in Bell states which Bob can distinguish to determine the original classical bits. \end_layout \begin_layout Standard \begin_inset Tabular \begin_inset Text \begin_layout Standard Bits \end_layout \end_inset \begin_inset Text \begin_layout Standard Qubit \end_layout \end_inset \begin_inset Text \begin_layout Standard 00 \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|\beta_{00}\right\rangle =\frac{\left|00\right\rangle +\left|11\right\rangle }{\sqrt{2}}\underrightarrow{I\otimes I}\frac{\left|00\right\rangle +\left|11\right\rangle }{\sqrt{2}}=\left|\beta_{00}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard 01 \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|\beta_{00}\right\rangle =\frac{\left|00\right\rangle +\left|11\right\rangle }{\sqrt{2}}\underrightarrow{Z\otimes I}\frac{\left|00\right\rangle -\left|11\right\rangle }{\sqrt{2}}=\left|\beta_{10}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard 10 \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|\beta_{00}\right\rangle =\frac{\left|00\right\rangle +\left|11\right\rangle }{\sqrt{2}}\underrightarrow{X\otimes I}\frac{\left|10\right\rangle +\left|01\right\rangle }{\sqrt{2}}=\left|\beta_{01}\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard 11 \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|\beta_{00}\right\rangle =\frac{\left|00\right\rangle +\left|11\right\rangle }{\sqrt{2}}\underrightarrow{iY\otimes I}\frac{\left|01\right\rangle -\left|10\right\rangle }{\sqrt{2}}=\left|\beta_{11}\right\rangle $ \end_inset \end_layout \end_inset \end_inset \end_layout \begin_layout Subsection* Quantum Queries \end_layout \begin_layout Standard Mechanism to insert data into a quantum computer. \end_layout \begin_layout Standard Assume you have a boolean function \begin_inset Formula $f=\left\{ 0,1\right\} \rightarrow\left\{ 0,1\right\} $ \end_inset , then this is a corresponding unitary operation \begin_inset Formula $U_{f}$ \end_inset which is defined on the basis states as: \begin_inset Formula $U_{f}\left|i\right\rangle \left|j\right\rangle =\left|i\right\rangle \left|j\oplus f\left(i\right)\right\rangle $ \end_inset . \end_layout \begin_layout Standard Proving \begin_inset Formula $U_{f}$ \end_inset is unitary: \end_layout \begin_layout Standard \begin_inset Formula $\left|i\right\rangle \left|j\right\rangle \underrightarrow{U_{f}}\left|i\right\rangle \left|j\oplus f\left(i\right)\right\rangle \underrightarrow{U_{f}}\left|i\right\rangle \left|j\oplus f\left(i\right)\oplus f\left(i\right)\right\rangle =\left|i\right\rangle \left|j\right\rangle $ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\left(U_{f}\right)^{2}=I$ \end_inset therefore \begin_inset Formula $U_{f}=U_{f}^{-1}$ \end_inset and \begin_inset Formula $U_{f}$ \end_inset is unitary. \end_layout \begin_layout Subsubsection* Quantum Parallelism \end_layout \begin_layout Standard Inputing a superposition state to \begin_inset Formula $U_{f}$ \end_inset computes a result of multiple inputs to the function \begin_inset Formula $f$ \end_inset in just a single operation. \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit: }U_{f}\left(H\otimes I\right)\left|0\right\rangle \left|0\right\rangle \] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|00\right\rangle & \underrightarrow{H\otimes I} & \frac{\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}\left|0\right\rangle \\ & \underrightarrow{U_{f}} & \frac{\left|0\right\rangle }{\sqrt{2}}\left|0\oplus f\left(0\right)\right\rangle +\frac{\left|1\right\rangle }{\sqrt{2}}\left|0\oplus f\left(1\right)\right\rangle \\ & = & \frac{\left|0f\left(0\right)\right\rangle +\left|1f\left(1\right)\right\rangle }{\sqrt{2}}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Single output state contains both values of function \begin_inset Formula $f$ \end_inset . \end_layout \begin_layout Subsection* General Quantum Queries \end_layout \begin_layout Standard Assume you have a boolean function \begin_inset Formula $f=\left\{ 0,\ldots,2^{n}-1\right\} \rightarrow\left\{ 0,1\right\} $ \end_inset , then there is a corresponding unitary operation \begin_inset Formula $U_{f}$ \end_inset which is defined on the basis states as: \begin_inset Formula $U_{f}\left|i\right\rangle \left|j\right\rangle =\left|i\right\rangle \left|j\oplus f\left(i\right)\right\rangle $ \end_inset . \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit: }U_{f}\left(H^{\otimes n}\otimes I\right)\left|0\right\rangle ^{\otimes n}\left|0\right\rangle \] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|0\ldots0\right\rangle \left|0\right\rangle & \underrightarrow{H^{\otimes n}\otimes I} & H^{\otimes n}\left|0\ldots0\right\rangle \left|0\right\rangle \\ & = & \left(H\left|0\right\rangle \otimes\cdots\otimes H\left|0\right\rangle \right)\left|0\right\rangle \\ & = & \frac{1}{2^{n/2}}\sum_{j=0}^{2^{n}-1}\left|j\right\rangle \left|0\right\rangle \\ & \underrightarrow{U_{f}} & \frac{1}{2^{n/2}}\sum_{j=0}^{2^{n}-1}\left|j\right\rangle \left|f\left(j\right)\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Quantum parallelism is not enough to exploit power of quantum computing, because even though the final state is a combination of all possible outputs of the function \begin_inset Formula $f$ \end_inset , when measurement occurs it will only give a single, random output. Need to find ways to combine the values to be able to efficiently measure some global property of the function. \end_layout \begin_layout Subsubsection* Matrix Representation of \begin_inset Formula $U_{f}$ \end_inset \end_layout \begin_layout Standard When \begin_inset Formula $f$ \end_inset is boolean function of 1 bit: \end_layout \begin_layout Standard \begin_inset Formula $U_{f}=\left(\begin{array}{cc} X^{f\left(0\right)}\\ & X^{f\left(1\right)}\end{array}\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $U_{f}\left|i\right\rangle \left|j\right\rangle =\left|i\right\rangle \left|j\oplus f\left(i\right)\right\rangle $ \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $i=0$ \end_inset , \begin_inset Formula $f\left(0\right)=0$ \end_inset , \begin_inset Formula $\left|0j\right\rangle \rightarrow\left|0j\right\rangle $ \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $i=0$ \end_inset , \begin_inset Formula $f\left(0\right)=1$ \end_inset , \begin_inset Formula $\left|0j\right\rangle \rightarrow\left|0\bar{j}\right\rangle $ \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $i=1$ \end_inset , \begin_inset Formula $f\left(1\right)=0$ \end_inset , \begin_inset Formula $\left|1j\right\rangle \rightarrow\left|1j\right\rangle $ \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $i=1$ \end_inset , \begin_inset Formula $f\left(1\right)=1$ \end_inset , \begin_inset Formula $\left|1j\right\rangle \rightarrow\left|1\bar{j}\right\rangle $ \end_inset \end_layout \begin_layout Standard When \begin_inset Formula $f$ \end_inset is boolean function of \begin_inset Formula $m$ \end_inset bits: \end_layout \begin_layout Standard \begin_inset Formula $U_{f}=\left(\begin{array}{cccc} X^{f\left(0\right)}\\ & X^{f\left(1\right)}\\ & & \ddots\\ & & & X^{f\left(2^{m}-1\right)}\end{array}\right)$ \end_inset \end_layout \begin_layout Standard When \begin_inset Formula $f$ \end_inset is function of \begin_inset Formula $m$ \end_inset bits returning \begin_inset Formula $n$ \end_inset bits: \end_layout \begin_layout Standard \begin_inset Formula $f=\left\{ 0,\ldots,2^{m}-1\right\} \rightarrow\left\{ 0,\ldots,2^{n}-1\right\} $ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $U_{f}\left|i_{1}\ldots i_{n}\right\rangle \left|j_{1}\ldots j_{n}\right\rangle =U_{f}\left|i\right\rangle \left|j\right\rangle =\left|i\right\rangle \left|j\oplus f\left(i\right)\right\rangle $ \end_inset \end_layout \begin_layout Standard where \begin_inset Formula $\oplus$ \end_inset is addition mod \begin_inset Formula $n$ \end_inset . \begin_inset Formula $U_{f}$ \end_inset is a permutation matrix (which makes it unitary) with a single 1 in each column. \end_layout \begin_layout Standard \begin_inset Formula $U_{f}$ \end_inset is made up of shifting matrixes, which work like: \begin_inset Formula $A_{p}\left|j\right\rangle =\left|p\oplus j\right\rangle $ \end_inset for \begin_inset Formula $j,p=0,\ldots,2^{n}-1$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $A_{p}=\left(\begin{array}{cccccccc} & & & & 1\\ & & & & & 1\\ & & & & & & 1\\ & & & & & & & 1\\ 1\\ & 1\\ & & 1\\ & & & 1\end{array}\right)$ \end_inset \end_layout \begin_layout Standard Matrix \begin_inset Formula $A_{p}$ \end_inset has 1 in first column at position \begin_inset Formula $p+1$ \end_inset , then one row down in each column after that. Some special cases of shifting matrices are \begin_inset Formula $A_{0}=I$ \end_inset and when \begin_inset Formula $n=1$ \end_inset , \begin_inset Formula $A_{1}=X$ \end_inset . But, back to \begin_inset Formula $U_{f}:$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $U_{f}\left|i\right\rangle \left|j\right\rangle =\left|i\right\rangle \left|j\oplus f\left(i\right)\right\rangle =\left|i\right\rangle A_{f\left(i\right)}\left|j\right\rangle =\left(I\otimes A_{f\left(i\right)}\right)U_{f}\left|i\right\rangle \left|j\right\rangle $ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $U_{f}=\left(\begin{array}{cccc} A_{f\left(0\right)}\\ & A_{f\left(1\right)}\\ & & \ddots\\ & & & A_{f\left(2^{m}-1\right)}\end{array}\right)$ \end_inset \end_layout \begin_layout Section* Lecture 13 (28 February) \end_layout \begin_layout Subsection* Lecture 12 Review \end_layout \begin_layout Standard \begin_inset Formula $U_{f}\left|i\right\rangle \left|j\right\rangle =\left|i\right\rangle \left|j\oplus f\left(i\right)\right\rangle $ \end_inset \end_layout \begin_layout Standard Homework Hint: When \begin_inset Formula $U_{f}^{2}\neq I$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} U_{f}U_{f}\left|i\right\rangle \left|j\right\rangle & = & U_{f}\left|i\right\rangle \left|j\oplus f\left(i\right)\right\rangle \\ & = & \left|i\right\rangle \left|j\oplus f\left(i\right)\oplus f\left(i\right)\right\rangle \\ & = & \left|i\right\rangle \left|j\oplus2f\left(i\right)\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Deutsch's Algorithm \end_layout \begin_layout Standard Given \begin_inset Formula $f:\left\{ 0,1\right\} \rightarrow\left\{ 0,1\right\} $ \end_inset compute \begin_inset Formula $f\left(0\right)\oplus f\left(1\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit: }\left[M\otimes I\right]\left(H\otimes I\right)U_{f}\left(H\otimes H\right)\left|0\right\rangle \left|1\right\rangle \] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|0\right\rangle \left|1\right\rangle & \underrightarrow{H\otimes H} & \left(\frac{\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}\right)\left(\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\right)\\ & = & \frac{1}{2}\left(\left|00\right\rangle -\left|01\right\rangle +\left|10\right\rangle -\left|11\right\rangle \right)\\ & \underrightarrow{U_{f}} & \frac{1}{2}\left(\left|0f\left(0\right)\right\rangle -\left|0\overline{f\left(0\right)}\right\rangle +\left|1f\left(1\right)\right\rangle -\left|1\overline{f\left(1\right)}\right\rangle \right)\\ & = & \frac{1}{2}\left(\left|0\right\rangle \left(\left|f\left(0\right)\right\rangle -\left|\overline{f\left(0\right)}\right\rangle \right)+\left|1\right\rangle \left(\left|f\left(1\right)\right\rangle -\left|\overline{f\left(1\right)}\right\rangle \right)\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $f\left(0\right)=0$ \end_inset , \begin_inset Formula $\left|f\left(0\right)\right\rangle -\left|\overline{f\left(0\right)}\right\rangle =\left|0\right\rangle -\left|1\right\rangle $ \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $f\left(0\right)=1$ \end_inset , \begin_inset Formula $\left|f\left(0\right)\right\rangle -\left|\overline{f\left(0\right)}\right\rangle =\left|1\right\rangle -\left|0\right\rangle $ \end_inset \end_layout \begin_layout Standard Therefore \begin_inset Formula $\left|f\left(0\right)\right\rangle -\left|\overline{f\left(0\right)}\right\rangle =\left(-1\right)^{f\left(0\right)}\left(\left|0\right\rangle -\left|1\right\rangle \right)$ \end_inset \end_layout \begin_layout Standard Continuing\SpecialChar \ldots{} \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} & = & \frac{1}{2}\left(\left(-1\right)^{f\left(0\right)}\left|0\right\rangle \left(\left|0\right\rangle -\left|1\right\rangle \right)+\left(-1\right)^{f\left(1\right)}\left|1\right\rangle \left(\left|0\right\rangle -\left|1\right\rangle \right)\right)\\ & = & \frac{1}{\sqrt{2}}\left(\left(-1\right)^{f\left(0\right)}\left|0\right\rangle +\left(-1\right)^{f\left(1\right)}\left|1\right\rangle \right)\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\\ & = & \frac{1}{\sqrt{2}}\left(-1\right)^{f\left(0\right)}\left(\left|0\right\rangle +\left(-1\right)^{f\left(1\right)-f\left(0\right)}\left|1\right\rangle \right)\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $f\left(0\right)=f\left(1\right)$ \end_inset , then \begin_inset Formula $\left(\left|0\right\rangle +\left(-1\right)^{f\left(1\right)-f\left(0\right)}\left|1\right\rangle \right)=\left|0\right\rangle +\left|1\right\rangle $ \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $f\left(0\right)\neq f\left(1\right)$ \end_inset , then \begin_inset Formula $\left(\left|0\right\rangle +\left(-1\right)^{f\left(1\right)-f\left(0\right)}\left|1\right\rangle \right)=\left|0\right\rangle -\left|1\right\rangle $ \end_inset \end_layout \begin_layout Standard Continuing\SpecialChar \ldots{} \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} & \underrightarrow{H\otimes I} & \left\{ \begin{array}{cc} \left(-1\right)^{f\left(0\right)}\left|0\right\rangle \frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}} & \textrm{ if }f\left(0\right)=f\left(1\right)\\ \left(-1\right)^{f\left(0\right)}\left|1\right\rangle \frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}} & \textrm{ if }f\left(0\right)\neq f\left(1\right)\end{array}\right.\\ & = & \pm\left|f\left(0\right)\oplus f\left(1\right)\right\rangle \frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Deutsch-Jonsa Algorithm \end_layout \begin_layout Standard Given \begin_inset Formula $f:\left\{ 0,\ldots,2^{n}-1\right\} \rightarrow\left\{ 0,1\right\} $ \end_inset \end_layout \begin_layout Standard where function \begin_inset Formula $f$ \end_inset is either balanced or constant. Constant means \begin_inset Formula $f\left(j\right)=f\left(0\right)\forall j$ \end_inset . Balanced means if \begin_inset Formula $A_{o}=\left\{ j:f\left(j\right)=0\right\} $ \end_inset and \begin_inset Formula $A_{1}=\left\{ j:f\left(j\right)=1\right\} $ \end_inset , then \begin_inset Formula $\left|A_{0}\right|=\left|A_{1}\right|=2^{n-1}$ \end_inset . The algorithm determines whether a function is constant or balanced, assuming it won't be any thing else. \end_layout \begin_layout Subsubsection* Classical Solution \end_layout \begin_layout Standard Requires \begin_inset Formula $2^{n-1}+1$ \end_inset evaluations worst case. Algorithm is to loop through the inputs, checking to see if the function ever returns two different values. If it does return two different values, the function is not constant and the loop can be terminated. After the halfway point, if only one value has been returned, the function is not balanced and can be labeled constant. \end_layout \begin_layout Subsubsection* Quantum Solution \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit: }\left[M\otimes I\right]\left(H\otimes I\right)U_{f}\left(H^{\otimes n}\otimes H\right)\left|0\right\rangle ^{\otimes n}\left|1\right\rangle \] \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|0\right\rangle ^{\otimes n}\left|1\right\rangle & \underrightarrow{H^{\otimes n}\otimes H} & \left(\frac{1}{2^{n/2}}\sum_{j=0}^{2^{n}-1}\left|j\right\rangle \right)\left(\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\right)\\ & = & \frac{1}{2^{n/2}}\sum_{j=0}^{2^{n}-1}\left(\frac{\left|j0\right\rangle -\left|j1\right\rangle }{\sqrt{2}}\right)\\ & \underrightarrow{U_{f}} & \frac{1}{2^{n/2}}\sum_{j=0}^{2^{n}-1}\left(\frac{\left|jf\left(j\right)\right\rangle -\left|j\overline{f\left(j\right)}\right\rangle }{\sqrt{2}}\right)\\ & = & \frac{1}{2^{n/2}}\sum_{j=0}^{2^{n}-1}\left|j\right\rangle \left(\frac{\left|f\left(j\right)\right\rangle -\left|\overline{f\left(j\right)}\right\rangle }{\sqrt{2}}\right)\\ & = & \frac{1}{2^{n/2}}\sum_{j=0}^{2^{n}-1}\left|j\right\rangle \left(-1\right)^{f\left(j\right)}\left(\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\right)\\ & \underrightarrow{H^{\otimes n}\otimes I} & \frac{1}{2^{n/2}}\sum_{j=0}^{2^{n}-1}\left(\frac{1}{2^{n/2}}\sum_{k=0}^{2^{n}-1}\left(-1\right)^{j\cdot k}\left|k\right\rangle \right)\left(-1\right)^{f\left(j\right)}\left(\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\right)\\ & = & \sum_{k}a_{k}\left|k\right\rangle \left(\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Setting \begin_inset Formula $a_{k}=\frac{1}{2^{n}}\sum_{j}\left(-1\right)^{j\cdot k}\left(-1\right)^{f\left(j\right)}$ \end_inset to represent the \begin_inset Quotes eld \end_inset amplitude \begin_inset Quotes erd \end_inset of each \begin_inset Formula $k$ \end_inset . \end_layout \begin_layout Standard Looking at \begin_inset Formula $a_{0}=\frac{1}{2^{n}}\sum_{j}\left(-1\right)^{f\left(j\right)}$ \end_inset : \end_layout \begin_layout Standard If function \begin_inset Formula $f$ \end_inset is constant then \begin_inset Formula $a_{0}=\pm1$ \end_inset which means \begin_inset Formula $a_{k}=0$ \end_inset for all \begin_inset Formula $k\neq0$ \end_inset . This is because of completeness, if coefficient of one basis state 1, all others must be zero. If function \begin_inset Formula $f$ \end_inset is balanced then \begin_inset Formula $a_{0}=0.$ \end_inset \end_layout \begin_layout Standard Homework: What do we need to do to detect 3/4 balanced instead of 1/2 balanced. \end_layout \begin_layout Subsubsection* Randomized Classical Algorithm \end_layout \begin_layout Standard Generate \begin_inset Formula $k$ \end_inset random input to function \begin_inset Formula $f$ \end_inset , if function evaluated at any two of the inputs is different, the function will be labeled balanced, otherwise it's considered constant. Algorithm can fail, outputting constant when the function is actually balanced. \end_layout \begin_layout Standard \begin_inset Formula $A_{0}=\left\{ j:f\left(j\right)=0\right\} $ \end_inset , \begin_inset Formula $A_{1}=\left\{ j:f\left(j\right)=1\right\} $ \end_inset \end_layout \begin_layout Standard Balanced when \begin_inset Formula $\left|A_{0}\right|=\left|A_{1}\right|$ \end_inset \end_layout \begin_layout Standard Probability of picking 1 sample which is 0: \begin_inset Formula $p\left(1,0\right)=\frac{1}{2}$ \end_inset \end_layout \begin_layout Standard Probability of picking \begin_inset Formula $k$ \end_inset samples which are 0: \begin_inset Formula $p\left(k,0\right)=\frac{1}{2^{k}}$ \end_inset \end_layout \begin_layout Standard Probability of picking 1 sample which is 1: \begin_inset Formula $p\left(1,1\right)=\frac{1}{2}$ \end_inset \end_layout \begin_layout Standard Probability of picking \begin_inset Formula $k$ \end_inset samples which are 1: \begin_inset Formula $p\left(k,1\right)=\frac{1}{2^{k}}$ \end_inset \end_layout \begin_layout Standard Probability of failure given \begin_inset Formula $f$ \end_inset is balanced: \begin_inset Formula $p\left(k,0\right)+p\left(k,1\right)=\frac{2}{2^{k}}$ \end_inset \end_layout \begin_layout Standard Set \begin_inset Formula $p>\frac{2}{2^{k}}$ \end_inset to succeed with arbitrary probability. \end_layout \begin_layout Section* Lectures 14/15 (5/7 March) \end_layout \begin_layout Subsection* Midterm and Midterm Review \end_layout \begin_layout Section* Lecture 16 (19 March) \end_layout \begin_layout Standard [Book Chapter 5] \end_layout \begin_layout Subsection* Discrete Fourier Transform \end_layout \begin_layout Standard Maps vectors \begin_inset Formula $x_{0},\ldots,x_{N-1}\rightarrow y_{0},\ldots,y_{N-1}$ \end_inset like: \begin_inset Formula \[ y_{k}=\frac{1}{\sqrt{N}}\sum_{j=0}^{N-1}x_{j}e^{2\pi ikj/N}\] \end_inset Cost \begin_inset Formula $O\left(N^{2}\right)$ \end_inset \end_layout \begin_layout Standard 1965 -- Cooley-Tukey Fast Fourier Transform (FFT) cost \begin_inset Formula $O\left(N\log N\right)$ \end_inset \end_layout \begin_layout Subsection* Quantum Fourier Transform \end_layout \begin_layout Standard Input state \begin_inset Formula $\left|j\right\rangle $ \end_inset \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none for \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $j=0,\ldots,N-1$ \end_inset where \begin_inset Formula $N=2^{n}$ \end_inset ( \begin_inset Formula $N$ \end_inset is power of 2): \begin_inset Formula \[ F\left|j\right\rangle =\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}e^{2\pi ijk/N}\left|k\right\rangle \] \end_inset \end_layout \begin_layout Subsubsection* Equivalence to Discrete Transform \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} F\left(\sum_{j=0}^{N-1}x_{j}\left|j\right\rangle \right) & = & \sum_{j=0}^{N-1}x_{j}F\left|j\right\rangle \\ & = & \sum_{j=0}^{N-1}x_{j}\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}e^{2\pi ijk/N}\left|k\right\rangle \\ & = & \sum_{k=0}^{N-1}\left(\frac{1}{\sqrt{N}}\sum_{j=0}^{N-1}x_{j}e^{2\pi ijk/N}\right)\left|k\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Subsubsection* Applied to \begin_inset Formula $\left|0\right\rangle $ \end_inset \begin_inset Formula \[ F\left|0\right\rangle =\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}e^{2\pi i0k/N}\left|k\right\rangle =\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}\left|k\right\rangle =H^{\bigotimes n}\left|0\right\rangle ^{\bigotimes n}\] \end_inset \end_layout \begin_layout Subsubsection* Matrix representation \end_layout \begin_layout Standard \begin_inset Formula $F\left|j\right\rangle =\frac{1}{\sqrt{N}}\left(\begin{array}{c} \vdots\\ e^{2\pi ijk/N}\\ e^{2\pi ij\left(k+1\right)/N}\\ \vdots\end{array}\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $F=\frac{1}{\sqrt{N}}\left(\begin{array}{cccc} 1 & 1 & \cdots & 1\\ 1 & e^{2\pi i1/N} & & e^{2\pi i\left(N-1\right)/N}\\ \vdots & \vdots & \ddots & \vdots\\ 1 & e^{2\pi i\left(N-1\right)/N} & & e^{2\pi i\left(N-1\right)^{2}/N}\end{array}\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $F=\frac{1}{\sqrt{N}}\left(e^{2\pi ijk/N}\right)_{k,j=0,\ldots,N-1}$ \end_inset \end_layout \begin_layout Subsubsection* Proof F is Unitary \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} F^{H} & = & \frac{1}{\sqrt{N}}\left(e^{-2\pi ijk/N}\right)_{j,k=0,\ldots,N-1}\\ F^{H}F & = & \frac{1}{N}\left(\sum_{k=0}^{N-1}e^{-2\pi ipk/N}e^{2\pi ikq/N}\right)_{p,q=0,\ldots,N-1}\\ & = & \frac{1}{N}\left(\sum_{k=0}^{N-1}e^{2\pi ik\left(q-p\right)/N}\right)_{p,q}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard If \begin_inset Formula $p=q$ \end_inset , \begin_inset Formula $\left(F^{H}F\right)_{p,q}=1$ \end_inset \end_layout \begin_layout Standard If \begin_inset Formula $p\neq q$ \end_inset , \begin_inset Formula \begin{eqnarray*} \left(F^{H}F\right)_{p,q} & = & \sum_{k=0}^{N-1}e^{2\pi ik\left(q-p\right)/N}\\ & = & \frac{e^{2\pi i\left(q-p\right)\frac{N-1}{N}}e^{2\pi i\left(q-p\right)\frac{1}{N}}-1}{e^{2\pi i\left(q-p\right)\frac{1}{N}}-1}\\ & = & \frac{e^{2\pi i\left(q-p\right)}-1}{e^{2\pi i\left(q-p\right)\frac{1}{N}}-1}\\ & = & 1-1=0\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Therefore, \begin_inset Formula $F^{H}F=I$ \end_inset , and \begin_inset Formula $F$ \end_inset is unitary. \end_layout \begin_layout Standard (Formula for sum of a geometric progression used above: \begin_inset Formula $\sum_{k=0}^{n}r^{k}=\frac{r^{n+1}-1}{r-1}$ \end_inset ) \end_layout \begin_layout Subsubsection* Tensor Product Representation \end_layout \begin_layout Standard Notation: \end_layout \begin_layout Standard \begin_inset Formula $j=j_{1}j_{2}\ldots j_{n}=j_{1}2^{n-1}+j_{2}2^{n-2}+\ldots+j_{n}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\frac{j}{2^{n}}=0.j_{1}j_{2}\ldots j_{n}=j_{1}\frac{1}{2}+j_{2}\frac{1}{2^{2}}+j_{n}\frac{1}{2^{n}}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\frac{j}{2^{\ell}}=j_{1}\ldots j_{n-\ell}.j_{n-\ell+1}\ldots j_{n}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $e^{2\pi i\frac{j}{2^{\ell}}}=e^{2\pi i\left(j_{1}\ldots j_{n-\ell}.j_{n-\ell+1}\ldots j_{n}\right)}$ \end_inset \end_layout \begin_layout Standard Lemma: \begin_inset Formula \[ F\left|j\right\rangle =F\left|j_{1}\ldots j_{n}\right\rangle =\frac{\left|0\right\rangle +e^{2\pi i0.j_{n}}\left|1\right\rangle }{\sqrt{2}}\otimes\frac{\left|0\right\rangle +e^{2\pi i0.j_{n-1}j_{n}}\left|1\right\rangle }{\sqrt{2}}\otimes\cdots\otimes\frac{\left|0\right\rangle +e^{2\pi i0.j_{1}j_{2}\ldots j_{n}}\left|1\right\rangle }{\sqrt{2}}\] \end_inset \end_layout \begin_layout Standard Proof, start with: \begin_inset Formula \[ F\left|j\right\rangle =\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}e^{2\pi ijk/N}\left|k\right\rangle \] \end_inset Decompose \begin_inset Formula $k=\left(k_{1}\ldots k_{n}\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} F\left|j\right\rangle & = & \frac{1}{\sqrt{N}}\sum_{k_{1}=0}^{1}\cdots\sum_{k_{n}=0}^{1}e^{2\pi ij0.k_{1}\ldots k_{n}}\left|k_{1}\right\rangle \ldots\left|k_{n}\right\rangle \\ & = & \frac{1}{\sqrt{N}}\sum_{k_{1}=0}^{1}\cdots\sum_{k_{n}=0}^{1}e^{2\pi ij\left(k_{1}\frac{1}{2}+k_{2}\frac{1}{2^{2}}+\cdots+k_{n}\frac{1}{2^{n}}\right)}\left|k_{1}\right\rangle \ldots\left|k_{n}\right\rangle \\ & = & \frac{1}{\sqrt{N}}\sum_{k_{1}=0}^{1}\cdots\sum_{k_{n}=0}^{1}\bigotimes_{\ell=1}^{n}e^{2\pi ijk_{\ell}\frac{1}{2^{\ell}}}\left|k_{\ell}\right\rangle \\ & = & \frac{1}{\sqrt{N}}\bigotimes_{\ell=1}^{n}\sum_{k_{\ell}=0}^{1}e^{2\pi ijk_{\ell}\frac{1}{2^{\ell}}}\left|k_{\ell}\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Simple example illustrating last step: \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} & & \sum_{k_{1}=0}^{1}\sum_{k_{2}=0}^{1}e^{2\pi ijk_{1}\frac{1}{2}/N}e^{2\pi ijk_{2}\frac{1}{4}}\left|k_{1}\right\rangle \left|k_{2}\right\rangle \\ & & =\left(\sum_{k_{1}=0}^{1}e^{2\pi ijk_{1}\frac{1}{2}}\left|k_{1}\right\rangle \right)\left(\sum_{k_{2}=0}^{1}e^{2\pi ijk_{2}\frac{1}{4}}\left|k_{2}\right\rangle \right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Continuing: \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} F\left|j\right\rangle & = & \bigotimes_{\ell=1}^{n}\left(\frac{\left|0\right\rangle +e^{2\pi ij/2^{\ell}}\left|1\right\rangle }{\sqrt{2}}\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Dividing \begin_inset Formula $j$ \end_inset by \begin_inset Formula $2^{\ell}$ \end_inset is equivalent to moving the decimal point in the binary representation of \begin_inset Formula $j$ \end_inset by \begin_inset Formula $\ell$ \end_inset places to the left. Additionally, after the shift, any digits to the left of the dot can be discarded. This is because the function \begin_inset Formula $e^{xi}$ \end_inset has a period of \begin_inset Formula $2\pi$ \end_inset , so the only the fractional part of \begin_inset Formula $\frac{j}{2^{\ell}}$ \end_inset matters, and the whole number part can be set to \begin_inset Formula $0.$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \[ F\left|j\right\rangle =F\left|j_{1}\ldots j_{n}\right\rangle =\frac{\left|0\right\rangle +e^{2\pi i0.j_{n}}\left|1\right\rangle }{\sqrt{2}}\otimes\frac{\left|0\right\rangle +e^{2\pi i0.j_{n-1}j_{n}}\left|1\right\rangle }{\sqrt{2}}\otimes\cdots\otimes\frac{\left|0\right\rangle +e^{2\pi i0.j_{1}j_{2}\ldots j_{n}}\left|1\right\rangle }{\sqrt{2}}\] \end_inset \end_layout \begin_layout Standard At \begin_inset Formula $\ell=1$ \end_inset , term is: \begin_inset Formula $\left(\frac{\left|0\right\rangle +e^{2\pi i0.j_{n}}\left|1\right\rangle }{\sqrt{2}}\right)$ \end_inset \end_layout \begin_layout Standard At \begin_inset Formula $\ell=2$ \end_inset , term is: \begin_inset Formula $\left(\frac{\left|0\right\rangle +e^{2\pi i0.j_{n-1}j_{n}}\left|1\right\rangle }{\sqrt{2}}\right)$ \end_inset \end_layout \begin_layout Standard At \begin_inset Formula $\ell=3$ \end_inset , term is: \begin_inset Formula $\left(\frac{\left|0\right\rangle +e^{2\pi i0.j_{n-2}j_{n-1}j_{n}}\left|1\right\rangle }{\sqrt{2}}\right)$ \end_inset \end_layout \begin_layout Standard Tip: Remember this lemma for final \end_layout \begin_layout Subsection* Fourier Transform as Circuit \end_layout \begin_layout Standard Define \begin_inset Formula $R_{k}=\left(\begin{array}{cc} 1 & 0\\ 0 & e^{2\pi i/2^{k}}\end{array}\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $R_{0}=\left(\begin{array}{cc} 1 & 0\\ 0 & 1\end{array}\right)=I$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $R_{1}=\left(\begin{array}{cc} 1 & 0\\ 0 & -1\end{array}\right)=Z$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $R_{2}=\left(\begin{array}{cc} 1 & 0\\ 0 & i\end{array}\right)=S$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $R_{3}=\left(\begin{array}{cc} 1 & 0\\ 0 & e^{\pi i/4}\end{array}\right)=T$ \end_inset \end_layout \begin_layout Standard When evaluating cost of implementing fourier transform, assume implementing each of one these \begin_inset Formula $R$ \end_inset gates has unit cost. The assumption may not necessarily be true in an actual implementation. \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit:}\bigotimes_{\ell=1}^{n}\left(R_{n-\ell+1}^{\# n}\ldots R_{2}^{\#\ell+1}H\right)\left|j_{\ell}\right\rangle \] \end_inset \end_layout \begin_layout Standard First Qubit: \end_layout \begin_layout Standard \begin_inset Formula \[ \left|j_{1}\right\rangle \xrightarrow{H}\frac{\left|0\right\rangle +\left(-1\right)^{j_{1}}\left|1\right\rangle }{\sqrt{2}}=\frac{\left|0\right\rangle +e^{2i\pi0.j_{1}}\left|1\right\rangle }{\sqrt{2}}\] \end_inset \end_layout \begin_layout Standard Trick used: \begin_inset Formula $e^{2\pi i0.j_{1}}=\left\{ \begin{array}{cc} 1 & j_{1}=0\\ e^{2\pi i/2} & j_{1}=1\end{array}\right.=\left(-1\right)^{j_{1}}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} & \xrightarrow[w/j_{2}]{R_{2}} & \frac{R_{2}^{j_{2}}\left|0\right\rangle +e^{2i\pi0.j_{1}}R_{2}^{j_{2}}\left|1\right\rangle }{\sqrt{2}}\\ & = & \frac{\left|0\right\rangle +e^{2i\pi0.j_{1}}e^{2\pi ij_{2}/2^{2}}\left|1\right\rangle }{\sqrt{2}}\\ & = & \frac{\left|0\right\rangle +e^{2i\pi0.j_{1}j_{2}}\left|1\right\rangle }{\sqrt{2}}\\ & \xrightarrow[w/j_{3}]{R_{3}} & \frac{R_{3}^{j_{3}}\left|0\right\rangle +e^{2i\pi0.j_{1}}R_{3}^{j_{3}}\left|1\right\rangle }{\sqrt{2}}\\ & = & \frac{\left|0\right\rangle +e^{2i\pi0.j_{1}j_{2}j_{3}}\left|1\right\rangle }{\sqrt{2}}\\ & \vdots\\ & \xrightarrow[w/j_{n}]{R_{n}} & \frac{\left|0\right\rangle +e^{2i\pi0.j_{1}j_{2}\ldots j_{n}}\left|1\right\rangle }{\sqrt{2}}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Second qubit: \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|j_{2}\right\rangle & \xrightarrow{H} & \frac{\left|0\right\rangle +e^{2i\pi0.j_{2}}\left|1\right\rangle }{\sqrt{2}}\\ & \xrightarrow[w/j_{3}]{R_{2}} & \frac{\left|0\right\rangle +e^{2i\pi0.j_{2}}e^{2\pi ij_{3}/2^{2}}\left|1\right\rangle }{\sqrt{2}}\\ & = & \frac{\left|0\right\rangle +e^{2i\pi0.j_{2}j_{3}}\left|1\right\rangle }{\sqrt{2}}\\ & \xrightarrow[w/j_{4}]{R_{3}} & \frac{\left|0\right\rangle +e^{2i\pi0.j_{2}j_{3}}e^{2\pi ij_{4}/2^{3}}\left|1\right\rangle }{\sqrt{2}}\\ & = & \frac{\left|0\right\rangle +e^{2i\pi0.j_{2}j_{3}j_{4}}\left|1\right\rangle }{\sqrt{2}}\\ & \vdots\\ & \xrightarrow[w/j_{n}]{R_{n-1}} & \frac{\left|0\right\rangle +e^{2i\pi0.j_{2}\ldots j_{n}}\left|1\right\rangle }{\sqrt{2}}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Last qubit: \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|j_{n}\right\rangle & \xrightarrow{H} & \frac{\left|0\right\rangle +e^{2i\pi0.j_{n}}\left|1\right\rangle }{\sqrt{2}}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Circuit output is \begin_inset Formula \[ \frac{\left|0\right\rangle +e^{2i\pi0.j_{1}\ldots j_{n}}\left|1\right\rangle }{\sqrt{2}}\otimes\cdots\otimes\frac{\left|0\right\rangle +e^{2i\pi0.j_{n}}\left|1\right\rangle }{\sqrt{2}}\] \end_inset \end_layout \begin_layout Standard which is the Lemma 1 expression for the Fourier transform with qubits in reverse order. To correct this, \begin_inset Formula $\left\lfloor \frac{n}{2}\right\rfloor $ \end_inset swap gates can be used to swap the top and bottom bits, second to top and second to bottom bits, and so on. Each swap gate is made of 3 CNOT gates. \end_layout \begin_layout Standard Cost: Each qubit requires \begin_inset Formula $O\left(n\right)$ \end_inset gates to transform, total cost is \begin_inset Formula $O\left(n^{2}\right)$ \end_inset for transforming all qubits and \begin_inset Formula $O\left(n\right)$ \end_inset for swaps, which is \begin_inset Formula $O\left(n^{2}\right)$ \end_inset total. Best classical cost is \begin_inset Formula $O\left(N\log N\right)=O\left(2^{n}n\right)$ \end_inset , so quantum implementation represents an exponential speedup. \end_layout \begin_layout Standard Next Lecture: Phase Estimation \end_layout \begin_layout Standard Homework: Implement \emph on reverse \emph default fourier transform, finding algorithm and cost. \end_layout \begin_layout Section* Lecture 17 (21 March) \end_layout \begin_layout Subsection* Lecture 16 Review \end_layout \begin_layout Standard \begin_inset Formula $F\left|j\right\rangle =\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}e^{2\pi ijk/N}\left|k\right\rangle $ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $F\left|j_{1}\ldots j_{n}\right\rangle =\left(\frac{\left|0\right\rangle +e^{2\pi i0.j_{n}}\left|k\right\rangle }{\sqrt{0}}\right)\otimes\cdots\otimes\left(\frac{\left|0\right\rangle +e^{2\pi i0.j_{1}\ldots j_{n}}\left|k\right\rangle }{\sqrt{0}}\right)$ \end_inset \end_layout \begin_layout Standard Cost: quantum implementation \begin_inset Formula $O\left(n^{2}\right)$ \end_inset beats classical \begin_inset Formula $O\left(2^{n}n\right)=O\left(N\log N\right)$ \end_inset \end_layout \begin_layout Standard Hint: Finding \begin_inset Formula $F^{H}$ \end_inset , problem 1 next homework. Two approaches. One is to look at the circuit and determine meaning of the conjugate transpose as an operator. Other is to look at the definition of \begin_inset Formula $F^{H}$ \end_inset which differs only by a minus sign. \begin_inset Formula \[ F^{H}\left|j\right\rangle =\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}e^{-2\pi ijk/N}\left|k\right\rangle \] \end_inset Cost should be the same. \end_layout \begin_layout Subsection* Phase Estimation \end_layout \begin_layout Subsubsection* Overview \end_layout \begin_layout Standard Heart of many quantum algorithms. Related to solution to Schrodinger's equation, important for quantum simulation. \end_layout \begin_layout Standard Problem: Given unitary matrix \begin_inset Formula $U$ \end_inset , size \begin_inset Formula $N\times N$ \end_inset where \begin_inset Formula $N=2^{k}$ \end_inset (using \begin_inset Formula $k$ \end_inset instead of \begin_inset Formula $n$ \end_inset as in previous lecture because \begin_inset Formula $n$ \end_inset is used for something else here). Also given \begin_inset Formula $\left|u\right\rangle $ \end_inset , eigenvector of \begin_inset Formula $U$ \end_inset , so \end_layout \begin_layout Standard \begin_inset Formula \[ U\left|u\right\rangle =\lambda\left|u\right\rangle =e^{2\pi i\varphi}\left|u\right\rangle \] \end_inset \end_layout \begin_layout Standard for \begin_inset Formula $\varphi\in\left[0,1\right]$ \end_inset . Goal is to find approximation of \begin_inset Formula $\varphi$ \end_inset with accuracy \begin_inset Formula $2^{-n}$ \end_inset . Algorithm is covered in this lecture, the correctness in shown next lecture. \begin_inset Formula $\varphi$ \end_inset can be represented as: \end_layout \begin_layout Standard \begin_inset Formula \[ \varphi=0.\varphi_{1}\varphi_{2}\ldots\varphi_{n}\varphi_{n+1}\] \end_inset \end_layout \begin_layout Standard If only \begin_inset Formula $n$ \end_inset digits are given, precision is lost but bounded by a maximum error. Maximum error can be computed by assuming every digit after the \begin_inset Formula $n$ \end_inset th is 1 when it should be zero: \end_layout \begin_layout Standard \begin_inset Formula \[ \sum_{j=n+1}^{\infty}\frac{1}{2^{j}}=\frac{1}{2^{n+1}}\sum_{j=0}^{\infty}\frac{1}{2^{j}}=\frac{1}{2^{n+1}}\left(\frac{1}{1-\frac{1}{2}}\right)=2^{^{-n}}\] \end_inset \end_layout \begin_layout Subsubsection* Givens \end_layout \begin_layout Standard 1. Given \begin_inset Formula $\left|u\right\rangle $ \end_inset , eigenvector as superposition state \begin_inset Formula $k$ \end_inset qubits long. \end_layout \begin_layout Standard 2. Given controlled operators \begin_inset Formula $U^{2^{j}}$ \end_inset for \begin_inset Formula $j=0,2,\ldots$ \end_inset implemented as black boxes. \end_layout \begin_layout Standard [See also paper: Quantum Algorithms Revisited] \end_layout \begin_layout Subsubsection* Algorithm \end_layout \begin_layout Standard To see understand the algorithm, it helps to look at how a \begin_inset Formula $U^{2^{j}}$ \end_inset gate controlled by an \begin_inset Formula $H\left|0\right\rangle $ \end_inset qubit acts: \begin_inset Formula \begin{eqnarray*} \frac{\left|0\right\rangle \left|u\right\rangle +\left|1\right\rangle \left|u\right\rangle }{\sqrt{2}} & \xrightarrow{C\left(U^{2^{j}}\right)} & \frac{\left|0\right\rangle \left|u\right\rangle +\left|1\right\rangle U^{2^{j}}\left|u\right\rangle }{\sqrt{2}}\\ & = & \frac{\left|0\right\rangle \left|u\right\rangle +\left|1\right\rangle e^{2\pi i\varphi2^{j}}\left|u\right\rangle }{\sqrt{2}}\\ & = & \frac{\left|0\right\rangle +\left|1\right\rangle e^{2\pi i\varphi2^{j}}}{\sqrt{2}}\left|u\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Using different values of \begin_inset Formula $j$ \end_inset results in qubits that can be expressed in terms of different portions of the bitwise representation of \begin_inset Formula $\varphi$ \end_inset : \end_layout \begin_layout Standard \begin_inset Formula $U^{2^{t-1}}\rightarrow\left|0\right\rangle +e^{2\pi i\varphi2^{t-1}}\left|1\right\rangle =\left|0\right\rangle +e^{2\pi i0.\varphi_{t}\varphi_{t+1}\ldots}\left|1\right\rangle $ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $U^{2^{t-2}}\rightarrow\left|0\right\rangle +e^{2\pi i\varphi2^{t-2}}\left|1\right\rangle =\left|0\right\rangle +e^{2\pi i0.\varphi_{t-1}\varphi_{t}\varphi_{t+1}\ldots}\left|1\right\rangle $ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\vdots$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $U^{2^{1}}\rightarrow\left|0\right\rangle +e^{2\pi i\varphi2}\left|1\right\rangle =\left|0\right\rangle +e^{2\pi i0.\varphi_{2}\ldots\varphi_{t}\varphi_{t+1}\ldots}\left|1\right\rangle $ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $U^{2^{0}}\rightarrow\left|0\right\rangle +e^{2\pi i\varphi}\left|1\right\rangle =\left|0\right\rangle +e^{2\pi i0.\varphi_{1}\ldots\varphi_{t}\varphi_{t+1}\ldots}\left|1\right\rangle $ \end_inset \end_layout \begin_layout Standard As can be seen above, \begin_inset Formula $U^{2^{j}}$ \end_inset essentially means shift \begin_inset Formula $\varphi$ \end_inset by \begin_inset Formula $j$ \end_inset bits to the left. The whole number portion of the resulting numbers is discarded because the exponential function is periodic. \end_layout \begin_layout Standard The states shown above look like the states that would result from \begin_inset Formula $F\left|\varphi_{1}\ldots\varphi_{t}\right\rangle $ \end_inset , where \begin_inset Formula $F$ \end_inset is the quantum fourier transform. \end_layout \begin_layout Subsubsection* Circuit \end_layout \begin_layout Standard Circuit is made of two registers, top register is \begin_inset Formula $t$ \end_inset \begin_inset Formula $\left|0\right\rangle $ \end_inset qubits, bottom register is \begin_inset Formula $\left|u\right\rangle $ \end_inset (which is \begin_inset Formula $k$ \end_inset qubits long). Hadamard gates are applied to each \begin_inset Formula $\left|0\right\rangle $ \end_inset qubit in the first register, and output of those is used to control a sequence of \begin_inset Formula $U^{2^{j}}$ \end_inset gates on the second register. The first gate on the second register, \begin_inset Formula $U^{2^{0}}$ \end_inset , is controlled by the \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $H\left|0\right\rangle $ \end_inset output on the first qubit, then there is a \begin_inset Formula $U^{2^{1}}$ \end_inset gate controlled by \begin_inset Formula $H\left|0\right\rangle $ \end_inset from the second qubit, followed by a \begin_inset Formula $U^{2^{2}}$ \end_inset gate controlled by the third qubit, and so on. [Textbook figure 5.2 page 222] \end_layout \begin_layout Standard \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none After these gates, an inverse fourier transform is applied to the first register, and measurement of that register on the computational basis yields the binary digits of the representation of \begin_inset Formula $\varphi$ \end_inset . \end_layout \begin_layout Standard We need to show that before the inverse fourier transform is applied, the top register has value \begin_inset Formula $\frac{1}{2^{t/2}}\sum_{k=0}^{2^{t}-1}e^{2\pi ik\varphi}\left|k\right\rangle $ \end_inset . This can be proved with induction. Start with the last two qubits: \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} & & \frac{1}{2}\left(\left|0\right\rangle +e^{2\pi i2\varphi}\left|1\right\rangle \right)\left(\left|0\right\rangle +e^{2\pi i\varphi}\left|1\right\rangle \right)\\ & & =\left|00\right\rangle +e^{2\pi i\varphi}\left|01\right\rangle +e^{2\pi i2\varphi}\left|10\right\rangle +e^{2\pi i3\varphi}\left|11\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Then the inductive step is: \begin_inset Formula \begin{eqnarray*} & & \frac{1}{\sqrt{2}}\left(\left|0\right\rangle +e^{2\pi i2^{t-1}\varphi}\left|1\right\rangle \right)\left(\frac{1}{2^{\left(t-1\right)/2}}\sum_{k=0}^{2^{t-1}-1}e^{2\pi ik\varphi}\left|k\right\rangle \right)\\ & & =\frac{1}{2^{t/2}}\sum_{k=0}^{2^{t-1}-1}\left(e^{2\pi ik\varphi}\left|0k\right\rangle +e^{2\pi i\left(k+2^{t-1}\right)\varphi}\left|1k\right\rangle \right)\\ & & =\frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}e^{2\pi ij\varphi}\left|j\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Subsubsection* Circuit and Expression \end_layout \begin_layout Standard A second interpretation of phase estimation can be seen by looking at the overall circuit diagram [Textbook figure 5.3 page 223]. \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|0\right\rangle ^{\otimes t}\left|u\right\rangle & \xrightarrow{H^{\otimes t}\otimes I} & \frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}\left|j\right\rangle \left|u\right\rangle \\ & \xrightarrow{U^{j}} & \frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}\left|j\right\rangle U^{j}\left|u\right\rangle \\ & = & \frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}\left|j\right\rangle e^{2\pi ij\varphi}\left|u\right\rangle \\ & \xrightarrow{F^{H}} & \sum_{\ell=0}^{2^{t}-1}g\left(\ell,\varphi\right)\left|\ell\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard We aren't solving for the coefficients of possible output basis states right now, we just refer to them here as \begin_inset Formula $g\left(\ell,\varphi\right)$ \end_inset or \begin_inset Formula $\alpha_{\ell}$ \end_inset . (The next lecture solves for \begin_inset Formula $\alpha_{\ell}$ \end_inset ). Now when \begin_inset Formula $\varphi$ \end_inset \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none can be expressed as \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $0.\varphi_{1}\ldots\varphi_{t}$ \end_inset exactly, there is unique \begin_inset Formula $\ell$ \end_inset so that \begin_inset Formula \[ \left|a_{\ell}\right|=\left|g\left(\ell_{1}\varphi\right)\right|=1\] \end_inset \end_layout \begin_layout Standard and all the other \begin_inset Formula $\alpha_{\ell}$ \end_inset values are 0. The algorithm succeeds in this case, but it also succeeds more generally, and this is shown in the next lecture. \end_layout \begin_layout Standard (Above depends on the fact that the sequence of controlled-U operations in the circuit transform a basis state \begin_inset Formula $\left|j\right\rangle \left|u\right\rangle $ \end_inset to \begin_inset Formula $\left|j\right\rangle U^{j}\left|u\right\rangle .$ \end_inset This is exercise 5.7 in the book, and can be seen from the fact that if \begin_inset Formula $j$ \end_inset has a \begin_inset Formula $t$ \end_inset bit representation: \begin_inset Formula \begin{eqnarray*} \left|j\right\rangle U^{j}\left|u\right\rangle & = & \left|j\right\rangle U^{j_{t}2^{o}+j_{t-1}2^{t}+\cdots+j_{1}2^{t-1}}\left|u\right\rangle \\ & = & \left|j\right\rangle U^{2^{o}j_{t}}\times U^{2^{1}j_{t-1}}\times\cdots\times U^{2^{t-1}j_{t}}\left|u\right\rangle \end{eqnarray*} \end_inset ) \end_layout \begin_layout Standard Cost of circuit in gates is \begin_inset Formula $t$ \end_inset H gates, \begin_inset Formula $t$ \end_inset controlled \begin_inset Formula $U^{2^{j}}$ \end_inset gates (assuming the exponents don't affect cost), and an \begin_inset Formula $F^{H}$ \end_inset gate which has cost \begin_inset Formula $t^{2}$ \end_inset . \begin_inset Formula $O\left(t+t+t^{2}\right)=O\left(t^{2}\right)$ \end_inset . Cost in qubits is \begin_inset Formula $t+k$ \end_inset , \begin_inset Formula $O\left(t+k\right)$ \end_inset \end_layout \begin_layout Standard Application: If you have real matrix, \begin_inset Formula $A$ \end_inset , so that \begin_inset Formula $A=A^{T}$ \end_inset , \begin_inset Formula $e^{iA}$ \end_inset is unitary, \begin_inset Formula $ih\frac{g\psi\left(x,t\right)}{gt}=H\psi\left(x,t\right)$ \end_inset where \begin_inset Formula $h$ \end_inset is Planck's constant, \begin_inset Formula $H$ \end_inset is Hamiltonian. \end_layout \begin_layout Section* Lecture 18 (26 March) \end_layout \begin_layout Standard Missed Class, filling in blanks from Textbook section 5.2.1. \end_layout \begin_layout Standard Output of the first register of the phase estimation circuit before inverse fourier transform is: \begin_inset Formula \begin{eqnarray*} & & \frac{1}{2^{t/2}}\left(\left|0\right\rangle +e^{2\pi i2^{t-1}\varphi}\left|1\right\rangle \right)\left(\left|0\right\rangle +e^{2\pi i2^{t-2}\varphi}\left|1\right\rangle \right)\ldots\left(\left|0\right\rangle +e^{2\pi i2^{0}\varphi}\left|1\right\rangle \right)\\ & & =\frac{1}{2^{t/2}}\sum_{k=0}^{2^{t}-1}e^{2\pi i\varphi k}\left|k\right\rangle \end{eqnarray*} \end_inset If \begin_inset Formula $\varphi=0.\varphi_{1}\ldots\varphi_{t}$ \end_inset exactly, applying inverse fourier transform to this state gives state \begin_inset Formula $\left|\varphi_{1}\ldots\varphi_{t}\right\rangle $ \end_inset . When \begin_inset Formula $\varphi$ \end_inset cannot be represented with \begin_inset Formula $t$ \end_inset bits, the analysis below applies. \end_layout \begin_layout Standard Let \begin_inset Formula $b$ \end_inset be integer in the range 0 to \begin_inset Formula $2^{t}-1$ \end_inset such that \begin_inset Formula $b/2^{t}=0.b_{1}\ldots b_{t}$ \end_inset is the best \begin_inset Formula $t$ \end_inset bit approximation to \begin_inset Formula $\varphi$ \end_inset which is less than \begin_inset Formula $\varphi$ \end_inset . Error is \begin_inset Formula $\delta\equiv\varphi-b/2^{t}$ \end_inset and \begin_inset Formula $0\le\delta\le2^{t-1}$ \end_inset . Applying the inverse fourier transform to the first register gives: \begin_inset Formula \begin{eqnarray*} & & \frac{1}{2^{t}}\sum_{\ell=0}^{2^{t}-1}\sum_{k=0}^{2^{t}-1}e^{-2\pi ik\ell/2^{t}}e^{2\pi i\varphi k}\left|\ell\right\rangle \\ & & =\sum_{\ell=0}^{2^{t}-1}\frac{1}{2^{t}}\sum_{k=0}^{2^{t}-1}\left(e^{2\pi i\left(\varphi-\ell/2^{t}\right)}\right)^{k}\left|\ell\right\rangle \\ & & =\sum_{\ell=0}^{2^{t}-1}\alpha_{\ell-b}\left|\ell\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Let \begin_inset Formula $\alpha_{\ell}$ \end_inset be the amplitude of \begin_inset Formula $\left|b+\ell\right\rangle $ \end_inset (taking addition inside the state and subtraction in the subscript of \begin_inset Formula $\alpha$ \end_inset to be modulo \begin_inset Formula $2^{t}$ \end_inset ): \begin_inset Formula \begin{eqnarray*} \alpha_{\ell} & \equiv & \frac{1}{2^{t}}\sum_{k=0}^{2^{t}-1}\left(e^{2\pi i\left(\varphi-\left(b+\ell\right)/2^{t}\right)}\right)^{k}\\ & = & \frac{1}{2^{t}}\frac{1-e^{2\pi i\left(2^{t}\varphi-\left(b+\ell\right)\right)}}{1-e^{2\pi i\left(\varphi-\left(b+\ell\right)/2^{t}\right)}}\\ & = & \frac{1}{2^{t}}\frac{1-e^{2\pi i\left(2^{t}\delta-\ell\right)}}{1-e^{2\pi i\left(\delta-\ell/2^{t}\right)}}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard The second step follows from the formula for sum of a geometric series, the third from substituting \begin_inset Formula $\delta=\varphi-b/2^{t}$ \end_inset . \end_layout \begin_layout Standard Introduce new variables. Take the output of the final measurement to be \begin_inset Formula $m$ \end_inset , and chose an error tolerance, \begin_inset Formula $e$ \end_inset which is a positive integer such that if \begin_inset Formula $\left|m-b\right|>e$ \end_inset , the algorithm is considered to have failed. The probability of that failure condition is: \begin_inset Formula \[ p\left(\left|m-b\right|>e\right)=\sum_{\ell=-2^{t-1}+1}^{-\left(e+1\right)}\left|\alpha_{\ell}\right|^{2}+\sum_{\ell=e+1}^{2^{t-1}}\left|\alpha_{\ell}\right|^{2}\] \end_inset For any real \begin_inset Formula $\theta$ \end_inset , \begin_inset Formula $\left|1-e^{i\theta}\right|\le2$ \end_inset , so \begin_inset Formula \[ \left|\alpha_{\ell}\right|\le\frac{1}{2^{t}\left|1-e^{2\pi i\left(\delta-\ell/2^{t}\right)}\right|}\] \end_inset Whenever \begin_inset Formula $-\pi\le\theta\le\pi$ \end_inset , then \begin_inset Formula $\left|1-e^{i\theta}\right|\ge2\left|\theta\right|/\pi$ \end_inset . And when \begin_inset Formula $-2^{t-1}<\ell\le2^{t-1}$ \end_inset , then \begin_inset Formula $-\pi\le2\pi\left(\delta-\ell/2^{t}\right)\le\pi$ \end_inset , therefore: \begin_inset Formula \[ \left|\alpha_{\ell}\right|\le\frac{1}{2^{t}\cdot2\left(\delta-\ell/2^{t}\right)}=\frac{1}{-\frac{1}{2}\left(\ell-2^{t}\delta\right)}\] \end_inset And \begin_inset Formula \begin{eqnarray*} p\left(\left|m-b\right|>e\right) & \le & \frac{1}{4}\left(\sum_{\ell=-2^{t-1}+1}^{-\left(e+1\right)}\frac{1}{\left(\ell-2^{t}\delta\right)^{2}}+\sum_{\ell=e+1}^{2^{t-1}}\frac{1}{\left(\ell-2^{t}\delta\right)^{2}}\right)\\ & \le & \frac{1}{4}\left(\sum_{\ell=-2^{t-1}+1}^{-\left(e+1\right)}\frac{1}{\ell^{2}}+\sum_{\ell=e+1}^{2^{t-1}}\frac{1}{\left(\ell-1\right)^{2}}\right)\\ & \le & \frac{1}{2}\sum_{\ell=e}^{2^{t-1}+1}\frac{1}{\ell^{2}}\\ & \le & \frac{1}{2}\int_{e-1}^{2^{t-1}-1}d\ell\frac{1}{\ell^{2}}\\ & = & \frac{1}{2\left(e-1\right)}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Second step follows because \begin_inset Formula $0\le2^{t}\delta\le1$ \end_inset . \end_layout \begin_layout Standard When approximating \begin_inset Formula $\varphi$ \end_inset to an accuracy of \begin_inset Formula $2^{-n}$ \end_inset , \begin_inset Formula $e=2^{t-n}-1$ \end_inset . When using \begin_inset Formula $t=n+p$ \end_inset qubits in phase estimation, then the probability of success is \begin_inset Formula $1-\frac{1}{2\left(2^{p}-2\right)}$ \end_inset . Let \begin_inset Formula $\epsilon$ \end_inset be the probability of failure, then you can find minimum \begin_inset Formula $t$ \end_inset that won't exceed that failure rate: \begin_inset Formula \begin{eqnarray*} \epsilon & = & \frac{1}{2\left(2^{p}-2\right)}\\ 2^{p} & = & \frac{1}{2\epsilon}+2\\ p & = & \log_{2}\left(\frac{1}{2\epsilon}+2\right)\end{eqnarray*} \end_inset So for success probability of at least \begin_inset Formula $1-\epsilon$ \end_inset , choose \begin_inset Formula $t=n+\left\lceil \log_{2}\left(2+\frac{1}{2\epsilon}\right)\right\rceil $ \end_inset : \end_layout \begin_layout Section* Lecture 19 (28 March) \end_layout \begin_layout Subsection* Homework Hint \end_layout \begin_layout Standard Homework 4, Problem 2: Convolution Theorem and Fourier Transform \end_layout \begin_layout Standard Given coefficients of basis states \begin_inset Formula $\alpha_{0}$ \end_inset , \begin_inset Formula $\alpha_{N-1}$ \end_inset and \begin_inset Formula $\beta_{0}$ \end_inset , \begin_inset Formula $\beta_{N-1}$ \end_inset which tranform into \begin_inset Formula $\gamma_{0}$ \end_inset , \begin_inset Formula $\gamma_{N-1}$ \end_inset and \begin_inset Formula $\delta_{0}$ \end_inset , \begin_inset Formula $\delta_{N-1}$ \end_inset \end_layout \begin_layout Standard Discrete FT: \begin_inset Formula \[ \gamma_{j}=\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}\alpha_{k}e^{2\pi ijk/N},\quad\delta_{j}=\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}\beta_{k}e^{2\pi ijk/N}\] \end_inset Inverse FT: \begin_inset Formula \[ \alpha_{j}=\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}\gamma_{k}e^{-2\pi ijk/N},\quad\beta_{j}=\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}\delta_{k}e^{-2\pi ijk/N}\] \end_inset Convolution: \begin_inset Formula \[ \frac{1}{\sqrt{N}}\sum_{j=0}^{N-1}\sum_{\ell=0}^{N-1}\alpha_{\ell}\beta_{j-\ell}\left|j\right\rangle \] \end_inset \end_layout \begin_layout Standard Use FT formulas to substitute \begin_inset Formula $\alpha_{\ell}$ \end_inset and \begin_inset Formula $\beta_{j-\ell}$ \end_inset above: \begin_inset Formula \[ \beta_{j-\ell}=\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}\delta_{k}e^{-2\pi i\left(j-\ell\right)k/N}\] \end_inset \end_layout \begin_layout Standard Result is messy, you end up with four sums, but it simplifies. \end_layout \begin_layout Subsection* Performance Analysis of Phase Estimation \end_layout \begin_layout Standard We can compute bounded probability of failure and use that to determine how many qubits to use in top register to get desired accuracy. Last lecture proved: \begin_inset Formula \[ Pr\left\{ \left|m-b\right|>e=2^{t-n}-1\right\} \le\frac{1}{2\left(e-1\right)}<\epsilon\] \end_inset where \begin_inset Formula $\epsilon$ \end_inset is highest allowed probability of failure, \begin_inset Formula $m$ \end_inset is the measurement of the first register on the computational basis, \begin_inset Formula $b$ \end_inset is the representation of \begin_inset Formula $\varphi$ \end_inset expressed as a measurement, \begin_inset Formula $e$ \end_inset is our error tolerance, expressed as the highest allowed absolute difference between \begin_inset Formula $m$ \end_inset and \begin_inset Formula $b$ \end_inset . \begin_inset Formula $t$ \end_inset is the number of qubits in the top register and \begin_inset Formula $n$ \end_inset is the desired accuracy in bits, which is just an alternate expression of error tolerance. \end_layout \begin_layout Standard This expression of probability of failure and accuracy is unwieldy and not what we originally set out to determine, which was finding: \begin_inset Formula \[ Pr\left\{ \left|\varphi-\hat{\varphi}\right|\leq2^{-n}\right\} \] \end_inset where \begin_inset Formula $\hat{\varphi}=\frac{m}{2^{t}}$ \end_inset . To find this, we switch to finding probability of failure instead of probabilit y of success because that it is easier to bound that from above. \begin_inset Formula \[ Pr\left\{ \left|\varphi-\hat{\varphi}\right|>2^{-n}\right\} =Pr\left\{ \left|\varphi-\frac{b}{2^{t}}+\frac{b}{2^{t}}-\hat{\varphi}\right|>2^{-n}\right\} \] \end_inset Using the triangle inequality ( \begin_inset Formula $\left|a+b\right|\le\left|a\right|+\left|b\right|$ \end_inset ) : \begin_inset Formula \begin{eqnarray*} & \le & Pr\left\{ \left|\varphi-\frac{b}{2^{t}}\right|+\left|\frac{b}{2^{t}}-\hat{\varphi}\right|>2^{-n}\right\} \\ & \le & Pr\left\{ 2^{-t}+\left|\frac{b}{2^{t}}-\hat{\varphi}\right|>2^{-n}\right\} \\ & = & Pr\left\{ \left|\frac{b}{2^{t}}-\hat{\varphi}\right|>2^{-n}-2^{-t}\right\} \\ & = & Pr\left\{ \left|b-m\right|>2^{t-n}-1\right\} \\ & = & Pr\left\{ \left|b-m\right|>e\right\} \\ & \le & \frac{1}{2\left(e-1\right)}\end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* P.E. w/ approx Eigenvector \end_layout \begin_layout Standard Phase estimation algorithm requires an eigenvector of the matrix \begin_inset Formula $U$ \end_inset , but it is also possible to use approximations of an eigenvector and still get meaningful results. [Paper: Abrams + Lloyd] \end_layout \begin_layout Standard Given \begin_inset Formula $\left|u\right\rangle $ \end_inset , an approximate eigenvector which can be expressed in terms of real eigenvector s \begin_inset Formula $\left|u_{k}\right\rangle $ \end_inset as: \begin_inset Formula \[ \left|u\right\rangle =\sum_{k=0}^{N-1}d_{k}\left|u_{k}\right\rangle \] \end_inset We would like to estimate the phase \begin_inset Formula $\varphi_{0}$ \end_inset corresponding to \begin_inset Formula $\lambda_{0}=e^{2\pi i\varphi_{0}}\left|u_{0}\right\rangle $ \end_inset . The of the P.E. on this input is: \begin_inset Formula \begin{eqnarray*} \left|0\right\rangle ^{\otimes t}\left|u\right\rangle & \xrightarrow{H^{\otimes t}\otimes I} & \frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}\left|j\right\rangle \left|u\right\rangle \\ & = & \frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}\left|j\right\rangle \sum_{k=0}^{2^{t}-1}d_{k}\left|u_{k}\right\rangle \\ & = & \sum_{k=0}^{2^{t}-1}d_{k}\frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}\left|j\right\rangle \left|u_{k}\right\rangle \\ & \xrightarrow{U^{j}} & \sum_{k=0}^{2^{t}-1}d_{k}\frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}\left|j\right\rangle U^{j}\left|u_{k}\right\rangle \\ & = & \sum_{k=0}^{2^{t}-1}d_{k}\frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}e^{2\pi i\varphi_{k}j}\left|j\right\rangle \left|u_{k}\right\rangle \\ & \xrightarrow{F^{H}\otimes I} & \sum_{k=0}^{2^{t}-1}d_{k}\sum_{j=0}^{2^{t}-1}g\left(\varphi_{k},j\right)\left|j\right\rangle \left|u_{k}\right\rangle \end{eqnarray*} \end_inset \begin_inset Formula $g\left(\varphi_{k},j\right)$ \end_inset in the previous lecture was \begin_inset Formula $\alpha_{j}$ \end_inset , the amplitude of output state \begin_inset Formula $j$ \end_inset in the top register. The last lecture showed that \begin_inset Formula $\alpha_{j}$ \end_inset amplitudes were bounded from above, and that if \begin_inset Formula $j$ \end_inset was far from \begin_inset Formula $b$ \end_inset , then \begin_inset Formula $\alpha_{j}$ \end_inset would be low. \end_layout \begin_layout Standard Next, measure top register to find \begin_inset Formula $Pr\left\{ \left|m-b_{o}\right| \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|y\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $U\left|y\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|0\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|0\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|1\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|2\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|2\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|4\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|3\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|1\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|4\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|3\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|5\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|5\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|6\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|6\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|7\right\rangle $ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left|7\right\rangle $ \end_inset \end_layout \end_inset \end_inset \end_layout \begin_layout Section* Lecture 20 (2 April) \end_layout \begin_layout Subsection* Lecture 19 Review \end_layout \begin_layout Standard Item 1: With initial state \begin_inset Formula $\left|u\right\rangle $ \end_inset , eigenvector for phase estimation satisfies \begin_inset Formula $\varphi-\hat{\varphi}\le2^{-n}$ \end_inset where \begin_inset Formula $n$ \end_inset is the number of bits of desired accuracy, and \begin_inset Formula $\hat{\varphi}=\frac{m}{2^{t}}$ \end_inset is the measured value approximating \begin_inset Formula $\varphi$ \end_inset . This condition has to hold with probability \begin_inset Formula $\ge\left(1-\epsilon\right)$ \end_inset , \begin_inset Formula $\epsilon$ \end_inset being the allowed probability of failure. \end_layout \begin_layout Standard Item 2: If the initial state is some arbitrary initial vector, \begin_inset Formula $\left|\tilde{u}\right\rangle $ \end_inset , instead of an eigenvector, the output will still satisfy \begin_inset Formula $\varphi-\hat{\varphi}\le2^{-n}$ \end_inset with probability \begin_inset Formula $\ge\left|\left\langle u|\tilde{u}\right\rangle \right|^{2}\left(1-\epsilon\right)$ \end_inset . [There is another proof of this fact in 2 lines in a paper online about constructing initial states] \end_layout \begin_layout Standard Example: Take unitary matrix \begin_inset Formula $U$ \end_inset , which has two phases \begin_inset Formula $\varphi_{1}$ \end_inset , \begin_inset Formula $\varphi_{2}$ \end_inset and two eigenvectors \begin_inset Formula $u_{1}$ \end_inset , \begin_inset Formula $u_{2}$ \end_inset . The eigenvalues are related to the phases like \begin_inset Formula $\lambda_{1}=e^{2\pi i\varphi_{1}}$ \end_inset , \begin_inset Formula $\lambda_{2}=e^{2\pi i\varphi_{2}}$ \end_inset . If the initial state is \begin_inset Formula $\left|\tilde{u}\right\rangle =\frac{1}{2}\left|u_{1}\right\rangle +\frac{\sqrt{3}}{2}\left|u_{2}\right\rangle $ \end_inset , the phase estimation algorithm will give close approximation of \begin_inset Formula $\varphi_{1}$ \end_inset with probability \begin_inset Formula $\left(\frac{1}{2}\right)^{2}\left(1-\epsilon\right)$ \end_inset , and a close approximation of \begin_inset Formula $\varphi_{2}$ \end_inset with probability \begin_inset Formula $\left(\frac{\sqrt{3}}{2}\right)^{2}\left(1-\epsilon\right)$ \end_inset . \end_layout \begin_layout Subsection* Order Finding \end_layout \begin_layout Standard Given \begin_inset Formula $x$ \end_inset , \begin_inset Formula $N$ \end_inset : \begin_inset Formula $x1$ \end_inset : \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} 2b & = & 1\left(\textrm{mod }4\right)\\ 2b-1 & = & 4\ell\\ \textrm{odd} & = & \textrm{even}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard \begin_inset Formula $x$ \end_inset has multiplicative inverse \begin_inset Formula $x^{-1}\left(\textrm{mod }N\right)$ \end_inset iff \begin_inset Formula $\gcd\left(x,N\right)=1$ \end_inset . \end_layout \begin_layout Subsubsection* Showing U is Unitarry \end_layout \begin_layout Standard To show that the mapping \begin_inset Formula $xy\left(\textrm{mod }N\right)$ \end_inset is 1:1 for different values of \begin_inset Formula $y$ \end_inset , we need to show no two values of \begin_inset Formula $y$ \end_inset give the same output. \end_layout \begin_layout Standard Take \begin_inset Formula $z=xy_{1}\left(\textrm{mod }N\right)$ \end_inset and \begin_inset Formula $z=xy_{2}\left(\textrm{mod }N\right)$ \end_inset . The order finding problem assumes \begin_inset Formula $x$ \end_inset and \begin_inset Formula $N$ \end_inset are coprime, so we don't have to worry about multiplicative inverses not existing and: \begin_inset Formula \begin{eqnarray*} x^{-1}xy_{1}\left(\textrm{mod }N\right) & = & x^{-1}xy_{2}\left(\textrm{mod }N\right)\\ \left(1+\ell N\right)y_{1}\left(\textrm{mod }N\right) & = & \left(1+\ell N\right)y_{2}\left(\textrm{mod }N\right)\\ y_{1}\left(\textrm{mod }N\right) & = & y_{2}\left(\textrm{mod }N\right)\\ y_{1} & = & y_{2}\end{eqnarray*} \end_inset Therefore \begin_inset Formula $P$ \end_inset is 1:1 \begin_inset Formula $\Rightarrow$ \end_inset \begin_inset Formula $U$ \end_inset is 1:1 \begin_inset Formula $\Rightarrow$ \end_inset \begin_inset Formula $U$ \end_inset is unitary . \end_layout \begin_layout Standard If \begin_inset Formula $P$ \end_inset is a permutation matrix then \begin_inset Formula $P^{-1}=P^{T}$ \end_inset \end_layout \begin_layout Subsubsection* Eigenvector of U \end_layout \begin_layout Standard Definition: For \begin_inset Formula $S=0,\ldots,r-1$ \end_inset define \begin_inset Formula $\left|u_{s}\right\rangle =\frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}e^{-2\pi isk/r}\left|x^{k}\left(\textrm{mod }N\right)\right\rangle $ \end_inset \end_layout \begin_layout Standard Then \begin_inset Formula \begin{eqnarray*} U\left|u_{s}\right\rangle & = & \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}e^{-2\pi isk/r}U\left|x^{k}\left(\textrm{mod }N\right)\right\rangle \\ & = & \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}e^{-2\pi isk/r}\left|x^{k+1}\left(\textrm{mod }N\right)\right\rangle \\ & = & \frac{1}{\sqrt{r}}\sum_{k=1}^{r}e^{-2\pi is\left(k-1\right)/r}\left|x^{k}\left(\textrm{mod }N\right)\right\rangle \\ & = & \frac{1}{\sqrt{r}}e^{2\pi is/r}\sum_{k=1}^{r}e^{-2\pi isk/r}\left|x^{k}\left(\textrm{mod }N\right)\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $k=r$ \end_inset , then \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $e^{-2\pi isr/r}=1$ \end_inset \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit , \begin_inset Formula $\left|x^{r}\left(\textrm{mod }N\right)\right\rangle =\left|1\right\rangle $ \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $k=0$ \end_inset , then \begin_inset Formula $e^{-2\pi is0/r}=1$ \end_inset , \begin_inset Formula $\left|x^{0}\left(\textrm{mod }N\right)\right\rangle =\left|1\right\rangle $ \end_inset \end_layout \begin_layout Standard This means we can sum from \begin_inset Formula $0$ \end_inset to \begin_inset Formula $r-1$ \end_inset instead of \begin_inset Formula $1$ \end_inset to \begin_inset Formula $r$ \end_inset : \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} U\left|u_{s}\right\rangle & = & \frac{1}{\sqrt{r}}e^{2\pi is/r}\sum_{k=0}^{r-1}e^{-2\pi isk/r}\left|x^{k}\left(\textrm{mod }N\right)\right\rangle \\ & = & e^{-2\pi is/r}\left|u_{s}\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Subsubsection* Phase Estimation for Order Finding \end_layout \begin_layout Standard The phase of matrix \begin_inset Formula $U$ \end_inset given eigenvector \begin_inset Formula $\left|u_{s}\right\rangle $ \end_inset will be \begin_inset Formula $\frac{s}{r}$ \end_inset and the output of phase estimation \begin_inset Formula $\hat{\varphi}$ \end_inset , will approximate this. \end_layout \begin_layout Standard Possible problems with using this approach to find \begin_inset Formula $r$ \end_inset : \end_layout \begin_layout Standard 1. We do not know how to construct initial state \begin_inset Formula $\left|u_{s}\right\rangle $ \end_inset . \end_layout \begin_layout Standard 2. We do not know how to get \begin_inset Formula $r$ \end_inset from \begin_inset Formula $\varphi=\frac{s}{r}$ \end_inset . \end_layout \begin_layout Standard 3. We do not know how to compute \begin_inset Formula $U^{j}$ \end_inset . \end_layout \begin_layout Subsubsection* Initial State for Phase Estimation \end_layout \begin_layout Standard Regarding problem 1, it turns out there is a trivial way to construct a suitable approximate initial state. Take the combination of all eigenvectors: \begin_inset Formula \begin{eqnarray*} \frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}\left|u_{s}\right\rangle & = & \frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}\frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}e^{-2\pi isk/r}\left|x^{k}\left(\textrm{mod }N\right)\right\rangle \\ & = & \frac{1}{r}\sum_{k=0}^{r-1}\sum_{s=0}^{r-1}e^{-2\pi isk/r}\left|x^{k}\left(\textrm{mod }N\right)\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $k=0$ \end_inset , this simplifies to \begin_inset Formula $\left|1\right\rangle $ \end_inset \end_layout \begin_layout Standard Case \begin_inset Formula $k>0$ \end_inset , the coefficients for each output state are given by geometric series: \end_layout \begin_layout Standard \begin_inset Formula \[ \frac{e^{-2\pi ik/r\cdot\left(r-1+1\right)}-1}{e^{-2\pi ik/r}-1}=\frac{1-1}{e^{-2\pi ik/r}-1}=0\] \end_inset \end_layout \begin_layout Standard (Geometric series \begin_inset Formula \begin{eqnarray*} \sum_{k=0}^{n}r^{k} & = & r^{0}+r^{1}+\cdots+r^{n}\\ \left(1-r\right)\sum_{k=0}^{n}r^{k} & = & \left(r^{0}+r^{1}+\cdots+r^{n}\right)-\left(r^{1}+r^{2}+\cdots+r^{n+1}\right)\\ & = & r^{0}-r^{n+1}\\ \sum_{k=0}^{n}r^{k} & = & \frac{1-r^{n+1}}{1-r}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard So, \begin_inset Formula \begin{eqnarray*} \frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}\left|u_{s}\right\rangle & = & \frac{1}{r}r\left|x^{0}\left(\textrm{mod }N\right)\right\rangle =\left|1\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard The state \begin_inset Formula $\left|1\right\rangle $ \end_inset is equal to a combination of all the eigenvectors of \begin_inset Formula $U$ \end_inset , and also happens to be extremely easy to implement, making it a good initial input for phase estimation. Note that the state \begin_inset Formula $\left|1\right\rangle $ \end_inset is \begin_inset Formula $L$ \end_inset qubits long, expressed as \begin_inset Formula $\left|0\ldots01\right\rangle $ \end_inset in binary. \end_layout \begin_layout Standard Showing P.E. with this initial state (following circuit diagram 5.3 again, page 223): \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|0\right\rangle ^{\otimes t}\left|1\right\rangle & = & \left|0\right\rangle ^{\otimes t}\frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}\left|u_{s}\right\rangle \\ & = & \frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}\left|0\right\rangle ^{\otimes t}\left|u_{s}\right\rangle \\ & \xrightarrow{H^{\otimes t}\otimes I} & \frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}\frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}\left|j\right\rangle \left|u_{s}\right\rangle \\ & \xrightarrow{U^{j}} & \frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}\frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}\left|j\right\rangle U^{j}\left|u_{s}\right\rangle \\ & = & \frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}\frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}\left|j\right\rangle e^{2\pi isj/r}\left|u_{s}\right\rangle \\ & = & \sum_{s=0}^{r-1}\frac{1}{\sqrt{r}}\left(\frac{1}{2^{t/2}}\sum_{j=0}^{2^{t}-1}e^{2\pi isj/r}\left|j\right\rangle \right)\left|u_{s}\right\rangle =\left|\psi\right\rangle \\ & \xrightarrow{F^{H}\otimes I} & \sum_{s=0}^{r-1}\frac{1}{\sqrt{r}}\left(\sum_{\ell=0}^{2^{t}-1}g\left(\varphi_{s},\ell\right)\left|\ell\right\rangle \right)\left|u_{s}\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\varphi_{s}$ \end_inset is just \begin_inset Formula $\frac{s}{r}$ \end_inset . If \begin_inset Formula $\varphi_{s}2^{t}$ \end_inset is an exact whole number, then \begin_inset Formula $g\left(\varphi_{s},\ell\right)$ \end_inset is \begin_inset Formula $1$ \end_inset when \begin_inset Formula $\ell=\varphi_{s}2^{t}$ \end_inset and \begin_inset Formula $0$ \end_inset otherwise. \end_layout \begin_layout Standard In the general case, assuming initial state is \begin_inset Formula $\left|u_{s}\right\rangle $ \end_inset , phase estimation produces an approximation with \begin_inset Formula $n$ \end_inset bits accuracy satisfying \begin_inset Formula $\left|\varphi-\hat{\varphi}\right|\le2^{-n}$ \end_inset with probability \begin_inset Formula $\left(1-\epsilon\right)$ \end_inset . Since we are starting with state \begin_inset Formula $\left|1\right\rangle $ \end_inset instead of \begin_inset Formula $\left|u_{s}\right\rangle $ \end_inset , the success probability is \begin_inset Formula $\ge\left(\frac{1}{\sqrt{r}}\right)^{2}\left(1-\epsilon\right)$ \end_inset \end_layout \begin_layout Standard This success probability, which is the probability of \begin_inset Formula $\hat{\varphi}$ \end_inset being close to \begin_inset Formula $\frac{s}{r}$ \end_inset for some specific value of \begin_inset Formula $s$ \end_inset , is very small. In reality though, we don't care which value of \begin_inset Formula $s$ \end_inset (which eigenvector) phase estimation returns the phase for, because we only care about the ratio \begin_inset Formula $\frac{s}{r}$ \end_inset which we can recover from any \begin_inset Formula $s$ \end_inset . The success probability is high enough to allow this. \end_layout \begin_layout Section* Lecture 21 (4 April) \end_layout \begin_layout Subsection* Lecture 20 Review \end_layout \begin_layout Standard Phase estimation for order finding \end_layout \begin_layout Standard Initial state \begin_inset Formula $\left|1\right\rangle =\frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}\left|u_{s}\right\rangle $ \end_inset ( \begin_inset Formula $L$ \end_inset qubits long) \end_layout \begin_layout Standard U matrix given by: \begin_inset Formula \[ U\left|y\right\rangle =\left\{ \begin{array}{ll} \left|xy\textrm{ mod }N\right\rangle & y=0,1,2,\ldots,N-1\\ \left|y\right\rangle & y=N,N+1,\ldots,2^{L}-1\end{array}\right.\] \end_inset where \begin_inset Formula $L=\left\lceil \log_{2}N\right\rceil $ \end_inset . \end_layout \begin_layout Standard Accuracy needed is \begin_inset Formula $n=2L+1$ \end_inset . \begin_inset Formula \[ \left|\varphi_{s}-\hat{\varphi}_{s}\right|=\left|\frac{s}{r}-\hat{\varphi}_{s}\right|\le2^{-\left(2L+1\right)}\] \end_inset \begin_inset Formula \[ \lambda_{s}=e^{2\pi is/r}\] \end_inset Success probability is \begin_inset Formula $\frac{1}{r}\left(1-\epsilon\right)$ \end_inset for each \emph on individual \emph default \begin_inset Formula $s$ \end_inset using \begin_inset Formula $t=2L+1+\left\lceil \log_{2}\left(\frac{1}{2\epsilon}+2\right)\right\rceil $ \end_inset \end_layout \begin_layout Standard Recovering denominator of \begin_inset Formula $\frac{s}{r}$ \end_inset is impossible for individual numerator because success probability is too low. But overall, if we don't care about individual values of \begin_inset Formula $s$ \end_inset , then we can get a high enough probability ratio. \end_layout \begin_layout Subsection* Deriving order from estimated phase \end_layout \begin_layout Standard Question 2 unanswered from last time: How to get \begin_inset Formula $r$ \end_inset from \begin_inset Formula $\hat{\varphi}_{s}$ \end_inset , assuing phase estimation suceeded, or \begin_inset Formula \[ \left|\frac{s}{r}-\hat{\varphi}_{s}\right|\le2^{-\left(2L+1\right)}\] \end_inset for some \begin_inset Formula $s$ \end_inset . \end_layout \begin_layout Standard Theorem: If \begin_inset Formula $\left|\frac{s}{r}-\hat{\varphi}_{s}\right|\le\frac{1}{2r^{2}}$ \end_inset , then \begin_inset Formula $\frac{s}{r}$ \end_inset is a convergent of a continued fraction for \begin_inset Formula $\varphi$ \end_inset , and can be computed from \begin_inset Formula $\varphi$ \end_inset in \begin_inset Formula $O\left(L^{3}\right)$ \end_inset operations, using continued fraction algorithm. [Theorem 5.1, and A.4.16 p637] \end_layout \begin_layout Standard It is not hard to satisfy condition needed to apply this theorem: \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} L=\left\lceil \log_{2}N\right\rceil & \ge & \log_{2}N\\ 2L+1 & \ge & 2\log_{2}N+1=2\log_{2}N+\log_{2}2=\log_{2}\left(2N^{2}\right)\\ -\left(2L+1\right) & \le & -\log_{2}\left(2N^{2}\right)\\ 2^{-\left(2L+1\right)} & \le & 2^{-\log_{2}\left(2N^{2}\right)}=2^{\log_{2}\left(\frac{1}{2N^{2}}\right)}=\frac{1}{2N^{2}}\le\frac{1}{2r^{2}}\\ \left|\varphi-\hat{\varphi}_{s}\right| & \le & \frac{1}{2r^{2}}\end{eqnarray*} \end_inset \end_layout \begin_layout Subsubsection* Continued Fractions \end_layout \begin_layout Standard Any real number \begin_inset Formula $x$ \end_inset be represented as a sequence of integers \begin_inset Formula $\left[a_{0},a_{1},\ldots a_{n}\right]$ \end_inset which are terms in a continued fraction: \begin_inset Formula \[ x=a_{o}+\frac{1}{a_{1}+\frac{1}{a_{2}+\frac{1}{\cdots+\frac{1}{a_{n-1}+\frac{1}{a_{n}}}}}}\] \end_inset Example: \begin_inset Formula \begin{eqnarray*} \frac{43}{18} & = & 2+\frac{7}{18}\\ & = & 2+\frac{1}{\frac{18}{7}}\\ & = & 2+\frac{1}{2+\frac{4}{7}}\\ & = & 2+\frac{1}{2+\frac{1}{1+\frac{3}{4}}}\\ & = & 2+\frac{1}{2+\frac{1}{1+\frac{1}{1+\frac{1}{3}}}}\end{eqnarray*} \end_inset The sequence of \begin_inset Formula $a_{i}$ \end_inset values can continue forever when \begin_inset Formula $x$ \end_inset is an arbitrary real, but will end when \begin_inset Formula $x$ \end_inset is a rational number because the sequence of remainders will be strictly decreasing, and the procedure for determining \begin_inset Formula $a_{i}$ \end_inset terminates in \begin_inset Formula $\log\left(\textrm{numerator or denominator}\right)$ \end_inset . In the case of order finding, it converges in \begin_inset Formula $O\left(t\right)$ \end_inset or \begin_inset Formula $O\left(L\right)$ \end_inset steps. \end_layout \begin_layout Standard Reason: The procedure divides when remainder is \begin_inset Formula $\ge2$ \end_inset and stops when remainer is \begin_inset Formula $1$ \end_inset or \begin_inset Formula $0$ \end_inset . Since are dividing repeatedly by numbers which are \begin_inset Formula $\ge2$ \end_inset , it only takes \begin_inset Formula $\log N$ \end_inset iterations before reaching \begin_inset Formula $0$ \end_inset or \begin_inset Formula $1$ \end_inset . \end_layout \begin_layout Standard Continued fraction cost per step is \begin_inset Formula $t^{2}$ \end_inset for the division of a \begin_inset Formula $t$ \end_inset bit number. This is \begin_inset Formula $O\left(L^{2}\right)$ \end_inset . Total cost of the algorithm is the cost per steps times number of steps, or \begin_inset Formula $O\left(L^{3}\right)$ \end_inset . \end_layout \begin_layout Standard [More information on Continued Fraction Algorithm in Appendix p635-6, theorem A.4.15). \end_layout \begin_layout Subsubsection* Continued Fractions as Simple Fractions \end_layout \begin_layout Standard Given \begin_inset Formula $\left[a_{0},a_{1},\ldots,a_{N}\right]$ \end_inset then \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left[a_{0},a_{1},\ldots,a_{n}\right]=\frac{P_{n}}{Q_{n}}$ \end_inset for \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $n \begin_inset Text \begin_layout Standard \begin_inset Formula $\left[a_{0}\right]$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $a_{0}=\frac{a_{0}}{1}=\frac{p_{0}}{q_{0}}$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left[a_{0},a_{1}\right]$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $a_{0}+\frac{1}{a_{1}}=\frac{a_{0}a_{1}+1}{a_{1}}=\frac{p_{1}}{q_{1}}$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $\left[a_{0},a_{1},a_{2}\right]$ \end_inset \end_layout \end_inset \begin_inset Text \begin_layout Standard \begin_inset Formula $a_{0}+\frac{1}{a_{1}+\frac{1}{a_{2}}}=\frac{a_{0}\left(a_{1}+\frac{1}{a_{2}}\right)+1}{a_{1}+\frac{1}{a_{2}}}=\frac{p_{1}+\frac{p_{0}}{a_{2}}}{\frac{a_{1}a_{2}+1}{a_{2}}}=\frac{p_{1}a_{2}+p_{0}}{a_{2}q_{1}+q_{0}}=\frac{p_{2}}{q_{2}}$ \end_inset \end_layout \end_inset \end_inset \end_layout \begin_layout Subsubsection* Continued Fraction Examples \end_layout \begin_layout Standard Ex 1: \begin_inset Formula $\frac{9}{15}=0+\frac{1}{\frac{15}{9}}$ \end_inset , continue running with \begin_inset Formula $\frac{15}{9}$ \end_inset \end_layout \begin_layout Standard Ex 2: \begin_inset Formula $0.333=\frac{333}{1000}=0+\frac{1}{\frac{1000}{333}}=0+\frac{1}{3+\frac{1}{333}}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $p_{0}=a_{0}=0$ \end_inset , \begin_inset Formula $q_{0}=1$ \end_inset , \begin_inset Formula $\frac{p_{0}}{q_{0}}=0$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $p_{1}=a_{0}a_{1}+1=1$ \end_inset , \begin_inset Formula $q_{1}=a_{1}=3$ \end_inset , \begin_inset Formula $\frac{p_{0}}{q_{0}}=\frac{1}{3}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $p_{2}=a_{2}p_{1}+p_{0}=333\cdot1+0=333$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $q_{2}=a_{2}q_{1}+q_{0}=333\cdot3+1=1000$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\frac{p_{2}}{q_{2}}=\frac{333}{1000}$ \end_inset \end_layout \begin_layout Standard If we would have started over with \begin_inset Formula $\frac{1000}{333}=3+\frac{1}{333}$ \end_inset , then: \end_layout \begin_layout Standard \begin_inset Formula $p_{0}=a_{0}=3$ \end_inset , \begin_inset Formula $q_{0}=1$ \end_inset , \begin_inset Formula $\frac{p_{0}}{q_{0}}=\frac{3}{1}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $p_{1}=333\cdot3+1=1000$ \end_inset , \begin_inset Formula $q_{1}=333\cdot1=333$ \end_inset , \begin_inset Formula $\frac{p_{1}}{q_{1}}=\frac{1000}{333}$ \end_inset \end_layout \begin_layout Subsubsection* Order Finding Algorithm \end_layout \begin_layout Standard Algorithm after phase estimation is classical. Get \begin_inset Formula $\hat{\varphi}=\left[a_{0},\ldots,a_{m}\right]$ \end_inset determine \begin_inset Formula $\frac{p_{n}}{q_{n}}$ \end_inset , for \begin_inset Formula $n=0,\ldots,m$ \end_inset . For each \begin_inset Formula $q_{n}$ \end_inset , check if \begin_inset Formula $x^{q_{n}}\overset{?}{=}1\left(\textrm{mod }N\right)$ \end_inset . If the equation is satisfied, then \begin_inset Formula $r=q_{n}$ \end_inset . \end_layout \begin_layout Standard The algorithm may fail in two seperate cases: \end_layout \begin_layout Standard 1. If phase estimation fails \end_layout \begin_layout Standard 2. If \begin_inset Formula $\gcd\left(s,r\right)>1$ \end_inset . If this is the case, recovering the denominator of \begin_inset Formula $\frac{s}{r}$ \end_inset will give \begin_inset Formula $r$ \end_inset divided by the gcd, instead of just \begin_inset Formula $r$ \end_inset . \begin_inset Formula $\frac{s}{r}=\frac{s'}{r'}$ \end_inset , \begin_inset Formula $r'0$ \end_inset . \end_layout \begin_layout Standard Related to order finding. \end_layout \begin_layout Standard Definitions: \end_layout \begin_layout Standard \begin_inset Formula $N$ \end_inset - composite number \end_layout \begin_layout Standard \begin_inset Formula $x$ \end_inset , \begin_inset Formula $N$ \end_inset - coprime, \begin_inset Formula $11-\frac{1}{2^{2}}=\frac{3}{4}$ \end_inset \end_layout \begin_layout Standard even if \begin_inset Formula $n=1$ \end_inset prob \begin_inset Formula $>\frac{1}{2}$ \end_inset \end_layout \begin_layout Standard If you can verify solution, even probabilities \begin_inset Formula $<\frac{1}{2}$ \end_inset are ok, just repeat. As long as probability isn't exponentially tiny, verification is all you need to get away with tiny probabilities. \end_layout \begin_layout Subsection* Reduction of factoring to order finding \end_layout \begin_layout Standard High level summary, steps later \end_layout \begin_layout Standard Choose random \begin_inset Formula $x$ \end_inset and find \begin_inset Formula $r$ \end_inset . \end_layout \begin_layout Standard \begin_inset Formula $x^{r}=1\left(\textrm{mod }N\right)$ \end_inset \end_layout \begin_layout Standard if \begin_inset Formula $r$ \end_inset is even \begin_inset Formula $=\left(x^{r/2}\right)^{2}$ \end_inset and you can use theorem 2 \end_layout \begin_layout Standard return \begin_inset Formula $\gcd\left(x^{r/2}-1,N\right)$ \end_inset or \begin_inset Formula $\gcd\left(x^{r/2}+1,N\right)$ \end_inset \end_layout \begin_layout Standard Wednesday: details, grover's algorithm \end_layout \begin_layout Section* Lecture 23 (11 April) \end_layout \begin_layout Standard Theorem 1: \begin_inset Formula $x^{2}=1\left(\textrm{mod }N\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\left(x-1\right)\left(x+1\right)=\ell N$ \end_inset \begin_inset Formula $\gcd\left(x-1,N\right)$ \end_inset or \begin_inset Formula $\gcd\left(x+1,N\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $x\neq\pm\left(\textrm{mod }N\right)$ \end_inset \end_layout \begin_layout Standard Ex 1: \begin_inset Formula $N=15$ \end_inset , \begin_inset Formula $x=4$ \end_inset , \begin_inset Formula $x^{2}=16=1\left(\textrm{mod }15\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\left(x-1\right)\left(x+1\right)=15$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\gcd\left(3,15\right)\times\gcd\left(5,15\right)=\ell N$ \end_inset \end_layout \begin_layout Standard Both gcd's are factors \end_layout \begin_layout Standard Ex 2: \begin_inset Formula $N=12$ \end_inset , \begin_inset Formula $x=7$ \end_inset , \begin_inset Formula $x^{2}=49=1\left(\textrm{mod }12\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\left(x-1\right)\left(x+1\right)=6\cdot8=48=4\cdot12$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\ell=4$ \end_inset , \begin_inset Formula $N=12$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\gcd\left(6,12\right)=6$ \end_inset , \begin_inset Formula $\gcd\left(8,12\right)=4$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $6\cdot4\ne12$ \end_inset , both gcd's are not factors \end_layout \begin_layout Standard Therefore take one gcd, get another factor by division.Look at pages 15-16 of schor's papers. \end_layout \begin_layout Subsection* Reduction to order finding \end_layout \begin_layout Standard Choose \begin_inset Formula $x\in\left\{ 1,\ldots,N-1\right\} $ \end_inset \end_layout \begin_layout Standard Find order r, \begin_inset Formula $x^{r}=1\left(\textrm{mod }N\right)$ \end_inset , use theorem \end_layout \begin_layout Standard If r is even \begin_inset Formula $\left(x^{r/2}-1\right)\left(x^{r/2}+1\right)=\ell N$ \end_inset \end_layout \begin_layout Standard then \begin_inset Formula $\gcd\left(x^{2}-1,N\right)$ \end_inset or \begin_inset Formula $\gcd\left(x^{2}+1,N\right)$ \end_inset \end_layout \begin_layout Standard there are constraints, we cover them later \end_layout \begin_layout Standard assuming r is even, assuming not a trivial solution (as indicated by theorem). In even case, you know \begin_inset Formula $x^{r/2}\ne1\left(\textrm{mod }N\right)$ \end_inset because \begin_inset Formula $r$ \end_inset is order, order is smallest \begin_inset Formula $r$ \end_inset . \end_layout \begin_layout Standard Theorem: If \begin_inset Formula $N$ \end_inset is odd and composite and factors as \begin_inset Formula $N=p_{1}^{\alpha_{1}}p_{2}^{\alpha_{2}}\ldots p_{n}^{\alpha_{n}}$ \end_inset \begin_inset Formula $p_{n}$ \end_inset primes and pick one \begin_inset Formula $X=\left\{ 1,\ldots,N-1\right\} $ \end_inset uniformly at random. \begin_inset Formula $Pr\left\{ \textrm{r even and }x^{r/2}\neq-1\left(\textrm{mod }N\right)\right\} \ge1-\frac{1}{2^{n}}$ \end_inset \end_layout \begin_layout Subsection* Shor Factoring Algorithm \end_layout \begin_layout Standard Input: Composite number N \end_layout \begin_layout Standard Output: Factor of N \end_layout \begin_layout Standard Runtime: \begin_inset Formula $O\left(L^{3}\right)=O\left(\left(\log N\right)^{3}\right)$ \end_inset \end_layout \begin_layout Standard Probability success \begin_inset Formula $\ge\frac{3}{4}$ \end_inset \end_layout \begin_layout Standard Steps: \end_layout \begin_layout Standard 1. If \begin_inset Formula $N$ \end_inset even output 2 \end_layout \begin_layout Standard 2. Determine if \begin_inset Formula $N=a^{b}$ \end_inset , for some \begin_inset Formula $a\ge1$ \end_inset , \begin_inset Formula $b\ge2$ \end_inset . If so, determine \begin_inset Formula $n$ \end_inset and stop. \end_layout \begin_layout Standard 3. Uniformly chose \begin_inset Formula $x\in\left\{ 1,\ldots,N-1\right\} $ \end_inset . If \begin_inset Formula $\gcd\left(x,N\right)>1m$ \end_inset return \begin_inset Formula $\gcd\left(x,N\right)$ \end_inset . \end_layout \begin_layout Standard 4. Only quantum step. Use order finding algorithm, obtain \begin_inset Formula $r$ \end_inset order of \begin_inset Formula $x$ \end_inset mod \begin_inset Formula $N$ \end_inset . \end_layout \begin_layout Standard 5. If \begin_inset Formula $r$ \end_inset is even and \begin_inset Formula $x^{r/2}\ne-1\left(\textrm{mod }N\right)$ \end_inset , then return \begin_inset Formula $\gcd\left(x^{r/2}-1,N\right)$ \end_inset or \begin_inset Formula $\gcd\left(x^{r/2}+1,N\right)$ \end_inset doesn't matter which. Otherwise algorithm fails. \end_layout \begin_layout Standard Remarks \end_layout \begin_layout Standard Step 1: Step 1 is easy \end_layout \begin_layout Standard Step 2: How to check \begin_inset Formula $N=a^{b}$ \end_inset for \begin_inset Formula $a\ge3$ \end_inset , \begin_inset Formula $b\ge2$ \end_inset , we know \begin_inset Formula $b\le\log N\le L$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $b=\left\{ 2,3,4,\ldots,L\right\} $ \end_inset \end_layout \begin_layout Standard Check if \begin_inset Formula $a^{k}=N$ \end_inset for each \begin_inset Formula $b$ \end_inset and integer \begin_inset Formula $a$ \end_inset . Book uses algorithm to find \begin_inset Formula $a$ \end_inset , but you can use binary search. Bisection isn't so bad because only need sign information, don't need to compute whole powers. Cost of bisection in \begin_inset Formula $\log N=L$ \end_inset steps, error \begin_inset Formula $\le\frac{1}{2N}$ \end_inset , cost per step is cost of repeated querying \begin_inset Formula $O\left(\log\log N\right)$ \end_inset . Total cost \begin_inset Formula $O\left(\log^{2}N\log\log N\right)$ \end_inset \end_layout \begin_layout Standard Alternative: Newton's method \end_layout \begin_layout Standard \begin_inset Formula $x_{i+1}=x_{i}-\frac{f\left(x\right)}{f'\left(x\right)}=x_{i}-\frac{x_{i}^{-b}-N}{bx_{i}^{b-1}}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\left|x_{i}-N^{1/b}\right|=O\left(\left|x_{i}-N^{1/b}\right|^{2}\right)$ \end_inset \end_layout \begin_layout Standard Quadratic convergence, taking as few steps as needed. \end_layout \begin_layout Standard After steps 1 and 2 know \begin_inset Formula $x$ \end_inset is odd and has more than one prime factor. \end_layout \begin_layout Standard Combine w/ theorem 2 to see that prob \begin_inset Formula $\ge\frac{3}{4}=1-\frac{1}{2^{2}}$ \end_inset . 2 is number of factors ( \begin_inset Formula $2>1$ \end_inset ). \end_layout \begin_layout Standard Step 3: Use euclid algorithm with cost \begin_inset Formula $O\left(L^{3}\right)=O\left(\log^{3}N\right)$ \end_inset to get \begin_inset Formula $\gcd\left(x,N\right)$ \end_inset . if \begin_inset Formula $>1$ \end_inset stop, else continue knowing \begin_inset Formula $x$ \end_inset , \begin_inset Formula $N$ \end_inset are coprime. \end_layout \begin_layout Standard Step 4: \begin_inset Formula $x$ \end_inset , \begin_inset Formula $N$ \end_inset coprime, so order finding. Cost \begin_inset Formula $O\left(L^{3}\right)$ \end_inset or \begin_inset Formula $O\left(L^{4}\right)$ \end_inset , depending which way you do, not significant. Gives \begin_inset Formula $r$ \end_inset , so \begin_inset Formula $x^{r}=1\left(\textrm{mod }N\right)$ \end_inset . \end_layout \begin_layout Standard Theorem 2: \begin_inset Formula $Pr\left\{ \textrm{r even and }x^{r/2}\ne-1\left(\textrm{mod }N\right)\right\} \ge1-\frac{1}{2^{2}}=\frac{3}{4}$ \end_inset . \end_layout \begin_layout Standard Step 5: Check r even \end_layout \begin_layout Standard \begin_inset Formula $x^{r/2}\ne-1\left(\textrm{mod }N\right)$ \end_inset ? \end_layout \begin_layout Standard If so, \begin_inset Formula $\gcd\left(x^{r/2}-1,N\right)$ \end_inset or \begin_inset Formula $\gcd\left(x^{r/2}+1,N\right)$ \end_inset \end_layout \begin_layout Standard Example: \end_layout \begin_layout Standard \begin_inset Formula $N=a\left(13\times7\right)$ \end_inset \end_layout \begin_layout Standard 1. Not even \end_layout \begin_layout Standard 2. Not \begin_inset Formula $N\ne a^{b}$ \end_inset \end_layout \begin_layout Standard 3. Say \begin_inset Formula $x=4$ \end_inset , \begin_inset Formula $\gcd\left(4,9\right)=1$ \end_inset coprime \end_layout \begin_layout Standard 4. Order of \begin_inset Formula $x=4\left(\textrm{mod }91\right)=1$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $r=6$ \end_inset , \begin_inset Formula $4^{6}=2^{12}=4096=1\left(\textrm{mod }91\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $4096=45\cdot91+1$ \end_inset \end_layout \begin_layout Standard 5. \begin_inset Formula $r=6$ \end_inset even \end_layout \begin_layout Standard \begin_inset Formula $x^{r/2}=4^{3}=2^{6}=64=64\left(\textrm{mod }91\right)\ne-1\left(\textrm{mod }91\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\gcd\left(63,91\right)=\gcd\left(63,28\right)=\gcd\left(28,7\right)=7$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\gcd\left(65,91\right)=\gcd\left(65,26\right)=\gcd\left(26,13\right)=13$ \end_inset \end_layout \begin_layout Standard Both of them are not factors, but they are both divisors. \end_layout \begin_layout Subsection* Search, counting algorithms \end_layout \begin_layout Standard Grover's algorithms \end_layout \begin_layout Standard Boolean mean, Brascyd et al (amplitude, amplification, estimations) \end_layout \begin_layout Standard Applications many problems science / engineering, integration, approximation, path integrations, differential equations (Schrodinger eqn). \end_layout \begin_layout Section* Lecture 24 (16 April) \end_layout \begin_layout Subsection* Searching / Counting Algorithm \end_layout \begin_layout Standard Given a function \begin_inset Formula \[ f:\left\{ 0,1,\ldots,N-1\right\} \rightarrow\left\{ 0,1\right\} \] \end_inset as in Deutsch Josza, find which inputs produce an output. \end_layout \begin_layout Standard \begin_inset Formula $N=2^{n}$ \end_inset , \begin_inset Formula $N$ \end_inset is huge \end_layout \begin_layout Standard We use queries, or oracle calls \begin_inset Formula \[ Q_{f}\left|x\right\rangle \left|y\right\rangle =\left|x\right\rangle \left|y\oplus f\left(x\right)\right\rangle \] \end_inset \begin_inset Formula $\left|x\right\rangle $ \end_inset is \begin_inset Formula $n$ \end_inset qubits, \begin_inset Formula $\left|y\right\rangle $ \end_inset is 1 qubit. \end_layout \begin_layout Standard Using \begin_inset Formula $H\left|1\right\rangle $ \end_inset as an input: \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} Q_{f}\left|x\right\rangle \frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}} & = & \frac{1}{\sqrt{2}}\left(\left|x\right\rangle \left|0\oplus f\left(x\right)\right\rangle -\left|x\right\rangle \left|1\oplus f\left(x\right)\right\rangle \right)\\ & = & \frac{1}{\sqrt{2}}\left(\left|x\right\rangle \left|f\left(x\right)\right\rangle -\left|x\right\rangle \left|\overline{f\left(x\right)}\right\rangle \right)\end{eqnarray*} \end_inset if \begin_inset Formula $f\left(x\right)=0$ \end_inset then \begin_inset Formula $\left|x\right\rangle \frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}$ \end_inset . \end_layout \begin_layout Standard if \begin_inset Formula $f\left(x\right)=1$ \end_inset then \begin_inset Formula $\left|x\right\rangle \frac{\left|1\right\rangle -\left|0\right\rangle }{\sqrt{2}}$ \end_inset . \begin_inset Formula \begin{eqnarray*} Q_{f}\left|x\right\rangle \frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}} & = & \left(-1\right)^{f\left(x\right)}\left|x\right\rangle \frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\end{eqnarray*} \end_inset With this input, the \begin_inset Formula $\left|y\right\rangle $ \end_inset qubit is unchanged, there is just an overall phase shift. This is more convenient for analysis than the general \begin_inset Formula $Q_{f}\left|x\right\rangle \left|y\right\rangle $ \end_inset function. \end_layout \begin_layout Subsection* Search \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} M_{f} & = & \left\{ x:f\left(x\right)=1\right\} \\ M & = & \left|M_{f}\right|\ge1\end{eqnarray*} \end_inset Problem is to find elements of \begin_inset Formula $M_{f}$ \end_inset . This is a reverse lookup problem, like searching an unordered database. Unlike the quantum solution for the factoring problem, the quantum solution for this problem is not exponentially faster, just polylog. Another difference is that this quantum solution beats the upper bound of the equivalent classical solution, whereas the quantum factoring algorithm only beats known classical algorithms. \end_layout \begin_layout Standard Related Problem: Boolean Mean \end_layout \begin_layout Standard \begin_inset Formula \[ S\left(f\right)=\frac{1}{N}\sum_{x=0}^{N-1}f\left(x\right)=\frac{M}{N}\] \end_inset \end_layout \begin_layout Subsubsection* Classsical Search Algorithms \end_layout \begin_layout Standard 1. Deterministic Algorithm. Lower bound \begin_inset Formula $O\left(N\right)$ \end_inset , because you may have to evaluate \begin_inset Formula $N$ \end_inset times before search succeeds. \end_layout \begin_layout Standard 2. Randomized Algorithms. (See paper Beals et al). Lower bound is also \begin_inset Formula $O\left(N\right)$ \end_inset . No proof, but basic idea follows. \end_layout \begin_layout Standard Algorithm: \end_layout \begin_layout Standard Choose \begin_inset Formula $x$ \end_inset uniformly at random with replacement. \end_layout \begin_layout Standard If \begin_inset Formula $f\left(x\right)=1$ \end_inset stop with success. \end_layout \begin_layout Standard If \begin_inset Formula $f\left(x\right)=0$ \end_inset fail. \end_layout \begin_layout Standard Repeat \begin_inset Formula $k$ \end_inset times. \end_layout \begin_layout Standard Probability of failure first time is \begin_inset Formula $1-\frac{M}{N}$ \end_inset . If \begin_inset Formula $M=1$ \end_inset , \begin_inset Formula $1-\frac{1}{N}>C$ \end_inset . \end_layout \begin_layout Standard Probability to fail in \begin_inset Formula $k$ \end_inset trials is \begin_inset Formula $\left(1-\frac{M}{N}\right)^{k}\le\delta$ \end_inset . Set desired tolerance to \begin_inset Formula $\delta$ \end_inset . \begin_inset Formula \[ k\log\left(1-\frac{M}{N}\right)=\log\delta\] \end_inset \begin_inset Formula \begin{eqnarray*} k & = & \frac{\log d}{\log\left(1-\frac{M}{N}\right)}\approx\frac{\log d}{-\frac{M}{N}}=\frac{N}{M}\log\frac{1}{d}\end{eqnarray*} \end_inset Approximation holds when \begin_inset Formula $M\ll N$ \end_inset . In this case, algorithm is \begin_inset Formula $O\left(N\right)$ \end_inset , in general case algorithm is \begin_inset Formula $O\left(\frac{N}{M}\right)$ \end_inset . \end_layout \begin_layout Standard General hint: \begin_inset Formula $\log\left(1+x\right)\approx x$ \end_inset when \begin_inset Formula $x$ \end_inset is tiny. This is used frequently in complexity analysis, and is based on the power series expansion. \end_layout \begin_layout Standard When algorithm is run without replacement, probability of failure is \begin_inset Formula \[ \frac{\left(\begin{array}{c} N-M\\ k\end{array}\right)\left(\begin{array}{c} M\\ 0\end{array}\right)}{\left(\begin{array}{c} N\\ k\end{array}\right)}=\frac{\left(\begin{array}{c} N-1\\ k\end{array}\right)}{\left(\begin{array}{c} N\\ k\end{array}\right)}=\frac{\left(N-1\right)!}{k!\left(N-k-1\right)!}=\frac{N-k}{N}=1-\frac{k}{N}\] \end_inset this is bounded by a constant unless \begin_inset Formula $k$ \end_inset is \begin_inset Formula $O\left(N\right)$ \end_inset \end_layout \begin_layout Subsubsection* Repeating \begin_inset Formula \[ \left(1-\frac{k}{N}\right)^{S}\le\delta\] \end_inset \begin_inset Formula \[ S=\frac{N}{k}\log\frac{1}{\delta}\Rightarrow S_{k}=N\log\frac{1}{\delta}=O\left(N\right)\] \end_inset \end_layout \begin_layout Subsubsection* Quantum Search Algorithm \end_layout \begin_layout Standard Grover's Algorithm, \begin_inset Formula $O\left(\sqrt{\frac{N}{M}}\right)$ \end_inset counting the number of queries of \begin_inset Formula $Q_{f}$ \end_inset . \end_layout \begin_layout Standard Algorithm: Given some initial state \begin_inset Formula $\left|\psi_{0}\right\rangle $ \end_inset . Apply operator then query, then operator, repeating as neccesary. \begin_inset Formula \[ \left|\psi_{1}\right\rangle =Q_{F}U_{T}Q_{F}U_{T-1}\ldots U_{2}Q_{F}U_{1}\left|\psi_{0}\right\rangle \] \end_inset \end_layout \begin_layout Standard using \begin_inset Formula $T$ \end_inset queries. \end_layout \begin_layout Subsection* Boolean Mean \end_layout \begin_layout Standard \begin_inset Formula \[ S\left(f\right)=\frac{1}{N}\sum_{x=0}^{N-1}f\left(x\right)=\frac{M}{N}\] \end_inset \end_layout \begin_layout Subsubsection* Classical Algorithms \end_layout \begin_layout Standard 1. Deterministic Algorithm. Find lower bound on number of evaluations given error tolerance \begin_inset Formula $\epsilon$ \end_inset . To do this we need to ensure \begin_inset Formula \[ \max_{f}\left|S\left(f\right)-\hat{S}\left(f\right)\right|\le\epsilon\] \end_inset For \begin_inset Formula $k$ \end_inset evaluations, assume \begin_inset Formula $f\left(x\right)=0$ \end_inset to get lower bound, we then know that \begin_inset Formula $0\le S\left(f\right)\le\frac{M-k}{N}$ \end_inset . Take an estimate at the middle of this range to get least possible error in worst case: \begin_inset Formula \[ \hat{S}\left(f\right)=\frac{0+\left(1-\frac{k}{N}\right)}{2}\] \end_inset In this case \begin_inset Formula \[ \max_{f}\left|S\left(f\right)-\hat{S}\left(f\right)\right|^{2}=\frac{1}{2}\left(1-\frac{k}{N}\right)\] \end_inset \begin_inset Formula \begin{eqnarray*} \frac{1}{2}\left(1-\frac{k}{N}\right) & < & \epsilon\\ N-k & \le & 2N\epsilon\\ k & \ge & N\left(1-2\epsilon\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Section* Lecture 25 (18 April) \end_layout \begin_layout Subsection* Searching + Counting \end_layout \begin_layout Standard Classical Algorithms, Deterministic and Random \begin_inset Formula $O\left(N\right)$ \end_inset , \begin_inset Formula $1\le M\ll N$ \end_inset . \end_layout \begin_layout Standard Quantum Algorithm \begin_inset Formula $O\left(\sqrt{\frac{N}{M}}\right)$ \end_inset \end_layout \begin_layout Subsection* Counting / Boolean Mean \end_layout \begin_layout Standard Classical deterministic algorithm: \begin_inset Formula $k\ge N\left(1-2\epsilon\right)$ \end_inset \end_layout \begin_layout Standard Classical randomized algorithm: Choose \begin_inset Formula $k$ \end_inset inputs at random computing \begin_inset Formula \[ \hat{S}\left(f\right)=\frac{1}{k}\sum_{i=1}^{k}f\left(x_{i}\right)\] \end_inset \begin_inset Formula \[ k:x_{i}\in\left\{ 0,\ldots,N-1\right\} \] \end_inset This is a Monte Carlo algorithm. Instead of finding the lower bound error, find the expected error \begin_inset Formula \[ \left(E_{x_{1}\ldots x_{k}}\left[S\left(f\right)-\hat{S}\left(f\right)\right]^{2}\right)^{1/2}\le\frac{1}{\sqrt{k}}<\epsilon\] \end_inset \begin_inset Formula \[ k=\min\left(\frac{1}{\epsilon^{2}},N\right)\] \end_inset Chebyshev inequality \begin_inset Formula \begin{eqnarray*} Pr\left\{ \left|S\left(f\right)-\hat{S}\left(f\right)\right|>\tau\right\} & \le & \frac{E\left(\left(S\left(f\right)-\hat{S}\left(f\right)\right)^{2}\right)}{\tau^{2}}\\ \tau & = & 2\epsilon\\ Pr\left\{ \left|S\left(f\right)-\hat{S}\left(f\right)\right|>2\epsilon\right\} & \le & \frac{E\left(\left(S\left(f\right)-\hat{S}\left(f\right)\right)^{2}\right)}{4\epsilon^{2}}\end{eqnarray*} \end_inset \begin_inset Formula \[ k=\min\left(\frac{1}{\epsilon},N\right)\] \end_inset \end_layout \begin_layout Subsubsection* Quantum Algorithm \end_layout \begin_layout Standard Provides provable polynomial speedup over classical randomized algorithm. This is unlike factoring where there is no known lower bound and we are beating known classical algorithms without any proof that there isn't an unknown classical algorithm which could be faster. \end_layout \begin_layout Subsection* Grover's Search \end_layout \begin_layout Standard 1. Apply oracle \begin_inset Formula $Q_{f}$ \end_inset (from Deutsch-Jozsa) or the nice oracle \begin_inset Formula $O_{f}$ \end_inset (from previous lecture), \begin_inset Formula $O_{f}\left|x\right\rangle =\left(-1\right)^{f\left(x\right)}\left|x\right\rangle $ \end_inset . \end_layout \begin_layout Standard 2. Apply \begin_inset Formula $H^{\otimes n}$ \end_inset \end_layout \begin_layout Standard 3. Apply phase shift \begin_inset Formula $Q_{0}$ \end_inset which is a reflaction about \begin_inset Formula $\left|0\right\rangle $ \end_inset \begin_inset Formula \begin{eqnarray*} Q_{0} & = & 2\left|0\right\rangle \left\langle 0\right|-I\\ Q_{0}\left|0\right\rangle & = & 2\left|0\right\rangle \left\langle 0|0\right\rangle -I\left|0\right\rangle =\left|0\right\rangle \\ Q_{0}\left|y\right\rangle & = & 2\left|0\right\rangle \left\langle 0|y\right\rangle -I\left|y\right\rangle =-\left|y\right\rangle ,\: y\ne0\end{eqnarray*} \end_inset so for any basis state \begin_inset Formula $\left|y\right\rangle $ \end_inset \begin_inset Formula \[ Q_{0}\left|y\right\rangle =\left(-1\right)^{\delta_{0}y}\left|y\right\rangle \:\forall y=0,\ldots,N-1\] \end_inset \end_layout \begin_layout Standard 4. Apply \begin_inset Formula $H^{\otimes n}$ \end_inset \end_layout \begin_layout Standard All 4 operations can be combined with one operator \begin_inset Formula \begin{eqnarray*} G & = & H^{\otimes n}\left(2\left|0\right\rangle \left\langle 0\right|-I\right)H^{\otimes n}O_{f}\\ & = & \left(2H^{\otimes n}\left|0\right\rangle \left\langle 0\right|H^{\otimes n}-H^{\otimes n}H^{\otimes n}\right)O_{f}\\ & = & \left(2\left|\psi\right\rangle \left\langle \psi\right|-I\right)O_{f}\end{eqnarray*} \end_inset where \begin_inset Formula \[ \left|\psi\right\rangle =\frac{1}{\sqrt{N}}\sum_{j=0}^{N-1}\left|j\right\rangle \] \end_inset \begin_inset Formula $2\left|\psi\right\rangle \left\langle \psi\right|-I$ \end_inset acts as a reflection about \begin_inset Formula $\left|\psi\right\rangle $ \end_inset because for \begin_inset Formula $\left|z\right\rangle \perp\left|\psi\right\rangle $ \end_inset \begin_inset Formula \begin{eqnarray*} \left(2\left|\psi\right\rangle \left\langle \psi\right|-I\right)\left|\psi\right\rangle & = & \left|\psi\right\rangle \\ \left(2\left|\psi\right\rangle \left\langle \psi\right|-I\right)\left|z\right\rangle & = & -\left|z\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Analysis \end_layout \begin_layout Standard \begin_inset Formula \[ M_{f}=\left\{ x:f\left(x\right)=1\right\} ,\:1\le M=\left|M_{f}\right|\le N-1\] \end_inset \end_layout \begin_layout Standard Define two states \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset and \begin_inset Formula $\left|\beta\right\rangle $ \end_inset so \begin_inset Formula \begin{eqnarray*} \left|\alpha\right\rangle & = & \frac{1}{\sqrt{N-M}}\sum_{x\notin M_{f}}\left|x\right\rangle \\ \left|\beta\right\rangle & = & \frac{1}{\sqrt{M}}\sum_{x\in M_{f}}\left|x\right\rangle \end{eqnarray*} \end_inset \begin_inset Formula $\left\Vert \left|\alpha\right\rangle \right\Vert =\left\Vert \left|b\right\rangle \right\Vert =1$ \end_inset and \begin_inset Formula $\left\langle a|b\right\rangle =0$ \end_inset \begin_inset Formula \begin{eqnarray*} \left|\psi\right\rangle & = & \frac{1}{\sqrt{N}}\sum_{j=0}^{N-1}\left|j\right\rangle \\ & = & \frac{1}{\sqrt{N}}\left(\sqrt{N-M}\left|\alpha\right\rangle +\sqrt{M}\left|\beta\right\rangle \right)\\ & = & \frac{\sqrt{N-M}}{\sqrt{N}}\left|\alpha\right\rangle +\frac{\sqrt{M}}{\sqrt{N}}\left|\beta\right\rangle \end{eqnarray*} \end_inset Idea of algorithm is to boost change initial state \begin_inset Formula $\left|\psi\right\rangle $ \end_inset boosting the amplitude of \begin_inset Formula $\left|\beta\right\rangle $ \end_inset so the state that is measured will likely be in \begin_inset Formula $M_{f}$ \end_inset . \begin_inset Formula \begin{eqnarray*} \left|\psi\right\rangle & = & \left\langle \alpha|\psi\right\rangle \left|\alpha\right\rangle +\left\langle \beta|\psi\right\rangle \left|\beta\right\rangle \\ \left\langle \alpha|\psi\right\rangle & = & \frac{1}{\sqrt{N-M}}\frac{1}{\sqrt{N}}\sum_{x\notin M_{f}}\sum_{y=0}^{N-1}\left\langle x|y\right\rangle \\ & = & \frac{1}{\sqrt{N-M}}\frac{1}{\sqrt{N}}\sum_{x\notin M_{f}}1\\ & = & \frac{1}{\sqrt{N-M}}\frac{1}{\sqrt{N}}\left(N-M\right)\\ & = & \sqrt{\frac{N-M}{N}}\end{eqnarray*} \end_inset Similarly for \begin_inset Formula $\left|\beta\right\rangle .$ \end_inset Because \begin_inset Formula $\left\Vert \left|\psi\right\rangle \right\Vert ^{2}=\frac{N-M}{N}\left\Vert \left|\alpha\right\rangle \right\Vert ^{2}+\frac{M}{N}\left\Vert \left|\beta\right\rangle \right\Vert ^{2}=1$ \end_inset , \begin_inset Formula $\left|\psi\right\rangle $ \end_inset can be written as \begin_inset Formula \[ \left|\psi\right\rangle =\cos\frac{\vartheta}{2}\left|\alpha\right\rangle +\sin\frac{\vartheta}{2}\left|\beta\right\rangle \] \end_inset where \begin_inset Formula \begin{eqnarray*} \cos\frac{\vartheta}{2} & = & \sqrt{\frac{N-M}{N}}\\ \sin\frac{\vartheta}{2} & = & \sqrt{\frac{M}{N}}\end{eqnarray*} \end_inset \end_layout \begin_layout Subsubsection* Powers of G \end_layout \begin_layout Standard Want to determine \begin_inset Formula $G\left|\psi\right\rangle ,G^{2}\left|\psi\right\rangle ,G^{3}\left|\psi\right\rangle ,\ldots,G^{k}\left|\psi\right\rangle $ \end_inset \begin_inset Formula \begin{eqnarray*} G & = & \left(2\left|\psi\right\rangle \left\langle \psi\right|-I\right)O_{f}\\ O_{f}\left|\alpha\right\rangle & = & \frac{1}{\sqrt{N-M}}\sum_{x\notin M_{f}}O_{f}\left|x\right\rangle \\ & = & \frac{1}{\sqrt{N-M}}\sum_{x\notin M_{f}}\left(-1\right)^{f\left(x\right)=1}\left|x\right\rangle \\ & = & \left|\alpha\right\rangle \\ O_{f}\left|\beta\right\rangle & = & \frac{1}{\sqrt{M}}\sum_{x\in M_{f}}O_{f}\left|x\right\rangle \\ & = & \frac{1}{\sqrt{M}}\sum_{x\in M_{f}}\left(-1\right)^{f\left(x\right)=1}\left|x\right\rangle \\ & = & -\left|\beta\right\rangle \end{eqnarray*} \end_inset So when operator \begin_inset Formula $O_{f}$ \end_inset is applied to \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset , it is unchanged. When the operator is applied to \begin_inset Formula $\left|\beta\right\rangle $ \end_inset it is reflected. Given this, we can see \begin_inset Formula $G$ \end_inset applied to a state creates a rotation of that state in the \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset , \begin_inset Formula $\left|\beta\right\rangle $ \end_inset plane. Previously we showed expressed \begin_inset Formula $\left|\psi\right\rangle $ \end_inset in terms of an angle \begin_inset Formula $\frac{\vartheta}{2}$ \end_inset \begin_inset Formula \[ \left|\psi\right\rangle =\cos\frac{\vartheta}{2}\left|\alpha\right\rangle +\sin\frac{\vartheta}{2}\left|\beta\right\rangle \] \end_inset allowing the state \begin_inset Formula $\left|\psi\right\rangle $ \end_inset to be represented graphically as a 2 dimensional vector in the \begin_inset Formula $\left|\alpha\right\rangle ,\left|\beta\right\rangle $ \end_inset plane oriented \begin_inset Formula $\frac{\vartheta}{2}$ \end_inset degrees above the \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset axis. Applying \begin_inset Formula $O_{f}$ \end_inset to this state negates \begin_inset Formula $\left|\beta\right\rangle $ \end_inset component reflecting it about the \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset axis resulting in a vector \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $\frac{\vartheta}{2}$ \end_inset degrees below the \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset axis. Applying \begin_inset Formula $2\left|\psi\right\rangle \left\langle \psi\right|-I$ \end_inset is the same as a reflection about \begin_inset Formula $\left|\psi\right\rangle $ \end_inset . This results in a state oriented \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $\frac{\vartheta}{2}+\left(\frac{\vartheta}{2}--\frac{\vartheta}{2}\right)=\frac{3\vartheta}{2}$ \end_inset degrees above the \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset axis. ( \begin_inset Formula $\frac{\vartheta}{2}$ \end_inset being the angle of the \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $\left|\psi\right\rangle $ \end_inset state relative to \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit , \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left(\frac{\vartheta}{2}--\frac{\vartheta}{2}\right)$ \end_inset being the angular distance between \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $\left|\psi\right\rangle $ \end_inset and \begin_inset Formula $O_{f}\left|\psi\right\rangle $ \end_inset ). The result of the two reflections is \begin_inset Formula \[ G\left|\psi\right\rangle =\cos\frac{3\vartheta}{2}\left|\alpha\right\rangle +\sin\frac{3\vartheta}{2}\left|\beta\right\rangle \] \end_inset which taken together are equivalent to a rotation by \begin_inset Formula $2\vartheta$ \end_inset . Applying the \begin_inset Formula $G$ \end_inset operator repeatedly is then equivalent to \begin_inset Formula \[ G^{k}\left|\psi\right\rangle =\cos\left(\frac{2k+1}{2}\vartheta\right)\left|\alpha\right\rangle +\sin\left(\frac{2k+1}{2}\vartheta\right)\left|\beta\right\rangle \] \end_inset when a good value for \begin_inset Formula $k$ \end_inset is chosen, \begin_inset Formula $\sin\left(\frac{2k+1}{2}\vartheta\right)$ \end_inset will be close to 1 and measuring \begin_inset Formula $G^{k}\left|\psi\right\rangle $ \end_inset will yield a state from the \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\beta\right\rangle $ \end_inset superposition with high probability. Recall that any state in \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $\left|\beta\right\rangle $ \end_inset is a solution to the search problem. More formally, for a measurement \begin_inset Formula $\left|x\right\rangle $ \end_inset on the computational basis \begin_inset Formula \begin{eqnarray*} Pr\left\{ x\in M_{f}\right\} & = & \sin^{2}\left(\frac{2k+1}{2}\vartheta\right)\end{eqnarray*} \end_inset \end_layout \begin_layout Section* Lecture 26 (23 April) \end_layout \begin_layout Subsection* Grover's Review \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} G & = & H^{\otimes n}\left(2\left|0\right\rangle \left\langle 0\right|-I\right)H^{\otimes n}O_{f}\\ & = & \left(2\left|\psi\right\rangle \left\langle \psi\right|-I\right)O_{f}\\ O_{f}\left|x\right\rangle & = & \left(-1\right)^{f\left(x\right)}\left|x\right\rangle \\ \left|\alpha\right\rangle & = & \frac{1}{\sqrt{N-M}}\sum_{x\notin M_{f}}\left|x\right\rangle \\ \left|\beta\right\rangle & = & \frac{1}{\sqrt{M}}\sum_{x\in M_{f}}\left|x\right\rangle \\ \left|\psi\right\rangle & = & \frac{1}{\sqrt{N}}\sum_{j=0}^{N-1}\left|j\right\rangle =H^{\otimes n}\left|0\right\rangle ^{\otimes n}\\ G^{k}\left|\psi\right\rangle & = & \cos\left(\frac{2k+1}{2}\vartheta\right)\left|\alpha\right\rangle +\sin\left(\frac{2k+1}{2}\vartheta\right)\left|\beta\right\rangle \\ \sin\left(\frac{\vartheta}{2}\right) & = & \sqrt{\frac{M}{N}}\\ \cos\left(\frac{\vartheta}{2}\right) & = & \sqrt{\frac{M-N}{N}}\end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Grover's Analyis (continued) \end_layout \begin_layout Standard Need to find value of \begin_inset Formula $k$ \end_inset that gives \begin_inset Formula $G^{k}\left|\psi\right\rangle $ \end_inset close to \begin_inset Formula $\left|\beta\right\rangle $ \end_inset . Start with success probability of algorithm assuming \begin_inset Formula $k$ \end_inset is known. For \begin_inset Formula $x\in M_{f}$ \end_inset \begin_inset Formula \begin{eqnarray*} \left\langle x\right|G^{k}\left|\psi\right\rangle & = & \left|\sin\left(\frac{2k+1}{2}\vartheta\right)\left\langle x|\beta\right\rangle \right|^{2}\\ & = & \left|\sin\left(\frac{2k+1}{2}\vartheta\right)\frac{1}{\sqrt{M}}\right|^{2}\\ & = & \sin^{2}\left(\frac{2k+1}{2}\vartheta\right)\frac{1}{M}\\ Pr\left\{ \textrm{measuring }x\in M_{f}\right\} & = & M\sin^{2}\left(\frac{2k+1}{2}\vartheta\right)\frac{1}{M}\\ & = & \sin^{2}\left(\frac{2k+1}{2}\vartheta\right)\frac{1}{M}\end{eqnarray*} \end_inset Success probability is therefore \begin_inset Formula $\sin^{2}\left(\frac{2k+1}{2}\vartheta\right)$ \end_inset given a \begin_inset Formula $k$ \end_inset . \begin_inset Formula $\frac{2k+1}{2}\vartheta$ \end_inset should be close to \begin_inset Formula $\frac{\pi}{2}$ \end_inset , so \begin_inset Formula \[ \frac{\pi}{2}-\frac{\vartheta}{2}\le\frac{2k+1}{2}\vartheta<\frac{\pi}{2}+\frac{\vartheta}{2}\] \end_inset If \begin_inset Formula $\frac{M}{N}<\frac{1}{2}$ \end_inset then \begin_inset Formula $\sqrt{\frac{M}{N}}=\sin\frac{\vartheta}{2}<\sin\frac{\pi}{4}=\sqrt{\frac{1}{2}}$ \end_inset and \begin_inset Formula $0\le\vartheta\le\frac{\pi}{2}$ \end_inset \begin_inset Formula \[ \pi-\vartheta\le\left(2k+1\right)\vartheta<\pi+\vartheta\] \end_inset \begin_inset Formula \[ \frac{\pi}{\vartheta}-1\le2k+1<\frac{\pi}{\vartheta}+1\] \end_inset \begin_inset Formula \[ \frac{\pi}{2\vartheta}-1\le k<\frac{\pi}{2\vartheta}\] \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\sqrt{\frac{M}{N}}=\sin\frac{\vartheta}{2}\approx\frac{\vartheta}{2}$ \end_inset , a valid approximation when \begin_inset Formula $\vartheta$ \end_inset is tiny. In this case \begin_inset Formula $\varphi\approx2\sqrt{\frac{M}{N}}$ \end_inset , and \begin_inset Formula $k=\frac{\pi}{2\vartheta}\approx\frac{\pi}{4}\sqrt{\frac{N}{M}}$ \end_inset , so a good \begin_inset Formula $k$ \end_inset can be set \begin_inset Formula $k=\left\lceil \frac{\pi}{4}\sqrt{\frac{N}{M}}\right\rceil $ \end_inset , making the complexity of the algorithm in terms of oracle calls \begin_inset Formula $O\left(N\right)$ \end_inset . \end_layout \begin_layout Standard When \begin_inset Formula $M$ \end_inset is larger, you need a more precise analysis without the approximation. In this case use \begin_inset Formula \begin{eqnarray*} \sin\frac{\vartheta}{2} & = & \sqrt{\frac{M}{N}}\\ \cos\frac{\vartheta}{2} & = & \sqrt{\frac{N-M}{N}}\end{eqnarray*} \end_inset Then use a trig identity \begin_inset Formula \begin{eqnarray*} \sin\vartheta & = & 2\sin\frac{\vartheta}{2}\cos\frac{\vartheta}{2}=2\sqrt{\frac{M}{N}}\sqrt{\frac{N-M}{N}}\\ \varphi & = & \arcsin\left(2\sqrt{\frac{M\left(N-M\right)}{N^{2}}}\right)\\ k & = & \frac{\pi}{2\vartheta}\end{eqnarray*} \end_inset To see what happens when \begin_inset Formula $\frac{M}{N}\ge\frac{1}{2}$ \end_inset look at the relation \begin_inset Formula \[ \sin^{2}\vartheta=\frac{4M\left(N-M\right)}{N^{2}}=4\frac{M}{N}\left(1-\frac{M}{N}\right)\] \end_inset and note that \begin_inset Formula $\vartheta$ \end_inset gets smaller as \begin_inset Formula $M$ \end_inset increases from \begin_inset Formula $\frac{N}{2}$ \end_inset to \begin_inset Formula $N$ \end_inset . Because \begin_inset Formula $\vartheta$ \end_inset gets smaller, \begin_inset Formula $k$ \end_inset gets larger, and algorithm gets slower to the point where it is not better than a random classical algorithm. \end_layout \begin_layout Subsection* Grover's Algorithm Circuit \end_layout \begin_layout Standard \begin_inset Formula \[ \textrm{Circuit: }\left(G^{k}\right)\left(H^{\otimes n}\otimes I\right)\left(\left|0\right\rangle ^{\otimes n}\otimes\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\right)\] \end_inset (Diagram Figure 6.1, Page 251) \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|0\right\rangle ^{\otimes t}\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}} & \xrightarrow{H^{\otimes n}\otimes I} & \left|\psi\right\rangle \frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\\ & \xrightarrow{G^{k}} & \left(\cos\left(\frac{2k+1}{2}\vartheta\right)\left|\alpha\right\rangle +\sin\left(\frac{2k+1}{2}\vartheta\right)\left|\beta\right\rangle \right)\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}}\end{eqnarray*} \end_inset \end_layout \begin_layout Subsection* Estimating M \end_layout \begin_layout Standard Grovers assumes \begin_inset Formula $M$ \end_inset is known. If \begin_inset Formula $M$ \end_inset is unknown, there are two approaches. \end_layout \begin_layout Standard 1. Brasard, et al. Apply \begin_inset Formula $G^{j}$ \end_inset for random \begin_inset Formula $j$ \end_inset , and show expected number of steps is \begin_inset Formula $O\left(\sqrt{N/M}\right)$ \end_inset . \end_layout \begin_layout Standard 2. Find \begin_inset Formula $M$ \end_inset using \begin_inset Formula $\sin\frac{\vartheta}{2}=\sqrt{\frac{M}{N}}$ \end_inset and estimating \begin_inset Formula $\vartheta$ \end_inset . Since this also gives you the boolean mean it lets you \begin_inset Quotes eld \end_inset hit 2 birds for the price of one. \begin_inset Quotes erd \end_inset We cover this second approach. \begin_inset Formula \begin{eqnarray*} G & = & \left(2\left|\psi\right\rangle \left\langle \psi\right|-I\right)O_{f}\\ G\left|\alpha\right\rangle & = & \cos\left(\vartheta\right)\left|\alpha\right\rangle +\sin\left(\vartheta\right)\left|\beta\right\rangle \\ G\left|\beta\right\rangle & = & \cos\left(\vartheta+\frac{\pi}{2}\right)\left|\alpha\right\rangle +\sin\left(\varphi+\frac{\pi}{2}\right)\left|\beta\right\rangle \\ & = & -\sin\left(\vartheta\right)\left|\alpha\right\rangle +\cos\left(\vartheta\right)\left|\beta\right\rangle \end{eqnarray*} \end_inset The effect of \begin_inset Formula $G$ \end_inset on the \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset vector above is determined by looking at reflections and rotations on the \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset , \begin_inset Formula $\left|\beta\right\rangle $ \end_inset plane (Figure 6.3, page 253). Applying \begin_inset Formula $O_{f}$ \end_inset to \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset does not change anything because as shown earlier, \begin_inset Formula $O_{f}$ \end_inset is a reflection about the \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset axis. Applying \begin_inset Formula $\left(2\left|\psi\right\rangle \left\langle \psi\right|-I\right)$ \end_inset to \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset reflects the state about \begin_inset Formula $\left|\psi\right\rangle $ \end_inset . Since \begin_inset Formula $\left|\psi\right\rangle $ \end_inset is \begin_inset Formula $\frac{\vartheta}{2}$ \end_inset degrees above \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset , reflecting \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset about it is equivalent to rotating the state by \begin_inset Formula $2\cdot\frac{\vartheta}{2}=\vartheta$ \end_inset degrees. The resulting vector has magnitudes of \begin_inset Formula $\cos\left(\vartheta\right)$ \end_inset in the \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset direction and \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $\sin\left(\vartheta\right)$ \end_inset in the \begin_inset Formula $\left|\beta\right\rangle $ \end_inset direction. \begin_inset Formula $G\left|\beta\right\rangle $ \end_inset is \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none derived similarly. The relation above can be used to express \begin_inset Formula $G$ \end_inset as a transformation on the \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $\left|\alpha\right\rangle ,$ \end_inset \begin_inset Formula $\left|\beta\right\rangle $ \end_inset basis: \begin_inset Formula \[ G=\left(\begin{array}{cc} \cos\vartheta & -\sin\vartheta\\ \sin\vartheta & \cos\vartheta\end{array}\right)\] \end_inset \end_layout \begin_layout Standard The eigenvalues of \begin_inset Formula $G$ \end_inset are given by \begin_inset Formula \begin{eqnarray*} 0 & = & \left|\begin{array}{cc} \cos\vartheta-\lambda & -\sin\vartheta\\ \sin\vartheta & \cos\vartheta-\lambda\end{array}\right|\\ & = & \left(\cos\left(\vartheta\right)-\lambda\right)^{2}+\sin^{2}\left(\vartheta\right)\\ \left(\cos\left(\vartheta\right)-\lambda\right)^{2} & = & -\sin^{2}\left(\vartheta\right)\\ \cos\left(\vartheta\right)-\lambda & = & \pm i\sin\left(\vartheta\right)\\ \lambda & = & \cos\left(\vartheta\right)\pm i\sin\left(\vartheta\right)\\ & = & e^{\pm i\vartheta}\end{eqnarray*} \end_inset Phase estimation is performed on \begin_inset Formula $G$ \end_inset to find \begin_inset Formula $\vartheta$ \end_inset , which can in turn be used to find \begin_inset Formula $M$ \end_inset and \begin_inset Formula $k$ \end_inset . \end_layout \begin_layout Section* Lecture 27 (25 April) \end_layout \begin_layout Subsection* Review: Grover's Algorithm \end_layout \begin_layout Standard \begin_inset Formula $G^{k}$ \end_inset , \begin_inset Formula $k=\frac{\pi}{2\vartheta}$ \end_inset , \begin_inset Formula $\sin\frac{\vartheta}{2}=\sqrt{\frac{M}{N}}$ \end_inset \end_layout \begin_layout Standard When \begin_inset Formula $M$ \end_inset is small, the following approximation for \begin_inset Formula $k$ \end_inset is valid: \begin_inset Formula $k\approx\left\lceil \frac{\pi}{4}\sqrt{\frac{M}{N}}\right\rceil $ \end_inset \end_layout \begin_layout Standard Otherwise \begin_inset Formula $k$ \end_inset can be found using \begin_inset Formula $\vartheta=\arcsin\left(2\frac{M\left(N-M\right)}{N^{2}}\right)$ \end_inset . \end_layout \begin_layout Standard If \begin_inset Formula $M=1$ \end_inset , \begin_inset Formula $k=O\left(\sqrt{N}\right)$ \end_inset \end_layout \begin_layout Standard If \begin_inset Formula $M$ \end_inset is unknown, can use estimate of \begin_inset Formula $\vartheta$ \end_inset to find it. Estimating \begin_inset Formula $\vartheta$ \end_inset happens with phase estimation on \begin_inset Formula $G$ \end_inset , which expressed as a transformation on the \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset , \begin_inset Formula $\left|\beta\right\rangle $ \end_inset basis looks like \begin_inset Formula \[ G=\left(\begin{array}{cc} \cos\vartheta & -\sin\vartheta\\ \sin\vartheta & \cos\vartheta\end{array}\right)\] \end_inset and has eigenvalues, \begin_inset Formula $\lambda_{\pm}=e^{\pm i\vartheta}$ \end_inset . \end_layout \begin_layout Subsection* Phase Estimation for \begin_inset Formula $\vartheta$ \end_inset \end_layout \begin_layout Standard Phase estimation requires us to generate an initial state which approximates one or more eigenvectors of \begin_inset Formula $G$ \end_inset . \end_layout \begin_layout Subsubsection* Finding Eigenvectors of G \end_layout \begin_layout Standard Denote unknown eigenvector as \begin_inset Formula $\left(x\left|\alpha\right\rangle +y\left|\beta\right\rangle \right)$ \end_inset so: \begin_inset Formula \[ G\left(x\left|\alpha\right\rangle +y\left|\beta\right\rangle \right)=e^{\pm i\vartheta}\left(x\left|\alpha\right\rangle +y\left|\beta\right\rangle \right)\] \end_inset Expanding the left side gives: \begin_inset Formula \begin{eqnarray*} xG\left|\alpha\right\rangle +yG\left|\beta\right\rangle & = & x\left(\cos\vartheta\left|\alpha\right\rangle +\sin\vartheta\left|\beta\right\rangle \right)+y\left(-\sin\vartheta\left|\alpha\right\rangle +\cos\vartheta\left|\beta\right\rangle \right)\end{eqnarray*} \end_inset Which is true when \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $x\cos\vartheta-y\sin\vartheta=xe^{\pm i\vartheta}$ \end_inset and \begin_inset Formula $x\sin\vartheta+y\cos\vartheta=ye^{\pm i\vartheta}$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} x\cos\vartheta-y\sin\vartheta & = & xe^{\pm ig}\\ x\cos\vartheta-y\sin\vartheta & = & x\left(\cos\vartheta\pm i\sin\vartheta\right)\\ -y & = & \pm ix\textrm{ when }\sin\vartheta\ne0,\frac{\vartheta}{2}\ne k\frac{\pi}{2}\end{eqnarray*} \end_inset Which gives eigenvector of the form \begin_inset Formula $x\left|\alpha\right\rangle \pm ix\left|\beta\right\rangle $ \end_inset . Normalized, the eigenvectors are \begin_inset Formula \begin{eqnarray*} \left|\psi_{+}\right\rangle & = & \frac{\left|\alpha\right\rangle +i\left|\beta\right\rangle }{\sqrt{2}}\\ \left|\psi_{-}\right\rangle & = & \frac{\left|\alpha\right\rangle -i\left|\beta\right\rangle }{\sqrt{2}}\end{eqnarray*} \end_inset \begin_inset Formula $\left|\alpha\right\rangle $ \end_inset and \begin_inset Formula $\left|\beta\right\rangle $ \end_inset can be rewritten as \begin_inset Formula \begin{eqnarray*} \left|\alpha\right\rangle & = & \frac{1}{\sqrt{2}}\left(\left|\psi_{+}\right\rangle +\left|\psi_{-}\right\rangle \right)\\ \left|\beta\right\rangle & = & \frac{i}{\sqrt{2}}\left(\left|\psi_{+}\right\rangle -\left|\psi_{-}\right\rangle \right)\end{eqnarray*} \end_inset \end_layout \begin_layout Subsubsection* Generating Initial State \end_layout \begin_layout Standard \begin_inset Formula $\left|\psi\right\rangle $ \end_inset can be used as an initial state because it is a combination of eigenvectors: \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \left|\psi\right\rangle & = & \frac{1}{\sqrt{N}}\sum_{x}\left|x\right\rangle \\ & = & \cos\left(\frac{\vartheta}{2}\right)\left|\alpha\right\rangle +\sin\left(\frac{\vartheta}{2}\right)\left|\beta\right\rangle \\ & = & \cos\left(\frac{\vartheta}{2}\right)\frac{1}{\sqrt{2}}\left(\left|\psi_{+}\right\rangle +\left|\psi_{-}\right\rangle \right)+\sin\left(\frac{\vartheta}{2}\right)\frac{i}{\sqrt{2}}\left(\left|\psi_{+}\right\rangle -\left|\psi_{-}\right\rangle \right)\\ & = & \frac{1}{\sqrt{2}}\left(\cos\left(\frac{\vartheta}{2}\right)+i\sin\left(\frac{\vartheta}{2}\right)\right)\left|\psi_{+}\right\rangle +\frac{1}{\sqrt{2}}\left(\cos\left(\frac{\vartheta}{2}\right)-i\sin\left(\frac{\vartheta}{2}\right)\right)\left|\psi_{-}\right\rangle \\ & = & \frac{1}{\sqrt{2}}e^{i\frac{\vartheta}{2}}\left|\psi_{+}\right\rangle +\frac{1}{\sqrt{2}}e^{-i\frac{\vartheta}{2}}\left|\psi_{-}\right\rangle \end{eqnarray*} \end_inset \end_layout \begin_layout Standard Note: Coefficients to \family roman \series medium \shape up \size normal \emph off \bar no \noun off \color none \begin_inset Formula $\left|\psi_{+}\right\rangle $ \end_inset and \family default \series default \shape default \size default \emph default \bar default \noun default \color inherit \begin_inset Formula $\left|\psi_{-}\right\rangle $ \end_inset above are not important. Any state which was a combination of the two eigenvectors would work for finding the boolean mean. \end_layout \begin_layout Subsubsection* Phase Estimation Results \end_layout \begin_layout Standard The result of phase estimation with \begin_inset Formula $G$ \end_inset and initial state \begin_inset Formula $\left|\psi\right\rangle $ \end_inset can be used to find boolean mean \begin_inset Formula \[ S\left(f\right)=\frac{1}{N}\sum_{x}f\left(x\right)=\frac{M}{N}=\sin^{2}\left(\frac{\vartheta}{2}\right)\] \end_inset Phase estimation gives \begin_inset Formula $\left|\varphi-\hat{\varphi}\right|\le2^{\eta_{0}}$ \end_inset , \begin_inset Formula $\hat{\varphi}=\frac{d}{2^{t}}$ \end_inset with probability \begin_inset Formula $\left(1-\epsilon\right)$ \end_inset using \begin_inset Formula $t=\eta_{0}+\left\lceil \log\left(2+\frac{1}{2\epsilon}\right)\right\rceil $ \end_inset qubits in the top register. Phase estimation will approximate \begin_inset Formula $\lambda_{+}$ \end_inset with probability \begin_inset Formula \[ \left(1-\epsilon\right)\left|\frac{1}{\sqrt{2}}e^{i\frac{\vartheta}{2}}\right|^{2}\] \end_inset and approximate \begin_inset Formula $\lambda_{-}$ \end_inset with probability \begin_inset Formula \[ \left(1-\epsilon\right)\left|\frac{1}{\sqrt{2}}e^{-i\frac{\vartheta}{2}}\right|^{2}\] \end_inset Eigenvalues again are \end_layout \begin_layout Standard \begin_inset Formula \begin{eqnarray*} \lambda_{+} & = & e^{i\vartheta}=e^{2\pi i\vartheta/\left(2\pi\right)}\\ \lambda_{-} & = & e^{i\left(2\pi-\vartheta\right)}=e^{-2\pi i\left(2\pi-\vartheta\right)/\left(2\pi\right)}\\ \varphi_{+} & = & \frac{\vartheta}{2\pi}\\ \varphi_{-} & = & \frac{2\pi-\vartheta}{2\pi}\end{eqnarray*} \end_inset \end_layout \begin_layout Standard Error bounds look like \begin_inset Formula \begin{eqnarray*} \left|\varphi_{\pm}-\hat{\varphi}\right| & \le & 2^{-\eta_{0}}\\ \left|\pi\varphi_{\pm}-\pi\hat{\varphi}\right| & \le & \frac{\pi}{2^{\eta_{0}}}\\ \pi\varphi_{+} & = & \frac{\vartheta}{2}\\ \pi\varphi_{-} & = & \pi-\frac{\vartheta}{2}\\ \left|\frac{\vartheta}{2}-\pi\hat{\varphi}\right| & \le & \frac{\pi}{2^{\eta_{0}}}\textrm{ w/prob }\frac{1}{2}\left(1-\epsilon\right)\\ \left|\pi-\frac{\vartheta}{2}-\pi\hat{\varphi}\right| & \le & \frac{\pi}{2^{\eta_{0}}}\textrm{ w/prob }\frac{1}{2}\left(1-\epsilon\right)\end{eqnarray*} \end_inset But we aren't using phase estimation to compute phase, we are using it to compute \begin_inset Formula $M$ \end_inset which is related to the sin, so we need a different bound: \begin_inset Formula \begin{eqnarray*} \left|\sin^{2}\left(\frac{\vartheta}{2}\right)-\sin^{2}\left(\frac{\pi j}{2^{t}}\right)\right| & \le & \frac{\pi}{2^{\eta_{0}}}\sqrt{S\left(f\right)\left(1-S\left(f\right)\right)}+\frac{\pi^{2}}{2^{2\eta_{0}}}\end{eqnarray*} \end_inset (from paper BHMT lemma 7, page 15) \end_layout \begin_layout Standard \begin_inset Formula $j$ \end_inset is measurement in computational basis \end_layout \begin_layout Standard since \begin_inset Formula $\sin^{2}\left(\frac{\varphi}{2}\right)=\sin^{2}\left(\pi-\frac{\varphi}{2}\right)=S\left(f\right)$ \end_inset \end_layout \begin_layout Standard \begin_inset Formula $\left.\begin{array}{c} \sin^{2}\left(\frac{\vartheta}{2}\right)\approx\frac{\vartheta}{2}\\ \sin^{2}\left(\frac{\pi j}{2}\right)\approx\frac{\pi j}{2}\end{array}\right\} \rightarrow\left(\frac{\vartheta}{2}\right)^{2}-\left(\frac{\pi i}{2}\right)^{2}=\left(\frac{\vartheta}{2}+\frac{\pi i}{2}\right)\left(\frac{\vartheta}{2}-\frac{\pi i}{2}\right)$ \end_inset \end_layout \begin_layout Subsubsection* Phase Estimation Circuit \end_layout \begin_layout Standard The circuit for using phase estimation to compute the boolean mean is the same as the circuit for normal phase estimation. (Figure 6.7 page 262) \end_layout \begin_layout Standard The output of the circuit in the bottom register will be either \begin_inset Formula $\left|\psi_{+}\right\rangle $ \end_inset or \begin_inset Formula $\left|\psi_{-}\right\rangle $ \end_inset . The top register needs just enough bits to be able to distinguish \begin_inset Formula $\frac{1}{N}$ \end_inset from \begin_inset Formula $0$ \end_inset . \end_layout \begin_layout Standard In general, there is no efficient way to make \begin_inset Formula $G^{2^{j}}$ \end_inset gates, just have to apply \begin_inset Formula $G$ \end_inset repeatedly, so the number of quesries is \begin_inset Formula $\tau=2^{t-1}=\Theta\left(2^{t}\right)=\Theta\left(2^{\eta_{0}}\right)$ \end_inset . Error is \begin_inset Formula $O\left(\frac{1}{\tau}\right)$ \end_inset . \begin_inset Formula $t=\eta_{0}+\left\lceil log_{2}\left(2+\frac{1}{2\epsilon}\right)\right\rceil $ \end_inset . This is the best possible, see paper [Nayak+Wu], algorithm is optimal. \end_layout \begin_layout Section* Lecture 28 (30 April) \end_layout \begin_layout Standard Review for Final \end_layout \end_body \end_document