\chapter{Linearized theory and Newtonian limit}
\section{Linearized theory}
Consider a weak gravitational field. Then we can split the full spacetime metric $\tensor{g}{_\mu_\nu}(x)$ into two parts.
\begin{definition}[Linearization of the metric field.]
    \begin{equation}
        \tensor{g}{_\mu_\nu}(x) = \tensor{\eta}{_\mu_\nu} +
        \tensor{h}{_\mu_\nu}(x) + \landauO(h^2) \, .
    \end{equation}
\end{definition}
Thereby $\tensor{h}{_\mu_\nu}$ is the flat, constant ``background'' metric of Minkowski
space, i.e.\ there is no gravitational field present.
The field $h_{\mu\nu}(x)$ can be interpreted as a perturbation on the fixed background $\eta_{\mu\nu}$.
One can identify a spin-2 particle, the so-called \emph{graviton}, with the excitations (quantized fluctuations) of this field.
Because only the linear order of $h$ is considered, the nonlinearity of Einstein's equations is lost.
We can raise and lower indices with $\tensor{h}{_\mu_\nu}$ and
$\tensor{h}{^\mu^\nu}$.

\begin{remark}
This works only for a weak gravitational field, since a strong gravitational field produces a strong back reaction of ``matter''
on the geometry, which follows from the nonlinearity of Einstein's equations.
Exactly this back reaction is neglected in the linearized theory.
\end{remark}

\subsection{Derivation of the linearized Einstein's equations}
In the following we neglect all terms with $\landauO(h^2)$.
Our goal is to express Einstein's field equations in the linearized approximation.
For this we need to calculate the Christoffel symbols, the Riemann tensor, the Ricci tensor and the Ricci scalar.

\subsubsection*{Christoffel symbols}
\begin{equation}
    \csym{\mu}{\nu}{\varrho} = \frac{1}{2} \left( \tensor{h}{_\mu_\varrho_,_\nu} + \tensor{h}{_\nu_\varrho_,_\mu}
    - \tensor{h}{_\mu_\nu_,_\varrho} \right) + \landauO(h^2) \, .
\end{equation}
Christoffel symbols of the second kind:
\begin{equation}
    \cSym{\varrho}{\mu}{\nu} = g^{\varrho\sigma} \csym{\mu}{\nu}{\sigma} = \eta^{\varrho\sigma} \csym{\mu}{\nu}{\sigma} + \landauO(h^2)
    = \frac{1}{2} \left( \tensor{h}{_\mu^\varrho_,_\nu} + \tensor{h}{_\nu^\varrho_,_\mu} - \tensor{h}{_\mu_\nu^,^\varrho} \right) + \landauO(h^2) \, .
\end{equation}
\subsubsection*{Riemann tensor}
The Riemann tensor can be calculated to
\begin{equation}
    \begin{split}
        \tensor{R}{^\varrho_\sigma_\mu_\nu}
        &= \partial_\mu \cSym{\varrho}{\nu}{\sigma} - \partial_\nu \cSym{\varrho}{\mu}{\sigma}
        + \underbrace{\cSym{\varrho}{\mu}{\lambda} \cSym{\lambda}{\nu}{\sigma} - \cSym{\varrho}{\nu}{\lambda} \cSym{\lambda}{\mu}{\sigma}}_{\landauO(h^2)} \\
        &= \frac{1}{2} \left( \tensor{h}{_\nu^\varrho_,_\sigma_\mu} +
        {\tensor{h}{_\sigma^\varrho_,_\nu_\mu}} - \tensor{h}{_\nu_\sigma^,^\varrho_\mu} - \tensor{h}{^\varrho_\mu_,_\sigma_\nu} -
        {\tensor{h}{_\sigma^\varrho_,_\mu_\nu}} +
        \tensor{h}{_\mu_\sigma^,^\varrho_\nu} \right) + \landauO(h^2) \\
        &= \frac{1}{2} \left( \tensor{h}{_\nu^\varrho_,_\sigma_\mu} - \tensor{h}{_\nu_\sigma^,^\varrho_\mu}
        - \tensor{h}{^\varrho_\mu_,_\sigma_\nu} +
        \tensor{h}{_\mu_\sigma^,^\varrho_\nu} \right) + \landauO(h^2) \, .
    \end{split}
\end{equation}
By contracting we get the Ricci tensor
\begin{equation}
    \tensor{R}{_\sigma_\nu} = \tensor{R}{^\varrho_\sigma_\varrho_\nu}
    = \frac{1}{2} \left( \tensor{h}{_\nu^\varrho_,_\sigma_\varrho} - \tensor{h}{_\nu_\sigma^,^\varrho_\varrho}
    - \tensor{h}{_,_\sigma_\nu} + \tensor{h}{_\varrho_\sigma^,^\varrho_\nu} \right) + \landauO(h^2)\, ,
\end{equation}
where for convenience the trace of $h$ is denoted with $h\coloneqq
h_{\mu\nu}\eta^{\mu\nu}$. Lastly the Ricci scalar is given by
\begin{equation}
    R = g^{\sigma\nu}R_{\sigma\nu} = \eta^{\sigma\nu}R_{\sigma\nu} + \landauO(h^2)
    = \tensor{h}{^\sigma^\nu_,_\sigma_\nu} - \tensor{h}{_,_\sigma^\sigma} + \landauO(h^2)
\end{equation}
We define
\begin{equation}
    \overline{h}_{\mu\nu} \coloneqq h_{\mu\nu} - \frac{1}{2} \eta_{\mu\nu}h\,.
\end{equation}
The trace is given by
\begin{equation}
    \overline{h} \coloneqq  \overline{h}_{\mu\nu}\eta^{\mu\nu} = h -
    \frac{h}{2} = \frac{h}{2}\,.
\end{equation}
If we repeat the procedure we arrive at the initial metric:
\begin{equation}
    \overline{\overline{h}}_{\mu\nu} = \overline{h}_{\mu\nu} - \frac{1}{2}
    \eta_{\mu\nu}\overline{h} = \overline{h}_{\mu\nu} + \frac{1}{2}
    \eta_{\mu\nu}h= h_{\mu\nu}\,.
\end{equation}
\subsubsection{Linearized Einstein tensor \texorpdfstring{$G_{\mu\nu}$}{Gmunu} in terms of \texorpdfstring{$\overline{h}_{\mu\nu}$}{hbarmunu}}
The linearized Einstein Tensor is given as
\begin{equation}
    \begin{split}
        G_{\mu\nu}^{\text{(L)}} =\ & R_{\mu\nu}^{\text{(L)}} - \frac{1}{2} \eta_{\mu\nu} R^{\text{(L)}} \\
        =\ & \frac{1}{2} \partial_\mu \partial_\varrho \tensor{h}{_\nu^\varrho} + \frac{1}{2} \partial_\nu \partial_\varrho \tensor{h}{_\mu^\varrho}
        - \frac{1}{2} \Box h_{\mu\nu} - \frac{1}{2}
        \partial_{\mu}\partial_\nu h-\frac{1}{2}
        \eta_{\mu\nu}\partial_\varrho\partial_\sigma h^{\varrho\sigma} + \frac{1}{2} \eta_{\mu\nu}\Box h \\
        =\ & \frac{1}{2} \partial_\mu\partial_\varrho \tensor{\overline{h}}{_\nu^\varrho}
        - {\frac{1}{4}\partial_\mu\partial_\nu\overline{h}}
        + \frac{1}{2} \partial_\nu\partial_\varrho\tensor{\overline{h}}{_\mu^\varrho}
        - {\frac{1}{4}\partial_\nu\partial_\mu\overline{h}} - \frac{1}{2}\Box\overline{h}_{\mu\nu} \\
        & + {\frac{1}{2}\eta_{\mu\nu}\Box\overline{h}} + {\frac{1}{2}\partial_\mu\partial_\nu\overline{h}}
        - \frac{1}{2}\eta_{\mu\nu}\partial_\varrho\partial_\sigma\overline{h}^{\varrho\sigma}
        + {\frac{1}{4}\eta_{\mu\nu}\Box\overline{h}} - {\frac{1}{2}\eta_{\mu\nu}\Box\overline{h}} \\
        =\ & -\frac{1}{2} \Box \overline{h}_{\mu\nu} + \partial_\varrho \tensor{\partial}{_(_\mu}\tensor{\overline{h}}{_\nu_)^\varrho}
        - \frac{1}{2} \eta_{\mu\nu}\partial_\varrho\partial_\sigma
        \overline{h}^{\varrho\sigma}\,,
    \end{split}
\end{equation}
% \begin{equation}
%     \begin{split}
%         G_{\mu\nu}^{\text{(L)}} =\ & R_{\mu\nu}^{\text{(L)}} - \frac{1}{2} \eta_{\mu\nu} R^{\text{(L)}} \\
%         =\ & \frac{1}{2} \partial_\mu \partial_\varrho \tensor{h}{_\nu^\varrho} + \frac{1}{2} \partial_\nu \partial_\varrho \tensor{h}{_\mu^\varrho}
%         - \frac{1}{2} \Box h_{\mu\nu} - \frac{1}{2}
%         \partial_{\mu}\partial_\nu h-\frac{1}{2}
%         \eta_{\mu\nu}\partial_\varrho\partial_\sigma h^{\varrho\sigma} + \frac{1}{2} \eta_{\mu\nu}\Box h \\
%         =\ & \frac{1}{2} \partial_\mu\partial_\varrho \tensor{\overline{h}}{_\nu^\varrho}
%         - \mathunderline{blue}{\frac{1}{4}\partial_\mu\partial_\nu\overline{h}}
%         + \frac{1}{2} \partial_\nu\partial_\varrho\tensor{\overline{h}}{_\mu^\varrho}
%         - \mathunderline{blue}{\frac{1}{4}\partial_\nu\partial_\mu\overline{h}} - \frac{1}{2}\Box\overline{h}_{\mu\nu} \\
%         & + \mathunderline{green}{\frac{1}{2}\eta_{\mu\nu}\Box\overline{h}} + \mathunderline{blue}{\frac{1}{2}\partial_\mu\partial_\nu\overline{h}}
%         - \frac{1}{2}\eta_{\mu\nu}\partial_\varrho\partial_\sigma\overline{h}^{\varrho\sigma}
%         + \mathunderline{green}{\frac{1}{4}\eta_{\mu\nu}\Box\overline{h}} - \mathunderline{green}{\frac{1}{2}\eta_{\mu\nu}\Box\overline{h}} \\
%         =\ & -\frac{1}{2} \Box \overline{h}_{\mu\nu} + \partial_\varrho \tensor{\partial}{_(_\mu}\tensor{\overline{h}}{_\nu_)^\varrho}
%         - \frac{1}{2} \eta_{\mu\nu}\partial_\varrho\partial_\sigma \overline{h}^{\varrho\sigma} \\
%         \overset{!}{=}\ & \kappa T_{\mu\nu}
%     \end{split}
% \end{equation}

%TODO introduce symmetration brackets somewhere
with the (linearized) d'Alembert operator
\begin{equation}
    \Box^{\text{(L)}} = \Box = \partial_\mu\partial_\nu
    \eta^{\mu\nu}=\partial_\mu\partial^\mu\,.
\end{equation}
\begin{definition}[Linearized Einstein equations]
    \begin{equation}
        \label{eq:lineinsteineqs}
        -\frac{1}{2} \Box \overline{h}_{\mu\nu} + \partial_\varrho \tensor{\partial}{_(_\mu}\tensor{\overline{h}}{_\nu_)^\varrho}
        - \frac{1}{2} \eta_{\mu\nu}\partial_\varrho\partial_\sigma \overline{h}^{\varrho\sigma} = \kappa T_{\mu\nu}
    \end{equation}
\end{definition}

\subsubsection{Gauge transformations}
Usually field equations are in the form of
\begin{equation}
    \Box \text{``field''} = \text{``source''}\,.
\end{equation}
Equation~\eqref{eq:lineinsteineqs} can be written in this form:
\begin{equation}
    \underbrace{\Box \overline{h}_{\mu\nu}}_{\Box\text{``field''}}
    \underbrace{- 2 \partial_\varrho \tensor{\partial}{_(_\mu} \tensor{\overline{h}}{_\nu_)^\varrho}
    + \eta_{\mu\nu}\partial_\varrho \overline{h}^{\varrho\sigma}}_{\text{ensures gauge invariance of equation}}
    = \underbrace{-2\kappa T_{\mu\nu}}_{\text{``source''}}
\end{equation}

We are now considering infinitesimal diffeomorphisms, which are given by affine
transformations
\begin{equation}
    x^\mu = x'^\mu + \xi^\mu(x'^\mu), \qquad \xi^\mu \ll 1
