\documentclass[11pt]{article}
\usepackage[margin = 1in]{geometry}
\usepackage{amsmath,amsthm,amsfonts,amssymb}
\usepackage{mathtools}
\usepackage{color,graphicx,overpic}
\usepackage{mathrsfs}
\usepackage{enumitem}
\usepackage{braket}
\usepackage{parskip}
\usepackage[numbers]{natbib}
\usepackage[colorlinks,allcolors=blue]{hyperref}
\bibliographystyle{hyperabbrv}
\usepackage{caption}
\captionsetup[figure]{labelfont=bf}
% \bibliographystyle{plainnat}

\newtheorem{thm}{Theorem}
\newtheorem*{thm*}{Theorem}
\newtheorem{claim}[thm]{Claim}
\newtheorem{algorithm}{Algorithm}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{proto}{Protocol}
\newtheorem{con}[thm]{Conjecture}
\theoremstyle{definition}
\newtheorem{remark}{Remark}
\newtheorem{observation}{Observation}
\newtheorem{example}{Example}
\newtheorem{conjecture}{Conjecture}
\newtheorem{dfn}[thm]{Definition}
\theoremstyle{plain}

\allowdisplaybreaks{}

\begin{document}

\title{\bf Numerical Analysis of the Collision Probability in Pseudo-Random Quantum Circuits}
\date{}
\author{Matthew Khoury}
\maketitle

% \noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
\numberwithin{equation}{section}

\begin{abstract}
We introduce two conjectures that predict how the expected value of the collision probability in a pseudo-random quantum circuit behaves as a function of both the depth of the circuit and the number of qubits in the circuit. We then present an algorithm to compute the collision probability of a stabilizer state in polynomial time. Lastly, we show that some of our numerical results strongly agree with the predictions made by the conjectures while others only loosely agree with those predictions.
\end{abstract}

\section{Introduction}
Current research suggests that quantum computers may be able to outperform classical computers in certain classes of algorithms. For example, as described in {\cite{supremacy_1}} and {\cite{supremacy_2}}, certain sampling tasks may be more efficient on small quantum computers than on current classical computers. One such task is to apply a set of random gates to $n$ qubits in the state $\ket{0}^{\otimes n}$, then measure the qubits in the computational basis.

One feasible way to accomplish this task is to lay the $n$ qubits out onto a lattice or a complete graph and then apply a polynomial number of random two qubit gates. We will refer to such a set of gates as a \emph{pseudo-random quantum circuit}. In this paper, we will describe numerical simulations that we have used to test one of the statistical properties of these pseudo-random quantum circuits.

\section{Statistical Property of Pseudo-Random Quantum Circuits}

\subsection{Definition of Collision Probability}
Imagine we prepare two identical quantum states of $n$ qubits represented as $\ket{\psi} \in \mathbb{C}^{2^n}$. We then measure both states in the computational basis, letting random variables $M_1$ and $M_2$ denote the outcomes of the two measurements. We then define the \emph{collision probability} $P_c$ as the probability of measuring the same state twice, so we have
\begin{equation}
P_c = P(M_1 = M_2)
\end{equation}
Using the basic rules of probability along with the fact that the two measurements are independent, we can simplify $P_c$ by writing
\begin{align}
  P_c &= P(M_1 = M_2) \\
      &= P \bigl( \bigl\{ \{M_1 = z_1\} \cap \{M_2 = z_1\} \bigr\} \cup \cdots \cup
        \bigl\{ \{M_1 = z_{2^n}\} \cap \{M_2 = z_{2^n}\} \bigr\} \bigr) \\
      &= \sum\limits_{z \in \mathbb{F}_2^n} P(\{M_1 = z\} \cap \{M_2 = z\}) \\
      &= \sum\limits_{z \in \mathbb{F}_2^n} P(M_1 = z) P(M_2 = z) \\
      &= \sum\limits_{z \in \mathbb{F}_2^n} {(p(z))}^2
\end{align}
Where $p(z)$ is the probability of measuring state $\ket{z}$ from $\ket{\psi}$. We know that we can write this probability as
\begin{equation}
  p(z) = |\braket{z | \psi}|^2 = \braket{z | \psi} \braket{z | \psi}^*
  = \braket{z | \psi} \braket{\psi | z}
\end{equation}
Likewise, we can rewrite the collision probability as
\begin{equation}\label{collision_probability}
  P_c = \sum\limits_{z \in \mathbb{F}_2^n} {(p(z))}^2
  = \sum\limits_{z \in \mathbb{F}_2^n} {\left( \braket{z | \psi} \braket{\psi | z} \right)}^2
\end{equation}

\subsection{Collision Probability in Pseudo-Random Quantum Circuits}\label{cp_conjecture}
If we have applied a total of $N = O(\text{poly}(n))$ gates in a pseudo-random quantum circuit, then the \emph{depth} $d$ of the circuit is defined as $d \sim N / n$. The statistical property of pseudo-random quantum circuits we are interested in testing is how the collision probability changes as a function of both the depth of the circuit $d$ and the number of qubits in the circuit $n$.

We note that in a pseudo-random quantum circuit, the final quantum state of the circuit can be modeled as a random variable. Likewise, the collision probability in a pseudo-random quantum circuit is also a random variable. With that said, we would like test the following conjectures. \\
\begin{conjecture}\label{conjecture_1}
  The collision probability in a pseudo-random quantum circuit arranged in a $w$-dimensional lattice will have an expected value
  \begin{equation}
    \langle P_c \rangle= \frac{2^{O(n/d^w)}}{2^n}
  \end{equation}
  Equivalently, we will have
  \begin{equation}
    - \log_2( \langle P_c \rangle ) = n - O\left( \frac{n}{d^w} \right)
    = n \left(1 - O\left( \frac{1}{d^w} \right) \right)
  \end{equation}
We also say that the collision probability is \emph{saturated} once $-\log_2( \langle P_c \rangle) = n - 1$. Thus, the conjecture also predicts that collision probability saturates when
\begin{equation}
  O\left(\frac{1}{d^w} \right) = \frac{1}{n} \quad \Rightarrow \quad
  d \sim n^{1/w}
\end{equation}
\end{conjecture}

\begin{conjecture}\label{conjecture_2}
  The collision probability in a pseudo-random quantum circuit arranged in a complete graph will have an expected value
  \begin{equation}
    \langle P_c \rangle = \frac{2^{O(n/e^{N/n})}}{2^n}
  \end{equation}
  Similarly, we will have
  \begin{equation}
    - \log_2( \langle P_c \rangle ) = n - O\left(\frac{n}{e^{N/n}}\right)
    = n \left( 1 - O\left(\frac{1}{e^{N/n}}\right) \right)
  \end{equation}
  And the circuit will be saturated when
  \begin{equation}
    O\left(\frac{1}{e^{N/n}}\right) = \frac{1}{n} \quad \Rightarrow \quad
    N \sim n \ln(n)
  \end{equation}
\end{conjecture}

\subsection{Underlying Intuition}
The intuition underlying Conjectures {\ref{conjecture_1}} and {\ref{conjecture_2}} is as follows. We start with the idea that in a $w$-dimensional lattice, we expect a qubit to be able to interact with $O(d^w)$ of its surrounding qubits after the circuit reaches a depth of $d$. Likewise, we expect that after the circuit has reached a depth $d$, there will be clusters of Haar Random qubits of size $O(d^w)$\footnote{A Haar Random quantum circuit of $n$ qubits will have an expected collision probability of $2 / 2^n$.}. Moreover, there will be $n / O(d^w)$ of these clusters and we expect these clusters to be independent of one another. As a result, the expected collision probability in a $w$-dimensional lattice will be
\begin{equation}
  \langle P_c \rangle = {\left( \frac{2}{2^{O(d^w)}} \right)}^{n / O(d^w)}
  = \frac{2^{O(n/d^w)}}{2^n}
\end{equation}
To generalize, we would expect that after a depth $d$, we will have $n / O(f(d))$ independent clusters of size $O(f(d))$ that are each Haar Random. We also expect that the function $f(d)$ will be determined by the geometry of the circuit. Likewise, the intuition behind Conjecture {\ref{conjecture_2}} would be to set $f(d) = e^{d} = e^{N/n}$, as we would expect the cluster sizes in a complete graph to be much larger than those in a lattice.

\section{The Stabilizer Formalism}

\subsection{Motivation}
In general, simulating a pseudo-random quantum circuit on a classical computer will take both exponentially large storage and an exponentially large runtime. Thus, in order to simulate a pseudo-random quantum circuit to numerically test Conjectures {\ref{conjecture_1}} and {\ref{conjecture_2}}, we make use of the Gottesman-Knill Theorem.

The Gottesman-Knill Theorem states that a quantum circuit composed only of Clifford Gates can be efficiently simulated on a classical computer. In this section, we review some of the mathematical principles underlying the Gottesman-Knill Theorem, as they will be necessary for explaining how our simulations work. Many concepts in this section can be found more thoroughly described in Chapter 10.5 of {\cite{nc}}.

\subsection{The Pauli Group}
We let $G_n$ denote the Pauli Group on $n$ qubits. Formally, we define \begin{equation}
  G_1 = \{ \pm I, \pm i I, \pm X, \pm iX, \pm Y, \pm i Y, \pm Z, \pm i Z \}
\end{equation}
Where
\begin{equation}
I =
\begin{bmatrix}
  1 & 0 \\
  0 & 1 \\
\end{bmatrix} \quad
X =
\begin{bmatrix}
  0 & 1 \\
  1 & 0 \\
\end{bmatrix} \quad
Y =
\begin{bmatrix}
  0 & -i \\
  i & 0 \\
\end{bmatrix} \quad
Z =
\begin{bmatrix}
  1 & 0 \\
  0 & -1 \\
\end{bmatrix}
\end{equation}
Likewise, the set $G_n$ consists of all the $n$-fold tensor product of the matrices in $G_1$. We see that the Pauli Group is closed under matrix multiplication, as these matrices satisfy
\begin{align}
  & X^2 = Y^2 = Z^2 = I \label{pauli_1}\\
  & XY = iZ \quad YX = -iZ \\
  & YZ = iX \quad ZY = -iX \\
  & ZX = iY \quad XZ = -iY \label{pauli_3}
\end{align}
From this we also see that all of the elements in $G_n$ either commute or anti-commute. We also note that any $g \in G_n$ can be written as
\begin{equation}\label{pauli_2}
  g = {(-1)}^a \ i^b \ g_1 \otimes g_2 \otimes \cdots \otimes
  g_n \quad \text{for} \quad a, b \in \mathbb{F}_2 \quad \text{and} \quad
  g_j \in \{ I, X, Y, Z \}
\end{equation}

\subsection{Isomorphism to $\mathbb{F}_2$}
We use $\mathbb{F}_2$ to refer to the finite field $\mathbb{F}_2 \in \{0, 1\}$. All operations are done modulo 2, so we will have $1 + 1 = 0$ and $x = -x$. We can also see that $\mathbb{F}_2$ defines a group closed under addition modulo 2.

We define the map $M: \mathbb{F}_2^2 \rightarrow \{I, X, Y, Z\}$ as
\begin{equation}
  00 \rightarrow I, \quad 01 \rightarrow Z, \quad 10 \rightarrow X, \quad
  11 \rightarrow Y
\end{equation}
Likewise, from {\ref{pauli_2}}, if we let $u = (u_s, u_i, u_{x_1}, \ldots, u_{x_n}, u_{z_1}, \ldots, u_{z_n}) \in \mathbb{F}_2^{2n+2}$, we can write any element $g \in G_n$ as
\begin{equation}
  g = {(-1)}^{u_s} \ i^{u_i} \ M(u_{x_1}, u_{z_1}) \otimes \cdots \otimes
  M(u_{x_n}, u_{z_n})
\end{equation}
In shorthand, we will write that $v = (v_{x_1}, \ldots, v_{x_n}, v_{z_1}, \ldots, v_{z_n}) = (v_x, v_z) \in \mathbb{F}_2^{2n}$ and that
\begin{equation}\label{shorthand_1}
  M(v) = M(v_x, v_z) = M(v_{x_1}, v_{z_1}) \otimes \cdots \otimes
  M(v_{x_n}, v_{z_n})
\end{equation}

We also let $[A]$ be the set of operators that are the same up to a global phase so that
\begin{equation}
  [A] = \{\beta A : \beta \in \mathbb{C} , |\beta| = 1 \}
\end{equation}
Using {\ref{pauli_1}} {--} {\ref{pauli_3}}, we can see that the map $M$ induces an isomorphism $[M]: \mathbb{F}_2^{2n} \rightarrow [G_n]$ because addition of vectors in $\mathbb{F}_2^{2n}$ corresponds to the multiplication of matrices in $G_n$ up to a global phase
\begin{equation}\label{isomorphism}
  [M(u + v)] = [M(u)][M(v)] \quad \text{for} \quad u, v \in \mathbb{F}_2^{2n}
\end{equation}

\subsection{The Stabilizer Group}
A quantum state $\ket{\psi}$ is said to be \emph{stabilized} by a unitary operator $g$ if and only if $g \ket{\psi} = \ket{\psi}$. The \emph{stabilizer group} $S$ is a subgroup of $G_n$, which we denote as $S \leq G_n$. We then define a \emph{stabilizer subspace} $V_S$ to be the set of states that is stabilized by $S$, or more formally
\begin{equation}
  V_S = \left\{ \ket{\psi} : g \ket{\psi} = \ket{\psi} , \forall g \in S \right\}
\end{equation}
Here we note that if $g, h \in S$, then we must also have $gh \in S$ and $g^{-1} \in S$ because
\begin{equation}\label{stab_1}
  gh \ket{\psi} = g \ket{\psi} = \ket{\psi} \quad \text{and} \quad
  \ket{\psi} = g^{-1} g \ket{\psi} = g^{-1} \ket{\psi}
