Browse Source

Deutsch's algorithm

main
Tom Krüger 1 year ago
parent
commit
f75b9b5ba6
3 changed files with 82 additions and 0 deletions
  1. +80
    -0
      content.tex
  2. BIN
      main.pdf
  3. +2
    -0
      main.tex

+ 80
- 0
content.tex View File

@ -338,4 +338,84 @@ a_0 \ket{0} + a_1 \ket{1}
The key observation can already be made in \cref{eq:hadamard_on_superposition}. Probability amplitudes can destructively interfere with each other. In \cref{eq:hadamard_on_superposition} this can be seen in the term $(a_0 - a_1)$ and in \cref{eq:2_hadamards_on_superposition} the amplitudes cancel each other out just perfectly to restore the original input state. It can't be mentioned enough: probability amplitudes are not probabilities. Destructive Interference is not possible with stochastic matrices from \cref{sec:stocastic_matrix_model} with all their entries being strictly positive. The next section shows how interference effects can be utilized effectively to outperform any probabilistic computation.
\subsubsection{Deutsch's Algorithm}
Given a function $f : \parensc{0,1} \to \parensc{0,1}$, the problem at hand is to determine whether $f(0) \stackrel{?}{=} f(1)$. Obviously, deterministic and even probabilistic computations need to evaluate $f$ two times, once for each input, in order to answer this question. Surprisingly, orthogonal computations only need one call to $f$. But how is that possible?
First, function evaluation needs to be addressed in the context of orthogonal computations. The requirement of orthogonality requires all computations to be reversible. But what if $f$ is not injective e.g. $f(0) = f(1)$? Well, a simple trick solves this dilemma: Instead of evaluating $f$ directly, $f$ will be wrapped by an orthogonal operator $O_f$. Note that the $\XOR$ operator:
\begin{center}
\begin{tabular}{c c}
\begin{tikzcd}
\lstick{$\ket{x}$} & \ctrl{1} & \qw \rstick{$\ket{x}$} \\
\lstick{$\ket{y}$} & \targ{} & \qw \rstick{$\ket{y \oplus x}$}
\end{tikzcd} &
$
\hat{\XOR} = \begin{pmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0
\end{pmatrix}
$ \\
\end{tabular}
\end{center}
is reversible as $\XOR \ket{x, y \oplus x} = \ket{x, y \oplus x \oplus x} = \ket{x,y}$. From the matrix form it apparent that $O_f$ even is orthogonal. Similarly, it follows that $O_f \ket{x,y} \coloneqq \ket{x, y \oplus f(x)}$ is reversible. A closer look reveals that $O_f$ just permutes the basis states depending on $f$ and again it is easily verifiable that $O_f O_f = \idmat$, making $O_f$ orthogonal.
\begin{center}
\begin{tabular}{c c}
\begin{tikzcd}
\lstick{$\ket{x}$} & \gate[wires=2]{O_f} & \qw \rstick{$\ket{x}$} \\
\lstick{$\ket{y}$} & & \qw \rstick{$\ket{y \oplus f(x)}$}
\end{tikzcd}
&
$
O_f = \begin{pmatrix}
1-f(0) & f(0) & 0 & 0 \\
f(0) & 1-f(0) & 0 & 0 \\
0 & 0 & 1-f(1) & f(1) \\
0 & 0 & f(1) & 1-f(1) \\
\end{pmatrix}
$
\end{tabular}
\end{center}
So it is indeed possible to evaluate a function $f : \parensc{0, 1} \to \parensc{0, 1}$ in the orthogonal computational model. If the second qubit $\ket{y}$ is chosen initialized as $\ket{0}$, measuring that qubit in the computational basis after the application of $O_f$ returns the value of $f(x)$. The trick that makes it possible to anwser $f(0) \stackrel{?}{=} f(1)$ with one call to $O_f$ is to initialize both qubits in a perfect superposition of $\ket{0}$ and $\ket{y}$. Then, both values of $f(0)$ and $f(1)$ will interfere $\ket{y}$.
\begin{center}
\begin{quantikz}
\lstick{$\ket{0}$} & \gate{H}\slice{$\ket{z_1}$} & \gate[2]{O_f}\slice{$\ket{z_2}$} & \gate{H} & \meter{}\\
\lstick{$\ket{1}$} & \gate{H} & & \qw & \qw
\end{quantikz}
\end{center}
So, now it is time to examen this circuit in detail to understand it's inner workings. After the first Hadamard gates the system is in state
\begin{align*}
\ket{z_1} &= \frac{1}{2} \parens{(\ket{0} + \ket{1}) \otimes (\ket{0} - \ket{1})} \\
&= \frac{1}{2} \parens{\ket{00} - \ket{01} + \ket{10} - \ket{11}}
\end{align*}
applying $O_f$ changes the system state to
$$
\begin{array}{c c c}
O_f\ket{z_1} &= \frac{1}{2}\parens*{\begin{aligned}
&(1 - f(0) - f(0))\ket{00} + \\
&(f(0) - 1 + f(0))\ket{01} + \\
&(1 - f(1) - f(1))\ket{10} + \\
&(f(1) - 1 + f(1))\ket{11}
\end{aligned}}
&= \frac{1}{2}\parens*{\begin{aligned}
&(-1)^{f(0)}\ket{00} - \\
&(-1)^{f(0)}\ket{10} + \\
&(-1)^{f(1)}\ket{01} - \\
&(-1)^{f(1)}\ket{11} \\
\end{aligned}} \\
&\multicolumn{2}{l}{=\frac{1}{2}\parens*{\parens*{(-1)^{f(0)}\ket{0} + (-1)^{f(1)}\ket{1}} \otimes
\parens*{\ket{0} - \ket{1}}}} \\
&\multicolumn{2}{l}{=\ket{z_2}}
\end{array}
$$
That is a lot to digest, but what happened is: Both qubits interfered with each other and although $f$ got applied to the second qubit, the effect of this operation moved through the amplitudes to the first qubit. From now on the second qubit is not important anymore, so only the first one will be considered from now on. The first bit viewed as an isolated system is in state $\sfrac{1}{\sqrt{2}}\parens{(-1)^{f(0)}\ket{0} + (-1)^{f(1)}\ket{1}}$. Applying a Hadamard gate results in
\begin{align*}
&H\frac{1}{\sqrt{2}}\parens*{(-1)^{f(0)}\ket{0} + (-1)^{f(1)}\ket{1}} = \\
&\frac{1}{2}\parens*{(-1)^{f(0)}(\ket{0} + \ket{1}) + (-1)^{f(1)}(\ket{0} - \ket{1})} = \\
&\frac{1}{2}\parens*{(-1)^{f(0)}\ket{0} + (-1)^{f(0)}\ket{1} +(-1)^{f(1)}\ket{0} - (-1)^{f(1)}\ket{1}} = \\
&\frac{1}{2}\parens*{\parens*{(-1)^{f(0)} + (-1)^{f(1)}}\ket{0} + \parens*{(-1)^{f(0)} - (-1)^{f(1)}}\ket{1}} = \\
&\frac{1}{2}(-1)^{f(0)}\parens*{\parens*{1 + (-1)^{f(0) \oplus f(1)}}\ket{0} + \parens*{1 - (-1)^{f(0) \oplus f(1)}}\ket{1}}
\end{align*}
Now measuring the first bit returns $\ket{0}$ iff $f(0) = f(1)$ and otherwise $\ket{1}$.
\todo[inline]{rename qubits as the term is not yet defined}

BIN
main.pdf View File


+ 2
- 0
main.tex View File

@ -15,6 +15,7 @@
\usepackage{cleveref}
\usepackage{tikz}
\usetikzlibrary{quantikz}
\usepackage{standalone}
\usepackage{tkz-euclide}
@ -23,6 +24,7 @@
\newcommand{\contentsketch}[2][]{\todo[inline, color=yellow, #1]{#2}}
\DeclareMathOperator{\XOR}{\text{XOR}}
\newcommand{\ptrans}{\delta}
\DeclarePairedDelimiter{\parens}{\lparen}{\rparen}
\DeclarePairedDelimiter{\parensc}{\{}{\}}


Loading…
Cancel
Save