\end{equation}
In the following we neglect terms with $\landauO(\xi^2)$, $\landauO(\xi h)$, and
$\landauO(h^2)$ and higher order terms, which we denote by $\landauO$.
The transformed metric reads
\begin{equation}
    \begin{split}
        \eta_{\mu\nu} + h'_{\mu\nu}(x') &= g'_{\mu\nu} \\
        &= \frac{\partial x^\varrho}{\partial x'^\mu} \frac{\partial x^\sigma}{\partial x'^\nu} g_{\varrho\sigma}(x) \\
        &= \frac{\partial \left( x'^\varrho + \xi^\varrho \right)}{\partial x'^\mu}
        \frac{\partial \left( x'^\sigma + \xi^\sigma \right)}{\partial x'^\nu}
        \left( \eta_{\varrho\sigma} + h_{\varrho\sigma}(x) \right) + \landauO \\
        &= \left( \tensor{\delta}{_\mu^\varrho} + \tensor{\xi}{^\varrho_,_\mu} \right)
        \left( \tensor{\delta}{_\nu^\sigma} + \tensor{\xi}{^\sigma_,_\nu} \right)
        \left( \eta_{\varrho\sigma} + h_{\varrho\sigma}(x) \right) + \landauO \\
        &= \left( \tensor{\delta}{_\mu^\varrho} + \tensor{\xi}{^\varrho_,_\mu} \right)
        \left( \eta_{\varrho\nu} + h_{\varrho\nu} + \tensor{\xi}{_\varrho_,_\nu}
        \right) + \landauO \\
        &= \eta_{\mu\nu} + h_{\mu\nu} + \tensor{\xi}{_\mu_,_\nu} +
        \tensor{\xi}{_\nu_,_\mu} + \landauO\,.
    \end{split}
\end{equation}
The perturbation $h_{\mu\nu}$ therefore transforms  under infinitesimal
diffeomorphisms in the following way
\begin{equation}
    \begin{split}
        h'_{\mu\nu}(x) &= h_{\mu\nu}(x) + \tensor{\xi}{_\mu_,_\nu} + \tensor{\xi}{_\nu_,_\mu} \\
        &= h_{\mu\nu}(x) + \left(\liedif{\xi}{\eta} \right)_{\mu\nu}\,.
    \end{split}
\end{equation}
\begin{definition}[Lie derivative]
    The Lie derivative off a tensor field $T$ with $k$ contravariant and $l$
    covariant indices along the vector $\xi$ is defined as
    \begin{equation}
        \begin{split}
            \left( \liedif{\xi}{T} \right)^{\alpha_1\ldots\alpha_k}_{\beta_1\ldots\beta_l}
            \coloneqq \xi^\mu \partial_\mu T^{\alpha_1\ldots\alpha_k}_{\beta_1\ldots\beta_l}
            & - \left( \partial_\mu \xi^{\alpha_1} \right) T^{\mu\alpha_2\ldots\alpha_k}_{\beta_1\ldots\beta_l} - \ldots
            - \left( \partial_\mu \xi^{\alpha_k} \right) T^{\alpha_1\ldots\alpha_{k-1}\mu}_{\beta_1\ldots\beta_l} \\
            & + \left( \partial_{\beta_1} \xi^\mu \right) T^{\alpha_1\ldots\alpha_k}_{\mu\beta_2\ldots\beta_l} + \ldots
            +  \left( \partial_{\beta_l} \xi^\mu \right)
            T^{\alpha_1\ldots\alpha_k}_{\beta_1\ldots\beta_{l-1}\mu}\,.
        \end{split}
    \end{equation}
\end{definition}
Therefore
\begin{equation}
    \left( \liedif{\xi}{\eta} \right)_{\mu\nu} = \underbrace{\xi^\varrho\partial_\varrho\eta_{\mu\nu}}_{=0}
    + \tensor{\xi}{_\mu_,_\nu} + \tensor{\xi}{_\nu_,_\mu} =
    \tensor{\xi}{_\mu_,_\nu} + \tensor{\xi}{_\nu_,_\mu}\,.
\end{equation}
If the derivative of a metric vanishes for a given $\xi^\mu$, then one obtains
the killing equations
\begin{equation}
    \tensor{\xi}{_\mu_,_\nu} + \tensor{\xi}{_\nu_,_\mu}=0
\end{equation}
for $\xi^\mu$ and the solutions are referred to as \emph{killing vector fields}.
In Minkowski-space the ten infinitesimal killing vectors correspond to the Poincaré-generators.
\begin{sidenote}
We can use the Lie-derivative on metric to detect symmetries of the Manifold.
\end{sidenote}
\subsubsection{Invariance of the linearized field equations under infinitesimal
diffeomorphisms}
We now check that linearized field equations are invariant under infinitesimal
diffeomorphism
\begin{equation}
    h'_{\mu\nu} = h_{\mu\nu} + \tensor{\xi}{_\mu_,_\nu} +
    \tensor{\xi}{_\nu_,_\mu}\,.
\end{equation}
The barred metric transforms as
\begin{equation}
    \begin{split}
        \overline{h'}_{\mu\nu} &= h'_{\mu\nu} - \frac{1}{2} \eta_{\mu\nu}h' \\
        &= h_{\mu\nu} + \tensor{\xi}{_\mu_,_\nu} + \tensor{\xi}{_\nu_,_\mu} - \frac{1}{2} \eta_{\mu\nu}h
        -\frac{1}{2}\eta_{\mu\nu}\partial^\varrho\xi_\varrho - \frac{1}{2} \eta_{\mu\nu}\partial^\varrho\xi_\varrho \\
        &= \overline{h}_{\mu\nu} + \tensor{\xi}{_\mu_,_\nu} +
        \tensor{\xi}{_\nu_,_\mu} -
        \eta_{\mu\nu}\tensor{\xi}{^\varrho_,_\varrho}\,.
    \end{split}
\end{equation}
We proceed by plugging this into Einstein's equations, the relevant terms are
\begin{align}
    -\frac{1}{2}\Box \overline{h'}_{\mu\nu} &= -\frac{1}{2}\Box\overline{h}_{\mu\nu} - \frac{1}{2}\Box\tensor{\xi}{_\mu_,_\nu}
    -\frac{1}{2}\Box\tensor{\xi}{_\nu_,_\mu} + \frac{1}{2}
    \eta_{\mu\nu}\Box\tensor{\xi}{^\varrho_,_\varrho}\,, \\
    -\frac{1}{2} \eta_{\mu\nu}\partial_\varrho\partial_\sigma \overline{h'}^{\varrho\sigma} &=
    -\frac{1}{2} \eta_{\mu\nu}\partial_\varrho\partial_\sigma \left( \tensor{\xi}{^\varrho^,^\sigma} + \tensor{\xi}{^\sigma^,^\varrho}
    - \eta^{\varrho\sigma} \tensor{\xi}{^\alpha_,_\alpha} \right) - \frac{1}{2}
    \eta_{\mu\nu}\partial_\varrho\partial_\sigma \overline{h}^{\varrho\sigma}\,,
    \\
    \partial^\varrho \tensor{\partial}{_(_\mu} \tensor{\overline{h'}}{_\nu_)_\varrho} &=
    \partial^\varrho \tensor{\partial}{_(_\mu} \tensor{\overline{h}}{_\nu_)_\varrho} + \frac{1}{2}\Box\tensor{\xi}{_\nu_,_\mu}
    + \frac{1}{2}\Box\eta_{\mu\nu}\,.
\end{align}
Therefore
\begin{equation}
    \begin{split}
        & -\frac{1}{2} \Box \overline{h'}_{\mu\nu} + \partial_\varrho \tensor{\partial}{_(_\mu}\tensor{\overline{h'}}{_\nu_)^\varrho}
        - \frac{1}{2} \eta_{\mu\nu}\partial_\varrho\partial_\sigma \overline{h'}^{\varrho\sigma} \\
        =\ & -\frac{1}{2}\Box\overline{h}_{\mu\nu} - {\frac{1}{2}\Box\tensor{\xi}{_\mu_,_\nu}}
        -{\frac{1}{2}\Box\tensor{\xi}{_\nu_,_\mu}}
        + {\frac{1}{2} \eta_{\mu\nu}\Box\tensor{\xi}{^\varrho_,_\varrho}}
        + \partial^\varrho \tensor{\partial}{_(_\mu}\tensor{\overline{h}}{_\nu_)_\varrho} \\
        & + {\Box\tensor{\xi}{_(_\mu_,_\nu_)}}
        - {\frac{1}{2}\eta_{\mu\nu}\Box\tensor{\xi}{^\varrho_,_\varrho}}
        - \frac{1}{2} \eta_{\mu\nu}\partial_\varrho\partial_\sigma \overline{h}^{\varrho\sigma} \\
        =\ & -\frac{1}{2} \Box \overline{h}_{\mu\nu} + \partial_\varrho \tensor{\partial}{_(_\mu}\tensor{\overline{h}}{_\nu_)^\varrho}
        - \frac{1}{2} \eta_{\mu\nu}\partial_\varrho\partial_\sigma \overline{h}^{\varrho\sigma}
    \end{split}
\end{equation}
This shows that the Einstein equations are invariant under an infinitesimal diffeomorphisms.
Therefore $\overline{h}_{\mu\nu}$ and $\overline{h'}_{\mu\nu}$ are the same \emph{physical} field.

\subsubsection{Harmonic gauge in linearized gravity}
As described above we want to bring the field equation in the form
$\Box\text{``field''}=\text{``source''}$, i.e. a wave equation.
This can ge done with the gauge condition
\begin{equation}
    \chi_\nu \left[ \overline{h} \right] \coloneqq \partial^\mu \overline{h}_{\mu\nu} = 0.
\end{equation}
In therms of the original field this condition reads
\begin{definition}[de Donder gauge, harmonic gauge]
    \begin{equation}
        \chi_\nu \left[ h \right] = \partial^\mu h_{\mu\nu} - \frac{1}{2} h_{\mu\nu} \partial^\mu h = 0
    \end{equation}
\end{definition}
Proof:
\begin{equation}
    \begin{split}
        \partial^\mu \overline{h'}_{\mu\nu} &= \partial^\mu \overline{h}_{\mu\nu} + \Box \xi_\nu + \partial_\nu \partial^\mu \xi_\mu -
        \eta_{\mu\nu} \partial^\mu\partial_\varrho\xi^\varrho \\
        &= \partial^\mu \overline{h}_{\mu\nu} + \Box \xi_\nu = 0
    \end{split}
\end{equation}
Solve for $\Box\xi_\nu$
\begin{equation}
    \implies \Box \overline{h'}_{\mu\nu} = -2\kappa T_{\mu\nu}
\end{equation}
Since $\overline{h}_{\mu\nu}$ and $\overline{h'}_{\mu\nu}$ correspond to the same physical field configuration, we can drop the prime.
\begin{definition}{Linearized field equations in de Donder gauge.}
    \begin{equation}
        \Box \overline{h}_{\mu\nu} = - 2 \kappa T_{\mu\nu}
\end{equation}
\end{definition}
\afterpage{
\clearpage
\thispagestyle{empty}
\begin{landscape}
    \begin{table}[h]
        \caption{Comparison between linearized gravity and electrodynamics.}
        \centering
        \begin{tabulars}{lll}
            \toprule
            & linearized gravity & electrodynamics \\
            \midrule

            basic field
            & $\overline{h}_{\mu\nu}$ ($h_{\mu\nu}$), spin-2, \emph{graviton}
            & $A_\mu$, spin-1, \emph{gauge boson}, \emph{gauge potential}
            \\%Photon????

            field equations
            & $ \underbrace{\Box \overline{h}_{\mu\nu}}_{\Box\text{``field''}} - \underbrace{2 \partial_\rho \tensor{\partial}{_(_\mu}\tensor{\overline{h}}{_\nu_)^\rho} - \eta_{\mu\nu}\partial_\rho\partial_\sigma \overline{h}^{\rho\sigma}}_{\text{ensures gauge inv.}} = -\underbrace{2 \kappa T_{\mu\nu}}_{\text{``source''}}$
            & $\underbrace{\Box A_\mu}_{\Box\text{``field''}} - \underbrace{\partial_\mu \left( \partial_\nu A^\nu \right)}_{\text{ensures gauge inv.}} = - \underbrace{4 \pi j_\mu}_{\text{source}}$ \\

            transf. under inf. gauge trafos
            & $\overline{h'}_{\mu\nu} = h_{\mu\nu}+\tensor{\xi}{_\mu_,_\nu} + \tensor{\xi}{_\nu_,_\mu} - \eta_{\mu\nu} \tensor{\xi}{^\rho_,_\rho}$
            & $A'_\mu = A_\mu + \partial_\mu\lambda(x)$\\

            & inf. coordinate transformation
            & internal symmetry \\

            inv. of field eqs
            & yes
            & yes \\

            specific gauges
            & de Donder gauge, $\partial_\mu \overline{h}^{\mu\nu}=0$
            & Lorentz gauge, $\partial_\mu A^\mu = 0$ \\

            field eqs. in specific gauges
            & $\Box \overline{h}_{\mu\nu} = - 2 \kappa T_{\mu\nu}$
            & $\Box A_\mu = - 4 \pi j_\mu$ \\

            inv. tensors under gauge trafo
            & $\tensor*{R}{^{(\text{L})\prime}_\mu_\nu} =
             \tensor*{R}{^{(\text{L})}_\mu_\nu}$
            & $F'_{\mu\nu} =F_{\mu\nu}$\\
            \bottomrule
        \end{tabulars}
    \end{table}
\end{landscape}
}

\begin{remark}[Fierz-Pauli action, 1939]
\begin{equation}
    \lagrangian_{\text{FP}} =
    \frac{1}{2} \left( \partial_\mu h^{\mu\nu} \right) \left( \partial_\nu h \right)
    - \partial_\mu h^{\rho \sigma} \partial_\rho \tensor{h}{^\mu_\sigma}
    + \frac{1}{2} \eta^{\mu\nu} \left( \partial_\mu h^{\rho\sigma} \right) \left( \partial_\nu h_{\rho \sigma} \right)
    - \frac{1}{2} \eta^{\mu\nu} \left( \partial_\mu h \right) \left( \partial_\nu h \right)
\end{equation}
For vacuum this is the Lagrangian of a massless spin-2 field $h_{\mu\nu}(x)$ (``the graviton'') in flat spacetime $h^{\mu\nu}$. \\
Problem: non-linearity (in electrodynamics: linear coupling)
\begin{equation}
    T_{\mu\nu}h^{\mu\nu} \rightarrow h_{\mu\nu}^{(2)} \propto \left( h_{\mu\nu}^{(1)}  \right)^2
\end{equation}
$\rightarrow$ Deser 1970: Iterative procedure \\
$\hookrightarrow$ including gravitational self energy and resuming one recovers the full nonlinear Einstein equations.
\end{remark}

\newpage

\section{Newtonian Limit}
Empirically we know
\begin{enumerate}
    \item Newtonian gravity describes the dynamics in our solar system to a high accuracy
    \item On earth, we can measure the gravitation constant $G_\text{N}$ e.g.\ by Cavendish-type  experiments
\end{enumerate}
If General Relativity is a more fundamental gravitational theory than Newton's theory it should
\begin{enumerate}
    \item recover \name{Newton}'s theory in appropriate limit, i.e.\ in the domain where Newtonian Gravity is a good description
    \item be more accurate than Newton's theory, i.e.\ it should predict small corrections to Newtonian Gravity.
\end{enumerate}
Conditions for the Newtonian limit:
\begin{enumerate}
    \item $v \ll c$ (sources move slowly) \\
    slowly changing geometry $\approx$ static: no $\dif{x}^i\dif t$ terms in
    $\dif{s}^2$ (would violate $t\rightarrow -t$ invariance)
    \item $g_{\mu\nu} = \eta_{\mu\nu} + h_{\mu\nu}$ with $\abs{h_{\mu\nu}} \ll 1$ (weak gravitational field)
    \item $p \ll \rho$ (sources have low internal pressure)
\end{enumerate}
\begin{enumerate}[{ad} 1.]
    \item $v\ll c$ is required as (special) relativistic effects must be small
    \item Consider the solar system as a closed system: Then a particle in the outer region with $v\ll c$ initially,
    will fall into the inner region (center of mass) and it will be accelerated by gravity. It will be then have a kinetic energy
    $E_\text{kin} = \frac{1}{2} m v^2 \sim \abs{m \Phi}$, where $\Phi < 0$ is the gravitational Newtonian potential with boundary condition
    $\displaystyle \lim_{x\to \infty}\Phi(x) = 0$. Small velocities of the
    sources imply weak gravitational fields.
    \item Speed of sound
    \begin{align}
        & c_s \coloneqq \abs{\frac{T_{ij}}{T_{00}}} \quad \text{with} \quad T_{\mu\nu} = \diag \left( \rho, \frac{p}{c^2}, \frac{p}{c^2}, \frac{p}{c^2} \right) \quad \text{(perfect fluid)} \\
        & c_s \sim \left( \frac{p}{\rho} \right)^{1/2}
    \end{align}
    The internal pressure of the sources must be small, otherwise they would also create (fast) motion of sound waves. \\
    $\implies p \ll \rho$ \\
    $\implies$ energy-momentum tensor of dust
    \begin{align}
        T^{\mu\nu} &= \rho_0 t^\mu t^\nu \\
        t^\mu &= \delta^\mu_0 = \left( \frac{\partial}{\partial x^0} \right)^\mu
    \end{align}
    $t^\mu$ is the ``direction'' of an internal coordinate system of time
    \begin{equation}
        \Box \overline{h}_{\mu\nu} \approx \Delta \overline{h}_{\mu\nu}
    \end{equation}
    alternatively $\Box = - \frac{1}{c^2} \frac{\partial^2}{\partial t^2} + \Delta \approx \Delta$ as
    $\frac{1}{c} \frac{\partial}{\partial t} = \frac{1}{c} \frac{\partial}{\partial x} \frac{\partial x}{\partial t}
    \sim \frac{v}{c} \frac{\partial}{\partial x} \ll \frac{\partial}{\partial x}$
\end{enumerate}

For the Newtonian limit, we must look for solutions to $\Box \overline{h}_{\mu\nu} = - 2 \kappa T_{\mu\nu}$, where time-derivatives are
negligible and where the energy-momentum tensor is the one of dust.
\begin{equation}
    \Delta \overline{h}_{\mu\nu} =
    \begin{cases}
    	-2 \kappa \rho_0 & \mu=\nu=0 \\
    	0 & \text{else}
    \end{cases}
\end{equation}
Consider first the \name{Poisson} equation with vanishing sources.
The unique solution is $\overline{h}_{\mu\nu} = \const$. The $\const$ can be always adjusted to zero by a residual gauge transformation:
\begin{equation}
    \overline{h}_{\mu\nu} = 0, \quad \mu \neq \nu = 0
\end{equation}
Residual gauge transformation
\begin{equation}
    \partial^\mu \overline{h'}_{_\mu\nu} = \underbrace{\partial^\mu \overline{h}_{\mu\nu}}_{=0} + \Box \xi_\nu = 0
\end{equation}
This means that all gauge transformations $\xi_\mu$ with $\Box \xi_\mu = 0$ are compatible with the de Donder gauge
(i.e.\ that doesn't lead out of the de Donder gauge). \\
As far we know:
\begin{align}
    \overline{h}_{\mu\nu} &= 0 \qquad \text{for the 0-0 component } \\
    \Delta \overline{h}_{00} &= - 2\kappa \rho_0 \qquad \mu \neq \nu = 0
\end{align}
We identify the gravitational potential as
\begin{equation}
    \Phi \coloneqq -\frac{1}{4} \overline{h}_{00}
\end{equation}
We obtain the \name{Poisson} equation
\begin{equation}
    \Delta \Phi = \frac{\kappa}{2} \rho_0 = 4 \pi G_\text{N} \rho_0
\end{equation}
Solution in terms of the original field $h_{\mu\nu}$:
\begin{equation}
    h_{\mu\nu} = \overline{h}_{\mu\nu} - \frac{1}{2} \eta_{\mu\nu} \overline{h}
    = \overline{h}_{00} \left( \tensor{\delta}{_\mu^0} \tensor{\delta}{_\nu^0} + \frac{1}{2} \eta_{\mu\nu} \right)
    = - 4\Phi \left( \tensor{\delta}{_\mu^0} \tensor{\delta}{_\nu^0} + \frac{1}{2} \eta_{\mu\nu} \right)
\end{equation}
We have used $\overline{h}=\eta^{\rho\sigma}\overline{h}_{\rho\sigma} = -\overline{h}_{00} = 4 \Phi$
\begin{align}
    & \implies h_{00}=-2\Phi \qquad h_{ij}=-2\Phi\delta_{ij} \qquad h_{0\mu}=0 \\
    & \implies \dif{s}^2 = g_{\mu\nu} \dif{x}^\mu \dif{x}^\nu = - (1+2\Phi)\dif{t}^2 + (1-2\Phi)\delta_{ij} \dif{x}^i \dif{x}^j
\end{align}
This is the Newtonian geometry.
%TODO ref to first appearance newt. geo.
\subsection{Motion of test particles in Newtonian Geometry}
Test particles carry clocks that read universal time in Newton Geometry.
\begin{align}
    & \frac{\dif{}^2 x^i}{\dif{} t^2} = \frac{\dif{}^2 x^i}{\dif{} \tau^2}
    = - \cSym{i}{\alpha}{\beta} \frac{\dif x^\alpha}{\dif \tau} \frac{\dif x^\beta}{\dif \tau}
    = - \cSym{i}{0}{0}
    = - \csym{0}{0}{i}
    = \frac{1}{2} \tensor{h}{_0_0_,_i} - \tensor{h}{_0_i_,_0}
    = \frac{1}{2} \tensor{h}{_0_0_,_i} = - \tensor{\Phi}{_,_i} \\
    & \implies \frac{\dif{}^2 x^i}{\dif{} t^2} =  - \tensor{\Phi}{_,_i} \qquad \left( \quad \widehat{=} \quad \vec{a} = -\nabla \Phi \right)
\end{align}
where we used $\frac{\dif \tau}{\dif t} = 1$,$v^i \sim \abs{\frac{\dif x^i}{\dif \tau}} \ll 1$, $g_{\mu\nu}=\eta_{\mu\nu}$, and
$\dif{}_t \sim \frac{v^i}{c} \dif{}_{x_i} \ll 1$.
In Newtonian Gravity, we have two equations
\begin{enumerate}
    \item ``field equations'': $\Delta \Phi = 4 \pi G_\text{N} \rho_0$ (Poisson equation), describes how the gravitational potential
    (geometry in General Relativity) reacts on matter $\rho_0$
    \item ``geodesic equation'': $\frac{\dif{}^2 x^i}{\dif{}t^2} = - \tensor{\Phi}{_,_i}$, describes how matter (test particles, dust)
    moves under the influence of the gravitational potential $\Phi$ (in General Relativity: moves in curved geometry)
\end{enumerate}

\subsection{Geodesic deviation in Newtonian Geometry}
From the last analysis, we know
\begin{equation}
    \cSym{i}{0}{0} = \tensor{\Phi}{^,^i} \qquad \text{(all other components are zero).}
\end{equation}
Insert this in the Riemannian curvature tensor:
\begin{equation}
    \tensor{R}{^i_0_j_0} = -\tensor{R}{^i_0_0_j} = \tensor{\Phi}{^,^i_j} \qquad \text{(all other components are zero).}
\end{equation}
Ricci-tensor:
\begin{equation}
    R_{00} = \Delta \Phi = 4 \pi G_\text{N} \rho_0
\end{equation}

\subsubsection{geodesic deviation}
\begin{equation}
    \frac{\difD^2 \eta^i}{\difD \tau^2} \approx \frac{\dif{}^2 \eta^i}{\dif{} \tau^2}
    = - \tensor{R}{^i_0_j_0} \eta^j = - \tensor{\Phi}{^,^i_j}\tensor{\eta}{^j}
\end{equation}
where we used that
\begin{equation}
    \frac{\difD{} \eta^i}{\difD{} \tau} = \nabla_j \eta^i \frac{\dif x^j}{\dif \tau} = \partial_j \eta^i x^j = \frac{\dif \eta^i}{\dif t}
\end{equation}
Compare to the deviation equation due to tidal forces in Newtonian Gravity.
\begin{equation}
    \begin{split}
        \frac{\dif{}^2 \eta^i}{\dif \tau^2} &= \frac{\dif{}^2 \left( x^i + \eta^i \right)}{\dif{} t^2} - \frac{\dif{}^2 x^i}{\dif{}t^2} \\
        &= - \left. \frac{\partial \Phi}{\partial x_i} \right|_{x+\eta} + \left. \frac{\partial \Phi}{\partial x_i} \right|_{x} \\
        &= - \left. \frac{\partial \Phi}{\partial x_i} \right|_{x}
        - \left. \frac{\partial^2 \Phi}{\partial x_i \partial x^j} \right|_{x} \eta^j
        + \left. \frac{\partial \Phi}{\partial x_i} \right|_{x} \\
        &= - \tensor{\Phi}{^,^i_j} \eta^j
    \end{split}
\end{equation}
This shows again that tidal forces are a genuine gravitational effect that is related to curvature of spacetime (in General Relativity)
and cannot be transformed away.
\begin{figure}[hbtp!]
\centering
 \includegraphics{geodesicdeviation.pdf}
\caption{}
%TODO Caption
\end{figure}
\begin{figure}[hbtp!]
\centering
 \includegraphics{Tidalforce.pdf}
\caption{Tidal forces acting on particles on a ring }
\end{figure}
\begin{figure}[hbtp!]
\centering
 \includegraphics{Tidalforces1.pdf}
%TODO Caption
\end{figure}

\begin{figure}[hbtp!]
\centering
 \includegraphics{Tidalforces2.pdf}
%TODO Caption
\end{figure}


\subsection{Greedy Algorithm}

It is a simple algorithm: add the vertices which minimize the added weight and does not violate the precedence-constraint iteratively until no more vertex can be added without exceeding the knapsack capacity. Such algorithm is presented below:

\begin{algorithm}[ht!]
    \caption{Greedy}
    \begin{algorithmic}[1]
        \Require{$\vertices, \edges, \weight, \maximumWeight$}
        \State{$S \gets \emptyset$}
        \State{$X \gets $ all leaf vertices}
        \State{$Y \gets 0$}
        \State{$\solutionE \gets \mathop{\mathrm{arg\,min}}\limits_{\solutionE \in X} \weightE$}
        \While{$Y + \weightE \leqslant \maximumWeight$}
            \State{$S \gets S \cup \Set{\solutionE}$}
            \State{$Y \gets Y + \weightE$}
            \State{$X \gets $ all the vertices not yet in $S$ that can be added to $S$ without violating the constraints}
            \State{$\solutionE \gets \mathop{\mathrm{arg\,min}}\limits_{\solutionE \in X} \norm{\weightE}$}
        \EndWhile
        \\\Return{$S$}
    \end{algorithmic}
    \label{algorithm:greedy}
\end{algorithm}


% based on example 7 in pythontex_gallery
% https://github.com/gpoore/pythontex/

\documentclass[12pt]{mmalatex}
\usepackage{examples}

\begin{document}

\section*{A table of derivatives and anti-derivatives}

This example is based upon a nice example in the Pythontex gallery, see
\ \url{https://github.com/gpoore/pythontex/}.
It uses a tagged block to capture the Mathematica output for later use
in the body of the LaTeX table.

\lstset{numbers=left}

\begin{minipage}[t]{0.65\textwidth}
\begin{mathematica}
   (* Create a list of functions to include in the table *)
   fun = {Sin[x],      Cos[x],      Tan[x],
          ArcSin[x],   ArcCos[x],   ArcTan[x],
          Sinh[x],     Cosh[x],     Tanh[x]};

   eol = {"\\\\" ,     "\\\\",      "\\\\",
          "\\\\[5pt]", "\\\\[5pt]", "\\\\[5pt]",
          "\\\\",      "\\\\",      " "};

   ddxfun = D[#, x] & /@ fun;
   intfun = Integrate[#, x] & /@ fun;

   ddxfunHold = HoldForm[D[#, x]] & /@ fun;
   intfunHold = HoldForm[Integrate[#, x]] & /@ fun;

   (* mmaBeg (CalculusTable) *)
   Do[Print[OutputForm[
      ToString[TeXForm[ddxfunHold[[i]]]] <> "&=" <>
      ToString[TeXForm[ddxfun[[i]]]]     <> "\\quad & \\quad"
      ToString[TeXForm[intfunHold[[i]]]] <> "&=" <>
      ToString[TeXForm[intfun[[i]]]]     <>
      eol[[i]]
      ]], {i,1,9}]
   (* mmaEnd (CalculusTable) *)
\end{mathematica}
\end{minipage}
\hskip 1cm
\begin{minipage}[t]{0.35\textwidth}
\begin{latex}
   \begin{align*}
      \mma {CalculusTable}
   \end{align*}
\end{latex}
\end{minipage}

\clearpage

\begin{align*}
   \mma {CalculusTable}
\end{align*}

\end{document}


\section{Series}
\subsection{Finite Series}
\declareexercise{7.1.1}
\begin{proof}
(a)
Induct on $p$. When $p=m+1$, $n=m$, and
\[
\sum_{i=m}^n{a_i} + \sum_{i=n+1}^p{a_i} = a_m + a_{m+1} = \sum_{i=m}^p{a_i}
\]

We suppose inductively that for some $p$ the property still holds, then for $p+1$,
\begin{align*}
&\sum_{i=m}^n{a_i} + \sum_{i=n+1}^{p+1}{a_i}\\
&= \sum_{i=m}^n{a_i} +\sum_{i=n+1}^{p}{a_i} + a_{p+1} \tag{By def.}\\
&= \sum_{i=m}^{p}{a_i} + a_{p+1} \tag{Induction Hypothesis} \\
&= \sum_{i=m}^{p+1}{a_i} \tag{By def.}
\end{align*}

(b)
Induct on $n$. The inductive step is
\[
\sum_{i=m}^{n+1}a_i = \sum_{i=m}^{n}a_i + a_{n+1} = \sum_{i=m+k}^{n+k}a_i + a_{n+k+1-k} = \sum_{i=m+k}^{n+k}a_i
\]

(c)
The inductive step is
\begin{align*}
\sum_{i=1}^{n+1}{(a_i+b_i)}
&= \sum_{i=1}^{n}{(a_i+b_i)} + (a_{n+1}+b_{n+1}) \\
&= \sum_{i=1}^{n}{a_i}+\sum_{i=1}^{n}{b_i}+ (a_{n+1}+b_{n+1}) \\
&= \sum_{i=1}^{n+1}{a_i}+\sum_{i=1}^{n+1}{b_i}
\end{align*}

(d)
The inductive step is
\begin{align*}
\sum_{i=1}^{n+1}{ca_i}
&= \sum_{i=1}^{n}{ca_i} + ca_{n+1} \\
&= c\sum_{i=1}^{n}{a_i}+ c(a_{n+1}) \\
&= c\sum_{i=1}^{n+1}{a_i}
\end{align*}

(e)
The inductive step is
\begin{align*}
\left|\sum_{i=1}^{n+1}{a_i}\right|
&= \left|\sum_{i=1}^{n}{a_i} + a_{n+1}\right| \\
&\leq \left|\sum_{i=1}^{n}{a_i}\right| + \left|a_{n+1}\right| \\
&\leq \sum_{i=1}^{n}{|a_i|} + |a_{n+1}| \\
&= \sum_{i=1}^{n+1}{|a_i|}
\end{align*}

(f)
The inductive step is
\begin{align*}
\sum_{i=1}^{n+1}{a_i}
&= \sum_{i=1}^{n}{a_i} + a_{n+1} \\
&\leq \sum_{i=1}^{n}{b_i} + b_{n+1} \\
&= \sum_{i=1}^{n+1}{b_i}
\end{align*}
\end{proof}

\declareexercise{7.1.2}
\begin{proof}
(a)
Any function $g$ from the empty set ($\{i:1\leq i \leq 0\}$) to the empty set is a bijection. So $\sum_{x \in \varnothing}{f(x)} = \sum_{i=1}^0{f(g(i))} = 0$.

(b)
This time the bijection $g$ would be $\{1\} \to \{x_0\}$. And we have $\sum_{x \in \{x_0\}}{f(x)} = \sum_{i=1}^1{f(g(i))} = f(g(1)) = f(x_0)$.

(c)

\end{proof}

\subsection{Infinite Series}
\declareexercise{7.2.1}
It is divergent.
\begin{proof}
It is immediately derived from $((-1)^n)^\infty_n$ being divergent.
\end{proof}

\declareexercise{7.2.2}
\begin{proof}
According to Theorem 6.4.18, $(S_n)_n^\infty$ is convergent iff it is Cauchy. That is, iff
\[
\forall \varepsilon>0(\exists N(\forall p,q\geq N(|S_p-S_q|\leq \varepsilon)))
\]
If $p\geq q$, then according to Lemma 7.1.4, (a), $|S_p-S_q| = |\sum_{i=q+1}^p{a_i}|$. If $p \leq q$, then
\[
|S_p-S_q| = \left|\sum_{i=1}^p{a_i}-(\sum_{i=1}^p{a_i}+\sum_{i=q+1}^p{a_i})\right| = \left|-\sum_{i=q+1}^p{a_i}\right| = \left|\sum_{i=q+1}^p{a_i}\right|
\]
We nearly finished the proof except that here $i$ starts at $q+1$, not $q$. But this is an unimportant matter. In fact, on one hand, $\forall p,q \geq N(|\sum_{i=q}^p{a_i}|) \rightarrow \forall p,q \geq N(|\sum_{i=q+1}^p{a_i}|)$; on the other hand, $\forall p,q \geq N(|\sum_{i=q+1}^p{a_i}|) \rightarrow \forall p,q \geq N+1(|\sum_{i=q}^p{a_i}|)$. We only requires the existence of $N$ for any arbitrary $\varepsilon >0$, so the two statements are equivalent.
\end{proof}

\declareexercise{7.2.3}
\begin{proof}
Simply let $p=q$ in Proposition 7.2.5 to obtain $\forall \varepsilon >0 (\exists N(\forall p\geq N(|a_p|\leq \varepsilon)))$ and we are finished.
\end{proof}

\declareexercise{7.2.4}
\begin{proof}
According to Lemma 7.1.4, (e), we have $|\sum_{i=q}^p{a_i}| \leq \sum_{i=q}^p{|a_i|} = |\sum_{i=q}^p{|a_i|}|$ as $\sum_{i=q}^p{|a_i|}\geq 0$. So if $|\sum_{i=q}^p{|a_i|}| \leq \varepsilon$, then $|\sum_{i=q}^p{a_i}|$ must also satisfy it.
\end{proof}

\declareexercise{7.2.5}
\begin{proof}
(a)
According to Lemma 7.1.4, (c), the partial sum of $\sum_{n=m}^\infty{a_n+b_n}$ is $\sum_{n=m}^Na_n + \sum_{n=m}^Nb_n$. The limit of this sequence, according to Proposition 6.1.19, is the sum of the two limits, $\sum_{n=m}^\infty a_n+ \sum_{n=m}^\infty b_n$.

(b)
The partial sum can be seen as $c \sum_{n=m}^Na_n$.

(c)
This statement immediately follows from taking limits on both sides of the following equation derived from Lemma 7.1.4 (for $N \geq m+k$)
\[
\sum_{n=m}^Na_n = \sum_{n=m}^{m+k-1}a_n + \sum_{n=m+k}^Na_n
\]

(d)
This statement immediately follows from
\[
\sum_{n=m}^Na_n = \sum_{n=m+k}^{N+k}a_{n-k}
\]
\end{proof}

\declareexercise{7.2.6}
\begin{proof}
By induction we can easily show that $\sum_{i=0}^N{a_n-a_{n+1}} = a_0-a_{N+1}$. Taking limits on both sides of this equation immediately gives
$\sum_{n=0}^\infty = a_0-\lim_{n \to \infty}a_n$.
\end{proof}

\subsection{Sums of non-negative numbers}
\declareexercise{7.3.1}
\begin{proof}
By Lemma 7.1.4, we know that $\sum_{n=m}^N|a_n| \leq \sum_{n=m}^Nb_n$. Since that $\sum_{n=m}^\infty b_n$ converges, there is a $M$ such that
$\sum_{n=m}^N|a_n| \leq \sum_{n=m}^Nb_n \leq M$. This fact plus that $|a_n| \geq 0$ immediately leads to the convergence of $\sum_{n=m}^\infty|a_n$. We can draw a similar conclusion for $|\sum_{n=m}^Na_{n}|$.

To show that the limits of them still follows the order, however, it is not so obvious. We must prove that limit preserves order.
\end{proof}

\declareexercise{7.3.2}
\begin{proof}
If $|x| \geq 1$, then $x^n \to$ either $\infty$ or $-\infty$. Thus the series is divergent.

If $|x| < 1$, then the partial sum of $|x|^n$ equals $\frac{1-|x|^{N+1}}{1-|x|}$. Since $|x|^{N+1} \to 0$, taking limit gives $\sum_{n=0}^\infty {|x|^n} = \frac{1}{1-|x|}$. This immediately implies that the original series is conditionally convergent. So taking limit on the not absolute partial sum gives what we want.
\end{proof}

\declareexercise{7.3.3}
\begin{proof}
Assume that negation, that is, at least for some $n \in X$, $a_n \neq 0$.
\end{proof}


\section{Cartesian Products}

\begin{definition}
  Let $\mathcal{A}$ be a nonempty collection of sets. An \textbf{indexing
  function} for $\mathcal{A}$ is a surjective function $f$ from some set $J$,
  called the \textbf{index set}, to $\mathcal{A}$. The collection $\mathcal{A}$, together with the indexing function $f$ is called an \textbf{indexed family of sets}. Given $\alpha \in J$, we shall denote the set $f(\alpha)$ by the symbol $A_\alpha$. And we shall denote the indexed family itself by the symbol
  \begin{equation}
    \pbrac{
      A_\alpha
    }_{
      \alpha \in J
    },
  \end{equation}
  which is read as ``the family of all $A_\alpha$, as $\alpha$ ranges over $J$.''
\end{definition}

\section*{Exercises}

\bx{
  Consider $f : A \to B$
  \begin{align*}
    f(a, b) &= (b, a)\\
    f^{-1}(b, a) &= (a, b)
  \end{align*}
}

\bx{
  I'm just going to write out functions that you can check are bijective.
  \ea{
    \item $f(a_1, a_2, \dots, a_n) = ((a_1, \dots, a_{n-1}), a_n)$
    \item \begin{align*}
      f_{-1} (a_1, a_2, \dots) &= ((a_1, a_2), (a_3, a_4), \dots) = (b_1, b_2, \dots)\\
      f^{-1} (b_1, b_2, \dots) &= f^{-1}((a_1, a_2), (a_3, a_4), \dots)\\
        &= (a_1, a_2, \dots)
    \end{align*}
  }
}

\bx{
  \ea{
    \item For any $b \in B$, we have that every index element $\in A_i$, so
    therefore $b \in A$. Therefore $B \subset A$.
    \item The converse is if $B \subset A$, then $B_i \subset A_i$. This is true
    because AFSOC $\exists b \in B$ such that $\exists i$ such that $B_i \not\subset
    A_i$. Then $b \not \in A$, and therefore $B \not\subset A$. But this is a
    contradiction.
    \item AFSOC $\exists i$ such that $A_i$ is empty. Then, $A$ must be empty,
    because there is no element that can be in the $i^\text{th}$ tuple. If every
    $A_i$ is nonempty, then $A$ must also be nonempty.
    \item \begin{itemize}
      \item $A \cup B \subset \prod_i A_i \cup B_i$
      \item $A \cap B \supset \prod_i A_i \cap B_i$
    \end{itemize}
  }
}

\bx{
  \ea{
    \item Just map the first $m$ tuples to the first $m$, and the remainder just map to any element of $X$
    \item $f((x_1, \dots, x_m), (x'_1, \dots, x'_n)) = (x_1, \dots, x_m, x'_1, \dots, x'_n)$
    \item Just map the first $n$ elements, and for the rest just use any element of $X$
    \item Map first $n$, then map the rest. Other way, Map first $n$, then map the rest
    \item $f((x_1, x_2, \dots), (x'_1, x'_2, \dots)) = (x_1, x'_1, x_2, x'_2, \dots)$
    \label{chap1:sec5:prob4:part3}
    \item Just cycle through the $n$ coordinates for mapping, similar to
    \ref{chap1:sec5:prob4:part3}.
  }
}

\bx{
  \ea{
    \item Yes, just do $\prod_i \mathbb{Z}$
    \item Easy, just $\prod_i [i, \infty)$
    \item $\prod_{i=1}^{100} \mathbb{R} \times \prod_{i=101}^\infty \mathbb{Z}$
    \item Cannot be expressed.
  }
}


\section{Matrix inverses}

\begin{outcome}
  \begin{enumerate}
  \item Determine whether a matrix is invertible, and compute the
    inverse if it exists.
  \item Solve a system of linear equations using matrix algebra.
  \item Prove algebraic properties of matrix inverses.
  \item Determine whether a matrix is a left inverse, right inverse, or
    inverse of another matrix.
  \end{enumerate}
\end{outcome}


\subsection*{Q. 2}
\subsubsection*{Four-bit Parity Generator}
\vspace{-1.2em}
\begin{longtable}[c]{cccc|c}
\multicolumn{4}{l|}{Input 4-bit message} & \multicolumn{1}{l}{Odd parity generator} \\ \hline
\endfirsthead
%
\endhead
%
\hline
\endfoot
%
\endlastfoot
%
A        & B        & C        & D       & P                                        \\ \hline
0        & 0        & 0        & 0       & 1                                        \\
0        & 0        & 0        & 1       & 0                                        \\
0        & 0        & 1        & 0       & 0                                        \\
0        & 0        & 1        & 1       & 1                                        \\
0        & 1        & 0        & 0       & 0                                        \\
0        & 1        & 0        & 1       & 1                                        \\
0        & 1        & 1        & 0       & 1                                        \\
0        & 1        & 1        & 1       & 0                                        \\
1        & 0        & 0        & 0       & 0                                        \\
1        & 0        & 0        & 1       & 1                                        \\
1        & 0        & 1        & 0       & 1                                        \\
1        & 0        & 1        & 1       & 0                                        \\
1        & 1        & 0        & 0       & 1                                        \\
1        & 1        & 0        & 1       & 0                                        \\
1        & 1        & 1        & 0       & 0                                        \\
1        & 1        & 1        & 1       & 1                                        \\ \hline
\end{longtable}
\begin{center}
\begin{karnaugh-map}[4][4][1][$CD$][$AB$]
\minterms{0,3,5,6,9,10,12,15}
\implicant{0}{0}
\implicant{3}{3}
\implicant{5}{5}
\implicant{6}{6}
\implicant{9}{9}
\implicant{10}{10}
\implicant{12}{12}
\implicant{15}{15}
\end{karnaugh-map}
\end{center}
\vspace{-2.5em}
\begin{align*}
F(A,B,C,D)&=A'B'C'D'+A'B'CD+A'BC'D+A'BCD'+ABC'D'+ABCD+AB'C'D+AB'CD'\\
&=A'D'(BC+B'C')+A'D(B'C+BC')+AD'(BC'+B'C)+AD(BC+B'C')\\
&=A'D'(B\oplus C)'+A'D(B\oplus C)+AD'(B\oplus C)+AD(B\oplus C)'\\
&=(A'D'+AD)(B\oplus C)'+(A'D+AD')(B\oplus C)\\
&=(A\oplus D)'(B\oplus C)'+(A\oplus D)(B\oplus C)\\
&=((A\oplus D)\oplus (B\oplus C))'
\end{align*}
\centerline{\includegraphics[width=0.4\textwidth]{fig/f21}}

\subsubsection*{Three-bit Parity Checker}
\vspace{-1.2em}
% Please add the following required packages to your document preamble:
% \usepackage{longtable}
% Note: It may be necessary to compile the document several times to get a multi-page table to line up properly
\begin{longtable}[c]{cccc|c}
\multicolumn{4}{l|}{Input (3+1)-bit} & \multicolumn{1}{l}{Odd parity checker} \\ \hline
\endfirsthead
%
\endhead
%
\hline
\endfoot
%
\endlastfoot
%
A       & B       & C       & P      & $C_P$                                   \\ \hline
0       & 0       & 0       & 0      & 1                                      \\
0       & 0       & 0       & 1      & 0                                      \\
0       & 0       & 1       & 0      & 0                                      \\
0       & 0       & 1       & 1      & 1                                      \\
0       & 1       & 0       & 0      & 0                                      \\
0       & 1       & 0       & 1      & 1                                      \\
0       & 1       & 1       & 0      & 1                                      \\
0       & 1       & 1       & 1      & 0                                      \\
1       & 0       & 0       & 0      & 0                                      \\
1       & 0       & 0       & 1      & 1                                      \\
1       & 0       & 1       & 0      & 1                                      \\
1       & 0       & 1       & 1      & 0                                      \\
1       & 1       & 0       & 0      & 1                                      \\
1       & 1       & 0       & 1      & 0                                      \\
1       & 1       & 1       & 0      & 0                                      \\
1       & 1       & 1       & 1      & 1                                      \\ \hline
\end{longtable}
\begin{center}
\begin{karnaugh-map}[4][4][1][$CP$][$AB$]
\minterms{0,3,5,6,9,10,12,15}
\implicant{0}{0}
\implicant{3}{3}
\implicant{5}{5}
\implicant{6}{6}
\implicant{9}{9}
\implicant{10}{10}
\implicant{12}{12}
\implicant{15}{15}
\end{karnaugh-map}
\end{center}
\vspace{-2.5em}
\begin{align*}
F(A,B,C,P)&=A'B'C'P'+A'B'CP+A'BC'P+A'BCP'+ABC'P'+ABCP+AB'C'P+AB'CP'\\
&=A'P'(BC+B'C')+A'P(B'C+BC')+AP'(BC'+B'C)+AP(BC+B'C')\\
&=A'P'(B\oplus C)'+A'P(B\oplus C)+AP'(B\oplus C)+AP(B\oplus C)'\\
&=(A'P'+AP)(B\oplus C)'+(A'P+AP')(B\oplus C)\\
&=(A\oplus P)'(B\oplus C)'+(A\oplus P)(B\oplus C)\\
&=((A\oplus P)\oplus (B\oplus C))'
\end{align*}
\centerline{\includegraphics[width=0.4\textwidth]{fig/f22}}


\documentclass{article}

\usepackage[letterpaper, margin=1.3cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\usepackage[fleqn]{mathtools}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{datetime}
\newcommand\aug{\fboxsep=-\fboxrule\!\!\!\fbox{\strut}\!\!\!}

\title{MATH 225 Assignment 2}
\author{Michael Kwok}
\date{2020-07-20}
\begin{document}
\maketitle
\subsection*{1}
A linear transformation must be both additive and homogenous.

Show that the Trace function $Tr : M_{2,2} \rightarrow \mathbb{R}$ is linear, i.e. $Tr(\alpha A + \beta B) = \alpha Tr(A) + \beta Tr(B)$:

let $\alpha, \beta \in \mathbb{R}$

let $A = \begin{bmatrix}
a_1 & b_1\\
c_1 & d_1
\end{bmatrix}$

let $B = \begin{bmatrix}
a_2 & b_2\\
c_2 & d_2
\end{bmatrix}$

\begin{align*}
Tr(\alpha A + \beta B) &= Tr\left(\alpha \begin{bmatrix}
a_1 & b_1\\
c_1 & d_1
\end{bmatrix} + \beta \begin{bmatrix}
a_2 & b_2\\
c_2 & d_2
\end{bmatrix} \right)\\
&= Tr\left( \begin{bmatrix}
\alpha a_1 + \beta a_2 & \alpha b_1 + \beta b_2\\
\alpha c_1 + \beta c_2 & \alpha d_1 + \beta d_2
\end{bmatrix} \right)\\
&= \alpha a_1 + \beta a_2 + \alpha d_1 + \beta d_2\\
&= \alpha (a_1 + d_1) + \beta (a_2  + d_2)\\
&= \alpha Tr\left(\begin{bmatrix}
a_1 & b_1\\
c_1 & d_1
\end{bmatrix}\right) + \beta Tr\left(\begin{bmatrix}
a_2 & b_2\\
c_2 & d_2
\end{bmatrix}\right)\\
&= \alpha Tr(A) + \beta Tr(B)
\end{align*}

$\therefore$ the Trace function $Tr : M_{2,2} \rightarrow \mathbb{R}$ is linear
\newpage
\subsection*{2a}
\begin{align*}
    p(x) &= 5(1) + 2(x-1) - (x-1)^2\\
    &= 5 + 2x - 2 - x^2 + 2x - 1\\
    &= 2+ 4x -x^2
\end{align*}
\subsection*{2b}
Define the basis set with standard bases:

\begin{align*}
B_1 = \begin{bmatrix}
1\\
0\\
0\\
\end{bmatrix} B_2 = \begin{bmatrix}
-1\\
1\\
0\\
\end{bmatrix} B_3 = \begin{bmatrix}
1\\
-2\\
1\\
\end{bmatrix}
\end{align*}

Augmented matrix of the system:

\begin{align*}
\begin{bmatrix}
1 & -1 & 1  &\aug & 6 \\
0 & 1  & -2 &\aug & -4\\
0 & 0  & 1  &\aug & 1
\end{bmatrix} \xrightarrow{\text{rref}} \begin{bmatrix}
1 & 0 & 0 &\aug & 3 \\
0 & 1 & 0 &\aug & -2\\
0 & 0 & 1 &\aug & 1
\end{bmatrix}
\end{align*}

\begin{align*}
[q(x)]_{\mathcal{B}} &= \begin{bmatrix}
3\\
-2\\
1\\
\end{bmatrix}
\end{align*}
\subsection*{2c}
Value of $C_\mathcal{B}(a+bx^2+cx^2) = (a+b+c) + (b+2c)(x-1)+c(x-1)^2$

\begin{align*}
    &R((a+b+c)+(b+2c)(x-1)+c(x-1)^2)\\
    &= (a+b+c - b-2c) + (b+2c-c)x + (c-a-b-c) x^2\\
    &= (a-c) + (b+c)x - (a + b)x^2
\end{align*}
\newpage

\subsection*{2d}
For the map $R \circ C_B$ to be invertible, both the change of basis and transformation $R$ must be invertible. A change of basis by definition is invertible, so test for R.

Get the transformation matrix of R by inspection: $
\begin{bmatrix}
1 & -1 & 0 \\
0 & 1 & -1\\
-1 & 0 & 1
\end{bmatrix}$

Get $det(R)$ by row reduction:

\begin{align*}
det(R) &= det\begin{bmatrix}
1 & -1 & 0 \\
0 & 1 & -1\\
-1 & 0 & 1
\end{bmatrix}\\
&= det\begin{bmatrix}
0 & -1 & 1 \\
0 & 1 & -1\\
-1 & 0 & 1
\end{bmatrix}\\
&= det\begin{bmatrix}
0 & 0 & 0 \\
0 & 1 & -1\\
-1 & 0 & 1
\end{bmatrix}\\
&= det\begin{bmatrix}
1 & 0 & -1 \\
0 & 1 & -1\\
0 & 0 & 0
\end{bmatrix}
\end{align*}

Since matrix is upper triangle, determinant is product of diagonal entries:
\begin{align*}
     det(R) &= 1\cdot1\cdot0\\
     &= 0
\end{align*}

Since the determinant of the transformation matrix is zero, the map is non invertible
\newpage
\subsection*{3a}
Let $p(x) = a + bx + cx^2 + dx^3$.

\begin{align*}
    E_5\left(p\left(x\right)\right) = a+5b+25c+125d
\end{align*}

The image of $E_5 \text{ is all of } \mathbb{R}$. The mapping is onto $\mathbb{R}$ as any value in $\mathbb{R}$ can be represented by replacing $a, b, c,\text{or }d$ with appropriate values in $\mathbb{R}$

Let $k \in \mathbb{R}$.

There must exist some $q(x) \in mathscr{P}_3$ such that $E_5(q(x)) = k$.

\begin{align*}
\text{Let } q(x) &= k + 0x + 0x^2 + 0x^3\\
E_5(q(x)) &= k + 0\cdot5 + 0\cdot25 + 0\cdot125\\
&= k
\end{align*}
$\therefore$ any value $k \in \mathbb{R}$ can be calculated with the appropriate polynomial $q(x) \in \mathscr{P}_3$
\subsection*{3b}
\begin{align*}
    rank(E_5) + nullity(E_5) &= dim(\mathscr{P}_3)\\
    1 + nullity(E_5) &= 4\\
    nullity(E_5) &= 3
\end{align*}
\subsection*{3c}
\begin{align*}
    \text{Let } p(x) &= a+bx+cx^2+dx^3\\
    E_5(p(x)) &= a+5b+25c+125d\\
    ker(E_5) &= \left\{a+bx+cx^2+dx^3: a+5b+25c+125d = 0\right\}
\end{align*}
Use $B$ to denote the basis of $ker(E_5).~B = Nul(ker(E_5))$

Find Null space of the kernel.

Coeffecient matrix of the kernel: $\begin{bmatrix}
1 &5 &25& 125
\end{bmatrix}$

Null space of kernel: $\left\{\begin{bmatrix}
-5\\1 \\0\\ 0
\end{bmatrix}, \begin{bmatrix}
-25\\0 \\1\\ 0
\end{bmatrix}, \begin{bmatrix}
-125\\0 \\0\\ 1
\end{bmatrix}\right\}$

By converting the bases to a form in $\mathbb{R}$ space, we can find the basis of the kernel.
\begin{align*}
    Basis(ker(E_5)) = \left\{-5a+b,-25a+c,-125a+d\right\}
\end{align*}
\end{document}


\lab{Applications}{Web Page Experiments}{Web Page Experiments}
\objective{This lab applies multi-armed bandit problems to web page experiments.}

\section*{Web Page Experiments}
One application of the multi-armed bandit problem is in web page design.
Bandit problems provide a way to compare the success of different variations of a web page.
Suppose a business wants to test new versions of a web page.
The goal of the page might be to get the user to click a certain link, make a purchase, etc.
When the user does this, we call it a conversion.  The proportion of web page visits
that results in a conversion is called the conversion rate, or CvR.
The website designer wants to determine which variation of the web page has the best CvR.

We can model this situation as a bandit problem by considering each page as a different arm.
Each page has some unknown probability (the CvR) that a user will perform the desired action.
The company then wants to experiment with giving different users different versions of
the page in order to determine which variation is most successful.

This method is the same that is used by Google Analytics.  Take a moment to skim their description located here:
\url{http://analytics.blogspot.com/2013/01/multi-armed-bandit-experiments.html}.

In this lab we will apply the Thompson Sampling method from the previous lab (the same method used by Google)
to solve this problem.  We will simulate the results and attempt to replicate Google's results found at the website above.

\section*{The Experiment}
Here we describe how we will design our web page experiment using bandits and how we will simulate it.
We will have some number of variations of a web page, $n$.  Each day, the web-page will receive 100 visitors
(for the purposes of our simulation).  Twice each day, at the beginning and after 50 visits,
we will compute the number of each variation to deliver to the next 50 visitors using the weights
method described in the previous lab (you should have written a function that does this in Problem 4
of the previous algorithms lab).

\begin{problem}
Write a function that simulates the experiment for one day.
The function should accept a vector of length $n$ of the true probabilities (CvR)
for different web page variations.  It should also accept the state of the variations
at the beginning of the day; this is an $n \times 2$ array with the number of previous
successes plus one in the first column and the number of previous failures plus one in
the second column (so if it is the first day the state for any arm would be $(1,1)$
corresponding to a $Beta(1,1)$ distribution).

The function could be outlined like this: first compute how many times each variation
should be used in the next 50 visits.  When determining the weights you will need to use
the \li{sim_data} function.  Use 100 as the number of draws here and throughout this lab.
Then ``visit'' each page the number of times given by the weights.
Whether each visit results in a conversion (1) or not (0) can be randomly determined using the following function:
\begin{lstlisting}
import scipy as sp
def pull(p):
    return sp.random.binomial(1,p,size = None).
\end{lstlisting}
This will return a random one or zero based on the probability input \li{p}.

After the first 50 visits, update the state of each arm.
Then recompute the weights and do the same for the next 50 visits, resulting in 100 visits total.

This function should return the resulting states and their corresponding weights.
\end{problem}

In this manner we will continue from day to day, always updating the state of each arm
(the beta distribution for the CvR of each arm).  We will have three criteria to determine when to stop the experiment.
The first, is that the experiment must run at least two weeks to make sure the
results are not overly influenced by a small number of random draws.

The second stopping criteria is that there be a $95\%$ probability that one of the variations is the best variation.
This is the same as saying that, of the weights for each variation, the largest is greater than $.95$.

It may seem that these two criteria should be enough; however, in some cases, the
experiment could last a very long time using just these criteria.
For example, consider the case that two of the web page variations have nearly the same CvR.
In this case it will be very difficult to determine which is best.
It will also not be very important since the results are so similar.
Thus we will use a measure that we will call the potential value remaining
in the experiment as the third criteria.  The value remaining is computed by
simulating many draws for each arm.  Using this data, the potential value remaining
for arm $i$ is obtained by computing the following for each simulated data point:
\begin{equation}\label{valrem}
\frac{\theta_{max} - \theta^*}{\theta^*}
\end{equation}
where $\theta_{max}$ is the largest value for the random draw and $\theta^*$ is the
value of the arm that is currently believed to be the best
(the arm with the highest weighting, or probability of being optimal).
The result is some distribution of numbers between $0$ and $1$ that we can think
of as the distribution of value remaining.  For example, if $50\%$ of the numbers are 0,
then about $50\%$ of the time the arm that is currently believed optimal will perform the best.
The potential value remaining is the $95$th percentile of this distribution.
If the potential value remaining were $.2$, we could interpret it as meaning
that there is about a $5\%$ chance that another arm beats the current best arm by $.2$ or more.
We stop the experiment if this value is less than $1\%$ of the current best arm's CvR.
This way we stop the experiment if there seems to be little chance of improvement over
the current best arm, regardless of whether we've met the $95\%$ tolerance for the weights.

The value remaining can be computed using the following code:
\begin{lstlisting}
import scipy as sp
def val_remaining(data,prob):
    champ_ind = sp.argmax(prob)
    thetaM = sp.amax(data,1)
    valrem = (thetaM - data[:,champ_ind])/data[:,champ_ind]
    pvr = sp.stats.mstats.mquantiles(valrem,.95)
    return valrem,pvr
\end{lstlisting}
where data is simulated using the \li{sim_data} function from the previous algorithms lab,
and prob is a vector containing the probabilities that each arm is optimal
(also computed using a function from the previous lab).

\begin{problem}
Write a function that simulates the problem described above, using the stopping criteria described above.
The function should accept a vector of the true probabilities of the arms.
It should use the function from the previous problem to simulate each day and
continue until the stopping criteria are met.

The function should return the state of each arm (i.e. an $n$ by $2$ matrix with the
successes and failures of each arm), a matrix that contains the weights assigned to
each arm each day, the index of the winning variation, and the number of days it took to converge.

Your code should have a while loop that checks for the stopping criteria after each day.
It might look something like this:
\begin{lstlisting}
while ((delta < p_tol) and (champ_cvr/100. < v_quant)) or days < 14:
\end{lstlisting}
where \li{delta} is the largest weight for the current day, meaning if there were two arms and you determined the weights to be .9 and .1, then delta would be .9.  We stop when the largest weight is greater than .95, so \li{p_tol} is .95.  The variables \li{champ_cvr} and \li{v_quant} describe the stop mechanism that accounts for the potential value remaining.  First, \li{champ_cvr} is the conversion rate of the current best arm over the course of the experiment.  So if it has been used 100 times with 4 successes, then \li{champ_cvr} would be .04.  The variable \li{v_quant} is the potential value remaining, i.e. the $95$th percentile of the value remaining distribution described above.  The variable \li{pvr} can be computed using the \li{val_remaining} function given above.
The \li{days} variable simply keeps track of how many days the experiment has been running.
\end{problem}

Now let's see how our bandit performs with specific examples.

\begin{problem}
Suppose a web page has two variations and the true CvR of the original is
$.04$ and the true CvR of the new variation is $.05$.
Create a plot similar to \ref{fig:weights1} that shows how the weights
assigned to the pages changes from day to day until the optimal page is chosen and the experiment stops.

Next run the same simulation 200 times and keep track of how many days
the experiment took in each case.  Create a histogram that shows the
number of days it takes to complete the experiment.
The following code will create such a histogram:
\begin{lstlisting}
import scipy as sp
from matplotlib import pyplot as plt
hist, bins = sp.histogram(dayvec, bins = 12)
width = (bins[1]-bins[0])
center = (bins[:-1]+bins[1:]) / 2
plt.bar(center, hist, align = 'center', width = width, color = 'g')
plt.show()
\end{lstlisting}
where \li{dayvec} is a vector containing the number of days each simulation took to complete.
Also track which arm is determined to be optimal in each simulation.
What percent of the time did the bandit find the optimal arm?

Create the same two types of plots, this time with six variations having
weights $.04,.02,.03,.035,.045,.05$.  This time only run the simulation 100 times.
What percent of the time did the bandit find the optimal arm in this case?
\end{problem}

\begin{figure}[h]
\centering
\begin{subfigure}[t]{.49\textwidth}
\centering
\includegraphics[width=\textwidth]{weights1.pdf}
\caption{Optimal arm probabilities in the two arm case}
\label{fig:weights1}
\end{subfigure}
\begin{subfigure}[t]{.49\textwidth}
\centering
\includegraphics[width=\textwidth]{weights2.pdf}
\caption{Optimal arm probabilities in the six arm case}
\label{fig:weights2}
\end{subfigure}
\end{figure}

% \begin{figure}[h]
% \centering
% \includegraphics[width=\textwidth]{weights2.pdf}
% \caption{Optimal arm probabilities in the six arm case}
% \label{fig:weights2}
% \end{figure}

\section*{Comparison with Classical Tests}
A more classical approach to this problem would be to split traffic between each
variation for a predetermined amount of time, which should give enough data to
determine the best arm with some level of confidence.
Using the bandit approach described here has significant advantages over a classical test.
There are two main reasons why the bandit approach is more efficient.

The first reason is that the bandit method generally converges more quickly.
A standard test would require splitting the web page views between the different
variations over a long period of time.  According to Google's explanation in the
website mentioned at the beginning of this lab, the two arm case would take 223 days
and the 6 arm case would take 919 days.  The results from the simulations you performed
should show that on average the bandit method finishes much faster.
There are other ways we could choose our stopping criteria that may result in even shorter experiment times.
In general, we can always adjust the tolerance of our stopping criteria to shorten experiment time or increase accuracy.

The second reason the bandit approach is more efficient is that, as we gain more information,
we allocate more visits to the variation that we believe has a better CvR.
In the classical method we would split the visits evenly until the end of the experiment.
This way we gain many more conversions during testing than we would using classical tests.


\subsection{Breadth-first search}

A breadth-first search operates First-in First-out (FiFo). That is, it selects the oldest frontier node. This results in a broad, rather than a deep search. Once all branches have been explored, the algorithm will move deeper. Path cost is not considered in this algorithm.

Informed: No

Time: \(O(b^d)\)

Space: \(O(b^d)\)

Complete: Yes

Optimal: Picks the shallowest solution. Optimal of path costs are identical.


\documentclass[11pt,a4]{article}

% PACKAGES ----------
\usepackage[utf8]{inputenc} \usepackage{amsmath,amsfonts,amssymb}
\usepackage[left=2.5cm,right=2.5cm,top=2cm,bottom=2cm]{geometry}
\usepackage{xcolor} \usepackage{graphicx} \usepackage{hyperref}
\usepackage[lite]{mtpro2}

% MACROS ------
\newcommand{\ket}[1]{\left\vert #1 \right\rangle}
\newcommand{\bra}[1]{\left\langle #1 \right\vert}
\newcommand{\braket}[2]{\left\langle #1 \middle\vert #2\right\rangle}
\newcommand{\commut}[1]{\left[#1\right]}
\newcommand{\de}{\mathrm{d}}
\newcommand{\dx}{\de x}
\newcommand{\tdev}[2]{\frac{\de #1}{\de #2}}
\newcommand{\pdev}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\tdevzero}[1]{\left.\tdev{}{#1}\right\vert_{#1 = 0}}
\newcommand{\set}[1]{\left\{#1\right\}}
% DOCUMENT INFO ----------
\title{Why is momentum the generator of translations?}
\author{Santiago Quintero de los Ríos\\{\small for homotopico.com}} \date{\today}

% BEGIN DOCUMENT ----------

\begin{document}
\maketitle

In quantum mechanics, it is often stated that \emph{the momentum [operator] is the generator of translations}. However, most texts fail to give a satisfactory justification to this claim, if any is given at all. In some cases, the proof is simply begging the question. In others, the burden of proof is shifted to classical mechanics, stating that ``this was already proved in classical mechanics''. Again, most standard texts of classical mechanics fail to give a clear proof of this claim, although the mathematical apparatus is there. What we will do here is define \emph{precisely} what it means for observable to be a generator of a group of transformations, both in quantum and classical mechanics, and prove that, indeed, the momentum observable \emph{is} the generator of translations in classical mechanics.

\section*{The origin of the question}
\label{sec:origin-question}

We define the translation operator $\hat{T}_a$ acting on elements $\psi\in L^2(\mathbb{R})$ (the Hilbert space of square-integrable complex functions
over $\mathbb{R}$) by,
of course, translating the wavefunction a distance $a$ to the right:
\begin{equation}
  (\hat{T}_a\psi)(x) := \psi(x-a).
\end{equation}
This operator is actually a whole family of operators that depend on the parameter $a$.
It is clear that $\hat{T}_0$ is the identity operator. Now since this family of operators
is particularly well-behaved\footnote{That is, it is a one-parameter absolutely continuous group.}, it has an
\textbf{infinitesimal generator}, which is some operator $\hat{w}$ such that
\begin{equation}
  \label{eq:1}
  \hat{T}_a = \exp\left(-ia\hat{w}\right).
\end{equation}
Yes, I know that the standard name for this generator is $\hat{p}$, but
I am trying to remove any possible meaning to this operator. For the time being, we only
know that $\hat{w}$ is the generator of translations. That's why I don't call it $\hat{p}$.

What does $\hat{w}$ look like? One way to calculate the infinitesimal generator of a family of operators is
by evaluating the derivative at $a=0$. If we expand the right-hand side of equation \ref{eq:1} as a power series, then
\begin{equation}
  \label{eq:3}
  \exp\left(-ia\hat{w}\right) = \sum_{n=0}^{\infty}\frac{1}{n!}(-ia\hat{w})^n,
\end{equation}
then it follows that
\begin{equation}
  \label{eq:4}
  \tdevzero{a}\hat{T}_a = \tdevzero{a} \exp\left(-ia\hat{w}\right) = -i\hat{w}.
\end{equation}
So let $\psi$ be any function on $L^2(\mathbb{R})$. We have that
\begin{equation}
  \tdevzero{a}\hat{T}_a\psi(x) = \tdevzero{a}\psi(x-a) = -\tdev{}{x}\psi(x),
\end{equation}
so we can say that the infinitesimal generator is
\begin{equation}
  \label{eq:5}
  \hat{w} = -i\tdev{}{x}.
\end{equation}
And hey, look at that. It turns out that this is what we call the momentum operator in quantum mechanics.

However, it is not clear \textbf{at all} why the operator $-i\tdev{}{x}$ should be given the highly suggestive name of ``momentum''. So
this it's not that the generator of translations is momentum because it has
the form $-i\tdev{}{x}$, but the other way around:

We say that $-i\tdev{}{x}$ is the momentum operator, because it is the one that generates translations.

Therefore, the question is shifted: \textbf{Why do we give the name ``momentum'' to the operator that generates translations?}

\section*{The usual answers}
\label{sec:first-answer}

If you only want a half-plausible argument, here it goes. Let $\hat{x}$ be the position operator, that is
the expectation value $\braket{\psi}{\hat{x}\psi}$ is the expected value for the position of a particle in
state $\psi$. It can be shown that the position operator acts on wavefunctions by multiplication by the variable
$x$, i.e.
\begin{equation}
  (\hat{x}\psi)(x)=x\psi(x).
\end{equation}
This equation can also be used to define $\hat{x}$. Now we want to compute the commutator $\commut{\hat{x},\hat{w}}$.
On one hand, we have:
\begin{equation}
  (\hat{x}\hat{w}\psi)(x) = -ix\tdev{}{x}\psi(x),
\end{equation}
but on the other hand,
\begin{equation}
  (\hat{w}\hat{x}\psi)(x) = -i\tdev{}{x}\left(x\psi(x)\right) = -i\left(\psi(x) + x\tdev{}{x}\psi(x)\right).
\end{equation}
Then, clearly
\begin{equation}
  \commut{\hat{x},\hat{w}}\psi(x) = i\psi(x),
\end{equation}
and so $\commut{\hat{x},\hat{w}}=i\hat{I}$. Now we consider the ``quantization rule'' that
turns \emph{classical} observables $f$ into Hermitian operators $\hat{f}$ and that turns Poisson brackets
\emph{almost} into Lie brackets
\begin{equation}
  \set{f,g} \mapsto i\commut{\hat{f},\hat{g}},
\end{equation}
and what we do is go backwards! We found an operator $\hat{w}$ that satisfies the commutation relation
$\commut{\hat{x},\hat{w}}=i\hat{I}$, so the \emph{classical} observables they come from satisfy the Poisson-bracket
relation $\set{x,w}=1$. We know that $\hat{x}$ is the position operator, so $x$ must be the position observable. On the other
hand, we know that for the canonical momentum $p$,
\begin{equation}
  \set{x,p} = \pdev{x}{x} \pdev{p}{p}-\pdev{x}{p} \pdev{p}{x} = 1.
\end{equation}
We can clearly see that $\set{x,p}=\set{x,w}=1$, so this suggests that $w=p$! And we're done. $w$ is the momentum, so the operator
$\hat{w}$ is the momentum operator.

\textbf{But wait a minute...}

The relation
\begin{equation}
  \set{x,w} = 1
\end{equation}
is not enough to \emph{define} $w$! This is because the operator $f\mapsto\set{x,f}$ is degenerate. As a trivial example,
\begin{equation}
  \set{x,p+x} = 1,
\end{equation}
and actually, for any function $f(x)$ that \emph{does not depend on }$p$, it follows that
\begin{equation}
  \set{x,p+f(x)}=1.
\end{equation}
This means that $w$ is an observable of the form $ w = p + f(x)$ for \emph{some} function $f(x)$.
At this point you might think ``eh, close enough''. And fair enough, then you're done!

But I'm not thoroughly (actually, not at all) satisfied. There is another clue though. This previous
argument is one of two that I've seen in QM books. The other one is as follows:
\begin{center}
  \textit{In classical mechanics it is shown that momentum is the generator of
    translations.}
\end{center}
And well, yes, that could be enough for our purposes. We can't expect
every new theory to work out of the box and be able to stand by itself, right? When
we construct a new theory from a mathematical perspective, we look back to
other theories that are well-established and we understand, look for analogies and
similarities, and interpret the symbols in such a way that everything is as consistent
as possible with what came before.

Therefore it is quite reasonable to say that this operator $\hat{w}$ is the momentum operator if
we already know from classical mechanics that the generator of translations is the momentum. We've shown that
in quantum mechanics, translations \emph{also} have infinitesimal generators, so it is natural
to interpret those as momenta.

Again, that is \textbf{if} we already know from classical mechanics that momentum is the generator of translations.
And I think I missed that lecture? That's a big ``if''.

That quote up there shifts the burden of proof to classical mechanics. So what we're going to do is plunge into classical mechanics
and try to show that momentum is the generator of translations from two different points of view: the ``standard'' Goldstein point-of-view, and the
more modern symplectic geometry point-of-view. We will see from both that we can reasonably show that, in a certain way, momentum
is the generator of translations.

\section*{The standard point of view}
\label{sec:standard-pov}

More precisely, what we will prove is the following:\\
To each (classical) observable $f$ we can \emph{canonically} assign a one-parameter group
of \emph{canonical} transformations $\Phi_a$ that preserve $f$. In this case, we say that $f$ generates $\Phi_a$. When we choose the canonical momentum $f=p$, the
resulting transformations are translations, and thus we say that $p$ is the generator of translations.

In this first section, we will do it in a bit of a dirty way. If infinitesimals make you uncomfortable (completely understandable), then
always note that when we write, e.g. $\tilde{x} = x + \epsilon X$, what we mean is that $\tilde{x}=\tilde{x}(\epsilon)$ is a function of $\epsilon$, that $\tilde{x}(0)=x$, and $X = \lim_{\epsilon\to 0}\frac{1}{\epsilon}\tilde{x}(\epsilon)$. If you would like to see a more concise proof that requires a bit of differential topology, skip to the next section.

Consider some system with phase space $\mathcal{S}$, with canonical coordinates $q^i,p_j$, and let $f$ be an arbitrary observable. We want to find a \emph{canonical} transformation\footnote{And an additional question that I would like to explore is ``what's the huge deal about canonical transformations''? We know that they preserve the structure of the Hamilton-Jacobi equations, but not necessarily the Hamiltonian, so that doesn't seem like much, does it? Well it turns out that the \emph{structure} itself of the equations has an interesting and beautiful mathematical background... But I'm saving that for later. }
$Q^i = Q^i(q,p)$, $P_j = P_j(q,p)$ that preserves $f$ and depends on only one parameter $\epsilon$. For small $\epsilon$, we can write
\begin{equation}
  \begin{aligned}
    Q^i(\epsilon) &= q^i + \epsilon A^i\\
    P_j(\epsilon) &= p_j + \epsilon B_j
  \end{aligned},
\end{equation}
with $A^i,B_j$ functions of $q,p$ that we want to determine. Since we want these transformations to be canonical, the Poisson brackets must be conserved, so
\begin{equation}
  \begin{aligned}
    \set{q^i,p_i} = 1 &= \set{Q^i,P_i} \\
    &= \set{q^i + \epsilon A^i,p_i + \epsilon B_i}\\
    &= \set{q^i,p_i} + \epsilon\left(\set{A^i,p_i}+\set{q^i,B_i}\right) + \mathcal{O}(\epsilon^2).
  \end{aligned}
\end{equation}
Then, working up to first order in $\epsilon$, we require that
\begin{equation}
  \set{A^i,p_i}+\set{q^i,B_i} = 0.
\end{equation}
Unravel these Poisson brackets,
\begin{equation}
  \set{A^i,p_i} = \sum_k\left(\pdev{A^i}{q^k}\pdev{p_i}{p_k} - \pdev{A^i}{p_k}\pdev{p_i}{q^k}\right) = \pdev{A^i}{q^i}
\end{equation}
\begin{equation}
  \set{q^i,B_i} = \sum_k\left(\pdev{q^i}{q^k}\pdev{B_i}{p_k} - \pdev{q^i}{p_k}\pdev{B_i}{q^k}\right) = \pdev{B_i}{p_i},
\end{equation}
then we require $A^i,B_i$ to be such that
\begin{equation}
  \label{eq:2}
  \pdev{A^i}{q^i} + \pdev{B_i}{p_i} = 0.
\end{equation}
One way to guarantee that condition \eqref{eq:2} is satisfied is by finding some \emph{other} observable, say $g$, and write
\begin{equation}
  \label{eq:7}
  \begin{aligned}
    A^i &= \pdev{g}{p_i}\\
    B_j &= -\pdev{g}{q^j}
  \end{aligned}.
\end{equation}
However, not every $g$ will work, since we also require the transformation to preserve the observable $f$. So again, for small
$\epsilon$, we can write
\begin{equation}
  \begin{aligned}
    f\left(Q^i,P_j \right) &= f\left(q^i+\epsilon A^i,p_j+\epsilon B_j\right)\\
    &= f\left(q^i,p_j\right) + \epsilon\sum_k\left(A^k\pdev{f}{q^k} + B_k\pdev{f}{p_k}\right) + \mathcal{O}(\epsilon^2).
\end{aligned}
\end{equation}
Since we require the transformation to preserve $f$, then $f\left(Q^i,P_j \right) = f(q^i,p_j)$ and thus
\begin{equation}
  \label{eq:6}
  \sum_k\left(A^k\pdev{f}{q^k} + B_k\pdev{f}{p_k}\right) = 0.
\end{equation}
But again, if we assume that $A^i,B_j$ come from an observable $g$ as in equation \eqref{eq:7}, this condition
becomes
\begin{equation}
  \label{eq:6}
  \sum_k\left(\pdev{g}{p^k}\pdev{f}{q^k} - \pdev{g}{q^k}\pdev{f}{p_k}\right) = \set{f,g}=0.
\end{equation}
Therefore the admissible observables $g$ that can be used for equation \eqref{eq:7} are such that $\set{f,g}=0$.
Which one is the \emph{absolute simplest one} to choose? Well $f$ itself! This works since $\set{f,f}=0$.
Therefore the \emph{natural} choice is $g=f$, so that the transformation \emph{for infinitesimal} $\epsilon$ is
\begin{equation}
  \label{eq:8}
  \begin{aligned}
    Q^i(\epsilon) &= q^i + \epsilon \pdev{f}{p^i}\\
    P_j(\epsilon) &= p_j - \epsilon \pdev{f}{q^j}
  \end{aligned}.
\end{equation}
This equation only holds for infinitesimally small $\epsilon$, since we've been working only up to first order. What we want now is to write the exact solution  to large $\epsilon$. To do so, note that equation~\eqref{eq:8}
gives us a \emph{differential equation} for $Q$ and $P$: writing $q^i=Q^i(0), p_j=P_j(0)$, it can be easily seen that
\begin{equation}
  \label{eq:13}
  \begin{aligned}
    \tdev{Q^i}{\epsilon} &= \pdev{f}{p^i}\\
    \tdev{P_j}{\epsilon} &= -\pdev{f}{q^j}.
  \end{aligned}
\end{equation}
Note that these are just like the Hamilton-Jacobi equations, except that ``time'' is $\epsilon$ and the ``Hamiltonian''
is $f$!

Now we see how any general observable
changes when we do an infinitesimal transformation \eqref{eq:8}. Let $g$ be any observable. Then,
if we start at a point $(q_0,p_0)$, and write $(q_1,p_1)=(Q(\epsilon),P(\epsilon))$ (I'm dropping the $i,j$ indices), then
\begin{equation}
  \label{eq:9}
    \begin{aligned}
    g\left(Q^i(\epsilon),P_j(\epsilon) \right) &= g\left(q_0^i+\epsilon \left.\pdev{f}{p_{j}}\right|_{(q_0,p_0)},p_{0,j}-\left.\pdev{f}{q^j}\right|_{(q_0,p_0)}\right)\\
    g(q_1,p_1)&= g\left(q_0,p_{0}\right) + \epsilon\sum_k\left(\left.\pdev{f}{p_{k}}\right|_{(q_0,p_0)}\left.\pdev{g}{q^k}\right|_{(q_0,p_0)} - \left.\pdev{f}{q^k}\right|_{(q_0,p_0)}\left.\pdev{g}{p_k}\right|_{(q_0,p_0)}\right) + \mathcal{O}(\epsilon^2)\\
    g(q_1,p_1)&= g\left(q_0,p_{0}\right) + \epsilon\left.\set{g,f}\right|_{(q_0,p_0)} +\mathcal{O}(\epsilon^2).
\end{aligned}
\end{equation}
How do we go to large $\epsilon$? Well, the last equation tells us that
\begin{equation}
  \tdev{}{\epsilon}g\left(Q(\epsilon),P(\epsilon)\right) = \set{g,f}_{Q(\epsilon),P(\epsilon)},
\end{equation}
therefore, if we write $g(\epsilon) = g(Q(\epsilon),P(\epsilon))$, taking the derivative with respect to $\epsilon$ again we obtain:
\begin{equation}
  \tdev{^2}{\epsilon^2}g\left(\epsilon\right) = \tdev{}{\epsilon}\set{g,f}_\epsilon = \set{\set{g,f},f}_\epsilon.
\end{equation}
So if we call $X_f$ the differential operator $X_f(g):=\set{g,f}$, we can see that
\begin{equation}
  \tdev{^n}{\epsilon^n}g\left(\epsilon\right) = X_f(X_f(\dots X_f(g)))_{\epsilon}={X_f}^n(g)_{\epsilon}.
\end{equation}
And thus, by Taylor-expanding $g$ with respect to $\epsilon$ around $\epsilon=0$, we see that
\begin{equation}
  \label{eq:12}
  g(\epsilon) = \sum_{n=0}^{\infty}\frac{1}{n!}\left.\tdev{^n}{\epsilon^n}\right|_{\epsilon=0}g(\epsilon) = \sum_{n=0}^{\infty}\frac{1}{n!}{X_f}^n(g)_{(q_0,p_0)} = \exp\left(\epsilon {X_f}(0)\right)g.
\end{equation}
We call $X_f$ the \textbf{infinitesimal generator} associated to $f$.

Alright. We should stop here for a bit and gather what we have. We have shown that for any observable $f$, we can find a family of
canonical transformations, which we write as $Q(\epsilon),P(\epsilon)$, given by the set of Hamilton-Jacobi-like equations~\eqref{eq:13}.
Note that if we fix a starting point $(q_0,p_0)$, this family of transformations gives rise to a \emph{curve} in phase space, given by
$q= Q(\epsilon),p=P(\epsilon)$.
Any other observable $g$ also changes along this curve as $g(\epsilon) = \exp(\epsilon X_f(0))g$, or rather as $\tdev{g}{\epsilon}=\set{g,f}$.
In particular, $f$ is constant along this curve, since $\tdev{}{\epsilon}f = \set{f,f}=0$. Therefore the family of transformations is
canonical and preserves $f$, as was desired.

Now here comes what was promised. If we choose $f=p_j$, the momentum observable, then the infinitesimal
generator associated to $p_j$, $X_{p_j}$, is the differential operator
\begin{equation}
  X_{p_j}(g) = \set{g,p_j} = \sum_{k}\pdev{g}{q^k}\pdev{p_j}{p_k} - \pdev{g}{p_k}\pdev{p_j}{q^k} = \pdev{}{q^j}(g).
\end{equation}
Ring any bells?

Furthermore, the family of transformations is the solution to the Hamilton-Jacobi-like equations~\eqref{eq:13} with $f=p_j$, i.e.
\begin{equation}
  \label{eq:14}
  \begin{aligned}
    \tdev{Q^i}{\epsilon} &= \pdev{p_j}{p^i} = \delta^i_j\\
    \tdev{P_k}{\epsilon} &= -\pdev{p_j}{q^k} = 0,
  \end{aligned}
\end{equation}
which is readily integrated, given an initial point $q_0 = Q(0),p_0=P(0)$:
\begin{equation}
  Q^j(\epsilon) = q_{0}^j + \epsilon;
\end{equation}
and all the other coordinates constant. This is indeed a translation in the $j$-th space coordinate.

So there you have it! In classical mechanics, to each observable $f$ we assign a differential operator $X_f$ that
generates one-parameter canonical transformations that preserve $f$. In the case where $f=p$, the differential operator is $X_p = \pdev{}{q}$,
and the canonical transformations are translations! Therefore we say that \textbf{momentum is the generator of translations}.

\section*{The mathematician's way}
\label{sec:mathematicians-way}

This way is basically exactly the same as the one before, just with the more sophisticated language
of differential topology, specifically in the context of symplectic manifolds. It can be easily seen
that the results given here are exactly the same as the results given in the previous section, when
we write them in Darboux coordinates.

So first, some definitions.

A \textbf{symplectic manifold} is a smooth manifold $\mathcal{M}$ of dimension $2n$ endowed with a closed, non-degenerate $2$-form $\omega$, which we call a \textbf{symplectic form}. It can be shown that for each point
$x\in \mathcal{M}$ there exists a neighborhood $U$ of $x$ and coordinates $q^1,\dots,q^n,p_1,\dots,p_n$ such
that the symplectic form can be written as
\begin{equation}
  \label{eq:11}
  \omega = \de q^{\mu}\wedge\de p_{\mu}.
\end{equation}
Here we are using Einstein's sum notation. This result is \textbf{Darboux's theorem}, and the coordinates $(q^\mu,p_\mu)$ are called \textbf{Darboux coordinates}.

Since
$\omega$ is non-degenerate, it induces an isomorphism $(-)_\flat:T_p\mathcal{M}\to T_p^*\mathcal{M}$, given
pointwise by the relation
\begin{equation}
  \label{eq:10}
  v_\flat(u):=\omega(v,u)
\end{equation}
for all $u,v\in T_p\mathcal{M}$ and all $p\in\mathcal{M}$. The inverse of $(-)_\flat$ is denoted
by $(-)^\sharp:T_p^*\mathcal{M}\to T_p\mathcal{M}$.

This is basically all we need! Let $f\in C^{\infty}(\mathcal{M})$. Then we can define the \textbf{Hamiltonian vector field associated to $f$}, denoted by $X_f\in\mathfrak{X}(\mathcal{M})$, as
\begin{equation}
  \label{eq:15}
  X_f = (\de f)^{\sharp}.
\end{equation}
By this definition, for any other vector field $Y$, we have that
\begin{equation}
  \label{eq:16}
  \omega(X_f,Y) = \de f(Y)= Y[f].
\end{equation}
Therefore an alternative definition for $X_f$ is the unique vector field such that $\iota_{X_f}\omega = \de f$.

Using Cartan's magic formula, we see that
\begin{equation}
  \label{eq:17}
  L_{X_f}\omega = \iota_{X_f}(\de\omega) + \de\left(\iota_{X_f}\omega\right) = 0.
\end{equation}
Here, the first term is zero since $\omega$ is closed (i.e. $\de\omega=0$), and the second one is zero too since $\iota_{X_f}\omega=\de f$, and $\de^2=0$. In addition to this, the directional derivative of $f$ along $X_f$ is zero, since
\begin{equation}
  \label{eq:19}
  X_f(f) = \de f(X_f) = \iota_{X_f}\omega(X_f)=\omega(X_f,X_f)=0.
\end{equation}
This means that if $\Phi^f_\tau$ is the flow of $X_f$, then
for all values of $\tau$
\begin{equation}
  \label{eq:18}
  \left(\Phi^f_{\tau}\right)^*\omega = \omega,
\end{equation}
and $f\circ\Phi^f_\tau = f$. That is, neither $f$ nor $\omega$ change along the integral curves of the Hamiltonian vector field associated to $f$.

Furthermore, since $\Phi^f_{\tau}:\mathcal{M}\to\mathcal{M}$ is a diffeomorphism, then it satisfies the conditions for being a \textbf{symplectomorphism} or \textbf{canonical transformation}. Namely, a diffeomorphism $f:\mathcal{M}\to\mathcal{N}$ between two symplectic manifolds $(\mathcal{M},\omega)$ and $(\mathcal{N},\Omega)$ is a symplectomorphism if $f^*\Omega=\omega$.

What we have now is the following: to any $f\in C^\infty(\mathcal{M})$ we can assign a Hamiltonian vector field $X_f\in \mathfrak{X}(\mathcal{M})$ whose flow $\Phi^f_\tau$ is a symplectomorphism that preserves $f$. Now if we work locally in Darboux coordinates $(q^\mu,p_\mu)$, so that $\omega = \de q^\mu\wedge \de p_\mu$. If
we write $X_f$ locally as
\begin{equation}
  \label{eq:20}
  X_f = A^\mu\pdev{}{q^\mu} + B_{\nu}\pdev{}{p_\nu},
\end{equation}
then we have that
\begin{equation}
  \label{eq:21}
  \begin{aligned}
    \iota_{X_f}\omega &= \iota_{X_f}\left(\de q^\mu\wedge \de p_\mu\right)\\
    &= \de q^\mu(X_f)\de p_\mu - \de q^\mu\de p_\mu(X_f)\\
    &= A^\mu\de p_\mu - B_\mu\de q^\mu = \de f.
  \end{aligned}
\end{equation}
However, since
\begin{equation*}
  \de f = \pdev{f}{q^\mu}\de q^\mu + \pdev{f}{p_\mu}\de p_\mu,
\end{equation*}
then necessarily the components of $X_f$ must be
\begin{equation}
  \label{eq:22}
  \begin{aligned}
    A^\mu &= \pdev{f}{p_\mu}\\
    B_\mu &= -\pdev{f}{q^\mu}\\
  \end{aligned}.
\end{equation}
The Hamiltonian vector field associated to $f$ is then, in Darboux coordinates,
\begin{equation}
  \label{eq:23}
  X_f = \pdev{f}{p_\mu}\pdev{}{q^\mu} -\pdev{f}{q^\mu}\pdev{}{p_\mu} = \set{-,f}.
\end{equation}

And once again, if we choose $p_\nu =f$, then the Hamiltonian vector field is
\begin{equation}
  \label{eq:24}
  X_{p_\nu} = \pdev{}{q^\nu},
\end{equation}
So that the flow of $X_{p_\nu}$ is simply translation along the $q^\nu$ coordinate. Once again, we can
say that the [Hamiltonian vector field associated to the] canonical momentum is the generator of translations.

\section*{The takeaway}
\label{sec:takeaway}

We proved a general result in classical mechanics: to any observable $f$, we can assign a differential
operator $X_f=\set{-,f}$, called the infinitesimal generator or Hamiltonian vector field associated to $f$,
that \emph{generates} canonical transformations that preserve $f$. The one-parameter group of
canonical transformations associated to $X_f$ is given by $\Phi^f_\tau = \exp(\tau X_f)$, and we
say that $f$ is the generator of $\Phi^f$.

In particular, if we choose the canonical momentum $p$ to be the observable $f$, then the infinitesimal generator is $X_p = \tdev{}{q}$ and the group of canonical transformations associated to $X_p$ is precisely the group of translations of the $q$ coordinate.
Therefore, we can say that \textbf{the momentum is the generator of translations}.

Now in quantum mechanics, we simply \textbf{define} the momentum operator $\hat{p}$ to be the infinitesimal
generator of the unitary group of translations, and we see that this definition is consistent with canonical
quantization.

\subsection*{References}
\label{sec:references}

\begin{itemize}
\item Sakurai, J. J. (1995). \textit{Modern Quantum Mechanics, Revised Edition}.
\item Goldstein, H. , Poole, C. \& Safko, J. (2001). \textit{Classical Mechanics, Third Edition}.
\item José, J. V. \& Saletan, E. (1998). \textit{Classical Dynamics: A Contemporary Approach}. This book is great. I love it. Read it.
\item Abraham, R. \& Marsden, J. (2008). \textit{Foundations of Mechanics}.
\end{itemize}
Great thanks to Laura Arboleda for checking style and consistency.
\end{document}

% END DOCUMENT ----------

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:


\section{Functions on Euclidean Space}
\textbf{NOTE:} My notes differ from Spivak's text in that I use subscripts to denote
components instead of superscripts.

\subsection{Norm and Inner Product}

\subsubsection{Exercise 1}
\begin{align*}
        \sum_{i = 1}^n x_i^2  = \sum_{i = 1}^n \abs{x_i}^2 \leq \bigg(\sum_{i = 1}^n \abs{x_i}\bigg)^2
        \implies \sqrt{\sum_{i = 1}^n x_i^2} \leq \sum_{i = 1}^n \abs{x_i}^2
\end{align*}

\subsubsection{Exercise 2}
We need $\sum_{i = 1}^n x_i y_i = \abs{x} \abs{y}$. Linear dependence by itself is not enough, since if
$x$ and $y$ are opposite sign we see that the lefthand sum will be negative. Thus, we need linear dependence
as well as $x$ and $y$ having the same sign.

\subsubsection{Exercise 3}
The proof is identical to the $\abs{x + y}$ case, except now we have a $-2 \sum_{i = 1}^n x_i y_i$ term.
Thus, equality holds when $x$ and $y$ are linearly dependent and have opposite signs.

\subsubsection{Exercise 4}
$\abs{\abs{x} - \abs{y}}^2 = \abs{x}^2 + \abs{y}^2 - 2\abs{x} \abs{y}$. Since $\abs{x} \abs{y} \geq \langle x, y \rangle$, we have the desired inequality.

\subsubsection{Exercise 5}
\begin{align*}
        \abs{z - x} = \abs{z - y + y - x} \leq \abs{z - y} + \abs{y - x}
\end{align*}
Geometrically, this is just the fact that any sidelength of a triangle must be bounded by the sum of the
other two sidelengths.

\subsubsection{Exercise 6}
(a) We can proceed as Spivak hints by noting that for the $\int_{a}^{b} (f - \lambda g)^2 > 0$ case, the
proof is identical to that of Theorem 1-1 (2). For the $\int_{a}^{b} (f - \lambda g)^2 = 0$ case (which is when equality is obtained), we
can use the fact that $(f - \lambda g)^2 = 0$ almost everywhere.

However, I think it's a little smoother to handle both cases at once:
\begin{align*}
        \int_{a}^{b} (f - \lambda g)^2 = \int_{a}^{b} f^2 - 2\lambda \int_{a}^{b} fg + \lambda^2 \int_{a}^{b} g^2 &\geq 0 \\
        \int_{a}^{b} f^2 - \frac{2 \bigg(\int_{a}^{b} fg\bigg)^2}{\int_{a}^{b} g^2} + \frac{\bigg(\int_{a}^{b} fg\bigg)^2}{\int_{a}^{b} g^2} &\geq 0 \quad \text{for} \: \: \lambda = \frac{\int_{a}^{b} fg}{\int_{a}^{b} g^2} \\
        \sqrt{\int_{a}^{b} f^2 \int_{a}^{b} g^2} &\geq \abs{\int_{a}^{b} fg}
\end{align*}

(b) Equality does not necessarily imply that $f = \lambda g$, since we could consider $f$ and $g$ to be
0 everywhere except two points $a$ and $b$ such that $f(a) \neq \lambda g(a)$ and $f(b) \neq \lambda g(b)$.
However, if $f$ and $g$ are continuous, then $\int_{a}^{b} (f - \lambda g)^2 = 0$ implies that $f = \lambda g$.

(c) Define $f(m) = x_i$ and $g(m) = y_i$ for $m \in [i, i + 1)$. Then $\int_{1}^{n} f g = \sum_{1}^n x_i y_i$
(we can break up the integral at the points of discontinuity) and Theorem 1-1 (2) follows.

\subsubsection{Exercise 7}
(a) If $T$ is inner product preserving then we have $\langle Tx, Tx \rangle = \langle x, x \rangle$, so
$T$ is norm preserving. If $T$ is norm preserving, then
\begin{align*}
        \langle T(x - y), T(x - y) \rangle &= \abs{T(x)}^2 + \abs{T(y)}^2 - 2\langle T(x), T(y) \rangle \\
        \langle x - y, x - y \rangle &= \abs{x}^2 + \abs{y}^2 - 2 \langle x, y \rangle \\
        \implies \langle T(x), T(y) \rangle &= \langle x, y \rangle
\end{align*}
so $T$ is inner product preserving.

(b) Since $Tx = Ty \implies T(x - y) = 0 \implies \abs{x - y} = 0$, $T$ is injective. Furthermore,
$Tx = 0 \implies \abs{x} = 0$, so the nullspace of $T$ is trivial and $T$ is thus surjective. Now if we
consider $T^{-1} y = x$, then we have $\langle y, y \rangle = \langle TT^{-1} y, TT^{-1} y \rangle = \langle T^{-1} y, T^{-1} y \rangle$.

\subsubsection{Exercise 10}
Let $\norm{T}_F = \sqrt{\sum_{i = 1}^n \sum_{j = 1}^m T_{ij}^2}$ (Frobenius norm). Then we have
\begin{align*}
        \abs{T h}^2 = \sum_{i = 1}^n \bigg(\sum_{j = 1}^m T_{ij} h_j\bigg)^2 &\leq \sum_{i = 1}^n \sum_{j = 1}^m T_ij^2 \sum_{j = 1}^m h_j^2 = \norm{T}_F^2 \abs{h}^2
\end{align*}
so letting $M = \norm{T}_F$ gives the desired inequality.

\subsubsection{Exercise 12}
Linearity and injectivity of $T$ follow from linearity of inner product. To see surjectivity, we note that
any element $f \in (\mathbb{R}^n)^*$ is determined entirely by $f(e_1), ..., f(e_n)$ due to linearity. Thus,
$f(y) = \langle x, y \rangle$ for the unique $x$ satisfying $x_i = f(e_i)$.

\subsubsection{Exercise 13}
Expanding $\langle x + y, x + y \rangle$ gives the desired result.

\subsection{Subsets of Euclidean Space}

\subsubsection{Exercise 14}
Any point $a$ in the union is also in some set which contains an open set around $a$, and by the definition of
union this open set is also in the union. For finite intersection, if a point is in two open sets, then both
sets must contain some open rectangles around that point; the smaller of these rectangles is in the
intersection of both sets. For infinite intersection, we can consider the intersection of
$(-\frac{1}{n}, \frac{1}{n})$ for all $n \in \mathbb{N}$, as it consists only of the single point 0.

\subsubsection{Exercise 17}
The procedure hinted by Spivak seems to be to split the square into 4 quadrants and then select a point from
each quadrant while satisfying the constraint, then repeat this procedure indefinitely (split the 4 quadrants
into 16 quadrants, etc.). However, I'm not sure how to make this procedure more rigorous.

\subsubsection{Exercise 19}
We can use the facts that the rationals are dense in $\mathbb{R}$ and that closed sets contain all of their
limit points (although neither fact is proved so far in this book) to immediately get the desired result.

\subsubsection{Exercise 21}
(a) Since $A$ is closed, $A^c$ is open, which means $x$ has an open rectangle (and thus, an open ball) around
it that is contained within $A^c$. Therefore, there exists $d > 0$ such that $\abs{y - x} \geq d$ for all
$y \in A$.

(b) Suppose that for every $d > 0$, we could choose $y_i \in A$ and $x_i \in B$ such that $\abs{y_i - x_i} < d$.
This would imply that we could pick a sequence $\{y_n\} \in A$ and a sequence $\{x_n\} \in B$ such that
 $\lim_{n \to \infty} y_n = \lim_{n \to \infty} x_n$. Since $B$ is compact, this limit must be a point in
  $B$, which contradicts the disjointness of  $A$ and  $B$.

(c) Consider $A = \{(0, i) \: | \: i \in \mathbb{N}\}$ and $B = \{(0, i + \frac{1}{i}) \: | \: i \in \mathbb{N}\}$.
For any $d$, we can choose $i$  such that $\frac{1}{i} < d$.

\subsubsection{Exercise 22}
This is easier to argue with open/closed balls instead of open/closed rectangles (for me). Every point
$c \in C$ must have an open ball $B_{\delta} (c) \subset U$ for some $\delta > 0$. For each such ball,
consider instead $B_{r} (c)$ with $r < \delta$. The closure of $B_r(c)$ is a closed ball that is contained
within $U$. Now, since $C$ is compact, it can be covered by finitely many of these closed balls. Since
closed sets are closed under finite union, we can take $D$ to be the union of these balls to get a compact
set whose interior contains $C$.

\subsection{Functions and Continuity}

\subsubsection{Exercise 23}
Suppose $\lim_{x \to a} f(x) = b$. Then we can choose $\delta$ such that $\abs{x - a} < \delta$ implies
$\abs{f(x) - b} < \epsilon$ for any $\epsilon > 0$. Rewriting $\abs{f(x) - b}$ as
$\sqrt{\sum_{i = 1}^m (f_i (x) - b_i)^2}$ gives $\abs{f_i(x) - b_i} < \epsilon$ for the same $\delta$, so
we get $\lim_{x \to a} f_i(x) = b_i$. The other direction reverses the steps after choosing
$\abs{f_i(x) - b_i} < \frac{\epsilon}{\sqrt{m}}$.

\subsubsection{Exercise 24}
This is basically the same as the previous exercise.

\subsubsection{Exercise 25}
From Exercise 1-10 we have that there exists  $M$  such that $\abs{T(x)} \leq M \abs{x}$. Thus, for any
$\epsilon > 0$ and $a \in \mathbb{R}^n$, we can choose $\delta = \frac{\epsilon}{M}$. Using this $\delta$,
we get $\abs{x - a} < \delta$ implies $\abs{T(x) - T(a)} = \abs{T(x - a)} < \epsilon$, so $T$ is continuous.

\subsubsection{Exercise 28}
Choose any $x$ on the boundary of  $A$ and let  $f(y) = \frac{1}{\abs{y - x}}$. Since $f$ is the quotient
of two continuous functions ($g(y) = 1$ and  $h(y) = \abs{y - x}$) with non-zero denonimator, $f$ is continuous.
Furthermore, by construction we can choose  $y$ arbitrarily close to  $x$, so  $f$ is unbounded.

\subsubsection{Exercise 29}
Since $f$ is continuous,  $f(A)$ is compact. By Heine-Borel,  $f(A) \subset \mathbb{R}$ is closed and bounded,
so it contains its maximum and minimum.

\subsubsection{Exercise 30}
Let $x_0 = a$. We have that
\begin{align*}
        \sum_{i = 1}^n o(f, x_i) &= \lim_{\delta \to 0} \sum_{i = 1}^n [M(f, x_i, \delta) - m(f, x_i, \delta)] \\
                                 &\leq \lim_{\delta \to 0} \sum_{i = 1}^n [M(f, x_i, \delta) - M(f, x_{i - 1}, \delta)] \\
                                 &\leq \lim_{\delta \to 0} M(f, x_n, \delta) - m(f, a, \delta) \\
                                 &\leq f(b) - f(a)
\end{align*}
Where we used the fact that $f$ is increasing to get $m(f, x_i, \delta) \geq M(f, x_{i - 1}, \delta)$.


\subsection{Complex functions}\label{subsec:complex_functions}

\begin{definition}\label{def:sequence_spaces}
  We will define multiple Banach spaces of sequences over \( \BbbC \).

  \begin{thmenum}
    \thmitem{def:sequence_spaces/c00} The simplest nontrivial sequence space is that of all sequences with only finitely many nonzero elements. It is denoted by \( c_{00} \). It can be defined as
    \begin{equation*}
      c_{00} \coloneqq \bigcup_{i=1}^\infty \BbbC^k,
    \end{equation*}
    where \( \BbbC^k \) is the corresponding \hyperref[def:module_of_tuples]{tuple space}.

    This space can be generalized to modules over \hyperref[def:module]{semirings}.
  \end{thmenum}
\end{definition}

\begin{definition}\label{def:function_spaces}
  We will define multiple Banach spaces of functions over \( \BbbK \).

  \begin{thmenum}
    \thmitem{def:function_spaces/c0} Define the set of functions \term{vanishing at infinity}:
    \begin{equation*}
      C_0(\BbbC) \coloneqq \{ f: \BbbC \to \BbbC \colon f(x) \xrightarrow[\abs{x} \to \infty]{} 0 \}.
    \end{equation*}

    \thmitem{def:function_spaces/c} Fix \hyperref[def:topological_space]{topological space} \( X \). The set \( C(X) = C(X, \BbbK) \) of all \( \BbbK \)-valued continuous functions on \( X \) in a Banach space over \( \BbbK \).
  \end{thmenum}
\end{definition}

\begin{theorem}[Arzela-Ascoli]\label{thm:arzela_ascoli}\mcite[cor. 10.49]{Knapp2016BasicAlgebra}
  Let \( X \) be a \hyperref[def:compact_space]{compact} \hyperref[def:separation_axioms/T2]{Hausdorff} space.

  A family \( \mscrF \subseteq C(X, \BbbR) \) of continuous real-valued functions is totally \hyperref[def:totally_bounded_set]{bounded} if and only if it is pointwise \hyperref[def:bounded_function/pointwise]{bounded} and \hyperref[def:function_set_continuity/equicontinuous]{equicontinuous}.
\end{theorem}