\end{equation}
We also note that if we would like $V_S$ to be a non-trivial vector space\footnote{The trivial vector space is $V_s = \{0 \}$}, $S$ must satisfy two conditions
\begin{enumerate}[label = (\arabic*)]
\item\label{cond_1} The elements of $S$ must commute
\item\label{cond_2} $-I$ cannot be an element of $S$
\end{enumerate}
We see that condition {\ref{cond_2}} must hold because if $-I \in S$, then we will have that $-I \ket{\psi} = \ket{\psi}$, which can only be satisfied by $\ket{\psi} = 0$. We see that condition {\ref{cond_1}} must also hold because all of the elements in $S$ either commute or anti-commute, as $S \leq P_n$. This means that if two elements $g, h \in S$ do not commute, then they must anti-commute so that $gh = -hg$. But if this is the case, then $-\ket{\psi} = -hg \ket{\psi} = gh \ket{\psi} = \ket{\psi}$, which can also only be satisfied by $\ket{\psi} = 0$.

Moreover, if $g \in S$, then $g$ cannot have an overall phase of $\pm i$. This follows because if we let
\begin{equation}
  g = \pm i \ g_1 \otimes g_2 \otimes \cdots \otimes g_n
  \quad \text{for} \quad g_j \in \{I, X, Y, Z \}
\end{equation}
Then using {\ref{pauli_1}} and {\ref{stab_1}}, we see that
\begin{equation}
  \ket{\psi} = g \ket{\psi} = g^2 \ket{\psi} = {(\pm i)}^2 I^{\otimes n} \ket{\psi}
  = -\ket{\psi}
\end{equation}
Again, this is only satisfied when $\ket{\psi} = 0$. Thus, if $S$ stabilizes a non-trivial vector space, then we can write any element $g \in S$ as
\begin{equation}
  g = \pm 1 \ g_1 \otimes g_2 \otimes \cdots \otimes g_n
  \quad \text{for} \quad g_j \in \{I, X, Y, Z \}
\end{equation}
In terms of the $\mathbb{F}_2$ linear algebra perspective, this means that we can represent any $g \in S$ as a vector $u = (u_s, u_x, u_z) \in \mathbb{F}_2^{2n+1}$ where using the shorthand notation in {\ref{shorthand_1}} we have
\begin{equation}\label{stab_shorthand}
  g = {(-1)}^{u_s} M(u_x, u_z)
\end{equation}

\subsection{Clifford Gates}\label{clifford_gates}
It has been shown in {\cite{nc}} and {\cite{aaronson}} that we can actually make use of the $\mathbb{F}_2$ linear algebra perspective to efficiently simulate quantum circuits composed of the following gates.
\begin{align}
  H \left( \alpha \ket{0} + \beta \ket{1} \right)
  &= \frac{\alpha + \beta}{\sqrt{2}} \ket{0}
    + \frac{\alpha - \beta}{\sqrt{2}} \ket{1} \label{cg_1}\\
  P \left( \alpha \ket{0} + \beta \ket{1} \right) &= \alpha \ket{0}
    + i \beta \ket{1} \\
  C_{a,b}\left( \ket{a} \otimes \ket{b} \right) &= \ket{a} \otimes \ket{a + b}
    \quad \text{for} \quad a, b \in \mathbb{F}_2 \label{cg_2}
\end{align}
Any quantum circuit that can be decomposed into these three gates is said to only contain \emph{Clifford Gates}. In order to simulate a quantum circuit composed only of Clifford Gates, we keep track of the generators of the stabilizer group of $\ket{\psi}$, which we initialize as $\ket{0}^{\otimes n}$. We then update the generators as described in {\cite{aaronson}} each time we apply one of the gates above. Moreover, it has been shown that a state $\ket{\psi}$ created by applying Clifford Gates to $\ket{0}^{\otimes n}$ is uniquely determined by a stabilizer group $S \leq P_n$ that contains $2^n$ elements. Likewise, we only need a total of $n$ generators, or vectors in $\mathbb{F}_2^{2n+1}$, in order to uniquely determine such a state.\footnote{If $G$ is a group closed under multiplication, then a set of elements $g_1, \ldots, g_l \in G$ is said to generate a group $G$ if every element in $G$ can be written as a product of the elements in $g_1, \ldots, g_l$. Moreover, it is a known fact from Group Theory that a finite group $G$ of size $|G|$ has a set of at most $\log_2(|G|)$ generators. }

\subsection{Projectors}
If $W \subseteq \mathbb{C}^{2^n}$ is a $w$-dimensional vector subspace, then a \emph{projector} $\Pi_W$ onto the vector subspace $W$ is a linear operator that satisfies two conditions
\begin{enumerate}[label = (\arabic*)]
\item\label{p_cond_1}
  For all $\ket{\phi} \in \mathbb{C}^{2^n}$, $\Pi_W \ket{\phi} \in W$
\item\label{p_cond_2} $\Pi_W^2 = \Pi_W$
\end{enumerate}
Likewise, if $W$ has an orthonormal basis $\ket{1}, \ket{2}, \ldots, \ket{w}$, then
\begin{equation}\label{proj_1}
  \Pi_W = \sum\limits_{j=1}^w \ket{j}\bra{j}
\end{equation}

\begin{claim}
$\Pi_S$ given by
\begin{equation}\label{proj_2}
  \Pi_S = \frac{1}{|S|} \sum\limits_{g \in S} g
\end{equation}
is a projector onto the stabilizer subspace $V_S$.
\begin{proof} First we note that if $g \in S$, then using {\ref{stab_1}}
\begin{equation}
  g \Pi_S = g \frac{1}{|S|} \sum\limits_{h \in S} h
  = \frac{1}{|S|} \sum\limits_{h \in S} gh
  = \frac{1}{|S|} \sum\limits_{h' = gh \in S} h'
  = \Pi_s
\end{equation}
From this, we see that $\Pi_S$ satisfies condition {\ref{p_cond_1}} because for all $\ket{\phi} \in \mathbb{C}^{2^n}$ and for all $g \in S$ we have $g \Pi_S \ket{\phi} = \Pi_S \ket{\phi}$. By definition, this means that $\Pi_S \ket{\phi} \in V_S$. We also see that $\Pi_S$ satisfies condition {\ref{p_cond_2}} because
\begin{equation}
  \Pi_S^2 = \left( \frac{1}{|S|} \sum\limits_{g \in S} g \right) \Pi_S
  = \frac{1}{|S|} \sum\limits_{g \in S} g \Pi_S
  = \frac{1}{|S|} \sum\limits_{g \in S} \Pi_S
  = \frac{1}{|S|} \ |S| \ \Pi_S = \Pi_S
\end{equation}
\end{proof}
\end{claim}

Here we also note that if $V_S$ contains only one vector so that $V_S = \{ \ket{\psi} \}$, then combining {\ref{proj_1}} and {\ref{proj_2}}, we see that
\begin{equation}\label{proj_3}
    \Pi_S = \frac{1}{|S|} \sum\limits_{g \in S} g = \ket{\psi} \bra{\psi}
\end{equation}

\section{Efficiently Computing Collision Probability}

\subsection{Preliminaries}
As described in Section {\ref{clifford_gates}}, we can efficiently simulate pseudo-random quantum circuits composed only of Clifford Gates by keeping track of the $n$ generators of the stabilizer group $S$ that uniquely determine a stabilizer state $V_S = \{ \ket{\psi} \}$. Moreover, keeping track of these $n$ generators is equivalent to keeping track of $n$ vectors in $\mathbb{F}_2^{2n+1}$. In this section, we will present an algorithm to compute the collision probability of a stabilizer state $V_S = \{ \ket{\psi} \}$ given the $n$ vectors in $\mathbb{F}_2^{2n+1}$ corresponding to the $n$ generators of $S$.

Throughout this section we will always let $\ket{\psi}$ be a state that has been created by applying a set of Clifford Gates to the initial state $\ket{0}^{\otimes n}$. Equivalently, we let $\ket{\psi}$ be the state uniquely determined by the stabilizer group $S$ so that $V_S = \{ \ket{\psi} \}$. Moreover, we let $S = \langle g^{(1)}, \ldots, g^{(n)} \rangle$, meaning $S$ is generated by the $n$ matrices $g^{(1)}, \ldots, g^{(n)}$. For every element $g \in S$, we also let $u = (u_s, u_x, u_z) \in \mathbb{F}_2^{2n+1}$ be the vector representation of $g$ as written in {\ref{stab_shorthand}}.

By construction, we can use the fact that $|S| = 2^n$ along with {\ref{proj_3}} to write
\begin{equation}\label{prelim_1}
  \ket{\psi} \bra{\psi} = \Pi_S = \frac{1}{2^n} \sum\limits_{g \in S} g
\end{equation}
Here, we also note some properties of the trace of a matrix. Specifically for a vector $\ket{\phi}$ and matrices $A, B$ of the appropriate shape, we will have
\begin{align}
  \text{tr}(A \ket{\phi} \bra{\phi}) &=  \braket{\phi | A | \phi} \\
  \text{tr}(A + B) &= \text{tr}(A) + \text{tr}(B) \\
  \text{tr}(A \otimes B) &= \text{tr}(A) \text{tr}(B)
\end{align}
The last tool we need is the following:\\
\begin{claim}
If $a \in \mathbb{F}_2^n$ and we let $Z^a = Z^{a_1} \otimes \cdots \otimes Z^{a_n}$, then
\begin{equation}\label{prelim_2}
  \sum\limits_{z \in \mathbb{F}_2^n} \ket{z} \bra{z} \otimes \ket{z} \bra{z}
  = \frac{1}{2^n} \ \sum\limits_{a \in \mathbb{F}_2^n} Z^a \otimes Z^a
\end{equation}
\begin{proof}
First, we note that
\begin{equation}
  \ket{0} \bra{0} =
  \begin{bmatrix}
    1 & 0 \\
    0 & 0 \\
  \end{bmatrix} = \frac{I + Z}{2} \qquad
  \ket{1} \bra{1} =
  \begin{bmatrix}
    0 & 0 \\
    0 & 1 \\
  \end{bmatrix} = \frac{I - Z}{2}
\end{equation}
As a result, we can write that for any $z \in \mathbb{F}_2^n$
\begin{align}
  \ket{z} \bra{z} &= \ket{z_1} \bra{z_1} \otimes \cdots \otimes
                    \ket{z_n} \bra{z_n} \\
                  &= \frac{I + {(-1)}^{z_1} Z}{2} \otimes \cdots \otimes
                    \frac{I + {(-1)}^{z_n}Z}{2} \\
                  &= \frac{1}{2^n} \biggl(I \otimes I \otimes \cdots \otimes I
                    \ + \ {(-1)}^{z_1} Z \otimes I \otimes \ldots \otimes I
                    \ + \ I \otimes {(-1)}^{z_2} Z \otimes \cdots \otimes I
                    \nonumber \\
                  & \qquad \qquad
                    \ + \ \cdots \ + \
                    {(-1)}^{z_1} Z \otimes {(-1)}^{z_2} Z \otimes \cdots
                    \otimes {(-1)}^{z_n} Z \biggr) \\
                  &= \frac{1}{2^n} \sum\limits_{a \in \mathbb{F}_2^n}
                    {(-1)}^{\braket{a, z}} Z^a \label{prelim_4}
\end{align}
Second, we also note that for any $w \in \mathbb{F}_2^n$
\begin{equation}\label{prelim_5}
  \sum\limits_{z \in \mathbb{F}_2^n} {(-1)}^{\braket{w, z}} = 2^n \ \delta_{w = 0}
\end{equation}
We see this is the case whenever $w = 0$ because $\braket{0, z} = 0$ for all values of $z$.\footnote{In these notes, the function $\delta_{v}$ evaluates to 1 if $v$ is true and evaluates to 0 if $v$ is false} However, if $w$ has a $1$ in one or more entries, then for every $z$ such that $\braket{w, z} = 1$, there will be a $z'$ such that $\braket{w, z'} = 0$ that can be constructed by flipping one bit in $z$ that is in the same entry as a $1$ in $w$. Likewise, it follows that half of the values in the sum will evaluate to $(-1)$ while the other half evaluate to $1$, meaning the whole sum is just $0$.

Using {\ref{prelim_4}} and {\ref{prelim_5}}, we can now prove the original claim by writing
\begin{align}
  \sum\limits_{z \in \mathbb{F}_2^n} \ket{z}\bra{z} \otimes \ket{z}\bra{z}
  &= \sum\limits_{z \in \mathbb{F}_2^n}
    \left( \frac{1}{2^n} \sum\limits_{a \in \mathbb{F}_2^n}
    {(-1)}^{\braket{a,z}} Z^a \right)  \ \otimes \
    \left( \frac{1}{2^n} \sum\limits_{b \in \mathbb{F}_2^n}
    {(-1)}^{\braket{b,z}} Z^b \right) \\
  &= \frac{1}{4^n} \ \sum\limits_{a \in \mathbb{F}_2^n}
    \sum\limits_{b \in \mathbb{F}_2^n} \sum\limits_{z \in \mathbb{F}_2^n}
    {(-1)}^{\braket{a,z} + \braket{b, z}} \ Z^a \otimes Z^b  \\
  &= \frac{1}{4^n} \ \sum\limits_{a \in \mathbb{F}_2^n}
    \sum\limits_{b \in \mathbb{F}_2^n} \left( \sum\limits_{z \in \mathbb{F}_2^n}
    {(-1)}^{\braket{a + b,z}} \right) \ Z^a \otimes Z^b  \\
  &= \frac{1}{4^n} \ \sum\limits_{a \in \mathbb{F}_2^n}
    \sum\limits_{b \in \mathbb{F}_2^n} \left( 2^n \ \delta_{a+b = 0} \right)
    \ Z^a \otimes Z^b  \\
  &= \frac{1}{2^n} \  \sum\limits_{a \in \mathbb{F}_2^n}
    \sum\limits_{b \in \mathbb{F}_2^^n} \ \delta_{a = b} \
    \ Z^a \otimes Z^b \\
  &= \frac{1}{2^n} \sum\limits_{a \in \mathbb{F}_2^n} \ Z^a \otimes Z^a
