\section{One Qubit}

Quantum bits (or \textit{qubits}) are very similar to probabilistic bits, but have one major difference: \par
probabilities are replaced with \textit{amplitudes}.

\vspace{2mm}
Of course, a qubit can take the values \texttt{0} and \texttt{1}, which are denoted $\ket{0}$ and $\ket{1}$. \par
Like probabilistic bits, a quantum bit is written as a linear combination of $\ket{0}$ and $\ket{1}$:
\begin{equation*}
	\ket{\psi} = \psi_0\ket{0} + \psi_1\ket{1}
\end{equation*}
Such linear combinations are called \textit{superpositions}.

\vspace{2mm}

The $\ket{~}$ you see in the expressions above is called a \say{ket,} and denotes a column vector. \par
$\ket{0}$ is pronounced \say{ket zero,} and $\ket{1}$ is pronounced \say{ket one.} This is called bra-ket notation. \par
\note[Note]{$\bra{0}$ is called a \say{bra,} but we won't worry about that for now.}

\vspace{2mm}
This is very similiar to the \say{box} $[~]$ notation we used for probabilistic bits. \par
As before, we will write $\ket{0} = \left[\begin{smallmatrix} 1 \\ 0 \end{smallmatrix}\right]$
and $\ket{1} = \left[\begin{smallmatrix} 0 \\ 1 \end{smallmatrix}\right]$.


\vspace{8mm}

Recall that probabilistic bits are subject to the restriction that $p_0 + p_1 = 1$. \par
Quantum bits have a similar condition: $\psi_0^2 + \psi_1^2 = 1$. \par
Note that this implies that $\psi_0$ and $\psi_1$ are both in $[-1, 1]$: \par
Quantum amplitudes may be negative, but probabilistic bit probabilities cannot.

\vspace{2mm}

If we plot the set of valid quantum states on our plane, we get a unit circle centered at the origin:

\begin{center}
	\begin{tikzpicture}[scale=1.5]
		\draw[dashed] (0,0) circle(1);

		\fill[color = black] (0, 0) circle[radius=0.05];

		\draw[->] (0, 0) -- (1.2, 0);
		\fill[color = oblue] (1, 0) circle[radius=0.05];
		\node[below right] at (1, 0) {$\ket{0}$};

		\draw[->] (0, 0) -- (0, 1.2);
		\fill[color = oblue] (0, 1) circle[radius=0.05];
		\node[above left] at (0, 1) {$\ket{1}$};

		\fill[color = ored] (0.87, 0.5) circle[radius=0.05];
		\node[above right] at (0.87, 0.5) {$\ket{\psi}$};
	\end{tikzpicture}
\end{center}



Recall that the set of probabilistic bits forms a line instead:


\begin{center}
	\begin{tikzpicture}[scale = 1.5]
		\fill[color = black] (0, 0) circle[radius=0.05];
		\node[below left] at (0, 0) {$\left[\begin{smallmatrix} 0 \\ 0 \end{smallmatrix}\right]$};

		\draw[ored, -, line width = 2] (0, 1) -- (1, 0);


		\draw[->] (0, 0) -- (1.2, 0);
		\node[right] at (1.2, 0) {$p_0$};
		\fill[color = oblue] (1, 0) circle[radius=0.05];
		\node[below] at (1, 0) {$[0]$};

		\draw[->] (0, 0) -- (0, 1.2);
		\node[above] at (0, 1.2) {$p_1$};
		\fill[color = oblue] (0, 1) circle[radius=0.05];
		\node[left] at (0, 1) {$[1]$};
	\end{tikzpicture}
\end{center}


\problem{}
In the above unit circle, the counterclockwise angle from $\ket{0}$ to $\ket{\psi}$ is $30^\circ$\hspace{-1ex}. \par
Write $\ket{\psi}$ as a linear combination of $\ket{0}$ and $\ket{1}$.


\vfill
\pagebreak


\definition{Measurement I}
Just like a probabilistic bit, we must observed $\ket{0}$ or $\ket{1}$ when we measure a qubit. \par
If we were to measure $\ket{\psi} = \psi_0\ket{0} + \psi_1\ket{1}$, we'd observe either $\ket{0}$ or $\ket{1}$, \par
with the following probabilities:
\begin{itemize}[itemsep = 2mm, topsep = 2mm]
	\item $\mathcal{P}(\ket{1}) = \psi_1^2$
	\item $\mathcal{P}(\ket{0}) = \psi_0^2$
\end{itemize}
\note{Note that $\mathcal{P}(\ket{0}) + \mathcal{P}(\ket{1}) = 1$.}


\vspace{2mm}

As before, $\ket{\psi}$ \textit{collapses} when it is measured: its state becomes that which we observed in our measurement,
leaving no trace of the previous superposition. \par












\problem{}
\begin{itemize}
	\item What is the probability we observe $\ket{0}$ when we measure $\ket{\psi}$? \par
	\item What can we observe if we measure $\ket{\psi}$ a second time? \par
	\item What are these probabilities for $\ket{\varphi}$?
\end{itemize}



\begin{center}
	\begin{tikzpicture}[scale=1.5]
		\draw[dashed] (0,0) circle(1);

		\fill[color = black] (0, 0) circle[radius=0.05];

		\draw[->] (0, 0) -- (1.2, 0);
		\fill[color = oblue] (1, 0) circle[radius=0.05];
		\node[below right] at (1, 0) {$\ket{0}$};

		\draw[->] (0, 0) -- (0, 1.2);
		\fill[color = oblue] (0, 1) circle[radius=0.05];
		\node[above left] at (0, 1) {$\ket{1}$};

		\draw[dotted] (0, 0) -- (0.87, 0.5);
		\draw[color=gray,->] (0.5, 0.0) arc (0:30:0.5);
		\node[right, color=gray] at (0.47, 0.12) {$30^\circ$};
		\fill[color = ored] (0.87, 0.5) circle[radius=0.05];
		\node[above right] at (0.87, 0.5) {$\ket{\psi}$};


		\draw[dotted] (0, 0) -- (-0.707, -0.707);
		\draw[color=gray,->] (0.25, 0.0) arc (0:-135:0.25);
		\node[below, color=gray] at (0.2, -0.2) {$135^\circ$};
		\fill[color = ored] (-0.707, -0.707) circle[radius=0.05];
		\node[below left] at (-0.707, -0.707) {$\ket{\varphi}$};
	\end{tikzpicture}
\end{center}



\vfill

As you may have noticed, we don't need two coordinates to fully define a quibit's state. \par
We can get by with one coordinate just as well.

Instead of referring to each state using its cartesian coordinates $\psi_0$ and $\psi_1$, \par
we can address it using its \textit{polar angle} $\theta$, measured from $\ket{0}$ counterclockwise:

\begin{center}
	\begin{tikzpicture}[scale=1.5]
		\draw[dashed] (0,0) circle(1);
		\fill[color = black] (0, 0) circle[radius=0.05];

		\draw[dotted] (0, 0) -- (0.707, 0.707);
		\draw[color=gray,->] (0.5, 0.0) arc (0:45:0.5);
		\node[above right, color=gray] at (0.5, 0) {$\theta$};

		\draw[->] (0, 0) -- (1.2, 0);
		\fill[color = oblue] (1, 0) circle[radius=0.05];
		\node[below right] at (1, 0) {$\ket{0}$};

		\draw[->] (0, 0) -- (0, 1.2);
		\fill[color = oblue] (0, 1) circle[radius=0.05];
		\node[above left] at (0, 1) {$\ket{1}$};

		\fill[color = ored] (0.707, 0.707) circle[radius=0.05];
		\node[above right] at (0.707, 0.707) {$\ket{\psi}$};
	\end{tikzpicture}
\end{center}


\problem{}
Find $\psi_0$ and $\psi_1$ in terms of $\theta$ for an arbitrary qubit $\psi$.


\vfill
\pagebreak


\problem{}
Consider the following qubit states:

\null\hfill\begin{minipage}{0.48\textwidth}
	\begin{equation*}
		\ket{+} = \frac{\ket{0} + \ket{1}}{\sqrt{2}}
	\end{equation*}
\end{minipage}\hfill\begin{minipage}{0.48\textwidth}
	\begin{equation*}
		\ket{-} = \frac{\ket{0} - \ket{1}}{\sqrt{2}}
	\end{equation*}
\end{minipage}\hfill\null

\begin{itemize}
	\item Where are these on the unit circle?
	\item What are their polar angles?
	\item What are the probabilities of observing $\ket{0}$ and $\ket{1}$ when measuring $\ket{+}$ and $\ket{-}$?
\end{itemize}

\vfill

\begin{center}
	\begin{tikzpicture}[scale = 2.5]
		\draw[dashed] (0,0) circle(1);
		\fill[color = black] (0, 0) circle[radius=0.05];

		\draw[->] (0, 0) -- (1.2, 0);
		\fill[color = oblue] (1, 0) circle[radius=0.05];
		\node[below right] at (1, 0) {$\ket{0}$};

		\draw[->] (0, 0) -- (0, 1.2);
		\fill[color = oblue] (0, 1) circle[radius=0.05];
		\node[above left] at (0, 1) {$\ket{1}$};
	\end{tikzpicture}
\end{center}

\vfill
\vfill
\pagebreak


\section{Operations on One Qubit}

We may apply transformations to qubits just as we apply transformations to probabilistic bits.
Again, we'll represent transformations as $2 \times 2$ matrices, since we want to map
one qubit state to another. \par
\note{In other words, we want to map elements of $\mathbb{R}^2$ to elements of $\mathbb{R}^2$.} \par
We will call such maps \textit{quantum gates,} since they are the quantum equivalent of classical logic gates.


\vspace{2mm}

There are two conditions a valid quantum gate $G$ must satisfy:
\begin{itemize}[itemsep = 1mm]
	\item For any valid state $\ket{\psi}$, $G\ket{\psi}$ is a valid state. \par
	Namely, $G$ must preserve the length of any vector it is applied to. \par
	Recall that the set of valid quantum states is the set of unit vectors in $\mathbb{R}^2$

	\item Any quantum gate must be \textit{invertible}. \par
	We'll skip this condition for now, and return to it later.
\end{itemize}
In short, a quantum gate is a linear map that maps the unit circle to itself. \par
There are only two kinds of linear maps that do this: reflections and rotations.

\problem{}
The $X$ gate is the quantum analog of the \texttt{not} gate, defined by the following table:
\begin{itemize}
	\item $X\ket{0} = \ket{1}$
	\item $X\ket{1} = \ket{0}$
\end{itemize}
Find the matrix $X$.

\begin{solution}
	\begin{equation*}
		\begin{bmatrix}
			0 & 1 \\ 1 & 0
		\end{bmatrix}
	\end{equation*}
\end{solution}

\vfill

\problem{}
What is $X\ket{+}$ and $X\ket{-}$? \par
\hint{Remember that all matrices are linear maps. What does this mean?}

\begin{solution}
	$X\ket{+} = \ket{+}$ and $X\ket{-} = -\ket{-}$ (that is, negative ket-minus). \par
	Most notably, remember that $G(a\ket{0} + b\ket{1}) = aG\ket{0} + bG\ket{1}$
\end{solution}

\vfill


\problem{}
In terms of geometric transformations, what does $X$ do to the unit circle?

\begin{solution}
	It is a reflection about the $45^\circ$ axis.
\end{solution}

\vfill
\pagebreak


\problem{}
Let $Z$ be a quantum gate defined by the following table: \par
\begin{itemize}
	\item $Z\ket{0} = \ket{0}$,
	\item $Z\ket{1} = -\ket{1}$.
\end{itemize}
What is the matrix $Z$? What are $Z\ket{+}$ and $Z\ket{-}$? \par
What is $Z$ as a geometric transformation?

\vfill

\problem{}
Is the map $B$ defined by the table below a valid quantum gate?
\begin{itemize}
	\item $B\ket{0} = \ket{0}$
	\item $B\ket{1} = \ket{+}$
\end{itemize}
\hint{Find a $\ket{\psi}$ so that $B\ket{\psi}$ is not a valid qubit state}

\begin{solution}
	$B\ket{+} = \frac{1 + \sqrt{2}}{2}\ket{0} + \frac{1}{2}\ket{1}$, which has a non-unit length of $\frac{\sqrt{2} + 1}{\sqrt{2}}$.
\end{solution}

\vfill



\problem{Rotation}
As we noted earlier, any rotation about the center is a valid quantum gate. \par
Let's derive all transformations of this form.
\begin{itemize}[itemsep = 1mm]
	\item Let $U_\phi$ be the matrix that represents a counterclockwise rotation of $\phi$ degrees. \par
	What is $U\ket{0}$ and $U\ket{1}$?

	\item Find the matrix $U_\phi$ for an arbitrary $\phi$.
\end{itemize}

\vfill


\problem{}
Say we have a qubit that is either $\ket{+}$ or $\ket{-}$. We do not know which of the two states it is in. \par
Using one operation and one measurement, how can we find out, for certain, which qubit we received? \par

\vfill
\pagebreak