Quantum edits

This commit is contained in:
2025-10-02 09:02:01 -07:00
parent e2947ea54b
commit f88160b5f5
6 changed files with 136 additions and 106 deletions

View File

@ -27,7 +27,7 @@ We'll represent this probabilistic bit's \textit{state} as a vector:
$\left[\begin{smallmatrix}
p_0 \\ p_1
\end{smallmatrix}\right]$ \par
We do \textbf{not} assume this coin is fair, and thus $p_0$ might not equal $p_1$.
We do \textbf{not} assume this coin is fair---$p_0$ might not equal $p_1$.
\note{
This may seem a bit redundant: since $p_0 + p_1$, we can always calculate one probability given the other. \\
@ -45,15 +45,16 @@ The simplest probabilistic bit states are of course $[0]$ and $[1]$, defined as
\item $[0] = \left[\begin{smallmatrix} 1 \\ 0 \end{smallmatrix}\right]$
\item $[1] = \left[\begin{smallmatrix} 0 \\ 1 \end{smallmatrix}\right]$
\end{itemize}
That is, $[0]$ represents a bit that we known to be \texttt{0}, \par
That is, $[0]$ represents a bit that we know to be \texttt{0}, \par
and $[1]$ represents a bit we know to be \texttt{1}.
\vfill
\pagebreak
\definition{}
$[0]$ and $[1]$ form a \textit{basis} for all possible probabilistic bit states: \par
Every other probabilistic bit can be written as a \textit{linear combination} of $[0]$ and $[1]$:
$[0]$ and $[1]$ form a \textit{basis} for all possible probabilistic bit states. This means that \par
every other probabilistic bit can be written as a \textit{linear combination} of $[0]$ and $[1]$:
\begin{equation*}
\begin{bmatrix} p_0 \\ p_1 \end{bmatrix}
@ -66,7 +67,6 @@ Every other probabilistic bit can be written as a \textit{linear combination} of
\vfill
\pagebreak
\problem{}
Every possible state of a probabilistic bit is a two-dimensional vector. \par
@ -118,6 +118,10 @@ Draw all possible states on the axis below.
%
% MARK: measure
%
\section{Measuring Probabilistic Bits}
@ -125,7 +129,7 @@ Draw all possible states on the axis below.
\definition{}
As we noted before, a probabilistic bit represents a coin we've tossed but haven't looked at. \par
We do not know whether the bit is \texttt{0} or \texttt{1}, but we do know the probability of both of these outcomes. \par
We do not know whether the bit is \texttt{0} or \texttt{1}, but we do know the probability of each outcome. \par
\vspace{2mm}
@ -135,7 +139,7 @@ knowledge of its state is updated to either $[0]$ or $[1]$, since we now certain
\vspace{2mm}
Since measurement changes what we know about a probabilistic bit, it changes the probabilistic bit's state.
When we measure a bit, it's state \textit{collapses} to either $[0]$ or $[1]$, and the original state of the
When we measure a bit, its state \textit{collapses} to either $[0]$ or $[1]$, and the original state of the
bit vanishes. We \textit{cannot} recover the state $[x_0, x_1]$ from a measured probabilistic bit.
@ -165,7 +169,10 @@ Say $[x] = [\nicefrac{2}{3}, \nicefrac{1}{3}]$ and $[y] = [\nicefrac{3}{4}, \nic
\item If we measure $y$ first and observe \texttt{1}, \par
what is the probability of getting each of \texttt{00}, \texttt{01}, \texttt{10}, and \texttt{11}?
\end{itemize}
\note[Note]{$[x]$ and $[y]$ are column vectors, but I've written them horizontally to save space.}
\note[Note]{
$[x]$ and $[y]$ are column vectors in the previous pages, and are still column vectors here. \par
I've written them horizontally to save space.
}
\vfill
@ -189,7 +196,9 @@ What is the probability that $x$ and $y$ produce different outcomes?
%
% MARK: tensor product
%
\section{Tensor Products}
@ -315,7 +324,7 @@ $?
\problem{}
What is the \textit{span} of the vectors we found in \ref{basistp}? \par
In other words, what is the set of vectors that can be written as linear combinations of the vectors above?
In other words, what is the set of all vectors that can be written as linear combinations of the vectors above?
\vfill
@ -387,7 +396,7 @@ Compute the following. Is the result what we'd expect?
\problem{}<fivequant>
Of course, writing $[0] \otimes [1]$ is a bit excessive. We'll shorten this notation to $[01]$. \par
Writing $[0] \otimes [1]$ is tedious. We'll shorten this notation to $[01]$. \par
\vspace{2mm}
@ -429,9 +438,9 @@ Write the three-bit states $[0]$ through $[7]$ as column vectors. \par
%
% MARK: ops
%
@ -443,25 +452,6 @@ Write the three-bit states $[0]$ through $[7]$ as column vectors. \par
Now that we can write probabilistic bits as vectors, we can represent operations on these bits
with linear transformations---in other words, as matrices.
\definition{}
Consider the NOT gate, which operates as follows: \par
\begin{itemize}
\item $\text{NOT}[0] = [1]$
\item $\text{NOT}[1] = [0]$
\end{itemize}
What should NOT do to a probabilistic bit $[x_0, x_1]$? \par
If we return to our coin analogy, we can think of the NOT operation as
flipping a coin we have already tossed, without looking at its state.
Thus,
\begin{equation*}
\text{NOT} \begin{bmatrix}
x_0 \\ x_1
\end{bmatrix} = \begin{bmatrix}
x_1 \\ x_0
\end{bmatrix}
\end{equation*}
\begin{hobox}{Review: Multiplying Vectors by Matrices}{black!10!white}{black!65!white}
\begin{equation*}
Av =
@ -482,6 +472,10 @@ Thus,
Note that each element of $Av$ is the dot product of a row in $A$ and a column in $v$.
\end{hobox}
\generic{Remark:}
Also, recall that every matrix is linear map, and that every linear map may be written as a matrix. \par
We often use the terms \textit{matrix}, \textit{transformation}, and \textit{linear map} interchangeably.
\problem{}
Compute the following product:
\begin{equation*}
@ -496,12 +490,23 @@ Compute the following product:
\vfill
\generic{Remark:}
Also, recall that every matrix is linear map, and that every linear map may be written as a matrix. \par
We often use the terms \textit{matrix}, \textit{transformation}, and \textit{linear map} interchangeably.
\pagebreak
\definition{}
Consider the NOT gate, which operates as follows: \par
\begin{itemize}
\item $\text{NOT}[0] = [1]$
\item $\text{NOT}[1] = [0]$
\end{itemize}
What should NOT do to a probabilistic bit $[x_0, x_1]$? \par
If we return to our coin analogy, we can think of the NOT operation as
flipping a coin we have already tossed, without looking at its state.
Thus,
\begin{equation*}
\text{NOT} \begin{bmatrix}
x_0 \\ x_1
\end{bmatrix} = \begin{bmatrix}
x_1 \\ x_0
\end{bmatrix}
\end{equation*}
\problem{}
Find the matrix that represents the NOT operation on one probabilistic bit.
@ -516,6 +521,8 @@ Find the matrix that represents the NOT operation on one probabilistic bit.
\vfill
\pagebreak
\problem{Extension by linearity}
Say we have an arbitrary operation $M$. \par

View File

@ -4,7 +4,8 @@ Quantum bits (or \textit{qubits}) are very similar to probabilistic bits, but ha
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
As before a qubit can take the extremal 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}
@ -19,8 +20,8 @@ $\ket{0}$ is pronounced \say{ket zero,} and $\ket{1}$ is pronounced \say{ket one
\vspace{2mm}
This is very similar 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]$.
When we work with qubits, we will write $\left[\begin{smallmatrix} 1 \\ 0 \end{smallmatrix}\right]$ as $\ket{0}$
and $\left[\begin{smallmatrix} 0 \\ 1 \end{smallmatrix}\right]$ as $\ket{1}$.
\vspace{8mm}
@ -28,7 +29,7 @@ and $\ket{1} = \left[\begin{smallmatrix} 0 \\ 1 \end{smallmatrix}\right]$.
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.
Quantum amplitudes may be negative!
\vspace{2mm}
@ -89,8 +90,8 @@ Write $\ket{\psi}$ as a linear combination of $\ket{0}$ and $\ket{1}$.
\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
Just like a probabilistic bit, we must observe $\ket{0}$ or $\ket{1}$ when we measure a qubit. \par
If we measure $\ket{\psi} = \psi_0\ket{0} + \psi_1\ket{1}$, we will see either $\ket{0}$ or $\ket{1}$,
with the following probabilities:
\begin{itemize}[itemsep = 2mm, topsep = 2mm]
\item $\mathcal{P}(\ket{1}) = \psi_1^2$
@ -117,7 +118,7 @@ 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 is the probability that 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}
@ -235,6 +236,10 @@ Consider the following qubit states:
\pagebreak
%
% MARK: ops
%
\section{Operations on One Qubit}
We may apply transformations to qubits just as we apply transformations to probabilistic bits.
@ -277,7 +282,7 @@ Find the matrix $X$.
\vfill
\problem{}
What is $X\ket{+}$ and $X\ket{-}$? \par
What are $X\ket{+}$ and $X\ket{-}$? \par
\hint{Remember that all matrices are linear maps. What does this mean?}
\begin{solution}
@ -331,11 +336,21 @@ 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}$?
What are $U\ket{0}$ and $U\ket{1}$?
\item Find the matrix $U_\phi$ for an arbitrary $\phi$.
\end{itemize}
\begin{solution}
\begin{equation*}
\begin{bmatrix}
cos(\theta) & -sin(\theta) \\
sin(\theta) & cos(\theta)
\end{bmatrix}
\end{equation*}
\end{solution}
\vfill
@ -343,5 +358,10 @@ Let's derive all transformations of this form.
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
\begin{solution}
Use a 45 degree ccw rotation.
\end{solution}
\vfill
\pagebreak