\end{align}
\end{proof}
\end{claim}

\subsection{Simplifying Collision Probability}\label{simplifying_cp}
We now use {\ref{prelim_1}} {--} {\ref{prelim_2}} to simplify the expression for $P_c$ given in {\ref{collision_probability}} by writing
\begin{align}
  P_c &= \sum\limits_{z \in \mathbb{F}_2^n}
        {\left( \braket{z | \psi} \braket{\psi | z} \right)}^2 \\
      &= \sum\limits_{z \in \mathbb{F}_2^n}
        {\left( \braket{z | \Pi_S | z} \right)}^2 \\
      &= \sum\limits_{z \in \mathbb{F}_2^n}
        {\left( \text{tr}\left(\Pi_S \ket{z} \bra{z}\right) \right)}^2 \\
      &= \sum\limits_{z \in \mathbb{F}_2^n}
        \text{tr}\left( \left(\Pi_S \otimes \Pi_S \right)
        \left(\ket{z} \bra{z} \otimes \ket{z} \bra{z} \right) \right)  \\
      &= \text{tr}\left( \left(\Pi_S \otimes \Pi_S \right)
        \sum\limits_{z \in \mathbb{F}_2^n}
        \ket{z} \bra{z} \otimes \ket{z} \bra{z} \right)  \\
      &= \frac{1}{2^n} \ \text{tr}\left( \left(\Pi_S \otimes \Pi_S \right)
        \sum\limits_{a \in \mathbb{F}_2^n}
        Z^a \otimes Z^a \right)  \\
      &= \frac{1}{2^n} \  \sum\limits_{a \in \mathbb{F}_2^n}
        \text{tr}\left( \left(\Pi_S \otimes \Pi_S \right)
        \left(Z^a \otimes Z^a \right) \right) \\
      &= \frac{1}{2^n} \  \sum\limits_{a \in \mathbb{F}_2^n}
        {\left( \text{tr} \left(\Pi_S \ Z^a \right) \right)}^2 \\
      &= \frac{1}{2^n} \  \sum\limits_{a \in \mathbb{F}_2^n}
        {\left( \text{tr} \left(\frac{1}{2^n} \
        \sum\limits_{g \in S} g \ Z^a \right) \right)}^2 \\
      &= \frac{1}{2^{n}} \  \sum\limits_{a \in \mathbb{F}_2^n}
        {\left( \frac{1}{2^n} \ \sum\limits_{g \in S}
        \text{tr} \left(  g \ Z^a \right) \right)}^2 \label{simplify_1}
\end{align}
We now find an expression for the trace in {\ref{simplify_1}} by writing that for any $g \in S$ and $a \in \mathbb{F}_2^n$ we have
\begin{align}
  \text{tr} \left( g \ Z^a \right)
  &= \text{tr} \left({(-1)}^{u_s} M(u_x, u_z) Z^a \right) \\
  &= {(-1)}^{u_s} \prod\limits_{j=1}^n
    \text{tr} \left(M(u_{x_j}, u_{z_j}) Z^{a_j} \right) \label{simplify_2}\\
  &= {(-1)}^{u_s} \prod\limits_{j=1}^n
    ( 2 \ \delta_{u_{x_j}= 0} \ \delta_{u_{z_j}=a_j} ) \label{simplify_3}\\
  &= {(-1)}^{u_s} \ (2^n) \ \delta_{u_x = 0} \ \delta_{u_z = a} \label{simplify_4}
\end{align}
Where in {\ref{simplify_3}} we have used that the trace in {\ref{simplify_2}} is 2 only when the inner term evaluates to $I$. Otherwise, the trace in {\ref{simplify_2}} is just 0.

We now combine {\ref{simplify_1}} with {\ref{simplify_4}} to write
\begin{align}
P_c &= \frac{1}{2^{n}} \  \sum\limits_{a \in \mathbb{F}_2^n}
        {\left( \frac{1}{2^n} \ \sum\limits_{g \in S}
      {(-1)}^{u_s} \ (2^n) \ \delta_{u_x = 0} \ \delta_{u_z = a}  \right)}^2 \\
    &=  \frac{1}{2^{n}} \  \sum\limits_{a \in \mathbb{F}_2^n}
      {\left( \ \sum\limits_{g \in S}
      {(-1)}^{u_s} \ \delta_{u_x = 0} \ \delta_{u_z = a}  \right)}^2 \\
    &=  \frac{1}{2^{n}} \  \sum\limits_{a \in \mathbb{F}_2^n}
      {\left( \delta_{(0, 0, a) \in S} -
      \delta_{(1, 0, a)\in S} \right)}^2 \label{simplify_5}
\end{align}
Where in {\ref{simplify_5}} we use the shorthand notation $(u_s, u_x, u_z) \in S$ to mean that the matrix $g = {(-1)}^{u_s} M(u_x, u_z) \in S$. We now note that we cannot have both $(0, u_x, u_z) \in S$ and $(1, u_x, u_z) \in S$ because $V_S = \{ \ket{\psi} \}$, which is a non-trivial vector space. We see this is true because if both $(0, u_x, u_z) \in S$ and $(1, u_x, u_z) \in S$, then both $g \in S$ and $-g \in S$. As a result this would require that
\begin{equation}
  \ket{\psi} = g \ket{\psi} = -g \ket{\psi} = - \ket{\psi}
\end{equation}
And this can only be satisfied by the trivial vector space. Thus, we can further simplify {\ref{simplify_5}} by writing
\begin{align}
  P_c &=  \frac{1}{2^{n}} \  \sum\limits_{a \in \mathbb{F}_2^n}
      {\left( \pm \delta_{(0, 0, a) \in S \ \text{or} \ (1, 0, a) \in S } \right)}^2 \\
      &= \frac{1}{2^{n}} \  \sum\limits_{a \in \mathbb{F}_2^n}
        \delta_{(0, 0, a) \in S \ \text{or} \ (1, 0, a) \in S} \\
      &= \frac{ |\{(u_s, u_x, u_z) \in S : u_x = 0 \}| } {2^n}
\end{align}
We now define $U, V, W$ as
\begin{align}
  U &= \{(u_x, u_z) \in \mathbb{F}_2^{2n} : (0, u_x, u_z) \in S \text{ or }
  (1, u_x, u_z) \in S \} \label{simplify_6}\\
  V &= \{(v_x, v_z) \in \mathbb{F}_2^{2n} : v_x = 0 \} \label{simplify_7}\\
  W &= U \cap V \label{simplify_8}
\end{align}
Again, because only $(0, u_x, u_z) \in S$ or $(1, u_x, u_z) \in S$, we will have that $|U| = |S|$. Moreover, it has been shown in Chapter 10.5 of {\cite{nc}} that the $n$ vectors $u^{(1)}, \ldots, u^{(n)} \in U$ corresponding to the $n$ generators $g^{(1)}, \ldots, g^{(n)}$ of $S$ are linearly independent. Using this along with {\ref{isomorphism}}, we see that taking linear combinations of basis vectors in $U$ is isomorphic to matrix multiplying the generators of $S$. Thus, $U, V, W$ are actually all subspaces of $\mathbb{F}_2^{2n}$, which we denote as $U, V, W \subseteq \mathbb{F}_2^{2n}$.

If we let $\text{dim}(W)$ be the number of basis vectors of $W$, then we see that $|W| = 2^{\text{dim}(W)}$, meaning we can write
\begin{equation}\label{simplify_9}
  P_c = \frac{|W|}{2^n} = \frac{2^{\text{dim}(W)}}{2^n} = \frac{1}{2^{n - \text{dim}(W)}}
\end{equation}

\subsection{An Algorithm to Efficiently Compute Collision Probability}
Assume we are given a set of basis vectors for the subspace $U$, which we denote as $u^{(1)}, \ldots, u^{(n)}$. To re-iterate, these $n$ basis vectors correspond to the $n$ generators $g^{(1)}, \ldots, g^{(n)}$ of the stabilizer group $S$ that uniquely determines the stabilizer state $V_S = \ket{\psi}$ so that $g^{(j)} = \pm M(u_x^{(j)}, u_z^{(j)})$. We now provide an algorithm to efficiently compute the collision probability of the state $\ket{\psi}$\\
\begin{algorithm}\label{algo_1}
  Given the vectors $u^{(1)}, \ldots, u^{(n)}$, do the following
  \begin{enumerate}[label = (\arabic*)]
  \item Define the following vectors where each $v^{(j)} \in \mathbb{F}_2^{2n}$
    \begin{align}
      v^{(1)} &= (0, \ldots, 0, 1, 0, \ldots, 0) \\
      v^{(2)} &= (0, \ldots, 0, 0, 1, \ldots, 0) \\
              & \vdotswithin{=} \nonumber \\
      v^{(n)} &= (0, \ldots, 0, 0, 0, \ldots, 1)
    \end{align}
    Note that these form a basis for the vector space $V$ as defined in {\ref{simplify_7}} while $u^{(1)}, \ldots, u^{(n)}$ form a basis for the vector space $U$ as defined in {\ref{simplify_6}}
  \item Define the following matrices $A, B \in \mathbb{F}_2^{2n \times n}$ and $C \in \mathbb{F}_2^{2n \times 2n}$
    \begin{align}
      A &= \begin{bmatrix} {u^{(1)}}^T & {u^{(2)}}^T & \cdots & {u^{(n)}}^T
      \end{bmatrix} \\
      B &= \begin{bmatrix} {v^{(1)}}^T & {v^{(2)}}^T & \cdots & {v^{(n)}}^T
      \end{bmatrix} \\
      C &= \begin{bmatrix} A & B \end{bmatrix}
    \end{align}
  \item\label{algo_step}
    Let $r$ be the number of pivot columns in $\text{REF}(C)$. We then have $\text{dim}(W) = \text{dim}(\text{Ker}(C)) = 2n - r$, so return
    \begin{equation}\label{algo_cp}
      P_c = \frac{1}{2^{n - \text{dim}(W)}}
      = \frac{1}{2^{n - (2n - r)}} = \frac{1}{2^{r-n}}
    \end{equation}
  \end{enumerate}
\begin{proof}
  As shown in Section {\ref{simplifying_cp}}, the column vectors of matrices $A$ and $B$ are the basis vectors of the respective subspaces $U$ and $V$. Moreover, the expression for the collision probability in {\ref{algo_cp}} was also derived in section {\ref{simplifying_cp}}. Likewise, the only thing left to justify is the claim that $\text{dim}(W) = \text{dim}(\text{Ker}(C)) = 2n - r$.

  To see this, we note that the Kernel of $C = \begin{bmatrix} A & B \end{bmatrix}$ will be given by the vectors $(x, y) = \\(x_1, x_2, \ldots, x_n, y_1, y_2, \ldots, y_n) \in \mathbb{F}_2^{2n}$ such that
\begin{equation}
  \begin{bmatrix}
    A & B
  \end{bmatrix}
  \begin{bmatrix}
    x^T \\
    y^T \\
  \end{bmatrix}
  = 0
\end{equation}
Thus, all vectors ${(x, y)}^T \in \text{Ker}(C)$ will have
\begin{equation}\label{ker_1}
  Ax^T + By^T = 0 \quad \Rightarrow \quad Ax^T = By^T
  \quad \Rightarrow \quad xA^T = yB^T
\end{equation}
Where we have used that $y^T = -y^T$ when working in $\mathbb{F}_2^n$. Equivalently, this means that every vector in the $\text{Ker}(C)$ forms a simultaneous linear combination of the basis vectors in $U$ and $V$ because expanding {\ref{ker_1}} gives us
\begin{equation}
  x_1 u^{(1)} + x_2 u^{(2)} + \cdots + x_n u^{(n)} =
  y_1 v^{(1)} + y_2 v^{(2)} + \cdots + y_n v^{(n)}
\end{equation}
Likewise, we see that by definition ${(x, y)}^T \in \text{Ker}(C)$ if and only if ${(x, y)}^T \in U \cap V$. We also see that if ${(x^{(1)}, y^{(1)})}^T, {(x^{(2)}, y^{(2)})}^T \in \text{Ker}(C)$, then
\begin{equation}
\alpha (A {x^{(1)}}^T + B {y^{(1)}}^T) + \beta (A {x^{(2)}}^T + B {y^{(2)}}^T) = 0
\end{equation}
And we can rewrite this as
\begin{equation}
(\alpha {x^{(1)}} + \beta {x^{(2)}})A^T =(\alpha {y^{(1)}} + \beta {y^{(2)}})B^T
\end{equation}
From this we see that taking linear combinations of vectors in $\text{Ker}(C)$ is equivalent to taking linear combinations of vectors in $U \cap V = W$. Thus, the basis vectors of the $\text{Ker}(C)$ will also form a basis for the vectors in $W$. As a result, we will have
\begin{equation}\label{algo_proof_1}
  \text{dim}(\text{Ker}(C)) = \text{dim}(W)
\end{equation}
Lastly, by the Rank-Nullity Theorem, for the $2n \times 2n$ matrix $C$, we will have
\begin{equation}\label{algo_proof_2}
\text{dim}({\text{Im}(C)}) + \text{dim}(\text{Ker}(C)) = 2n
\end{equation}
In step {\ref{algo_step}} of the algorithm, we set $r$ equal to the number of pivot columns in $\text{REF}(C)$, which is the same as the $\text{dim}(\text{Im}(C))$. Thus, combining {\ref{algo_proof_1}} and {\ref{algo_proof_2}} we see
\begin{equation}
  \text{dim}(W) = \text{dim}(\text{Ker}(C)) = 2n - \text{dim}({\text{Im}(C)})
  = 2n - r
\end{equation}
\end{proof}
\end{algorithm}

\section{Simulations and Numerical Results}

\subsection{Simulation Protocol}
As described in Section {\ref{cp_conjecture}}, we are specifically interested in the relationship the expected value of the collision probability as a function of the depth of the circuit and the number of qubits in the circuit. In order to explore this relationship, we simulate pseudo-random quantum circuits in 1D, 2D, and 3D lattices as well as in a complete graph. Likewise, we restrict our simulations to stabilizer states that are created by applying Clifford Gates to the computational basis $\ket{0}^{\otimes n}$, as described in Section {\ref{clifford_gates}}

Our simulations use a tableau as described in {\cite{aaronson}} to keep track of the vector representations of the generators of the stabilizer group $S$ of the stabilizer state $V_S = \{ \ket{\psi} \}$. However, we do not keep track of the phase bits, as they will not be necessary in order to compute the collision probability of the state $\ket{\psi}$. See {\cite{aaronson}} for details on how to initialize and update the tableau.

In order to generate random Clifford Gates, we use the algorithm described in {\cite{random_clifford}}. Again, we ignore the phase bits as they will not affect the collision probability. Likewise, in order to generate a random Clifford Gate that acts on two qubits, we can equivalently generate a $4 \times 4$ Symplectic Matrix. We then decompose these Symplectic Matrices into Clifford Gates using the algorithm described in {\cite{aaronson}}.

Lastly, we use Algorithm {\ref{algo_1}} in order to efficiently compute the collision probability of the stabilizer state $\ket{\psi}$ using the tableau that keeps track of the generators of the stabilizer group.

Using these algorithms, all of our simulations use the following protocol to collect data in order to test Conjectures {\ref{conjecture_1}} and {\ref{conjecture_2}}. \\
\begin{proto}\label{proto_1} Our simulations perform the following steps for a fixed number of qubits $n$ and fixed number of samples $m$

  \begin{enumerate}[label = (\arabic*)]
  \item For a $w$-dimensional lattice, let $x_{\max} = O(n^{1/w})$ and for a complete graph let $x_{\max} = O(n \ln(n))$. Initialize a vector of evenly spaced integers $x = [0, \ldots, x_{\max}]$ which corresponds to values of depth $d$ in a lattice or number of gates $N$ in a complete graph. Initialize a matrix $K$ of all zeros and size $m \times \text{len}(x)$. Initialize a counter $i = 1$.
  \item\label{p_first} Initialize a tableau to keep track of the generators of our stabilizer state $\ket{\psi}$. This tableau corresponds to the state $\ket{0}^{\otimes n }$. For a lattice, initialize $d = 0$ and for a complete graph initialize $N = 0$. Initialize a counter $j = 2$.
  \item Based on the geometry of the circuit, create a list $L$ that contains pairs of qubits. In a lattice, we construct $L$ so that after applying two qubit gates to all pairs of qubits in $L$, the depth of the circuit will increase by one. In a complete graph, $L$ only contains one pair of qubits.
  \item For every pair of qubits in $L$, do the following. Pick a uniformly random $4 \times 4$ Symplectic Matrix and decompose it into Clifford Gates. Apply these two qubit gates to the pair of qubits by appropriately modifying the tableau.
  \item Update the values $d \leftarrow d + 1$ for a lattice and $N \leftarrow N + 1$ for a complete graph.
  \item\label{p_middle} If $x[j] = d$ for a lattice or $x[j] = N$ for a complete graph, do the following. Compute the collision probability of the state using the tableau. Update the matrix so that $K[i, j] \leftarrow - \log_2(P_c)$ and update the value $j \leftarrow j + 1$.
  \item\label{p_last} Repeat steps {\ref{p_first}} {--} {\ref{p_middle}} until $j = \text{len}(x) + 1$. At this point the $i^{th}$ row of $K$ is complete, so update $i \leftarrow i + 1$.
  \item Repeat steps {\ref{p_first}} {--} {\ref{p_last}} until $i = m+1$. At this point, we are finished collecting data for matrix $K$ for a fixed value of $n$.
  \end{enumerate}
\end{proto}

We have written code in Python 3.5 to implement the steps in Protocol {\ref{proto_1}}, which can be found in {\cite{matthewkhoury96}}. This code also includes implementations of the algorithms described in {\cite{aaronson}} and {\cite{random_clifford}} as well as an implementation of Algorithm {\ref{algo_1}}. In order to enhance performance, our code includes some methods to parallelize some of the steps in Protocol {\ref{proto_1}}. This implementation also precomputes the decomposition of all $4 \times 4$ Symplectic Matrices in order to speed up the simulations.

Our code also uses the following protocol to process the data for a given matrix $K$.\\
\begin{proto}\label{proto_2}Given a matrix $K$, perform the following protocol for each column in the matrix
  \begin{enumerate}[label = (\arabic*)]
  \item Initialize a value $s$ such that $m$ is an integer multiple of $s$.
  \item Exponentiate every data point such that if $k$ is an element of $K$, we have $k \leftarrow {(1/2)}^{k}$
  \item Divide the $m$ exponentiated data points in the column vector into $m/s$ sets of size $s$.
  \item Let $\mu$ and $\sigma$ be vectors of size $m/s$. Store values in the vectors such that $\mu[i]$ and $\sigma[i]$ are the mean and standard deviation of the exponentiated data points in the $i^{th}$ set of size $s$.
  \item Store our estimates for the expected value of the collision probability so that $\langle P_c \rangle = \text{mean}(\mu)$ and error $\text{Err} (\langle P_c \rangle) = \text{std}(\mu)$
  \item Store our estimates for the standard deviation of the collision probability so that $\Delta P_c = \text{mean}(\sigma)$ and error $\text{Err} (\Delta P_c) = \text{std}(\sigma)$.
  \item Convert these points to a logarithmic scale so our estimates are $-\log_2(\langle P_c \rangle)$ with error $\text{Err}(-\log_2(\langle P_c \rangle)) = \text{Err}(P_c)/(\langle P_c \rangle \ln(2))$ and $-\log_2(\Delta P_c)$ with error $\text{Err}(-\log_2(\Delta P_c)) = \text{Err}(\Delta P_c) / (\Delta P_c \ln(2))$
  \end{enumerate}
\end{proto}

Our code in {\cite{matthewkhoury96}} also implements Protocol {\ref{proto_2}} in Python 3.5. In doing so, we worked in the logarithmic domain in order to avoid underflow errors, meaning the exponentiation occurred in the last steps rather than the first steps.

In the following sections, we describe how to obtain $L$ for 1D, 2D, and 3D lattices as well as for a complete graph. We also provide some of our numerical results obtained using our implementation of Protocols {\ref{proto_1}} and {\ref{proto_2}} on 1D, 2D, and 3D lattices as well as for a complete graph. Here, we note that all of our simulations have $m = 25$ and $s = 5$.

\subsection{1D Lattice}\label{1d_lattice}
The pairs of qubits in a 1D lattice that correspond to a depth of $1$ can be seen in Figure {\ref{fig_1d}}. Specifically, we simply alternate between two lists of pairs of qubits, which we refer to as two separate rounds. Likewise, each round corresponds to a depth of 1. Figure {\ref{k_1d}} shows our results for $-\log_2(\langle P_c \rangle)$ as a function of depth in a 1D lattice with $n = 625$.

\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/1D/1D_circuit.pdf}
\caption{Qubits in a 1D Lattice. We alternate between two rounds and each round corresponds to a depth of 1. Black dots represent qubits, black lines represent random two qubit gates, grey lines represent inactive gates. }
\label{fig_1d}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/1D/cp_mean_log.pdf}
\caption{$-\log_2(\langle P_c \rangle)$ as a function of $d$ in a 1D lattice with $n = 625$ qubits.}
\label{k_1d}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/1D/x_star_30.pdf}
\caption{$d^*$ as a function of $n$ in a 1D lattice.}
\label{d_star_1d}
\end{figure}

We would like to note here that in the 1D lattice we did not compute the collision probability at each depth. Rather, we only computed the collision probability for 50 different values of the depth, which were approximately evenly spaced. The reasoning for this is two-fold. First, computing the collision probability given a tableau is the most expensive operation in our simulations. Second, in the 1D lattice, we needed to compute the collision probability for large values of depth on the order of $O(n)$. Likewise, limiting the number of data points we collected saved a significant amount of time while running our simulations.

We see that the numerical results obtained from our simulations support Conjecture {\ref{conjecture_1}}, which predicts
\begin{equation}
-\log_2(\langle P_c \rangle) = n \left( 1 - O\left(\frac{1}{d} \right) \right)
\end{equation}
Moreover, for a 1D lattice, we would expect the circuit to saturate at a depth of $d \sim n$. Likewise, looking at Figure {\ref{k_1d}}, it is clear that we will have $-\log_2(\langle P_c \rangle) = O(n - n/d)$ and the circuit clearly saturates well before $d = n$.

To provide further evidence in support of Conjecture {\ref{conjecture_1}}, we define $d^*$ to be the depth such that $-\log_2(\langle P_c \rangle)= n - 30$. Likewise, if we let $O(1/d) = c/d$ for some constant $c$, the conjecture predicts
\begin{equation}
  -\log_2(\langle P_c \rangle) = n \left( 1 - \frac{c}{d^*} \right) = n - 30
  \quad \Rightarrow \quad
  d^* = c \left( \frac{n}{30} \right)
\end{equation}
In Figure {\ref{d_star_1d}} we have plotted $d^*$ as a function of $n$ and chosen a value of $c$ that fits the data well. As we can see, the values of $d^*$ computed from our simulations show a clear linear trend, meaning our simulations in a 1D lattice largely agree with the predictions of Conjecture {\ref{conjecture_1}}.

\subsection{2D Lattice}
The pairs of qubits in a 2D lattice that correspond to a depth of $1$ can be seen in Figure {\ref{fig_2d}}. Similar to the 1D lattice, we perform a round robin cycling through four different rounds when applying our sets of two qubit gates. Each round in this round robin increases the depth of the circuit by $1$. Figure {\ref{k_2d}} shows our results for $-\log_2(\langle P_c \rangle)$ as a function of depth in a 2D lattice with $n=900$.

\begin{figure}[!htb]
\centering
\includegraphics[width=.9\textwidth]{figures/2D/2D_circuit.pdf}
\caption{Qubits in a 2D Lattice. We cycle through four rounds and each round corresponds to a depth of 1. Black dots represent qubits, black lines represent random two qubit gates, grey lines represent inactive gates.}
\label{fig_2d}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/2D/cp_mean_log.pdf}
\caption{$-\log_2(\langle P_c \rangle)$ as a function of $d$ in a 2D lattice with $n = 900$ qubits.}
\label{k_2d}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/2D/x_star_30.pdf}
\caption{$d^*$ as a function of $n$ in a 2D lattice.}
\label{d_star_2d}
\end{figure}

In Figure {\ref{k_2d}}, we collect $36$ data points corresponding to the values of depth $d = 0, 1, 2, \ldots, 35$ so that we can see how $-\log_2(\langle P_c \rangle)$ behaves as a function of $d$ for depths on the order of $O(n^{1/2})$.

For a 2D lattice, Conjecture {\ref{conjecture_1}} predicts
\begin{equation}
-\log_2(\langle P_c \rangle) = n \left( 1 - O\left(\frac{1}{d^2} \right) \right)
\end{equation}
We also expect that for a 2D lattice the circuit will saturate at a depth of $d \sim n^{1/2}$. Looking at Figure {\ref{k_2d}}, we can see that $-\log_2(\langle P_c \rangle) = O(n - n/d^2)$ and the circuit saturates before $d = n^{1/2}$. However, for small values of $d$, we see that the prediction provides a somewhat loose upper bound. Likewise, Conjecture {\ref{conjecture_1}} can likely be modified to provide a tighter bound for small values of $d$.

Again, to provide further evidence for Conjecture {\ref{conjecture_1}}, we look at how $d^*$ changes as a function of $n$. In this case, the conjecture predicts
\begin{equation}
  -\log_2(\langle P_c \rangle) = n \left( 1 - \frac{c}{{(d^*)}^2} \right) = n - 30
  \quad \Rightarrow \quad
  d^* = c^{1/2} {\left( \frac{n}{30} \right)}^{1/2}
\end{equation}
In Figure {\ref{d_star_2d}}, we have plotted $d^*$ as a function of $n$ in a 2D lattice. Here, we have chosen a value for $c^{1/2}$ that fits the data well. We see that the data collected from our simulations roughly behaves like $n^{1/2}$. However, the data seems to be a bit noisy and it may be the case that a different shaped curve will fit the data better. Modifications to Conjecture {\ref{conjecture_1}} that provide tighter bounds for smaller depth will likely address this issue. Nonetheless, Conjecture {\ref{conjecture_1}} still provides a meaningful upper bound and asymptotic behavior that largely agree with our data.

\subsection{3D Lattice}
The pairs of qubits in a 3D lattice that correspond to a depth of $1$ can be seen in Figure {\ref{fig_3d}}. Analogous to the 2D lattice, we perform a round robin cycling through six rounds and each round increases the depth of the circuit by $1$. Figure {\ref{k_3d}} shows our result for $-\log_2(\langle P_c \rangle)$ as a function of depth in a 3D lattice with $n = 1000$.

\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/3D/3D_circuit.pdf}
\caption{Qubits in a 3D Lattice. We cycle through six rounds and each round corresponds to a depth of 1. Black dots represent qubits, black lines represent random two qubit gates, grey lines represent inactive gates. }
\label{fig_3d}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/3D/cp_mean_log.pdf}
\caption{$-\log_2(\langle P_c \rangle)$ as a function of $d$ in a 3D lattice with $n = 1000$ qubits.}
\label{k_3d}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/3D/x_star_30.pdf}
\caption{$d^*$ as a function of $n$ in a 3D lattice with $m = 25$.}
\label{d_star_3d}
\end{figure}

In Figure {\ref{k_3d}}, we collect $21$ data points corresponding to the values of depth $d = 0, 1, 2, \ldots, 20$ so that we can see how $-\log_2(\langle P_c \rangle)$ behaves as a function of $d$ for depths on the order of $O(n^{1/3})$.