View File

@ -60,7 +60,7 @@ $\ket{\psi} = \frac{1}{\sqrt{2}} \ket{00} + \frac{1}{2} \ket{01} + \frac{\sqrt{3
Again, consider the two-qubit state
$\ket{\psi} = \frac{1}{\sqrt{2}} \ket{00} + \frac{1}{2} \ket{01} + \frac{\sqrt{3}}{4} \ket{10} + \frac{1}{4} \ket{11}$ \par
If we measure the first qubit of $\ket{\psi}$ and get $\ket{0}$, what is the resulting state of $\ket{\psi}$? \par
What would the state be if we'd measured $\ket{1}$ instead?
What would that state be if we'd measured $\ket{1}$ instead?
\vfill
@ -85,7 +85,7 @@ Say we measure the first two qubits and get $\ket{00}$. What is the resulting st
\definition{Entanglement}
Some product states can be factored into a tensor product of individual qubit states. For example,
Some compound states can be factored into a tensor product of individual qubit states. For example,
\begin{equation*}
\frac{1}{2} \bigl(\ket{00} + \ket{01} + \ket{10} + \ket{11}\bigr)
= \frac{1}{\sqrt{2}}\bigl( \ket{0} + \ket{1} \bigr) \otimes

View File

@ -1,40 +1,42 @@
\section{Logic Gates}
\definition{Matrices}
Throughout this handout, we've been using matrices. Again, recall that every linear map may be written as a matrix,
and that every matrix represents a linear map. For example, if $f: \mathbb{R}^2 \to \mathbb{R}^2$ is a linear
map, we can write it as follows:
\begin{equation*}
f\left(
\ket{x}
\right)
=
\begin{bmatrix}
m_1 & m_2 \\
m_3 & m_4
\end{bmatrix}
\begin{bmatrix} x_1 \\ x_2 \end{bmatrix}
=
\left[
\begin{matrix}
m_1x_1 + m_2x_2 \\
m_3x_1 + m_4x_2
\end{matrix}
\right]
\end{equation*}
%\definition{Matrices}
%cThroughout this handout, we've been using matrices. Again, recall that every linear map may be written as a matrix,
%and that every matrix represents a linear map. For example, if $f: \mathbb{R}^2 \to \mathbb{R}^2$ is a linear
%map, we can write it as follows:
%\begin{equation*}
% f\left(
% \ket{x}
% \right)
% =
% \begin{bmatrix}
% m_1 & m_2 \\
% m_3 & m_4
% \end{bmatrix}
% \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}
% =
% \left[
% \begin{matrix}
% m_1x_1 + m_2x_2 \\
% m_3x_1 + m_4x_2
% \end{matrix}
% \right]
%\end{equation*}
%
%A classical logic gate is a linear map from $\{0,1\}^m$ to $\{0,1\}^n$
\definition{}
Before we discussing multi-qubit quantum gates, we need to review to classical logic. \par
Of course, a classical logic gate is a linear map from $\{0,1\}^m$ to $\{0,1\}^n$
Before we discussing multi-qubit quantum gates, we need to review classical logic. \par
In this section, let's return to probabilistic bits.
\problem{}<notgatex>
The \texttt{not} gate is a map defined by the following table: \par
\begin{itemize}
\item $X\ket{0} = \ket{1}$
\item $X\ket{1} = \ket{0}$
\item $X[0] = [1]$
\item $X[1] = [0]$
\end{itemize}
Write the \texttt{not} gate as a matrix that operates on single-bit vector states. \par
@ -93,11 +95,11 @@ Find a matrix $A$ so that $A\ket{\texttt{ab}}$ works as expected. \par
\vspace{2mm}
For example, if we look at the first column of $A$ (which is $[1, 0]$), we see: \par
$A\ket{00} = A[1,0,0,0] = [1,0] = \ket{0}$
$A[00] = A[1,0,0,0] = [1,0] = [0]$
\vspace{2mm}
Also with the last column (which is $[0,1]$): \par
$A\ket{00} = A[0,0,0,1] = [0,1] = \ket{1}$
$A[00] = A[0,0,0,1] = [0,1] = [1]$
\end{instructornote}
\end{solution}
@ -244,10 +246,10 @@ Say we want to invert the first bit of a two-bit state. That is, we want a trans
In other words, we want a matrix $T$ satisfying the following equalities:
\begin{itemize}
\item $T\ket{00} = \ket{10}$
\item $T\ket{01} = \ket{11}$
\item $T\ket{10} = \ket{00}$
\item $T\ket{11} = \ket{01}$
\item $T[00] = [10]$
\item $T[01] = [11]$
\item $T[10] = [00]$
\item $T[11] = [01]$
\end{itemize}
@ -256,8 +258,8 @@ In other words, we want a matrix $T$ satisfying the following equalities:
Find the matrix that corresponds to the above transformation. \par
\hint{
Remember that
$\ket{0} = \left[\begin{smallmatrix} 1 \\ 0 \end{smallmatrix}\right]$ and
$\ket{1} = \left[\begin{smallmatrix} 0 \\ 1 \end{smallmatrix}\right]$ \\
$[0] = \left[\begin{smallmatrix} 1 \\ 0 \end{smallmatrix}\right]$ and
$[1] = \left[\begin{smallmatrix} 0 \\ 1 \end{smallmatrix}\right]$ \\
Also, we found earlier that $X = \left[\begin{smallmatrix} 0 && 1 \\ 1 && 0 \end{smallmatrix}\right]$,
and of course $I = \left[\begin{smallmatrix} 1 && 0 \\ 0 && 1 \end{smallmatrix}\right]$.
}
@ -279,25 +281,26 @@ Find the matrix that corresponds to the above transformation. \par
We could draw the above transformation as a combination $X$ and $I$ (identity) gate:
\begin{center}
\begin{tikzpicture}[scale=0.8]
\node[qubit] (a) at (0, 0) {$\ket{0}$};
\node[qubit] (b) at (0, -1) {$\ket{0}$};
\node[qubit] (a) at (0, 0) {$[0]$};
\node[qubit] (b) at (0, -1) {$[0]$};
\draw[wire] (a) -- ([shift={(3, 0)}] a.center) node[qubit] {$\ket{1}$};
\draw[wire] (b) -- ([shift={(3, 0)}] b.center) node[qubit] {$\ket{0}$};
\draw[wire] (a) -- ([shift={(3, 0)}] a.center) node[qubit] {$[1]$};
\draw[wire] (b) -- ([shift={(3, 0)}] b.center) node[qubit] {$[0]$};
\qubox{a}{1}{a}{2}{$X$}
\qubox{b}{1}{b}{2}{$I$}
\end{tikzpicture}
\end{center}
We can even omit the $I$ gate, since we now know that transformations affect the whole state: \par
We can even omit the $I$ gate. We know that transformations affect the whole state,
and can assume the empty space uncer $X$ implies $I$. \par
\begin{center}
\begin{tikzpicture}[scale=0.8]
\node[qubit] (a) at (0, 0) {$\ket{0}$};
\node[qubit] (b) at (0, -1) {$\ket{0}$};
\node[qubit] (a) at (0, 0) {$[0]$};
\node[qubit] (b) at (0, -1) {$[0]$};
\draw[wire] (a) -- ([shift={(3, 0)}] a.center) node[qubit] {$\ket{1}$};
\draw[wire] (b) -- ([shift={(3, 0)}] b.center) node[qubit] {$\ket{0}$};
\draw[wire] (a) -- ([shift={(3, 0)}] a.center) node[qubit] {$[1]$};
\draw[wire] (b) -- ([shift={(3, 0)}] b.center) node[qubit] {$[0]$};
\qubox{a}{1}{a}{2}{$X$}
\end{tikzpicture}

View File

@ -1,7 +1,7 @@
\section{HXH}
Let's return to the quantum circuit diagrams we discussed a few pages ago. \par
Keep in mind that we're working with quantum gates and proper half-qubits---not classical bits, as we were before.
Keep in mind that we're working with quantum gates and proper qubits---not classical bits, as we were before.
\definition{Controlled Inputs}
A \textit{control input} or \textit{inverted control input} may be attached to any gate. \par
@ -289,7 +289,7 @@ $\ket{-} = \frac{1}{\sqrt{2}}\Bigl(\ket{0} - \ket{1}\Bigr)$
\pagebreak
\generic{Remark:}
Now, consider the following circuit:
Consider the following circuit:
\begin{center}
\begin{tikzpicture}[scale=0.8]
@ -386,21 +386,21 @@ but the state $\ket{cd}$ on the right is $\ket{11} = [0,0,0,1]$. \par
\vspace{4mm}
How does this make sense? \par
Remember that a two-bit quantum state is \textit{not} equivalent to a pair of one-qubit quantum states.
We must treat a multi-qubit state as a single unit.
Remember that a two-bit quantum state is \textit{not} equivalent to a pair of disjoint one-qubit quantum states.
We cannot treat a multi-qubit state as a combination of $n$ independent bits.
Recall that a two-bit state $\ket{ab}$ comes with four probabilities:
$\mathcal{P}(\texttt{00})$, $\mathcal{P}(\texttt{01})$, $\mathcal{P}(\texttt{10})$, and $\mathcal{P}(\texttt{11})$.
\vspace{2mm}
A two-bit state $\ket{ab}$ comes with four probabilities:
$\mathcal{P}(\texttt{00})$, $\mathcal{P}(\texttt{01})$, $\mathcal{P}(\texttt{10})$, and $\mathcal{P}(\texttt{11})$. \par
If we change the probabilities of only $\ket{a}$, \textit{all four of these change!}
\vfill
Because of this fact, \say{controlled gates} may not work as you expect. They may seem
to \say{read} their controlling qubit without affecting its state, but remember---a
controlled gate still affects the \textit{entire} state. As we noted before, it is
not possible to apply a transformation to one bit of a quantum state.
Because of this fact, \say{controlled gates} behave in a somewhat counterintuitive way.
They do not simply \say{read} their controlling qubit without affecting its state---
they mutate the entire state they are applied to, and may change all its bits!
\begin{center}
\begin{tikzpicture}[scale=1]

View File

@ -12,7 +12,7 @@ Consider the following entangled two-qubit states, called the \textit{bell state
The probabilistic bits we get when measuring any of the above may be called \textit{anticorrelated bits}. \par
If we measure the first bit of any of these states and observe $1$, what is the resulting compound state? \par
What if we observe $0$ instead? \par
Do you see why we can call these bits anticorrelated?
Do you see why we call these bits \say{anticorrelated}?
\vfill