For a 3D lattice, Conjecture {\ref{conjecture_1}} predicts
\begin{equation}
-\log_2(\langle P_c \rangle) = n \left( 1 - O\left(\frac{1}{d^3} \right) \right)
\end{equation}
We also expect that for a 3D lattice the circuit will saturate at a depth of $d \sim n^{1/3}$. Looking at Figure {\ref{k_3d}}, we can see that $-\log_2 (\langle P_c \rangle) = O(n - n/d^3)$ and the circuit tends to saturate around $d = n^{1/3}$. Similar to the case of the 2D lattice, we see that the prediction provides a loose upper bound for small values of $d$.

We also see how $d^*$ changes as a function of $n$. Here, Conjecture {\ref{conjecture_1}} predicts
\begin{equation}
  -\log_2(\langle P_c \rangle) = n \left( 1 - \frac{c}{{(d^*)}^3} \right) = n - 30
  \quad \Rightarrow \quad
  d^* = c^{1/3} {\left( \frac{n}{30} \right)}^{1/3}
\end{equation}
In Figure {\ref{d_star_3d}}, we have plotted $d^*$ as a function of $n$ and have chosen a value of $c^{1/3}$ that fits the data well. Similar to the case of the 2D lattice, we see that the values of $d^*$ collected from our simulations roughly display a $n^{1/3}$ behavior. However, there may be a better curve that fits the function. Again, we hypothesize that modifications to Conjecture {\ref{conjecture_1}} that provide tighter bounds for small values of $d$ will likely address these issues.

\subsection{Complete Graph}
In a complete graph, we look at $-\log_2(\langle P_c \rangle)$ as a function of the total number of gates applied to the circuit $N$. Likewise, we simply choose two qubits uniformly at random and apply a gate to those two qubits. After doing so, $N$ increases by $1$. An illustration of this process can be seen in Figure {\ref{fig_cg}}. Figure {\ref{k_cg}} shows our results for $-\log_2(\langle P_c \rangle)$  as a function of $N$ in a complete graph with $n = 625$.

\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/CG/CG_circuit.pdf}
\caption{Qubits in a Complete Graph. This is an illustration of 6 qubits laid out in a complete graph. Each round corresponds to a single gate. In each round, two qubits are chosen uniformly at random. Black dots represent qubits, black lines represent random two qubit gates, grey lines represent inactive gates. }
\label{fig_cg}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/CG/cp_mean_log.pdf}
\caption{$-\log_2(\langle P_c \rangle)$ as a function of $N$ in a complete graph with $n = 625$ qubits.}
\label{k_cg}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/CG/x_star_30.pdf}
\caption{$N^*$ as a function of $n$ in a complete graph.}
\label{N_star_cg}
\end{figure}

Similar to the 1D lattice, we have also chosen to only compute the collision probability for $50$ different values of $N$. The reasons for doing this are the same as those described in Section {\ref{1d_lattice}}. These $50$ data points are also approximately evenly space out and we look at the number of gates $N$ on the order of $n \ln(n)$.

We see that the numerical results obtained from our simulations support Conjecture {\ref{conjecture_2}}, which predicts
\begin{equation}
-\log_2(\langle P_c \rangle) = n \left( 1 - O\left(\frac{1}{e^{N/n}} \right) \right)
\end{equation}
This conjecture also predicts that the circuit will saturate around $N \sim n \ln(n)$. Looking at Figure {\ref{k_cg}}, we see that $-\log_2(\langle P_c \rangle)= O(n - n / e^{N/n})$ and the circuit saturates around $N = n \ln(n)$.

Similar to the 1D, 2D, and 3D lattices, we provide further support for Conjecture {\ref{conjecture_2}} by defining a new quantity $N^*$. However, in this case, we define $N^*$ to be the number of gates such that $-\log_2(\langle P_c \rangle)= n - n/30$. Likewise, the conjecture predicts
\begin{equation}
  -\log_2(\langle P_c \rangle)= n \left( 1 - \frac{c}{e^{N^*/n}} \right)
  = n - \frac{n}{30}
  \quad \Rightarrow \quad
  e^{N^*/n} = 30c
  \quad \Rightarrow \quad
  N^* = \ln(30c) (n)
\end{equation}
In Figure {\ref{N_star_cg}}, we have plotted $N^*$ as a function of $n$. Here, we have adjusted the value of $\ln(30c)$ so the prediction fits the data well. Similar to the case of the 1D lattice, we see a clear linear trend in the values of $N^*$ from our simulations that line up very closely with our prediction. Both Figures {\ref{k_cg}} and {\ref{N_star_cg}} provide data that strongly agrees with the predictions of Conjecture {\ref{conjecture_2}}. Likewise, the upper bounds provided in Conjecture {\ref{conjecture_2}} are quite tight.

\subsection{Fluctuations in Collision Probability}
So far, we have shown that our numerical results largely support Conjecture {\ref{conjecture_1}} in a 1D lattice and Conjecture {\ref{conjecture_2}} in a complete graph. We have also shown that Conjecture {\ref{conjecture_1} provides meaningful, but loose, upper bounds in a 2D and 3D lattice. Overall, these numerical results are mostly concerned with the expected value of the collision probability $\langle P_c \rangle$. In this section, we present some numerical results concerned with the standard deviation of the collision probability $\Delta P_c$.

Figures {\ref{fig_1d_std}}, {\ref{fig_2d_std}}, {\ref{fig_3d_std}}, and {\ref{fig_cg_std}} show our numerical results for $-\log_2 (\Delta P_c)$ in a 1D lattice, 2D lattice, 3D lattice, and complete graph respectively. These plots show how $-\log_2 (\Delta P_c)$ changes as a function of depth for fixed values of $n$.

\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/1D/cp_std_log.pdf}
\caption{$-\log_2(\Delta P_c)$ as a function of $d$ in a 1D lattice with n = 625 qubits.}
\label{fig_1d_std}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/2D/cp_std_log.pdf}
\caption{$-\log_2(\Delta P_c)$ as a function of $d$ in a 2D lattice with n = 900 qubits.}
\label{fig_2d_std}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/3D/cp_std_log.pdf}
\caption{$-\log_2(\Delta P_c)$ as a function of $d$ in a 3D lattice with n = 1000 qubits.}
\label{fig_3d_std}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/CG/cp_std_log.pdf}
\caption{$-\log_2(\Delta P_c)$ as a function of $d$ in a complete graph with n = 625 qubits.}
\label{fig_cg_std}
\end{figure}
\begin{figure}[!htb]
\centering
\includegraphics[width=.8\textwidth]{figures/1D/steady_state_cp.pdf}
\caption{$-\log_2(\langle P_c \rangle)$ and $-\log_2(\Delta P_c)$ as a function of $n$ in a 1D lattice at saturated depths.}
\label{fig_steady_state}
\end{figure}

We see some striking similarities when comparing Figures {\ref{fig_1d_std}}, {\ref{fig_2d_std}}, {\ref{fig_3d_std}}, and {\ref{fig_cg_std}} with Figures {\ref{k_1d}}, {\ref{k_2d}}, {\ref{k_3d}}, {\ref{k_cg}} respectively. That is, the data collected from our simulations suggest that the values of $-\log_2(\langle P_c \rangle)$ and $-\log_2(\Delta P_c)$ grow similarly as functions of depth and number of qubits.

Furthermore, in Figure {\ref{fig_steady_state}} we plot both $-\log_2(\langle P_c \rangle)$ and $-\log_2(\Delta P_c)$ as a function of $n$ in a 1D lattice. In these plots, we have chosen large depths for each value of $n$ so that the circuits have been fully saturated. We see that both $-\log_2(\langle P_c \rangle)$ and $-\log_2(\Delta P_c)$ are almost exactly equal to $n$ when the circuits have reached a steady state. Moreover, although not included in this paper, we have found nearly the same exact results when creating the same plots for a 2D and 3D lattice as well as in a complete graph.

These results are quite interesting as they imply that as a circuit saturates, we expect fluctuations in the collision probability to be approximately $\Delta P_c \approx {(1/2)}^n$. This means that the steady state fluctuations in the collision probability become exponentially small as the size of the circuit grows.

\subsection{Summary of the Numerical Results}
We have tested Conjectures {\ref{conjecture_1}} and {\ref{conjecture_2}} on three separate accounts: the behavior of $-\log_2 (\langle P_c \rangle)$ as function of $d$ or $N$, the depths or number of gates at which the circuits saturate, and the behavior of $d^*$ or $N^*$ as a function of $n$. Overall, we found that our data strongly agrees with the predictions of Conjecture {\ref{conjecture_1}} in a 1D lattice and Conjecture {\ref{conjecture_2}} in a complete graph.

We found that our data roughly agreed with Conjecture {\ref{conjecture_1}} in a 2D and 3D lattice. Specifically, we saw that the upper bounds provided by the conjecture seemed a bit loose for small values of depth. Likewise, we hypothesize that modifications to Conjecture {\ref{conjecture_1}} will likely be able to address these issues. Nonetheless, our data still suggests that Conjecture {\ref{conjecture_1}} provides meaningful upper bounds for a 2D and 3D lattice.

Lastly, we diverged slightly from our original conjectures to discuss fluctuations we observed in the collision probability. Our numerical results suggest that $-\log_2(\langle P_c \rangle)$ and $-\log_2(\Delta P_c)$ grow similarly as functions of depth and number of qubits. We also observed that the standard deviation of the collision probability $\Delta P_c \approx {(1/2)}^n$ for large depths where the circuit is saturated, regardless of its geometry.

\section{Conclusion}
Throughout this paper, our main focus has been on studying one statistical property of pseudo-random quantum circuits: how the expected value of the collision probability behaves as a function of the depth of the circuit and the number of qubits in the circuit. In doing so, we began by introducing Conjectures {\ref{conjecture_1}} and {\ref{conjecture_2}}, which we have tested numerically via simulations of pseudo-random quantum circuits. Before presenting the structure and results of our simulations, we described some of the mathematical principles allowing us to efficiently simulate quantum circuits composed only of Clifford Gates. We also presented an algorithm to efficiently compute the collision probability of such circuits.

Overall, our numerical results for a 1D lattice and a complete graph strongly agree with the predictions made by Conjectures {\ref{conjecture_1}} and {\ref{conjecture_2}} respectively. Our numerical results also suggest that Conjecture {\ref{conjecture_1}} likely provides meaningful, but somewhat loose, upper bounds for a 2D and 3D lattice. We also found that $-\log_2(\langle P_c \rangle)$ and $-\log_2(\Delta P_c)$ behave similarly as functions of depth and number of qubits and that steady state fluctuations in the collision probability are approximately $\Delta P_c \approx {(1/2)}^n$.

\bibliography{mybib}

\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[onecolumn,11pt]{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{amsmath,amssymb,subfigure,times,graphicx,hyperref,verbatim,comment}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\newcommand{\BS}{\boldsymbol}
\newcommand{\bs}{\boldsymbol}

\newcommand{\bq}{{\bf q}}

\makeatletter
%as LaTeX considers descenders in its calculation of interline spacing,
%to get 12 point spacing for normalsize text, must set it to 10 points
\def\@normalsize{\@setsize\normalsize{12pt}\xpt\@xpt
\abovedisplayskip 10pt plus2pt minus5pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6pt plus3pt
minus3pt\let\@listi\@listI}

%12 pt font size for subsection and abstract headings
\def\subsize{\@setsize\subsize{12pt}\xipt\@xipt}

%make section titles bold and 12 point, 2 blank lines before, 1 after
\def\section{\@startsection {section}{1}{\z@}{24pt plus 2pt minus 2pt}
{12pt plus 2pt minus 2pt}{\large\bf\color{RoyalBlue}}}

%make subsection titles bold and 11 point, 1 blank line before, 1 after
\def\subsection{\@startsection {subsection}{2}{\z@}{12pt plus 2pt minus 2pt}
{12pt plus 2pt minus 2pt}{\subsize\bf\color{RoyalBlue}}}

\def\subsubsection{\@startsection {subsubsection}{2}{\z@}{12pt plus 2pt minus 2pt}
{12pt plus 2pt minus 2pt}{\subsize\bf\color{RoyalBlue}}}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\title{Analytic Gradients in Trajectory Optimization}
\author{Will Whener}

\begin{document}
\maketitle

This document describes the method for calculating the analytic gradients for the multiple shooting approach, ``rungeKutta'' of the OptimTraj package. The procedure is exactly the same as that described in Russ Tedrake's Course notes~\cite{tedrakeNotes},(Sec 12.3.3). It may look complicated, but it is essentially just a careful and repeated carrying out of the chain rule. The gradient calculation depends on the specific numerical integration approach of the dynamics and cost function. We consider a couple integration cases below: explicit Euler, and 4$^{\text{th}}$ order Runge-Kutta. The explicit Euler case is only considered as a simple example. The 4$^{\text{th}}$ order Runge-Kutta is the integration scheme used in multiple shooting approach, ``rungeKutta'', of the OptimTraj package.

\section{Cost function gradients}
Consider the scalar valued cost function,
\begin{equation}
J^{\bs \alpha} = h(t_0,t_F,\bs x(t_0),\bs x(t_F)) + \int_{t_0}^{t_F}  g(t, \bs x(t), \bs u(t)) dt,
\label{eq:Cost}
\end{equation}
for which we would like to find the gradient of $J^{\bs \alpha}$ with respect to some set of parameters $\bs \alpha$. The cost function $J^{\bs \alpha}$ is a function of the trajectory $(t,\bs x(t),\bs u(t))$, which is constrained by the dynamics,
\begin{equation}
\dot{\bs x} =\bs f(t,\bs x,\bs u), \quad \bs x(t_0) = \bs x_0, \quad t \in \lbrack t_0, t_F\rbrack.
\label{eq:dynamics}
\end{equation}
The vector of free parameters, $\bs \alpha$, could represent a variety of things, for example it could be the initial condition $\bs \alpha = \bs x_0$ or it could be a control policy of the form, $\bs u = \bs u^{\bs \alpha}(t,\bs x)$.

\begin{figure}[h]
\centering
\hspace{0mm}
\includegraphics[width=.38\textwidth]{Figures/singleShooting.pdf}
\vspace{-2mm}
\caption{Time discretization of trajectory. In the particular case illustrated, there are $N=4$ substeps. The initial time $t_0$ corresponds to $n=0$ and the final time of the trajectory corresponds to $n=N$.}
\label{fig:singleShoot}
\end{figure}

To proceed, we must first discretize the trajectory in time for purposes of numerical integration. Following the procedure of~\cite{betts2001practical}, we divide the trajectory into substeps evenly distributed in time and specify the state ($\bs x$) and control ($\bs u$) at each substep. Additionally, we define the value of the control at midpoints, points half way between each substep. For example, see Figure~\ref{fig:singleShoot}, where the trajectory is divided into $N=4$ substeps:  $\bs x[n]_{n = 0, \dots, N}$, $\bs u[n]_{n = 0, \dots, N}$, and $\bs u_M[n]_{n=0,\dots, N-1}$.

\subsection{Explicit Euler Integration}

Consider explicit Euler integration of the dynamics~\eqref{eq:dynamics},
\begin{equation*}
\begin{split}
&\bs x[n+1] = \bs x[n] + dt \bs f(t_n, \bs x[n], \bs u[n]), \quad dt = \frac{t_F-t_0}{N}, \quad t_n = t_0 + n dt.
%&J^{\bs \alpha} = h(t_0,t_F,\bs x[0], \bs x[N]) + \sum_{n=0}^{N-1} dt g(t_n,\bs x[n],\bs u[n])
\end{split}
\end{equation*}
Integrating the cost function~\eqref{eq:Cost} in the same manner, we have
\begin{equation*}
J^{\bs \alpha} = h(t_0,t_F,\bs x[0], \bs x[N]) + \sum_{n=0}^{N-1} dt g(t_n,\bs x[n],\bs u[n]),
\end{equation*}
and the gradient is found be repeatedly carrying out the chain rule,
\begin{equation*}
\begin{split}
\frac{\partial J^{\bs \alpha}}{\partial \bs \alpha} = &
\frac{\partial h(t_0,t_F,\bs x[0], \bs x[N])}{\partial t_0}\frac{\partial t_0}{\partial \bs \alpha} +
\frac{\partial h(t_0,t_F,\bs x[0], \bs x[N])}{\partial t_F}\frac{\partial t_F}{\partial \bs \alpha} +
\frac{\partial h(t_0,t_F,\bs x[0], \bs x[N])}{\partial \bs x[0]}\frac{\partial \bs x[0]}{\partial \bs \alpha} \\
+ & \frac{\partial h(t_0,t_F,\bs x[0], \bs x[N])}{\partial \bs x[N]}\frac{\partial \bs x[N]}{\partial \bs \alpha} +
\frac{\partial dt}{\partial \bs \alpha}  \sum_{n=0}^{N-1}g(t_n,\bs x[n],\bs u[n])  \\
+ & \sum_{n=0}^{N-1} dt \left ( \frac{\partial g(t_n,\bs x[n],\bs u[n])}{\partial  t_n}\frac{\partial t_n}{\partial \bs \alpha} +
\frac{\partial g(t_n,\bs x[n],\bs u[n])}{\partial \bs x}\frac{\partial \bs x[n]}{\partial \bs \alpha} +
\frac{\partial g(t_n,\bs x[n],\bs u[n])}{\partial \bs u}\frac{\partial \bs u[n]}{\partial \bs \alpha}   \right)\\
\end{split}
\end{equation*}

The terms $\partial \bs x[n]/\partial \bs \alpha$ can be obtained while integrating the dynamics forward, we have,
\begin{equation}
\begin{split}
\frac{\partial \bs x[n+1]}{\partial \bs \alpha} &= \frac{\partial \bs x[n]}{\partial \bs \alpha} + {d t} \left( \frac{\partial \bs f(t_n,\bs x[n], \bs u[n])}{\partial t}\frac{\partial t_n}{\partial \bs \alpha} + \frac{\partial \bs f(t_n,\bs x[n], \bs u[n])}{\partial \bs x}\frac{\partial \bs x[n]}{\partial \bs \alpha}  + \frac{\partial \bs f(t_n,\bs x[n], \bs u[n])}{\partial \bs u}\frac{\partial \bs u [n]}{\partial \bs \alpha}\right)  \\
+ & \frac{\partial dt}{\partial \bs \alpha}  \bs f(t_n,\bs x[n],\bs u[n]).
\end{split}
\label{eq:dxda}
\end{equation}

and the remaining terms, $\partial \bs x[0] /\partial\bs \alpha $, $\partial \bs u[n]/\partial \bs \alpha$, $\partial t_0 / \partial \bs \alpha$, etc. depend on the particular definition of $\bs \alpha$ in question. For example, take $\bs \alpha = \bs x_0$, in which case we have
\begin{align*}
\frac{\partial \bs x[0]}{\partial \bs \alpha} = \bs I, \quad  \frac{\partial \bs u[n]}{\partial \bs \alpha} = 0, \quad
\frac{\partial t_0}{\partial \bs \alpha} =0, \quad \text{etc.}
\end{align*}
Considering another possibility: $\bs \alpha^T = [t_0, t_F, \bs x_0^T, \bs u_0^T, (\bs u^M_0)^T, \bs u_1^T, (\bs u^M_1)^T ... , \bs u_N^T ]$, i.e. an open-loop control policy, then we have,
\begin{align*}
\frac{\partial \bs x[0]}{\partial \bs \alpha} =
\begin{bmatrix}
\bs 0 & \bs 0 & \bs I & \bs 0 & \dots & \bs 0
\end{bmatrix}, \quad
\frac{\partial \bs u[0]}{\partial \bs \alpha} =
\begin{bmatrix}
\bs 0 & \bs 0 & \bs 0 & \bs I & \bs 0 & \dots & \bs 0
\end{bmatrix}, \quad
\frac{\partial t_0}{\partial \bs \alpha} =
\begin{bmatrix}
1 & 0 & \dots & 0
\end{bmatrix}
, \quad \text{etc.}
\end{align*}
Note, for the explicit Euler integration scheme, the midpoint control values were not involved, but they are involved in the 4$^{\text{th}}$ order Runge-Kutta scheme below.

\section{Multiple-Shooting Formulation}
So far we have only considered the single shooting approach. In the multiple shooting approach, the trajectory is divided into multiple segments as shown in Figure~\ref{fig:multShoot}. Discrepancies between the endpoints of the segments are accounted for by defect constraints. If the trajectory is divided into $N_S$ segments, this requires the introduction of the optimization parameters $\bs x_1$, $\bs x_2$, $\dots$, $\bs x_{N_S-1}$. Now, the terms $\partial \bs x[n]/\partial \bs \alpha$ can be calculated separately for each shooting segment to determine gradients of the cost function and any constraint functions. For example, consider the first defect constraint of Figure~\ref{fig:multShoot},
\begin{equation*}
\bs\Delta_0 = \bs x_0^{+} - \bs x_1.
\end{equation*}
and take the set of optimization parameters to be
\begin{equation*}
\bs \alpha = \lbrack t_0, t_F, \bs x_0^T, \bs x_1^T, \bs x_2^T, \bs x_{F}^T, \bs u_0^T, (\bs u^M_0)^T, \bs u_1^T, (\bs u^M_1)^T, \dots , \bs u_N^T \rbrack.
\end{equation*}
The gradient, $\partial \bs\Delta_0/\partial \bs\alpha$, requires $\partial\bs x_0^{+}/\partial \bs \alpha$ and $\partial\bs x_1/\partial \bs \alpha$. The first term can be obtained by carrying out the recursive equation~\eqref{eq:dxda}, over the first shooting segment starting from
\begin{equation}
\frac{\partial \bs x[0]}{\partial \bs \alpha} =
\frac{\partial \bs x_0}{\partial \bs \alpha} =
\begin{bmatrix}
\bs 0 & \bs 0 & \bs I & \bs 0 & \dots & \bs 0
\end{bmatrix}.
\end{equation}
Similarly, to determine the gradient of second defect, the term $\partial\bs x_0^{+}/\partial \bs \alpha$ is evaluated using~\eqref{eq:dxda} over the second segment starting from
\begin{equation}
\frac{\partial \bs x[2]}{\partial \bs \alpha} =
\frac{\partial \bs x_1}{\partial \bs \alpha} =
\begin{bmatrix}
\bs 0 & \bs 0 & \bs 0 & \bs I & \dots & \bs 0
\end{bmatrix}.
\end{equation}

%\begin{figure}[h]
%\centering
%\hspace{0mm}
%\includegraphics[width=.47\textwidth]{Figures/multipleShooting_Defects.pdf}
%\vspace{-3mm}
%\caption{Multiple shooting case. The trajectory is divided into segments. In this particular case $N_S=3$ segments.}
%\label{fig:multShootDefects}
%\end{figure}

\begin{figure}[h]
\centering
\hspace{0mm}
\includegraphics[width=.5\textwidth]{Figures/multipleShooting.pdf}
\vspace{-3mm}
\caption{Multiple shooting case. The trajectory is divided into segments. In this particular case $N_S=3$ segments and $N=2$ substeps for each segment.}
\label{fig:multShoot}
\end{figure}

\section{Other Integration Schemes}

\subsection{4$^{\text{th}}$ Order Runge-Kutta Integration}
See the function \texttt{simSysGrad} inside \texttt{rungeKutta.m} of the OptimTraj package for the matlab implementation of the following equations. Consider the path cost
\begin{equation}
J^{\bs \alpha} = \int_{t_0}^{t_F}  g(t, \bs x(t), \bs u(t)) dt,
\label{eq:PathCost}
\end{equation}
and employ a 4th-order Runge-Kutta scheme for integration of the dynamics and cost function,
\begin{align*}
J^{\bs\alpha} = & \sum_{n=0}^{N-1} \frac{dt}{6} \left(  g_0[n] +  g_1[n] +  g_2[n] +  g_3[n]\right)   &\quad \bs x[n+1] &= \bs x[n] + \frac{dt}{6} \left(\bs k_0[n] + \bs k_1[n] + \bs k_2[n] + \bs k_3[n]\right)\\
g_0[n] &=  g(t_n, \bs x[n], \bs u[n])  &\bs k_0[n] & = \bs f(t_n, \bs x[n], \bs u[n])\\
g_1[n] &=  g(t_n + 0.5dt, \bs x[n] + 0.5dt\; \bs k_0, \bs u^M[n]) &\bs k_1[n] & = \bs f(t_n + 0.5dt, \bs x[n] + 0.5dt\; \bs k_0, \bs u^M[n])\\
g_2[n] &=  g(t_n+0.5dt, \bs x[n] + 0.5dt\; \bs k_1, \bs u^M[n]) &\bs k_2[n] & = \bs f(t_n+0.5dt, \bs x[n] + 0.5dt\; \bs k_1, \bs u^M[n])\\
g_3[n] &=  g(t_n+dt, \bs x[n] + dt\; \bs k_2, \bs u[n+1]) &\bs k_3[n] & = \bs f(t_n+dt, \bs x[n] + dt\; \bs k_2, \bs u[n+1])
\end{align*}
The gradient of the cost function w.r.t. the decision parameter $\bs \alpha$ is
\begin{equation*}
\frac{\partial J}{\partial \bs \alpha} = \sum_{n=0}^{N-1}\frac{d t}{6} \left(\frac{\partial g_0[n]}{\partial \bs \alpha} + \frac{\partial g_1[n]}{\partial \bs \alpha} + \frac{\partial g_2[n]}{\partial \bs \alpha} + \frac{\partial g_3[n]}{\partial \bs \alpha}  \right) + \frac{1}{6}\frac{\partial dt}{\partial \bs\alpha} \left(g_0[n] + g_1[n] + g_2[n] + g_3[n]\right)
\end{equation*}
where
\begin{equation*}
\begin{split}
\frac{\partial \bs x[n+1]}{\partial \bs \alpha} &= \frac{\partial \bs x[n]}{\partial \bs \alpha} + \frac{d t}{6} \left(\frac{\partial \bs k_0[n]}{\partial \bs \alpha} + \frac{\partial \bs k_1[n]}{\partial \bs \alpha} + \frac{\partial \bs k_2[n]}{\partial \bs \alpha} + \frac{\partial \bs k_3[n]}{\partial \bs \alpha}  \right) + \frac{1}{6}\frac{\partial dt}{\partial \bs\alpha} \left(\bs k_0[n] + \bs k_1[n] + \bs k_2[n] + \bs k_3[n]\right)
\end{split}
\end{equation*}
Now, all that's left is to obtain the terms, $  {\partial \bs k_i[n]}/{\partial \bs \alpha}$ and $  {\partial g_i[n]}/{\partial \bs \alpha}$ . This is where things start to get a bit ugly, but, again, it's just a repeated carrying out of the chain rule,
\begin{equation*}
\begin{split}
\frac{\partial \bs k_0}{\partial \bs \alpha} =& \frac{\partial \bs f(t_n,\bs x[n], \bs u[n])}{\partial t}\frac{\partial t_n}{\partial \bs \alpha} + \frac{\partial \bs f(t_n,\bs x[n], \bs u[n])}{\partial \bs x}\frac{\partial \bs x[n]}{\partial \bs \alpha}  + \frac{\partial \bs f(t_n,\bs x[n], \bs u[n])}{\partial \bs u}\frac{\partial \bs u [n]}{\partial \bs \alpha},
\\[2ex]
\frac{\partial \bs k_1}{\partial \bs \alpha} =& \frac{\partial \bs f(t_n+0.5dt,\bs x[n]+0.5dt \bs k_0,\bs u^M[n])}{\partial t} \left( \frac{\partial t_n}{\partial \bs \alpha} + 0.5\frac{\partial dt}{\partial \bs \alpha}  \right)+\\
& \frac{\partial \bs f(t_n+0.5dt,\bs x[n]+0.5dt \bs k_0,\bs u^M[n])}{\partial \bs x} \left( \frac{\partial \bs x[n]}{\partial \bs \alpha} + 0.5\bs k_0\frac{\partial dt}{\partial \bs \alpha} + 0.5dt\frac{\partial \bs k_0}{\partial \bs \alpha}  \right) +\\
&  \frac{\partial \bs f(t_n+0.5dt,\bs x[n]+0.5dt \bs k_0,\bs u^M[n])}{\partial \bs u}\frac{\partial \bs u^M[n]}{\partial \bs \alpha},
\\
\end{split}
\end{equation*}
\begin{equation*}
\begin{split}
\frac{\partial \bs k_2}{\partial \bs \alpha} =& \frac{\partial \bs f(t_n+0.5dt,\bs x[n]+0.5dt \bs k_1,\bs u^M[n])}{\partial t} \left( \frac{\partial t_n}{\partial \bs \alpha} + 0.5\frac{\partial dt}{\partial \bs \alpha}  \right)+\\
& \frac{\partial \bs f(t_n+0.5dt,\bs x[n]+0.5dt \bs k_1,\bs u^M[n])}{\partial \bs x} \left( \frac{\partial \bs x[n]}{\partial \bs \alpha} + 0.5\bs k_1\frac{\partial dt}{\partial \bs \alpha} + 0.5dt\frac{\partial \bs k_1}{\partial \bs \alpha}  \right) +\\
&  \frac{\partial \bs f(t_n+0.5dt,\bs x[n]+0.5dt \bs k_1,\bs u^M[n])}{\partial \bs u}\frac{\partial \bs u^M[n]}{\partial \bs \alpha},
\\[2ex]
\frac{\partial \bs k_3}{\partial \bs \alpha} =& \frac{\partial \bs f(t_n+dt,\bs x[n]+dt \bs k_2,\bs u[n+1])}{\partial t} \left( \frac{\partial t_n}{\partial \bs \alpha} + \frac{\partial dt}{\partial \bs \alpha}  \right)+\\
& \frac{\partial \bs f(t_n+dt,\bs x[n]+dt \bs k_2,\bs u[n+1])}{\partial \bs x} \left( \frac{\partial \bs x[n]}{\partial \bs \alpha} + \bs k_2\frac{\partial dt}{\partial \bs \alpha} + dt\frac{\partial \bs k_2}{\partial \bs \alpha}  \right) +\\
&  \frac{\partial \bs f(t_n+dt,\bs x[n]+dt \bs k_2,\bs u[n+1])}{\partial \bs u}\frac{\partial \bs u[n+1]}{\partial \bs \alpha},
\\[1ex]
\end{split}
\end{equation*}
The terms $  {\partial g_i[n]}/{\partial \bs \alpha}$ are very similar to $  {\partial \bs k_i[n]}/{\partial \bs \alpha}$. In each instance, simply replace $\bs k_i$ with $g_i$ and $\bs f$ with $g$ to obtain $  {\partial g_i[n]}/{\partial \bs \alpha}$.

\bibliographystyle{IEEEtran}
\bibliography{biblio}
\end{document}


\subsection{Optimization for the high density
scenario}\label{subsec:hdoptimization}

As we have seen, there is not much to do to optimize the \standout{percentage of
covered users}, since it is always nearly perfect. But, of course, there are
very low values of the parameters that does not allow the network to reach the
maximum coverage. We have run a full factorial analysis, with low values of each
parameter, in order to identify the minimum values required to reach the
coverage. Each possible configuration (\(750\)) has been run with 10
repetitions. The complete analysis can be found in \code{coverage.ipynb}. The
configuration used is named ``HighDensityCoverage''. We have found out that to
reach at least the \(99\%\) of the coverage, we need to have a broadcast radius
of at least \(7m\), but we also need higher values for \(m\) and \(D\) in order
to use \(R\!=\!7m\). If we use \(R\!=\!8m\) we get better results for the other
parameters. In particular, we have found the following minimum configuration the
we consider ``good'' and ``well balanced'' since it does not use the value
\code{1} for any of the parameters.

\begin{center}
	\begin{tabular}{cccc}
		\toprule
		R & T & m & \(\max(\delta)\) \\
		\midrule
		\(8m\) & \(2s\) & \(2\,\mathit{copies}\) & \(2s\) \\
		\bottomrule
	\end{tabular}
\end{center}

If we want to optimize the \standout{total broadcast time}, as we have seen in
\secref{subsec:hd2kr}, we need to increase the broadcast radius or decrease the
size of the hear window. File \code{broadcast-time.ipynb} shows the results with
various combination of these two factors. The configuration used is named
``HighDensityTime''. We use an high value for the maximum number of copies,
since from the plot generated by the \code{2kr.ipynb} script we see a slightly
decrease of the broadcast time with high values for \(m\). For the same reason,
we use a low value for the maximum relay delay. \figref{fig:hdtimeff} shows the
result of the analysis. As we can see, by using low values for \(T\) we can get
lower values for the broadcast time, even with higher values for the broadcast
radius. So, to not sacrifice the energy efficiency, we can lower the size of the
hear window rather than increase the broadcast radius to reduce the broadcast
time.

\begin{figure}[hbt]
	\centering
	\includegraphics[width=0.8\textwidth]{img/hd/broadcasttime-R-ffplot}
	\caption{The broadcast time is lower with higher values of the broadcast
	radius and lower values of the size of the hear
	window (95\% confidence intervals)}\label{fig:hdtimeff}
\end{figure}

We can verify that the model derived with the \(2^{k}r\) analysis is valid. If we
compute, for example, the value for \(R\!=\!17m\) and \(T\!=\!10s\) using the
model we get the result shown in~\eqref{eq:hdtimepredictionexample} (values for
the two parameters are normalized between \(-1\) and \(1\)) which is near the
mean value obtained from the full factorial analysis (\(117.2s\)) and inside its
95\% confidence interval (\(106.7255\), \(127.6745\)).

\begin{equation}\label{eq:hdtimepredictionexample}
	t_B = e^{4.782874 - 0.462452 \cdot 0.4 + 0.240663 \cdot 1} =
	e^{4.8385562} \simeq 126.2869s
\end{equation}

If instead we want to optimize the \standout{energy efficiency}, we must reduce
the broadcast radius and the total number of messages sent. In file
\code{messages.ipynb} we have performed a factorial analysis with low values for
the broadcast radius. Other factors taken into considerations are the one we
have identified as relevant in \secref{subsec:hd2kr}, namely the maximum number
of copies and the size of the hear window. The configuration used is named
``HighDensityMessages''.

As we can see from \figref{fig:hdmessagesff}, we get that the maximum number of
copies hugely affects the total number of messages sent, as previously found by
the \(2^{k}r\) analysis. Surprisingly, the combination of the maximum number of
copies and the size of the hear window is very important to reduce the number of
messages sent (the lower lines in the plot are those with the higher values for
\(T\)). This contradicts what the \(2^{k}r\) analysis found before.

\begin{figure}[htb]
	\centering
	\includegraphics[width=0.8\textwidth]{img/hd/messages-m-ffplot}
	\caption{With low values of the maximum number of copies and higher
	values for the size of the hear window, we get a lower number of
	messages sent}\label{fig:hdmessagesff}
\end{figure}

So, in order to improve the energy efficiency, since we can not increase the
broadcast radius, we need to use a large \(T\) and a low \(m\). Increasing
\(T\) also increases the broadcast time, so a trade-off decision is needed in
this parameter. In order to account for both the indexes, one can increase the
value of \(R\) to reduce the broadcast radius and increase \(T\) maintaining a
low \(m\) in order to compensate for the increment of the energy consumption due
to the higher value of \(R\).

Regarding the \standout{total number of collisions}, we can reduce it by
reducing the broadcast radius and the maximum number of copies. Also helps
increasing the maximum relay delay. If the energy efficiency is the main
performance index that we want to optimize, the best way to reduce the total
number of collisions is certainly to reduce the broadcast radius. If instead we
want to optimize the broadcast time, we can reduce the total number of
collisions by reducing \(m\) and increasing \(\max(\delta)\). Factorial
analysis with the \(m\) and \(\max(\delta)\) parameters is available in
\code{collisions.ipynb}, using the configuration named
``HighDensityCollisions''. \figref{fig:hdcollisionsff} shows the results: the
plot is very well linear in the \(\max(\delta)\) parameter, suggesting that
increasing this factor even more should allow to have even a lower number of
collisions. \(m\!=\!2\) is a good setup for this parameter since it allows to
completely exploit the advantages of the \emph{trickle relaying} algorithm in
order to reduce the number of collisions and the number of messages sent.

\begin{figure}[hbt]
	\centering
	\includegraphics[width=0.8\textwidth]{img/hd/collisions-D-ffplot}
	\caption{The number of collisions is linearly dependent on the maximum
	relay delay. Also, trickle relaying can be exploited with low values of
	\(m\) in order to reduce the number of
	collisions}\label{fig:hdcollisionsff}
\end{figure}

\subsubsection{Conclusions}\label{subsubsec:hdconclusions}

\begin{itemize}
	\item The minimal configuration to get a nearly perfect coverage is with
		\(R\!=\!8m\), \(T\!=\!2s\), \(m\!=\!2\) and
		\(\max(\delta)\!=\!2s\). Higher values for these parameters does
		not break the coverage. For a more ``safe'' setup, \(R\) may be
		increased to \(9m\) or \(10m\).
	\item If a low total broadcast time is a main objective, increasing
		\(R\) is effective. Also reducing \(T\) allows for further
		improvement of the broadcast time.
	\item If instead a better energy efficiency is the main objective, \(R\)
		can not be increased and \(T\) should not be reduced. A
		trade-off decision between a low broadcast time and a good
		energy efficiency is needed.
	\item There is no reason to use large values for the maximum number of
		copies: \(m\!=\!2\) is a good set for this parameter and it
		leads to a lower number of collisions and a better energy
		efficiency without sacrificing the broadcast time. Trickle
		relaying is very effective in this job.
	\item \(\max(\delta)\) should be sufficiently high, in order to reduce
		the total number of collisions, but not too high, in order to
		avoid an increase in the broadcast time due to users waiting too
		much before relaying the message.
\end{itemize}


\section{Hedonic games}


\documentclass[main.tex]{subfiles}
\begin{document}

\marginpar{Thursday\\ 2020-4-30, \\ compiled \\ \today}

Today we will improve on the Zel'dovich approximation with the adhesion approximation.

We see plots from a 1992 paper from the professor.

We are taking collisionless particles in 1D. The Zel'dovich approximation breaks down since the particles going through each other does not make sense: they will have gravitational interactions in that case.

We will discuss the difference, in structure formation, between ``pancakes'' and ``filaments''.

The issue seems to be that, after the trajectories of the particles cross the matrix of transformation between Eulerian and Lagrangian coordinates becomes singular.

How do we get extended structures? By continuity of the eigenvalues.

We cannot really estimate the global size of the structures here, they are transient anyway.

\section{The adhesion approximation}

We add a fictitious term for the gravitational ``sticking'' of particles into pancakes or filaments.

We start from the equations
%
\begin{subequations}
\begin{align}
\bigd{\vec{u}}{\tau } &= \nu \nabla^2 \vec{u}  \\
\bigd{\eta }{\tau } &= - \eta \nabla \cdot \vec{u}
\,.
\end{align}
\end{subequations}

We have basically added a kinematic viscosity term to the Navier-Stokes equations.
The coefficient \(\nu \) is called the kinematic viscosity coefficient, which has dimensions \(\qty[\nu ] = L^2 /T\).

This is completely artificial, but we do it to model the effect of gravitational interactions.

We are basically modelling gravity as a local effect.

What we obtain is called the 3D Burgers' equation.
We can obtain turbulence here, but the system is solvable.

\todo[inline]{Is the system solvable because at small scales the vortices die out?}

Let us assume that the velocity is irrotational: \(\vec{u} = \nabla \Phi \). The quantity \(\Phi \) is called a velocity potential.

Substituting in, we get
%
\begin{align}
\pdv{\Phi }{\tau } + \frac{1}{2} \qty(\nabla \Phi )^2 = \nu \nabla^2 \Phi
\,,
\end{align}
%
which is called the Bernoulli equation.

To see that these are equivalent: if we take the gradient, we get
%
\begin{align}
\frac{1}{2} \partial^{i}  \qty(\partial_{j} \Phi \partial^{j} \Phi )
&= \partial^{j} \Phi \partial_{i } \partial_{j} \Phi
= u^{j} \partial_{j} u^{i}
\,.
\end{align}

The other derivatives commute, so if we take the gradient of the equation we get back Euler's equation.

The issue is the fact that this is a nonlinear equation.

We do the Hopf-Cole transformation to solve the Burgers equation. So, we define
%
\begin{align}
\Phi = - 2 \nu \log U
\,,
\end{align}
%
where \(U\) is called the ``expotential''.
This simplifies the equation into the Fokker-Planck equation:
%
\begin{align}
\pdv{U}{\tau } = \nu \nabla^2 U
\,.
\end{align}

This is a linear diffusion equation. It models heat transfer, but it is also the Schrödinger equation after a Wick\footnote{Pronounced ``Vick'', not ``Uick''. } rotation.

This is a parabolic equation.
The Poisson equation, for instance, is elliptic: it only requires spatial initial conditions. Hyperbolic equations include the wave equation: they require initial conditions.

Parabolic equations require both: they imply infinite-speed transmission of signal.

We use the ansatz
%
\begin{align}
U(\vec{x}, \tau ) = f(\tau ) g(\vec{x})
\,,
\end{align}
%
and we substitute
%
\begin{align}
f(\tau ) = e^{E \tau }
\,,
\end{align}
%
so that we need to solve
%
\begin{align}
E g(\vec{x}) = \nu \nabla^2 g(\vec{x})
\,.
\end{align}

In Fourier space, then,
%
\begin{align}
E_k g_{\vec{k}} = - \nu k^2 g_{\vec{k}}
\,.
\end{align}
%
So, a general solution will be a superposition:
%
\begin{align}
U(\vec{x}, \tau ) = \int \frac{ \dd[3]{k}}{(2 \pi )^3}
e^{- \nu k \tau^2} g_{\vec{k}} e^{i \vec{k} \cdot \vec{x}}
\,.
\end{align}

The standard thing to do to get some boundary conditions is to look at a kernel of the function, its impulse response.

We get
%
\begin{align}
K(\vec{x}, \tau | \hat{q}, 0) \overset{\tau \to 0}{ \to } \delta (\vec{x} - \vec{q})
\,.
\end{align}

In order to get this, we need to set \(g_{\vec{k}} = e^{- i \vec{k} \cdot \vec{q}}\).
This yields
%
\begin{subequations}
\begin{align}
K (\vec{x}, \tau | \vec{q}, 0) &=
\int \frac{ \dd[3]{k}}{(2\pi )^3} e^{- \nu k^2\tau } e^{i \vec{k} \cdot \qty(\vec{x} - \vec{q})}  \\
&= (4 \pi \nu \tau )^{-3/2} \exp(- \frac{(\vec{x} - \vec{q})^2}{4 \nu \tau })
\,.
\end{align}
\end{subequations}

To get the initial conditions \(U_0 (\vec{q})\) we use the Chapman-Kolmogorov equation:
%
\begin{align}
U(\vec{x}, \tau ) = \int \dd[3]{q} U_0 (\vec{q}) K(\vec{x}, \tau | \vec{q}, 0)
\,.
\end{align}

This is a consequence of Bayes's theorem: we can marginalize over a parameter like
%
\begin{align}
\mathbb{P}(A) = \int \dd{B} \mathbb{P}(B) \mathbb{P}(A | B)
\,.
\end{align}

Inverting the definition of \(U\), we have
%
\begin{align}
U_0 (\vec{q}) = e^{- \Phi_0 (\vec{q})  / 2 \nu } = e^{ \phi_0 / 2 \nu }
\,,
\end{align}
%
and then we get
%
\begin{align}
U(\vec{x}, \tau ) = \int \frac{ \dd[3]{q}}{(4 \pi \nu \tau )^{3/2}}
e^{- S(\vec{x}, \vec{q}, \tau )  / 2 \nu }
\,.
\end{align}

The Bernoulli equation is the same as the Hamilton-Jacobi equation for the action.

Here,
%
\begin{align}
S(\vec{x}, \vec{q}, \tau ) = \frac{(\vec{x} - \vec{q})^2}{2 \tau } - \phi_0 (\vec{q})
\,,
\end{align}
%
and then we only need to recover the velocity: we need to differentiate and get
%
\begin{align}
\vec{u} (\vec{x}, \tau ) = - 2 \nu \frac{\nabla U }{U }
= \frac{ \int \dd[3]{q}\frac{\vec{x} - \vec{q}}{\tau } e^{- S(\vec{x}, \vec{q}, \tau ) / 2 \nu }}{ \int \dd[3]{q} e^{- S (\vec{x}, \vec{q}, \tau ) / 2 nn}}
\,.
\end{align}

We are interested in small values for \(\nu \). This parameter regulates the thickness of our pancakes, since it gives us a length scale for the derivative in the ``Navier-Stokes'' equation.

In this limit, the exponential is very peaked, and we can consider only the absolute minima of the action, just like in the path integral.

If we perform this approximation, we get
%
\begin{align}
U(\vec{x}, \tau ) = e^{ - S(\vec{x}, \vec{q}, \tau )  / 2 \nu } \sum _{s} j_s (\vec{x}, \vec{q}, \tau )
\,,
\end{align}
%
where we expanded the action around the minimum to get
%
\begin{align}
j_S = \qty[\det \pdv[2]{S}{q_{i}}{q_{j}}]^{- 1/2}
\,.
\end{align}

\end{document}


\section{Mass and Inertia}

\begin{tabularx}{\textwidth}{ | L | c | c | }
  \hline
  \textbf{Parameter}                    & \textbf{Value}   & \textbf{Reference} \\ \hline
  \endfirsthead
  \hline
  \textbf{Parameter}                    & \textbf{Value}   & \textbf{Reference} \\ \hline
  \endhead
  Empty weight (UH-60A)                 & 5~118 kg         & \cite{Janes20042005} \\ \hline
  Empty weight (UH-60L)                 & 5~224 kg         & \cite{Janes20042005} \\ \hline
  Internal fuel tanks capacity          & 1~361 l          & \cite{Janes20042005,UH60_OperatorsManual} \\ \hline
  Internal fuel tanks stationline       & 10.69 m          & \cite{UH60_OperatorsManual} \\ \hline
  Center of mass stationline (for 7~258 kg) & 9.09 m        & \cite{NASA-CR-166309} \\ \hline
  Center of mass waterline (for 7~258 kg)   & 6.38 m        & \cite{NASA-CR-166309} \\ \hline
  Moment of inertia $I_x$ (for 7~258 kg) &  7~406 kg$\cdot$m\textsuperscript{2} & \cite{NASA-CR-166309} \\ \hline
  Moment of inertia $I_y$ (for 7~258 kg) & 53~513 kg$\cdot$m\textsuperscript{2} & \cite{NASA-CR-166309} \\ \hline
  Moment of inertia $I_z$ (for 7~258 kg) & 50~012 kg$\cdot$m\textsuperscript{2} & \cite{NASA-CR-166309} \\ \hline
  Cross product of inertia $I_{xz}$ (for~7~258~kg) & 2~134 kg$\cdot$m\textsuperscript{2} & \cite{NASA-CR-166309} \\ \hline
  \caption{Mass data}
\end{tabularx}

\clearpage
\subsection{Structure Groups Breakdown}

Data given in \cite{UH60_OperatorsManual,NASA-CR-166309,UH60_MaintenanceManual} were used to calculate empty aircraft inertia tensor and center of mass coordinates. Results are given in the following table.

\begin{table}[h!]
  \begin{center}
    \begin{tabular}{ | l | c | }
      \hline
      \textbf{Parameter} & \textbf{Value} \\ \hline
      Center of mass x-coordinate & -0.15 m \\ \hline
      Center of mass y-coordinate &  0.00 m \\ \hline
      Center of mass z-coordinate & -0.25 m \\ \hline
      Moment of inertia $I_X$ &  6~543.0 kg$\cdot$m\textsuperscript{2} \\ \hline
      Moment of inertia $I_Y$ & 46~293.1 kg$\cdot$m\textsuperscript{2} \\ \hline
      Moment of inertia $I_Z$ & 43~498.3 kg$\cdot$m\textsuperscript{2} \\ \hline
      Cross product of inertia $I_{XY}$ &      0.0 kg$\cdot$m\textsuperscript{2} \\ \hline
      Cross product of inertia $I_{XZ}$ & -3~753.0 kg$\cdot$m\textsuperscript{2} \\ \hline
      Cross product of inertia $I_{YZ}$ &      0.0 kg$\cdot$m\textsuperscript{2} \\ \hline
    \end{tabular}
    \caption{Empty aircraft inertia tensor and center of mass coordinates}
  \end{center}
\end{table}

\clearpage
\newgeometry{margin=1cm}
\thispagestyle{empty}
\begin{sidewaystable}
  \begin{center}
    \scalebox{0.8}
    {
      \begin{tabular}{ l S S S S S S S S S S S S S }
        \toprule
        \textbf{Structure group} & \textbf{Weight} & \multicolumn{3}{c}{\textbf{Coordinates}} & \multicolumn{3}{c}{\textbf{First moment of mass}} & \multicolumn{6}{c}{\textbf{Moment of inertia}} \\
        & {[kg]} & \multicolumn{3}{c}{[m]} & \multicolumn{3}{c}{[kg$\cdot$m]} & \multicolumn{6}{c}{[kg$\cdot$m\textsuperscript{2}]} \\ \midrule
        & $m$ & $x$ & $y$ & $z$ & $S_X$ & $S_Y$ & $S_Z$ & $I_X$ & $I_Y$ & $I_Z$  & $I_{XY}$ & $I_{XZ}$ & $I_{YZ}$ \\ \midrule
        \csvreader[
          column count=14,
          no head,
          late after line=\\
        ]
        {csv/uh60_mass_intermediate.csv}
        {}
        {\csvlinetotablerow}
        \bottomrule
      \end{tabular}
    }
    \caption{Mass data intermediate results}
  \end{center}
\end{sidewaystable}
\restoregeometry


%!TEX root = ../../common/main.tex

\section{The \acl*{SM}}
\label{sec:cpv_theory:standard_model}

The \acf{SM} tries to describe the constituents of matter and anti-matter as
well as their interactions. The theoretical model has been rigorously tested by
experiments and any attempts to falsify even a part of it have been unsuccessful
up to date. From the beginning of the 1960s until the discovery of the Higgs
boson \cite{Aad:2015zhl} all experimental evidence has been in support of the
\SM. Nevertheless, the \SM must be part of some bigger universal theory: The
absence of a suitable dark matter candidate, a missing predictive model
explaining the quark and lepton mass hierarchy and mixing, and the absence of
anti-matter/the abundance of matter in the visible universe, are just a
selection of questions that are not answered by the \SM.

The theoretical framework of the \SM is built as a Lorentz invariant quantum
field theory describing the dynamics and kinematics of the theory. Based on the
gauge group $\group{SU}{3}\otimes\group{SU}{2}\otimes\group{U}{1}$ the \SM
Lagrangian $\mathcal{L}_{\text{\acs*{SM}}}$ describes all\footnote{The \ac{SM}
does not describes gravity, which makes it not less attractive from the
perspective of high energy particle physics as the strength of the gravitational
couplings is several orders of magnitude smaller compared to the other forces.}
known fundamental forces and their bosonic force mediators, the fermionic
particles forming matter, as well as the scalar field that lends masses to the
bosons and fermions of the \SM through the mechanism of spontaneous symmetry
breaking.

The fermionic fields can be expressed by their left-handed doublets of quarks
%
\begin{equation*}\label{eq:cpv_theory:standard_model:quarks}
  \begin{pmatrix}
    \uquark \\
    \dquark^\prime
  \end{pmatrix}_{\text{L}}\eqspace
  \begin{pmatrix}
    \cquark \\
    \squark^\prime
  \end{pmatrix}_{\text{L}}\eqspace
  \begin{pmatrix}
    \tquark \\
    \bquark^\prime
  \end{pmatrix}_{\text{L}}
\end{equation*}
%
and leptons
%
\begin{equation*}\label{eq:cpv_theory:standard_model:leptons}
  \begin{pmatrix}
    \nuel \\
    \electron
  \end{pmatrix}_{\text{L}}\eqspace
  \begin{pmatrix}
    \numu \\
    \muon
  \end{pmatrix}_{\text{L}}\eqspace
  \begin{pmatrix}
    \nutau \\
    \tauon
  \end{pmatrix}_{\text{L}}
\end{equation*}
%
as well as their right-handed singlet counterparts
%
\begin{equation*}\label{eq:cpv_theory:standard_model:right_handed}
  \electron_{\text{R}},\eqthinspace \muon_{\text{R}},\eqthinspace \tauon_{\text{R}},\eqthinspace \uquark_{\text{R}},\eqthinspace \dquark_{\text{R}},\eqthinspace \cquark_{\text{R}},\eqthinspace \squark_{\text{R}},\eqthinspace \tquark_{\text{R}},\eqand \bquark_{\text{R}}\eqpd
\end{equation*}
%
The \SM does not include right-handed neutrinos, yet they might be necessary to
explain the observed non-vanishing neutrino masses. To each listed particle, an
anti-particle with oppositely signed charge quantum numbers exist, usually
denoted with an overbar, \eg $\quarkbar$.

The fundamental interactions are represented by the \EM force, the weak force,
and the strong force. The \EM and weak interactions can be unified into the so
called electro-weak interaction \cite{set:gws}, represented by an
$\group{SU}{2}\otimes\group{U}{1}$ gauge group. Four corresponding massless
gauge bosons are present that can be associated with the $\group{SU}{2}$ and
$\group{U}{1}$ group. After the spontaneous breaking of the symmetry at the
electro-weak energy scale the massless photon $\photon$ and the massive $\Wpm$
and $\Zboson$ bosons emerge.

The photon couples to particles with non-zero \EM charge, \ie the charged
leptons $\electron$, $\muon$, and $\tauon$ and the quarks. The likewise
uncharged \Zboson additionally couples to the uncharged neutrinos. The bosons
$\Wpm$ act as mediators between the upper and lower fields of the fermionic
doublets enabling \eg the radioactive $\beta$ decay with a
$\dquark\to\uquark\electron\nuelbar$ transition through the exchange of a $\Wm$.

Finally, the strong force couples to the colour charge carried solely by quarks
and is mediated by gluons. Quarks cannot be observed in unbound states, thus
always form composite particles (\emph{hadrons}) as \eg the proton consists of
two $\uquark$-quarks and one $\dquark$-quark. In general, particles composed of
three quarks ($\quark\quark\quark$) or three anti-quarks
($\quarkbar\quarkbar\quarkbar$) are called \emph{baryons}, particles with a
quark and an anti-quark as constituents ($\quark\quarkbar$) are called
\emph{mesons}. Besides these two prevalent bound states, exotic
\emph{pentaquark} states composed of four quarks and one anti-quark were
experimentally confirmed recently \cite{Aaij:2015tga}.

All visible matter consists entirely of first generation quarks ($\uquark$ and
$\dquark$) and leptons ($\electron$), thus no other fermionic particles are
mandatory to explain most physical phenomena and moreover it seems non-essential
that they exist at all. To shed light into this puzzle the structure and
hierarchy of the quark and lepton sector is studied in the field of
\emph{flavour physics}.