\section{Cubical diagrams}

In this lecture we study commuting diagrams of the form
\begin{equation*}
  \begin{tikzcd}
    & C' \arrow[dl] \arrow[d] \arrow[dr] \\
    A' \arrow[d] & C \arrow[dl] \arrow[dr] & B' \arrow[dl,crossing over] \arrow[d] \\
    A \arrow[dr] & X' \arrow[from=ul,crossing over] \arrow[d] & B \arrow[dl] \\
    & X.
  \end{tikzcd}
\end{equation*}
In these diagrams there are six homotopies witnessing that the faces of the cube commute, as well as a homotopy of homotopies witnessing that the cube as a whole commutes.

Once the basic definitions of cubes are established, we focus on pullbacks and pushouts that appear in different configurations in these cubical diagrams. For example, if all the vertical maps in a commuting cube are equivalences, then the top square is a pullback square if and only if the bottom square is a pullback square. In \cref{chap:descent} we will use cubical diagrams in our formulation of the universality and descent theorems for pushouts.

In our first main theorem of this lecture we show that given a commuting cube in which the bottom square is a pullback square, the top square is a pullback square if and only if the induced square of fibers of the vertical maps is a pullback square. This theorem should be compared to \cref{cor:pb_fibequiv}, where we showed that a square is a pullback square if and only if it induces equivalences on the fibers of the vertical maps.

In our second main theorem we use the previous result to derive the 3-by-3 properties for pullbacks and pushouts.

\subsection{Commuting cubes}
\begin{defn}\label{defn:cube}
A \define{commuting cube}\index{commuting cube|textbf}
\begin{equation*}
\begin{tikzcd}[column sep=large,row sep=large]
& C' \arrow[dl,swap,"{p'}"] \arrow[dr,"{q'}"] \arrow[d,swap,"{h_C}" near end] \\
A' \arrow[d,swap,"{h_A}"] & C \arrow[dl,swap,"{p}" very near start] \arrow[dr,"{q}" very near start] & B' \arrow[dl,crossing over,"{g'}" near end] \arrow[d,"{h_B}"] \\
A \arrow[dr,swap,"f"] & X' \arrow[d,swap,"{h_X}" near start] \arrow[from=ul,crossing over,swap,"{f'}" near end] & B \arrow[dl,"{g}"] \\
& X,
\end{tikzcd}
\end{equation*}
consists of types and maps as indicated in the diagram, equipped with
\begin{enumerate}
\item homotopies
  \begin{align*}
    \mathsf{top} & : f' \circ p' \htpy g' \circ q' \\
    \mathsf{back\usc{}left} & : p \circ h_C \htpy h_A \circ p' \\
    \mathsf{back\usc{}right} & : q \circ h_C \htpy h_B \circ q' \\
    \mathsf{front\usc{}left} & : f \circ h_A \htpy h_X \circ f' \\
    \mathsf{front\usc{}right} & : g \circ h_B \htpy h_X \circ g' \\
    \mathsf{bottom} & : f \circ p \htpy g \circ q
  \end{align*}
  witnessing that the 6 faces of the cube commute,
\item and a homotopy
  \begin{align*}
    % ((((h ·l back-left) ∙h (front-left ·r f')) ∙h (hD ·l top))) ~
    % ((bottom ·r hA) ∙h ((k ·l back-right) ∙h (front-right ·r g')))
\mathsf{coh\usc{}cube} & : \ct{(\ct{(f \cdot \mathsf{back\usc{}left})}{(\mathsf{front\usc{}left}\cdot p')})}{(h_X \cdot \mathsf{top})} \\
& \qquad \htpy \ct{(\mathsf{bottom}\cdot h_C)}{(\ct{(g \cdot \mathsf{back\usc{}right})}{(\mathsf{front\usc{}right}\cdot q')})}
\end{align*}
filling the cube.
\end{enumerate}
\end{defn}

In the following lemma we show that if a cube commutes, then so do its rotations and mirror symmetries (that preserve the directions of the arrows).\footnote{The group acting on commuting cubes of maps is the \emph{dihedral group} $D_3$ which has order $6$.} This fact is obviously true, but there is some `path algebra' involved that we wish to demonstrate at least once.

\begin{lem}
  Consider a commuting cube
  \begin{equation*}
    \begin{tikzcd}
      & C' \arrow[dl] \arrow[d] \arrow[dr] \\
      A' \arrow[d] & C \arrow[dl] \arrow[dr] & B' \arrow[dl,crossing over] \arrow[d] \\
      A \arrow[dr] & X' \arrow[from=ul,crossing over] \arrow[d] & B \arrow[dl] \\
      & X.
    \end{tikzcd}
  \end{equation*}
  Then the cubes

  \begin{center}
  \begin{minipage}{.3\textwidth}
  \begin{equation*}
    \begin{tikzcd}
      & C' \arrow[dl] \arrow[d] \arrow[dr] \\
      C \arrow[d] & B' \arrow[dl] \arrow[dr] & A' \arrow[dl,crossing over] \arrow[d] \\
      B \arrow[dr] & A \arrow[from=ul,crossing over] \arrow[d] & X' \arrow[dl] \\
      & X
    \end{tikzcd}
  \end{equation*}
  \end{minipage}
  \begin{minipage}{.3\textwidth}
  \begin{equation*}
    \begin{tikzcd}
      & C' \arrow[dl] \arrow[d] \arrow[dr] \\
      B' \arrow[d] & A' \arrow[dl] \arrow[dr] & C \arrow[dl,crossing over] \arrow[d] \\
      X' \arrow[dr] & B \arrow[from=ul,crossing over] \arrow[d] & A \arrow[dl] \\
      & X
    \end{tikzcd}
  \end{equation*}
  \end{minipage}

  \begin{minipage}{.3\textwidth}
  \begin{equation*}
    \begin{tikzcd}
      & C' \arrow[dl] \arrow[d] \arrow[dr] \\
      C \arrow[d] & A' \arrow[dl] \arrow[dr] & B' \arrow[dl,crossing over] \arrow[d] \\
      A \arrow[dr] & B \arrow[from=ul,crossing over] \arrow[d] & X' \arrow[dl] \\
      & X.
    \end{tikzcd}
  \end{equation*}
  \end{minipage}
  \begin{minipage}{.3\textwidth}
  \begin{equation*}
    \begin{tikzcd}
      & C' \arrow[dl] \arrow[d] \arrow[dr] \\
      A' \arrow[d] & B' \arrow[dl] \arrow[dr] & C \arrow[dl,crossing over] \arrow[d] \\
      X' \arrow[dr] & A \arrow[from=ul,crossing over] \arrow[d] & B \arrow[dl] \\
      & X.
    \end{tikzcd}
  \end{equation*}
  \end{minipage}
  \begin{minipage}{.3\textwidth}
  \begin{equation*}
    \begin{tikzcd}
      & C' \arrow[dl] \arrow[d] \arrow[dr] \\
      B' \arrow[d] & C \arrow[dl] \arrow[dr] & A' \arrow[dl,crossing over] \arrow[d] \\
      B \arrow[dr] & X' \arrow[from=ul,crossing over] \arrow[d] & A \arrow[dl] \\
      & X.
    \end{tikzcd}
  \end{equation*}
  \end{minipage}
  \end{center}
  also commute.
\end{lem}

\begin{proof}
  We only show that the first cube commutes, which is obtained by a counter-clockwise rotation of the original cube around the axis through $C'$ and $X$. The other cases are similar, and they are formalized in the Agda library for this course.

  First we list the homotopies witnessing that the faces of the cube commute:
  \begin{align*}
    \mathsf{top}' & \defeq \mathsf{back\usc{}left} \\
    \mathsf{back\usc{}left}' & \defeq \mathsf{back\usc{}right}^{-1} \\
    \mathsf{back\usc{}right}' & \defeq \mathsf{top}^{-1} \\
    \mathsf{front\usc{}left}' & \defeq \mathsf{bottom}^{-1} \\
    \mathsf{front\usc{}right}' & \defeq \mathsf{front\usc{}left}^{-1} \\
    \mathsf{bottom}' & \defeq \mathsf{front\usc{}right}.
  \end{align*}
  Thus, to show that the cube commutes, we have to show that there is a homotopy of type
  \begin{align*}
    & \ct{(\ct{(g \cdot \mathsf{back\usc{}right}^{-1})}{(\mathsf{bottom}^{-1}\cdot h_C)})}{(f \cdot \mathsf{back\usc{}left})} \\
    & \qquad\qquad \htpy \ct{(\mathsf{front\usc{}right}\cdot q')}{(\ct{(h_X \cdot \mathsf{top}^{-1})}{(\mathsf{front\usc{}left}^{-1}\cdot p')})}.
  \end{align*}
  In other words, we need to construct a path
  \begin{align*}
    & \ct{(\ct{\ap{g}{\mathsf{back\usc{}right}(c')^{-1}}}{\mathsf{bottom}(h_C(c'))^{-1}})}{\ap{f}{\mathsf{back\usc{}left}(c')}} \\
    & \qquad\qquad \htpy \ct{\mathsf{front\usc{}right}(q'(c'))}{(\ct{\ap{h_X}{\mathsf{top}(c')^{-1}}}{\mathsf{front\usc{}left}(p'(c'))^{-1}})}
  \end{align*}
  for every $c':C'$. Recall that $\ap{g}{\mathsf{back\usc{}right}(c')^{-1}}=\ap{g}{\mathsf{back\usc{}right}(c')}^{-1}$. Using the action on paths of the concatenation function (twice), we see that
  \begin{align*}
    & \ct{(\ct{\ap{g}{\mathsf{back\usc{}right}(c')^{-1}}}{\mathsf{bottom}(h_C(c'))^{-1}})}{\ap{f}{\mathsf{back\usc{}left}(c')}} \\
    & \qquad\qquad \ct{(\ct{\ap{g}{\mathsf{back\usc{}right}(c')}^{-1}}{\mathsf{bottom}(h_C(c'))^{-1}})}{\ap{f}{\mathsf{back\usc{}left}(c')}}.
  \end{align*}
  Similarly, we have an identification
  \begin{align*}
    & \ct{\mathsf{front\usc{}right}(q'(c'))}{(\ct{\ap{h_X}{\mathsf{top}(c')}^{-1}}{\mathsf{front\usc{}left}(p'(c'))^{-1}})} \\
    & \qquad\qquad \htpy \ct{\mathsf{front\usc{}right}(q'(c'))}{(\ct{\ap{h_X}{\mathsf{top}(c')^{-1}}}{\mathsf{front\usc{}left}(p'(c'))^{-1}})}
  \end{align*}
  Therefore it suffices to construct an identification
  \begin{align*}
    & \ct{(\ct{\ap{g}{\mathsf{back\usc{}right}(c')}^{-1}}{\mathsf{bottom}(h_C(c'))^{-1}})}{\ap{f}{\mathsf{back\usc{}left}(c')}} \\
    & \qquad\qquad \htpy \ct{\mathsf{front\usc{}right}(q'(c'))}{(\ct{\ap{h_X}{\mathsf{top}(c')}^{-1}}{\mathsf{front\usc{}left}(p'(c'))^{-1}})}
  \end{align*}
  Now we note that our goal is of the form
  \begin{equation*}
    \ct{(\ct{\varepsilon^{-1}}{\delta^{-1}})}{\beta}=\ct{\zeta}{(\ct{\gamma^{-1}}{\beta^{-1}})}, %%% check greek alphabet
  \end{equation*}
  whereas the assumption that the original cube commutes yields an identification of the form
  \begin{equation*}
    \ct{(\ct{\alpha}{\beta})}{\gamma}=\ct{\delta}{(\ct{\varepsilon}{\zeta})}
  \end{equation*}
  Indeed, in the case that $\alpha$, $\beta$, $\gamma$, $\delta$, $\varepsilon$, and $\zeta$ are general identifications, we can conclude our goal using path induction on all of them.
\end{proof}

\begin{lem}
Given a commuting cube as in \cref{defn:cube} we obtain a commuting square
\begin{equation*}
\begin{tikzcd}
\fib{f_{1\check{1}1}}{x} \arrow[r] \arrow[d] & \fib{f_{0\check{1}1}}{f_{\check{1}01}(x)} \arrow[d] \\
\fib{f_{1\check{1}0}}{f_{10\check{1}}(x)} \arrow[r] & \fib{f_{0\check{1}0}}{f_{00\check{1}}(x)}
\end{tikzcd}
\end{equation*}
for any $x:A_{101}$.
\end{lem}

\begin{lem}
Consider a commuting cube
\begin{equation*}
\begin{tikzcd}
& A_{111} \arrow[dl] \arrow[dr] \arrow[d] \\
A_{110} \arrow[d] & A_{101} \arrow[dl] \arrow[dr] & A_{011} \arrow[dl,crossing over] \arrow[d] \\
A_{100} \arrow[dr] & A_{010} \arrow[d] \arrow[from=ul,crossing over] & A_{001} \arrow[dl] \\
& A_{000}.
\end{tikzcd}
\end{equation*}
If the bottom and front right squares are pullback squares, then the back left square is a pullback if and only if the top square is.
\end{lem}

\begin{rmk}
By rotating the cube we also obtain:
\begin{enumerate}
\item If the bottom and front left squares are pullback squares, then the back right square is a pullback if and only if the top square is.
\item If the front left and front right squares are pullback, then the back left square is a pullback if and only if the back right square is.
\end{enumerate}
By combining these statements it also follows that if the front left, front right, and bottom squares are pullback squares, then if any of the remaining three squares are pullback squares, all of them are. Cubes that consist entirely of pullback squares are sometimes called \define{strongly cartesian}\index{strongly cartesian cube}.
\end{rmk}

\subsection{Families of pullbacks}

\begin{lem}\label{lem:fiberwise-pullback}
Consider a pullback square\index{pullback!Sigma-type of pullbacks@{$\Sigma$-type of pullbacks}}
  \begin{equation*}
    \begin{tikzcd}
      C \arrow[r,"q"] \arrow[d,swap,"p"] & B \arrow[d,"g"] \\
      A \arrow[r,swap,"f"] & X
    \end{tikzcd}
  \end{equation*}
  with $H : f \circ p \htpy g \circ h$. Furthermore, consider type families $P_X$, $P_A$, $P_B$, and $P_C$ over $X$, $A$, $B$, and $C$ respectively, equipped with families of maps
  \begin{align*}
    f' & : \prd{a:A} P_A(a) \to P_X(f(a)) \\
    g' & : \prd{b:B} P_B(b) \to P_X(g(b)) \\
    p' & : \prd{c:C} P_C(c) \to P_A(p(c)) \\
    q' & : \prd{c:C} P_C(c) \to P_B(q(c)),
  \end{align*}
  and for each $c:C$ a homotopy $H'_c$ witnessing that the square
  \begin{equation}\label{eq:family-squares-pullback}
    \begin{tikzcd}
      P_C(c) \arrow[rr,"{q'_c}"] \arrow[d,swap,"{p'_c}"] & &[3em] P_B(q(c)) \arrow[d,"{g'_{q(c)}}"] \\
      P_A(p(c)) \arrow[r,swap,"{f'_{p(c)}}"] & P_X(f(p(c))) \arrow[r,swap,"{\tr_{P_X}(H(c))}"] & P_X(g(q(c)))
    \end{tikzcd}
  \end{equation}
  commutes. Then the following are equivalent:
  \begin{enumerate}
  \item For each $c:C$ the square in \cref{eq:family-squares-pullback} is a pullback square.
  \item The square
    \begin{equation}\label{eq:total-square-pullback}
      \begin{tikzcd}[column sep=huge]
        \sm{c:C}P_C(c)
        \arrow[r,"{\total[q]{q'}}"] \arrow[d,swap,"{\total[p]{p'}}"] &
        \sm{b:B}P_B(b) \arrow[d,"{\total[g]{g'}}"] \\
        \sm{a:A}P_A(a) \arrow[r,swap,"{\total[f]{f'}}"] & \sm{x:X}P_X(x)
      \end{tikzcd}
    \end{equation}
    is a pullback square.
  \end{enumerate}
\end{lem}

\begin{cor}
Consider a pullback square
\begin{equation*}
\begin{tikzcd}
C \arrow[r,"q"] \arrow[d,swap,"p"] & B \arrow[d,"g"] \\
A \arrow[r,swap,"f"] & X,
\end{tikzcd}
\end{equation*}
with $H:f\circ p\htpy g\circ q$, and let $c_1,c_2:C$. Then the square
\begin{equation*}
\begin{tikzcd}[column sep=8em]
(c_1=c_2) \arrow[r,"\apfunc{q}"] \arrow[d,swap,"\apfunc{p}"] & (q(c_1)=q(c_2)) \arrow[d,"\lam{\beta}\ct{H(c_1)}{\ap{g}{\beta}}"] \\
(p(c_1)=p(c_2)) \arrow[r,swap,"\lam{\alpha}\ct{\ap{f}{\alpha}}{H(c_2)}"] & f(p(c_1))=g(q(c_2)),
\end{tikzcd}
\end{equation*}
commutes and is a pullback square.
\end{cor}

\begin{thm}
  Consider a commuting cube
  \begin{equation*}
    \begin{tikzcd}
      & C' \arrow[dl] \arrow[dr] \arrow[d] \\
      A' \arrow[d] & C \arrow[dl] \arrow[dr] & B' \arrow[crossing over,dl] \arrow[d] \\
      A \arrow[dr] & X' \arrow[d] \arrow[from=ul,crossing over] & B \arrow[dl] \\
      & X
    \end{tikzcd}
  \end{equation*}
  in which the bottom square is a pullback square. Then the following are equivalent:
  \begin{enumerate}
  \item The top square is a pullback square.
  \item The square
    \begin{equation*}
      \begin{tikzcd}
        \fib{\gamma}{c} \arrow[d] \arrow[r] & \fib{\beta}{q(c)} \arrow[d] \\
        \fib{\alpha}{p(c)} \arrow[r] & \fib{\varphi}{f(p(c))}
      \end{tikzcd}
    \end{equation*}
    is a pullback square for each $c:C$.
  \end{enumerate}
\end{thm}

\subsection{The 3-by-3-properties for pullbacks and pushouts}

\begin{thm}
  Consider a commuting diagram of the form
  \begin{equation*}
    \begin{tikzcd}[column sep=large,row sep=large]
      AA \arrow[r,"Af"] \arrow[d,swap,"fA"] \arrow[dr,phantom,"\Rightarrow" description] & AX \arrow[d,swap,"fX"] & AB \arrow[l,swap,"Ag"] \arrow[d,"gB"] \arrow[dl,phantom,"\Leftarrow" description] \\
      XA \arrow[r,"Xf"] & XX & XB \arrow[l,swap,"Xg"] \\
      BA \arrow[u,"gA"] \arrow[r,swap,"Bf"] & BX \arrow[u,"gX"] & BB \arrow[u,swap,"gB"] \arrow[l,"Bg"]
    \end{tikzcd}
  \end{equation*}
  with homotopies
  \begin{align*}
    ff & : Xf \circ fA \htpy Af \circ fX \\
    fg & : Xg \circ gB \htpy Ag \circ fX \\
    gf & :
  \end{align*}
  filling the (small) squares. Furthermore, consider
  pullback squares
  \begin{equation*}
    \begin{tikzcd}
      AC \arrow[r] \arrow[d] & AB \arrow[d] & XC \arrow[r] \arrow[d] & XB \arrow[d] & BC \arrow[r] \arrow[d] & BB \arrow[d] \\
      AA \arrow[r] & AX & XA \arrow[r] & XX & BA \arrow[r] & BX
    \end{tikzcd}
  \end{equation*}
  \begin{equation*}
    \begin{tikzcd}
      CA \arrow[r] \arrow[d] & BA \arrow[d] & CX \arrow[r] \arrow[d] & BX \arrow[d] & CB \arrow[r] \arrow[d] & BB \arrow[d] \\
      AA \arrow[r] & XA & AX \arrow[r] & XX & AB \arrow[r] & XB.
    \end{tikzcd}
  \end{equation*}
  Finally, consider a commuting square
  \begin{equation*}
    \begin{tikzcd}
      D_3 \arrow[r] \arrow[d] & D_2 \arrow[d] \\
      D_0 \arrow[r] & D_1.
    \end{tikzcd}
  \end{equation*}
  Then the following are equivalent:
  \begin{enumerate}
  \item This square is a pullback square.
  \item The induced square
    \begin{equation*}
      \begin{tikzcd}
        D_3 \arrow[r] \arrow[d] & C_3 \arrow[d] \\
        A_3 \arrow[r] & B_3
      \end{tikzcd}
    \end{equation*}
    is a pullback square.
  \end{enumerate}
\end{thm}

\begin{proof}
  First we construct an equivalence
  \begin{equation*}
    (A_0\times_{B_0}C_0)\times_{(A_1\times_{B_1}C_1)}(A_2\times_{B_2} C_2) \eqvsym (A_0\times_{A_1}A_2)\times_{(B_0\times_{B_1} B_2)} (C_0\times_{C_1}C_2).
  \end{equation*}
  Now it follows that we have an equivalence
  \begin{equation*}
    \mathsf{cone}(f_0,g_0)
  \end{equation*}
\end{proof}

\begin{exercises}
\item Some exercises.
\end{exercises}


\section{More refined sparse grid and improved estimates}
This section presents a modified estimate \cite{bungartz2004sparse} of the approximation property of sparse grids. Recall
$$
\mathcal V_{\mathbf{k}} = \mathcal V_{k_1} \bigotimes  \mathcal V_{k_2}\bigotimes\cdots \bigotimes  \mathcal V_{k_d},
$$
where $\mathbf{k}=(k_1,k_2,\cdots,k_d)$ is a multi-index. Let
$$
\mathbf{I_l}=\{\mathbf{i}\in \mathbb{N}^d: \mathbf{1}\le \mathbf{i}\le 2^\mathbf{l}-1, i_j \text{ is odd for all }1\le j\le d\},
$$
and the hierarchical basis
$$
\{\psi_\mathbf{k, i}^d: \mathbf{i}\in \mathbf{I_k}, |\mathbf{k}|_\infty\le J\}.
$$

Recall $\mathcal V_{\mathbf{k}}$ in \eqref{sparseVk}. Let
$$
R_J=\left\{\mathbf{k}: |\mathbf{k}|_1 - \frac25 \log_2\|2^{\mathbf{k}}\|_{l^2}\le J+d-1- \frac15 \log_2 (4^J +4d-4)\right\},
$$
\begin{equation}
  \label{sparseVJ}
S_J =\bigoplus_{\mathbf{k}\in R_J} \mathcal V_{\mathbf{k}}.
\end{equation}
The following the result is analyzed in \cite{bungartz2004sparse}.
 \begin{theorem}\Label{lm:modifySparse1}
Suppose that  $u\in W^{2\mathbf{e}, \infty}(D_d)$,
$$
\inf_{\chi\in S_J} |v-\chi|_{1, D_d}\le C h_J \|u\|_{2\mathbf{e},\infty}.
$$
and the dimension of $S_J$ is $\mathcal{O}(de^dh_J^{-1})$.
\end{theorem}
\begin{proof}
First, we prove that $S_J$ is a subspace of $S_{J,J+d-1}^d$.
If $|\mathbf{k}|_{1}=J+d-1+i, i  \in \mathbb{N}$, we can prove
$$
\|2^{\mathbf{k}}\|_{l^2}^2=\sum_{s=1}^{d} 4^{k_{s}}\le 4^{J+i}+4 d-4
$$
 by induction with respect to $d$.
% It is trivial when $d=1$. For $\mathbf{k}\in \mathbb{R}^d$ and $|\mathbf{k}|_{1}=J+d-1+i$, there exists $1\le j\le d$ such that $k_j\ge 1$, thus
%\begin{equation}
%\begin{split}
%\sum_{s=1}^{d} 4^{k_{s}} &= \sum_{s=1, s\neq i}^{d} 4^{k_{s}} + 4^{k_{j}}\le 4^{J+i+1-k_j}+4 (d-1)-4 + 4^{k_j}\le 4^{J+i} + 4d-4.
%\end{split}
%\end{equation}
For subspaces $\mathcal V_{\mathbf{k}}$ with $|\mathbf{k}|_{1}=J+d-1+i, i \in \mathbb{N},$ we have
\begin{equation}
\begin{split}
|\mathbf{k}|_{1}-\frac{1}{5} \cdot \log _{2}\left(\sum_{s=1}^{d} 4^{k_{s}}\right) & \geq J+d-1+i-\frac{1}{5} \cdot \log _{2}\left(4^{J+i}+4 d-4\right) \\
& \geq J+d-1+i-\frac{1}{5} \cdot \log _{2}\left(4^{i}\left(4^{J}+4 d-4\right)\right) \\
&>J+d-1-\frac{1}{5} \cdot \log _{2}\left(4^{J}+4 d-4\right)
\end{split}
\end{equation}
Therefore, no $\mathcal V_{\mathbf{k}}$ with $|\mathbf{k}|_{1}>J+d-1$ can belong to $V_J .$ Consequently,
\begin{equation}
S_J\subset S_{J,J+d-1}^d,\qquad \left|S_J\right| \leq\left|S_{J,J+d-1}^d\right|.
\end{equation}

Then, we prove that  the dimension of $S_J$ is $\mathcal{O}(h_J^{-1})$.
Note that $\left|\mathcal V_{\mathbf{k}}\right| = 2^{|\mathbf{k}|_{1}-d}$. For any $\mathbf{k}\in R_J$ with $|\mathbf{k}|_{1}=J+d-1-i$, $ \sum_{j=1}^d 4^{k_j}\ge {4^J+4d-4\over 32^i}$. By \eqref{sparseVJ},
\begin{equation}
\begin{split}
\mbox{dim}S_J&=\sum_{i=0}^{J-1}  \sum_{|\mathbf{k}|_{1}=J+d-1-i, \sum_{j=1}^d 4^{k_j}\ge {4^J+4d-4\over 32^i}} \mbox{dim}\mathcal V_{\mathbf{k}}
\\
&=2^{J-1} \cdot \sum_{i=0}^{J-1} 2^{-i}  \sum_{|\mathbf{k}|_{1}=J+d-1-i, \sum_{j=1}^d 4^{k_j}\ge {4^J+4d-4\over 32^i}}1
\\
& \leq 2^{J-1} \cdot \lim _{J \rightarrow \infty} \sum_{i=0}^{J-1} 2^{-i} \sum_{|\mathbf{k}|_{1}=J+d-1-i, \sum_{j=1}^d 4^{k_j}\ge {4^J+4d-4\over 32^i}}1
\\
&=2^{J-1} d \lim _{J \rightarrow \infty} \sum_{i=0}^{J-1} 2^{-i}  \left(\begin{array}{c}
d-1+\lfloor 1.5 i\rfloor \\
d-1
\end{array}\right).
\end{split}
\end{equation}
Let $j=\lfloor 1.5 i\rfloor $. Since $\displaystyle\sum_{i=0}^{\infty} x^{i} \cdot\left(\begin{array}{c}k+i \\ k\end{array}\right)=(1-x)^{-k-1}$ for $k \in \mathbb{N}_{0}$ and $0<x<1$,
\begin{equation}
\begin{split}
\mbox{dim}S_J
& \leq 2^{J} \cdot \frac{d}{2} \cdot \sum_{j=0}^{\infty} 2^{-\frac{2}{3} j} \cdot\left(\begin{array}{c}
d-1+j \\
d-1
\end{array}\right)
\\
&=2^{J} \cdot \frac{d}{2} \cdot\left(1-2^{-\frac{2}{3}}\right)^{-d}
\\
& \leq 2^{J} \cdot \frac{d}{2} \cdot \mathrm{e}^{d}=\mathcal{O}(h_J^{-1}).
\end{split}
\end{equation}
Next we consider the approximation property of $S_J$. Let $\displaystyle u_J=\sum_{\mathbf{k}\in R_J}u_{\mathbf{k}}$. Note that
$$
\left|u-u_J\right|_1 \leq\left|u-u_{J,J+d-1}\right|_1+\left|u_{J,J+d-1}-u_J\right|_1.
$$
By $\left|u-u_{J,J+d-1}\right|_1=O\left(h_{J}\right),$ we can restrict ourselves to $\left|u_{J,J+d-1}-u_J\right|_1.$ Note that  for $i \in \mathbb{N}_{0},$
\begin{equation}
\mathcal V_{\mathbf{k}}\subset S_J, \quad \mbox{if } |\mathbf{k}|_{1}=J+d-1-i \ \mbox{ and }\ |\mathbf{k}|_{\infty} \geq J-2.5 i.
\end{equation}
Note that
$$
\left|u_{J,J+d-1}-u_J\right|_1\leq \sum_{\mathcal V_{\mathbf k} \in S_{J,J+d-1}^d \setminus S_J}\left|u_{\mathbf{k}}\right|_1
\leq \sum_{i=0}^{i^{*}} \sum_{\left.|\mathbf{k}\right|_{1}=J+d-1-i,\left.|\mathbf{k}\right|_{\infty}<J-2.5 i}\left|u_{\mathbf{k}}\right|_1,
$$
where $i^*$ is the maximum value of $i$ for which the set of indices $\mathbf{k}$ with $|\mathbf{k}|_1=n+d-1-i$ with $|\mathbf{k}|_\infty<n-2.5i$.
Therefore, we obtain with \eqref{sparseuk} that
\begin{equation*}
\begin{aligned}
 \sum_{\left.|\mathbf{k}\right|_{1}=J+d-1-i,\left.|\mathbf{k}\right|_{\infty}<J-2.5 i}\left|u_{\mathbf{k}}\right|_1
 \leq \frac{|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}}  \sum_{\left.|\mathbf{k}\right|_{1}=J+d-1-i,\left.|\mathbf{k}\right|_{\infty}<J-2.5 i} 4^{-|\mathbf{k}|_{1}} \cdot\left(\sum_{j=1}^{d} 4^{k_{j}}\right)^{1 / 2}.
 \end{aligned}
\end{equation*}
Since
$
\displaystyle \sum_{j=1}^{d} 4^{k_{j}}=\sum_{j=1}^{d} 2^{2k_{j}}\leq \left(\sum_{j=1}^{d} 2^{k_{j}}\right)^2,
$
\begin{equation*}
\begin{aligned}
 \sum_{\left.|\mathbf{k}\right|_{1}=J+d-1-i,\left.|\mathbf{k}\right|_{\infty}<J-2.5 i}\left|u_{\mathbf{k}}\right|_1
&\leq \frac{|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}} \cdot 4^{-J-d+1+i}  \sum_{\left.|\mathbf{k}\right|_{1}=J+d-1-i,\left.|\mathbf{k}\right|_{\infty}<J-2.5 i}\left(\sum_{j=1}^{d} 2^{k_{j}}\right)
\\
&\leq \frac{|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}} \cdot 4^{-J-d+1+i}  \sum_{j=1}^{J-1-\lfloor 2.5 i\rfloor} d \cdot\left(\begin{array}{c}
J+d-2-i-j \\
d-2
\end{array}\right) \cdot 2^{j}
\\
&=\frac{|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}} 4^{-J-d+1+i} \sum_{k=1}^{J-1-\lfloor 2.5 i\rfloor} d\left(\begin{array}{c}
d-2+\lfloor 1.5 i\rfloor+k \\
d-2
\end{array}\right) 2^{J-\lfloor 2.5 i\rfloor-k}
\\
&=\frac{d \cdot|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}} 4^{-(d-1)} 2^{-J-\left\lfloor\frac{i}{2}\right\rfloor} \sum_{k=1}^{J-1-\lfloor 2.5 i\rfloor}\left(\begin{array}{c}
d-2+\lfloor 1.5 i\rfloor+k \\
d-2
\end{array}\right) 2^{-k} .
\end{aligned}
\end{equation*}
Thus,
\begin{equation*}
\begin{aligned}
\left|u_{J,J+d-1}-u_J\right|_1
&\leq \frac{d \cdot|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}}  \cdot 4^{-(d-1)} \cdot 2^{-J} \cdot 2 \cdot 5^{d-1}\\
&=\frac{d \cdot|u|_{2\mathbf{e},\infty}}{3^{(d-1) / 2} \cdot 4^{d-1}} \cdot\left(\frac{5}{2}\right)^{d-1} \cdot 2^{-J}\le Ch_J,
\end{aligned}
\end{equation*}
which completes the proof.

%\begin{equation*}
%\begin{aligned}
%\left|u_{J,J+d-1}-u_J\right|_1&\leq \sum_{\mathcal V_{\mathbf k} \in S_{J,J+d-1}^d \setminus S_J}\left|u_{\mathbf{k}}\right|_1
%\\
%&\leq \sum_{i=0}^{i^{*}} \sum_{\left.|\mathbf{k}\right|_{1}=J+d-1-i,\left.|\mathbf{k}\right|_{\infty}<J-2.5 i}\left|u_{\mathbf{k}}\right|_1
%\\
%&\leq \frac{|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}} \cdot \sum_{i=0}^{i^{*}} \sum_{\left.|\mathbf{k}\right|_{1}=J+d-1-i,\left.|\mathbf{k}\right|_{\infty}<J-2.5 i} 4^{-|\mathbf{k}|_{1}} \cdot\left(\sum_{j=1}^{d} 4^{k_{j}}\right)^{1 / 2}
%\\
%&\leq \frac{|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}} \cdot 4^{-J-d+1} \cdot \sum_{i=0}^{i^{*}} 4^{i} \cdot \sum_{\left.|\mathbf{k}\right|_{1}=J+d-1-i,\left.|\mathbf{k}\right|_{\infty}<J-2.5 i}\left(\sum_{j=1}^{d} 2^{k_{j}}\right)
%\\
%&\leq \frac{|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}} \cdot 4^{-J-d+1} \cdot \sum_{i=0}^{i^{*}} 4^{i} \cdot \sum_{j=1}^{J-1-\lfloor 2.5 i\rfloor} d \cdot\left(\begin{array}{c}
%J+d-2-i-j \\
%d-2
%\end{array}\right) \cdot 2^{j}
%\\
%&=\frac{|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}} 4^{-J-d+1} \sum_{i=0}^{i^{*}} 4^{i} \sum_{k=1}^{J-1-\lfloor 2.5 i\rfloor} d\left(\begin{array}{c}
%d-2+\lfloor 1.5 i\rfloor+k \\
%d-2
%\end{array}\right) 2^{J-\lfloor 2.5 i\rfloor-k}
%\\
%&=\frac{d \cdot|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}} 4^{-(d-1)} 2^{-J} \sum_{i=0}^{i^{*}} 2^{-\left\lfloor\frac{i}{2}\right\rfloor} \sum_{k=1}^{J-1-\lfloor 2.5 i\rfloor}\left(\begin{array}{c}
%d-2+\lfloor 1.5 i\rfloor+k \\
%d-2
%\end{array}\right) 2^{-k}
%\\
%&\leq \frac{d \cdot|u|_{2\mathbf{e},\infty}}{2 \cdot 12^{(d-1) / 2}}  \cdot 4^{-(d-1)} \cdot 2^{-J} \cdot 2 \cdot 5^{d-1}\\
%&=\frac{d \cdot|u|_{2\mathbf{e},\infty}}{3^{(d-1) / 2} \cdot 4^{d-1}} \cdot\left(\frac{5}{2}\right)^{d-1} \cdot 2^{-J}\le Ch_J,
%\end{aligned}
%\end{equation*}

\end{proof}


\section{Conclusion}
\label{sec:conclusion}

The MinOver algorithm tries to maximize the minimum stability of the dataset.
In absence of noise, MinOver yields to a generalization error similar to the Rosenblatt algorithm.
For both algorithms the generalization error decreases for a high $\alpha = P / N$ (i.e. with a higher number of examples $P$) and approaches zero in the limit for $\alpha \to \infty$.
In presence of noise, the MinOver algorithm diverges for big datasets, where the likelihood of the data to be non linearly separable is very high.

In the original formulation, MinOver does not give any advantages over the Rosenblatt algorithm in terms of generalization error, both in absence and presence of noise in the data.
In addition, the MinOver algorithm requires more computation power than the Rosenblatt one, since it needs to compute the stability of all examples in the dataset at each epoch.


\documentclass[12pt]{article}
\usepackage[intlimits]{amsmath}
\usepackage{MnSymbol}
%\usepackage{fullpage}
\usepackage[top=0.8in, bottom=0.8in, left=0.8in, right=0.8in]{geometry}
\usepackage{multicol}
\usepackage{wrapfig}

\newcommand{\Sp}{\text{ }}
\newcommand{\Cov}{\text{Cov}}
\newcommand{\Var}{\text{Var}}
\newcommand{\Bin}{\text{Bin}}
\newcommand{\Poi}{\text{Poi}}
\newcommand{\HypG}{\text{HypG}}
\newcommand{\Geo}{\text{Geo}}
\newcommand{\Exp}{\text{Exp}}
\newcommand{\Norm}{\text{N}}
\newcommand{\Where}{\Sp\text{ where }}

\setlength{\columnsep}{0.1pc}

\title{CS 109 Study Notes}
\author{Stephen Koo}

\begin{document}
\maketitle
\vspace{-0.3in}
\rule{\linewidth}{0.4pt}

\section{Fundamentals}
\subsection{DeMorgan's Laws}
\begin{align*}
    &\left( \bigcup_{i=1}^n E_i \right)^c = \bigcap_{i=1}^n E_i^c &\left( \bigcap_{i=1}^n E_i \right)^c = \bigcup_{i=1}^n E_i^c
\end{align*}
\subsection{Axioms of Probability}
\emph{Axiom 1}: $0 \leq P(E) \leq 1$ \\
\emph{Axiom 2}: $P(S) = 1$ \\
\emph{Axiom 3}: For any sequence of mutually exclusive events $E_1, E_2, \ldots$
\[
    P\left( \bigcup_{i=1}^{\infty} E_i \right) = \sum_{i=1}^{\infty} P(E_i)
\]
\subsection{Inclusion-Exclusion Identity}
\[
    P(E \cup F) = P(E) + P(F) - P(EF)
\]
\[
    P\left( \bigcup_{i=1}^{n} E_i \right) = \sum_{r=1}^n (-1)^{(r+1)} \sum_{i_1 < \ldots < i_r} P(E_{i_1}, E_{i_2}, \ldots, E_{i_r})
\]
\subsection{Number of Integer Solutions of Equations}
There are $\binom{n-1}{r-1}$ distinct positive integer-valued vectors $(x_1, x_2, \ldots, x_r)$ satisfying the equation
\begin{align*}
    &x_1 + x_2 + \cdots + x_r = n &x_i > 0, i = 1, \ldots, r
\end{align*}
There are $\binom{n+r-1}{r-1}$ distince nonnegative integer-valued vectors $(x_1, x_2, \ldots, x_r)$ satisfying the equation
\[
    x_1 + x_2 + \cdots + x_r = n
\]

\section{Conditional Probability}
\[
    P(E|F) = \frac{P(EF)}{P(F)} \Leftrightarrow P(EF) = P(E|F)P(F)
\]
\subsection{Generalized Chain Rule}
\[
    P(E_1 E_2 \ldots E_n) = P(E_1)P(E_2|E_1)P(E_3|E_1 E_2)\ldots P(E_n|E_1 E_2 \ldots E_{n-1})
\]
\subsection{Bayes' Theorem}
The many shapes and forms of Bayes' Theorem...
\[
    P(E) = P(E|F)P(F) + P(E|F^c)P(F^c)
\]
\[
    P(F|E) = \frac{P(EF)}{P(E)} = \frac{P(E|F)P(F)}{P(E)}
\]
\[
    P(F|E) = \frac{P(E|F)P(F)}{P(E|F)P(F) + P(E|F^c)P(F^c)}
\]
\emph{Fully General Form}:\\
If $F_1, F_2, \ldots, F_n$ comprise a set of mutually exclusive and exhaustive events, then
\[
    P(F_j|E) = \frac{P(E|F_j)P(F_j)}{\sum_{i=1}^n P(E|F_i)P(F_i)}
\]
\emph{That's odd.} \\
The odds of $H$ given observed evidence $E$:
\[
    \frac{P(H|E)}{P(H^c|E)} = \frac{P(H)P(E|H)}{P(H^c)P(E|H^c)}
\]

\section{Independence}
\subsection{Definition}
Two events are independent if $P(EF) = P(E)P(F)$. Otherwise they are dependent. \\
More generally, events $E_1, E_2, \ldots, E_n$ are independent if for every subset $E_{1'}, E_{2'}, \ldots, E_r$ where $r \leq n$ it holds that
\[
    P(E_{1'} E_{2'} \ldots E_r) = P(E_{1'})P(E_{2'})\cdots P(E_r)
\]
\subsection{Conditional Independence}
Two events $E$ and $F$ are conditional independent given $G$ if
\[
    P(EF|G) = P(E|G)P(F|G)
\]
Dependent events can become independent, and vice-versa, by conditioning on additional information.

\section{Random Distributions}
\subsection{Definitions and Properties}
\emph{Probability Mass Function}:
\[
    p(a) = P(X=a)
\]
\emph{Probability Density Function}:
\begin{align*}
    &P(a \leq X \leq b) = \int_{a}^{b} f(x) dx &P(-\infty < X < \infty) = \int_{-\infty}^{\infty} f(x) dx = 1
\end{align*}
\emph{Cumulative Distribution Function}:
\[
    F(a) = F(X \leq a) \text{ where } -\infty < a \infty
\]
\begin{align*}
    &F(a) = \sum_{\text{all } x\leq a} p(x) &F(a) = \int_{-\infty}^a f(x) dx
\end{align*}
Density $f$ is the derivative of CDF $F$: $f(a) = \frac{d}{da} F(a)$

\subsection{Joint distributions}
\emph{Joint Probability Mass Function}:
\[
    p_{X,Y}(a,b) = P(X=a,Y=b)
\]
Marginal distributions:
\begin{align*}
    &p_X(a) = P(X=a)= \sum_y p_{X,Y} (a, y) &p_Y(b) = P(Y=b)= \sum_x p_{X,Y} (x, b)
\end{align*}
\emph{Joint Cumulative Probability Distribution (CDF)}:
\[
    F_{X,Y}(a,b) = F(a,b) = P(X \leq a, Y \leq b) \text{ where } -\infty < a,b < \infty
\]
Marginal distributions:
\begin{align*}
    F_X(a) = P(X \leq a) = P(X \leq a, Y < \infty) = F_{X,Y}(a,\infty) \\
    F_Y(b) = P(Y \leq b) = P(X < \infty, Y \leq b) = F_{X,Y}(\infty, b)
\end{align*}
\emph{Joint Probability Density Function}:
\[
    P(a_1 < X \leq a_2, b_1 < Y \leq b_2) = \int_{a_1}^{a_2} \int_{b_1}^{b_2} f_{X,Y}(x,y) dy dx
\]
\begin{align*}
    &F_{X,Y}(a,b) = \int_{-\infty}^a \int_{-\infty}^b f_{X,Y}(x,y) dy dx &f_{X,Y}(a,b) = \frac{\partial^2}{\partial a \partial b} F_{X,Y} (a,b)
\end{align*}
Marginal density functions:
\begin{align*}
    &f_x(a) = \int_{-\infty}^{\infty} f_{X,Y}(a,y)dy
    &f_y(b) = \int_{-\infty}^{\infty} f_{X,Y}(x,b)dx
\end{align*}
\subsection{Independent Random Variables}
$n$ random variables $X_1, X_2, \ldots, X_n$ are called independent if
\[
    P(X_1 = x_1, X_2 = x_2, \ldots, X_n = x_n) = \prod_{i=1}^n P(X_i = x_i) \text{ for all } x_1, x_2, \ldots, x_n
\]
or analogously for continuous random variables if
\[
    P(X_1 \leq a_1, X_2 \leq a_2, \ldots, X_n \leq a_n) = \prod_{i=1}^n P(X_i \leq a_i) \text{ for all } a_1, a_2, \ldots, a_n
\]
\subsection{Convolution}
Let $X$ and $Y$ be independent random variables. The convolution of $F_X$ and $F_Y$ is $F_{X+Y}$:
\[
    F_{X+Y}(a) = P(X+Y \leq a) = \int_{y=-\infty}^{\infty} F_X (a-y)f_Y(y)dy
\]
\[
    f_{X+Y}(a) = \int_{y=-\infty}^{\infty} f_X (a-y)f_Y(y)dy
\]
In discrete case, replace $\int_{y=-\infty}^{\infty}$ with $\sum_{y}$, and $f(y)$ with $p(y)$.
\subsection{Conditional Distributions}
\emph{Conditional PMF of $X$ given $Y$}:
\[
    p_{X|Y}(x|y) = P(X=x|Y=y) = \frac{p_{X,Y}(x,y)}{p_Y(y)}
\]
\emph{Conditional PDF of $X$ given $Y$}:
\[
    f_{X|Y}(x|y) = \frac{f_{X,Y}(x,y)}{f_Y(y)}
\]
\emph{Conditional CDF of $X$ given $Y$}:
\begin{align*}
    F_{X|Y}(a|y) = P(X \leq a, Y=y) &= \sum_{x\leq a} p_{X|Y}(x|y) \\
                                    &=\int_{-\infty}^{a} f_{X|Y} (x|y) dx
\end{align*}
$n$ random variables $X_1, X_2, \ldots, X_n$ are conditionally independent given $Y$ if
\[
    P(X_1 = x_1, X_2 = x_2, \ldots, X_n = x_n|Y=y) = \prod_{i=1}^n P(X_i = x_i|Y=y) \text{ for all } x_1, x_2, \ldots, x_n, y
\]
or analogously for continuous random variables if
\[
    P(X_1 \leq a_1, X_2 \leq a_2, \ldots, X_n \leq a_n|Y=y) = \prod_{i=1}^n P(X_i \leq a_i|Y=y) \text{ for all } a_1, a_2, \ldots, a_n, y
\]
It is possible to mix continuous and discrete random variables in conditional distributions. For example let $X$ be a continuous random variable and $N$ be a discrete random variable. Then the conditional PDF of $X$ given $N$ and the conditional PMF of $N$ given $X$ are
\[
    f_{X|N}(x|n) = \frac{p_{N|X}(n|x)f_X(x)}{p_N(n)}
\]
\[
    P_{N|X}(n|x) = \frac{f_{X|N}(x|n)p_N(n)}{f_X(x)}
\]

\section{Expectation}
\subsection{Definitions}
The expected value for a discrete random variable $X$ is defined as
\[
    E[X] = \sum_{x: p(x) > 0} x p(x)
\]
For a continuous random variable $X$, the expected value is
\[
    E[X] = \int_{-\infty}^{\infty} x f(x) dx
\]
\subsection{Properties}
If $I$ is an indicator variable for the event $A$, then
\[
    E[I] = P(A)
\]
Let $g(X)$ be a real-valued function of $X$.
\begin{align*}
    &E[g(X)] = \sum_{i} g(x_i)p(x_i) &E[g(X)] = \int_{-\infty}^{\infty} g(x) f(x) dx
\end{align*}
Let $g(X,Y)$ be a real-valued function of two random variables.
\begin{align*}
    &E[g(X,Y)] = \sum_y \sum_x g(x,y) p_{X,Y}(x,y)  &E[g(X,Y)] = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} g(x,y) f_{X,Y}(x,y) dx dy
\end{align*}
Linearity:
\[
    E[aX + b]  = aE[X] + b
\]
$N$-th Moment of $X$:
\[
    E[X^n] = \sum_{x: p(x) > 0} x^n p(x)
\]
Expected Values of Sums:
\[
    E\left[ \sum_{i=1}^n X_i \right] = \sum_{i=1}^n E[X_i]
\]
Bounding Expectation:\\
If random variable $X \geq a$ then $E[X] \geq a$. \\
If $P(a \leq X < \infty) = 1$ then $a \leq E[X] < \infty$. \\
If random variables $X \geq Y$ then $E[X] \geq E[Y]$.

\subsection{Conditional Expectation}
Conditional Expectation of $X$ given $Y=y$:
\begin{align*}
    &E[X|Y=y] = \sum_x x p_{X|Y}(x|y)   &E[X|Y=y] = \int_{-\infty}^{+\infty} x f_{X|Y} (x|y) dx
\end{align*}
Expectation of conditional sum:
\[
    E\left[ \sum_{i=1}^n X_i | Y=y \right] = \sum_{i=1}^n E[X_i | Y=y]
\]
Expectation of conditional expectations:
\[
    E[E[X|Y]] = E[X]
\]

\section{Variance}
\subsection{Definition}
If $X$ is a random variable with mean $\mu$ then the variance of $X$, denoted $\Var(X)$, is:
\[
    \Var(X) = E[(X-\mu)^2] = E[X^2] - (E[X])^2
\]
\subsection{Properties}
\[
    \Var(aX + b) = a^2\Var(X)
\]
If $X_1, X_2, \ldots, X_n$ are independent random variables, then
\[
    \Var\left( \sum_{i=1}^n X_i \right) = \sum_{i=1}^n \Var(X_i)
\]
\subsection{Covariance}
\[
    \Cov(X,Y) = E[(X-E[X])(Y-E[Y])] = E[XY] - E[X]E[Y]
\]
If $X$ and $Y$ are independent, $\Cov(X,Y) = 0$
\emph{Properties}:
\begin{align*}
    \Cov(X,Y) &= \Cov(Y,X) \\
    \Cov(X,X) &= \Var(X) \\
    \Cov(aX+b, Y) = a\Cov(X,Y)
\end{align*}
If $X_1, X_2, \ldots, X_n$ and $Y_1, Y_2, \ldots, Y_m$ are random variables, then
\[
    \Cov\left( \sum_{i=1}^n X_i, \sum_{j=1}^m Y_j \right) = \sum_{i=1}^n \sum_{j=1}^m \Cov(X_i, X_j)
\]
\subsection{Correlation}
\[
    \rho(X,Y) = \frac{\Cov(X,Y)}{\sqrt{\Var(X)\Var(Y)}}
\]
Note: $-1 \leq \rho(X,Y) \leq 1$. \\
Correlation measures linearity between $X$ and $Y$.\\
If $\rho(X,Y) = 0$, $X$ and $Y$ are uncorrelated.

\section{Moment Generating Functions}
\subsection{Definition}
Moment Generating Function (MGF) of a random variable $X$, where $-\infty < t < \infty$, is
\[
    M(t) = E[e^{tX}]
\]
\begin{align*}
    &\text{When $X$ is discrete: }      &= \sum_x e^{tx} p(x) \\
    &\text{When $X$ is continuous: }    &= \int_{-\infty}^{\infty} e^{tx} f(x) dx
\end{align*}
For any $n$ random variables $X_1, X_2, \ldots, X_n$
\[
    M(t_1, t_2, \ldots, t_n) = E[e^{t_1X_1+t_2X_2+\cdots+t_nX_n}]
\]
The individual moment generating function is obtained:
\[
    M_{X_i}(t) = E[e^{tX}] = M(0, \ldots, 0, t, 0, \ldots, 0) \text{ where $t$ at $i$th place}
\]
\subsection{Properties}
\[
    M^n(t) = \left( \frac{d^n}{dt^n} \right) M(t) = E[X^n e^{nX}]
\]
\[
    M^n(0) = E[X^n]
\]
\[
    M_X(t) = M_Y(t) \text{ iff } X \sim Y
\]
$X_1, X_2, \ldots, X_n$ independent if and only if:
\[
    M(t_1, t_2, \ldots, t_n) = M_{X_1}(t_1)M_{X_2}(t_2)\ldots M_{X_n}(t_n)
\]

\section{Inequalities}
\subsection{Boole's Inequality}
Let $E_1, E_2, \ldots, E_n$ be events with indicator random variables $X_i$.
\[
    \sum_{i=1}^n P(E_i) \geq P\left( \bigcup_{i=1}^n E_i \right)
\]
\subsection{Markov's Inequality}
$X$ is a nonnegative random variable.
\[
    P(X \geq a) \leq \frac{E[X]}{a} \text{ for all } a > 0
\]
\subsection{Chebyshev's Inequality}
$X$ is a random variable with $E[X] = \mu$ and $\Var(X) = \sigma^2$.
\[
    P(|X-\mu| \geq k) \leq \frac{\sigma^2}{k^2} \text{ for all } k > 0
\]
\emph{One-sided inequality}:
\[
    P(X \geq E[X] + a) \leq \frac{\sigma^2}{\sigma^2 + a^2} \text{ for any } a  > 0
\]
\[
    P(X \leq E[X] - a) \leq \frac{\sigma^2}{\sigma^2 + a^2} \text{ for any } a  > 0
\]
\subsection{Chernoff Bound}
$X$ is a random variable with MGF $M(t)$.
\[
    P(X \geq a) \leq e^{-ta} M(t) \text{ for all } t > 0
\]
\[
    P(X \leq a) \leq e^{-ta} M(t) \text{ for all } t < 0
\]
In practice, use the $t$ that minimizes $e^{-ta} M(t)$.

\subsection{Jensen's Inequality}
If $f(x)$ is a convex function ($f''(x) \geq 0$ for all $x$) then
\[
    E[f(x)] \geq f(E[X])
\]

\end{document}


\documentclass[../main.tex]{subfiles}

\begin{document}
        \section{Geometric Features of Curves}
        We have previously examined curvature, but curves have other geometric properties which may be of interest, so we wish to look at those and define them mathematically. One of these is the principal normal, which is always perpendicual to the tangent vector. The principal normal describes the rate of change of the tangent vector. Another is osculating planes and circles, where we use planes and circles to approximate curves, rather than linear  line segments.
        \begin{definition}{Principal Normal Vector}{}
                Consider a curve parameterized by \(\vec{r}(t)\) on some interval. There exists a vector \(\vec{N}\) of unit length called the \emph{principal normal  vector} which is always perpendicular to \(\vec{T}\), and describes the direction in which \(\vec{T}\) is moving.

                In the arc length parameterization, we have
                \[
                \vec{T}=\frac{d\vec{r}}{ds}
                \]
                then if \(\kappa\neq0\), we define
                \[
                \vec{N}(s)=\frac{\vec{T}'(s)}{|\vec{T}'(s)|}
                \]
                which is of unit length and points in the direction in which \(\vec{T}\) is curving. There is also an expression for \(\vec{N}\) in terms of an arbitrary parameterization, using that
                \[
                \frac{d\vec{T}}{ds}=\frac{d\vec{T}}{dt}\frac{dt}{ds}
                \]
                we have
                \[
                \vec{N}(t)=\frac{\vec{T}'(t)}{|\vec{T}'(t)|}
                \]
                so the formula is independent of parameterization.
        \end{definition}
        \begin{theorem}{}{}
                Prove that \(\vec{N}\perp\vec{T}\).
                \tcblower
                Since \(|\vec{T}|=1\), we have \(\vec{T}\cdot\vec{T}'=0\), but since \(\vec{N}\) is a scalar multiple of \(\vec{T}'\), it must be that \(\vec{N}\cdot\vec{T}=0\) and \(\vec{N}\perp\vec{T}\).
        \end{theorem}
        \begin{definition}{The Osculating Plane}{}
                Consider a curve described by \(\vec{r}(t)\) on some interval. We define the \emph{osculating plane} at a point \(P\) on the curve as the plane through \(P\) which is spanned by \(\vec{N}\) and \(\vec{T}\).
        \end{definition}
        \begin{definition}{The Osculating Circle}{}
                Consider a curve described by \(\vec{r}(t)\) on some interval. We define the \emph{osculating circle} at a point \(P\) on the curve to be a circle which lies in the osculating plane, having a radius of \(\rho=\frac{1}{\kappa}\), and a centre at \(P+\rho\vec{N}\).
        \end{definition}
        The osculating circle represents a best circular approximation of the curve at a given point. Note that a circle of radius \(a\) has curvature \(\kappa=\frac{1}{a}\), so the osculating circle has the same curvature as the curve it approximates.
        \begin{example}{}{}
                Consider the circle parameterized by \(\vec{r}(t)=a\cos{t}\i+a\sin{t}\j\) in \(\mathbb{R}^3\). Find an expression for the osculating  circle.
                \tcblower
                It has previously been found that
                \[
                \vec{T}(t)=-\sin{t}\vec{i}+\cos{t}\j
                \]
                and therefore
                \[
                \vec{T}'(t)=-\cos{t}\vec{i}-\sin{t}\j
                \]
                but since \(|\vec{T}'|=1\), we have
                \[
                \vec{N}(t)=\vec{T}'(t)
                \]

                The curvature of this circle is \(\kappa=\frac{1}{a}\), and therefore the radius of the osculating circle is \(a\), identical to that o f the original circle. The centre of the osculating circle is at \(\vec{r}-a\vec{N}=\vec{0}\), so the osculating circle is precisely equal to the original circle.
        \end{example}
        \begin{example}{}{}
                Consider the helix parameterized by \(\vec{r}=a\cos{t}\i+a\sin{t}\j+bt\k\). Find an expression for the osculating circle.
                \tcblower
                We have previously found that
                \[
                \vec{T}'(t)=\frac{1}{\sqrt{a^2+b^2}}\left(-a\cos{t}\i-a\sin{t}\j\right)
                \]
                and
                \[
                |\vec{T}'(t)|=\frac{a}{\sqrt{a^2+b^2}}
                \]
                but this yields
                \[
                \vec{N}=-\cos{t}\i-\sin{t}\j
                \]
                which gives the same osculating circle as that of the circle in the previous example, appropriately offset in the z-axis.
        \end{example}
        \begin{example}{}{}
                Find an expression for the osculating plane of the helix from the previous example.
                \tcblower
                We require our osculating plane be spanned by \(\vec{N}\) and \(\vec{T}\), so the plane's normal vector must be
                \[
                \vec{B}=\vec{T}\times\vec{N}
                \]
                where \(\vec{B}\) is known as the \emph{binormal vector}.
                An expression describing the plane may then be obtained using the usual method.
        \end{example}
\end{document}


\subsection{Boolean algebras}\label{subsec:boolean_algebras}

\begin{definition}\label{def:heyting_algebra}\mcite[10]{BezhanishviliHolliday2019}
  A \term{Heyting algebra} is a \hyperref[def:semilattice/bounded]{bounded} \hyperref[def:semilattice/distributive_lattice]{distributive lattice} \( X \) with a binary operation \( \rightarrow \) defined as
  \begin{equation}\label{eq:def:heyting_algebra/conditional}
    (x \rightarrow y) \coloneqq \bigvee\set{ a \in X \given a \wedge x \leq y }.
  \end{equation}

  In order for the operation to be well-defined, we require that the corresponding join exists for all \( y \) and \( z \). We call this operation the \term{conditional} in analogy with the \hyperref[def:propositional_language/connectives/conditional]{propositional connective}, although this operation is often called \enquote{implication} because of \hyperref[def:material_implication]{material implication}.

  Heyting algebras are useful for defining truth values for intuitionistic logic -- see \fullref{def:propositional_heyting_algebra_semantics} --- and also appear as the \hyperref[def:lindenbaum_tarski_algebra]{Lindenbaum-Tarski algebra} for propositional intuitionistic theories --- see \fullref{thm:intuitionistic_lindenbaum_tarski_algebra}.

  \begin{thmenum}[series=def:heyting_algebra]
    \thmitem{def:heyting_algebra/pseudocomplement} For any element \( x \), we define its \term{pseudocomplement} as
    \begin{equation}\label{eq:def:heyting_algebra/pseudocomplement}
      \widetilde x
      \coloneqq
      (x \rightarrow \bot)
      =
      \bigvee\set{ a \in X \given a \wedge x = \bot }.
    \end{equation}
  \end{thmenum}

  Heyting algebras have the following metamathematical properties:
  \begin{thmenum}[resume=def:heyting_algebra]
    \thmitem{def:heyting_algebra/theory} We extend the language of the \hyperref[def:semilattice/theory]{theory of lattices} with the binary infix functional symbol \( \rightarrow \) and the unary functional symbol \( \widetilde{\anon} \). By adding the axiom \eqref{eq:def:heyting_algebra/conditional} to the theory of bounded distributive lattices, we obtain the theory of Heyting algebras.

    \thmitem{def:heyting_algebra/submodel} The Heyting subalgebras are the \hyperref[def:semilattice/submodel]{bounded sublattices} for which the conditional is well-defined.

    \thmitem{def:heyting_algebra/trivial} The \hyperref[thm:substructures_form_complete_lattice/bottom]{trivial} Heyting algebra is the \hyperref[def:semilattice/trivial]{one-element bounded lattice}.

    \thmitem{def:heyting_algebra/homomorphism} \hyperref[def:first_order_homomorphism]{Homomorphisms} between Heyting algebras are lattice homomorphisms with the additional requirement that homomorphisms preserve conditionals.

    \thmitem{def:heyting_algebra/category} The \hyperref[def:category_of_small_first_order_models]{category of \( \mscrU \)-small models} for Heyting algebras is denoted by \( \cat{Heyt} \). It is a full subcategory of the \hyperref[def:semilattice/category]{category \( \cat{Lat} \) of lattices}.

    \thmitem{def:heyting_algebra/opposite} The \hyperref[def:semilattice/duality]{principle of duality for lattices} does not hold for Heyting algebras.
  \end{thmenum}
\end{definition}

\begin{example}\label{ex:topological_space_is_heyting_algebra}
  Somewhat similar to how the power set of a nonempty set is a Boolean algebra, as shown in \fullref{thm:boolean_algebra_of_subsets}, the topology \( \mscrT \) of a \hyperref[def:topological_space]{topological space} \( (X, \mscrT) \) is a Heyting algebra. This is actually used in topological semantics --- see \fullref{def:propositional_topological_semantics}.

  Indeed,
  \begin{itemize}
    \item \hyperref[def:semilattice/join]{Arbitrary joins} are given by \hyperref[def:basic_set_operations/union]{unions \( \bigcap \)}.
    \item \hyperref[def:semilattice/meet]{Finite meets} are given by \hyperref[def:basic_set_operations/intersection]{intersections \( \bigcup \)}.
    \item The \hyperref[def:partially_ordered_set_extremal_points/top_and_bottom]{top} is the entire domain \( X \).
    \item The \hyperref[def:partially_ordered_set_extremal_points/top_and_bottom]{bottom} is the empty set.
    \item The \hyperref[eq:def:heyting_algebra/conditional]{conditional \( U \leadsto V \)} is then
    \begin{equation*}
      \bigcup\set[\Big]{ A \in T \given \underbrace{A \cap U}_{A \setminus (X \setminus U)} \subseteq V }
      =
      \bigcup\set[\Big]{ A \in T \given A \subseteq V \cup (X \setminus U) }
      =
      \Int((X \setminus U) \cup V),
    \end{equation*}
    which is actually similar to \fullref{thm:boolean_equivalences/conditional_as_disjunction} despite the fact that arbitrary topologies are not Boolean algebras.

    \item As a result, the \hyperref[def:heyting_algebra/pseudocomplement]{pseudocomplement} is
    \begin{equation*}
      \widetilde U = \Int(X \setminus U).
    \end{equation*}
  \end{itemize}
\end{example}

\begin{definition}\label{def:bounded_lattice_complement}
  Let \( X \) be a \hyperref[def:semilattice/bounded]{bounded} \hyperref[def:semilattice/lattice]{lattice} and fix an element \( x \in X \). A \term{complement} of \( x \) is an element \( y \) such that
  \begin{align}
    x \vee y = \top \label{def:bounded_lattice_complement/join}, \\
    x \wedge y = \bot \label{def:bounded_lattice_complement/meet}.
  \end{align}

  Due to the commutativity of both \( \vee \) and \( \wedge \), \( y \) is a complement of \( x \) if and only if \( x \) is a complement of \( y \).
\end{definition}

\begin{proposition}\label{thm:distributive_bounded_lattice_unique_complement}
  In a \hyperref[def:semilattice/bounded]{bounded} \hyperref[def:semilattice/distributive_lattice]{distributive lattice} \( X \), each \( x \in X \) has at most one complement.

  Thus, complementation can be regarded as a \hyperref[def:partial_function]{partial operation}.
\end{proposition}
\begin{proof}
  If \( y \) and \( z \) are both complements of \( x \), then
  \begin{balign*}
    y
    &\reloset {\eqref{eq:thm:binary_lattice_operations/identity/meet}} =
    y \wedge \top
    = \\ &\reloset {\eqref{def:bounded_lattice_complement/join}} =
    y \wedge (z \vee x)
    = \\ &\reloset {\eqref{eq:def:semilattice/distributive_lattice/finite/meet_over_join}} =
    (y \wedge z) \vee (y \wedge x)
    = \\ &\reloset {\eqref{def:bounded_lattice_complement/meet}} =
    y \wedge z
    = \\ &\reloset {\eqref{def:bounded_lattice_complement/meet}} =
    (x \wedge z) \vee (y \wedge z)
    = \\ &\reloset {\eqref{eq:def:semilattice/distributive_lattice/finite/meet_over_join}} =
    (x \vee y) \wedge z
    = \\ &\reloset {\eqref{eq:thm:binary_lattice_operations/identity/meet}} =
    z.
  \end{balign*}
\end{proof}

\begin{definition}\label{def:boolean_algebra}\mcite[48]{Gratzer1978}
  A \term{Boolean algebra} is a \hyperref[def:semilattice/bounded]{bounded} \hyperref[def:semilattice/distributive_lattice]{distributive lattice} in which every element has a \hyperref[def:bounded_lattice_complement]{complement}. The complement of each element is unique due to \fullref{thm:distributive_bounded_lattice_unique_complement}. We define a unary function that gives to every element \( x \) its complement \( \overline \anon \). By definition, this function is an \hyperref[def:set_with_involution]{involution}.

  \begin{thmenum}[series=def:boolean_algebra]
    \thmitem{def:boolean_algebra/conditional} We also define the binary operation \term{conditional} (\( \rightarrow \)) via
    \begin{equation}\label{eq:def:boolean_algebra/conditional}
      (x \rightarrow y) \coloneqq (\overline x \vee y)
    \end{equation}
    in analogy with \fullref{thm:boolean_equivalences/conditional_as_disjunction}. This operation highlights that Boolean algebras are a special case of \hyperref[thm:boolean_algebras_are_heyting_algebras]{Heyting algebras}.

    \thmitem{def:boolean_algebra/biconditional} It remains to define a binary operation corresponding to the \hyperref[def:propositional_language/connectives/biconditional]{propositional biconditional}. Inspired by \fullref{thm:boolean_equivalences/biconditional_via_conditionals}, define
    \begin{equation}\label{eq:def:boolean_algebra/biconditional}
      (x \leftrightarrow y) \coloneqq (x \rightarrow y) \wedge (y \rightarrow x).
    \end{equation}
  \end{thmenum}

  Boolean algebras have the following metamathematical properties:
  \begin{thmenum}[resume=def:boolean_algebra]
    \thmitem{def:boolean_algebra/theory} To obtain the theory of Boolean algebras, we replace the unary functional symbol \( \widetilde{\anon} \) with \( \overline \anon \) in the language of the \hyperref[def:heyting_algebra/theory]{theory of Heyting algebras} and then add the axioms \eqref{def:bounded_lattice_complement/join} and \eqref{def:bounded_lattice_complement/meet} to the theory. We may also replace \eqref{eq:def:heyting_algebra/conditional} defining \( \rightarrow \) with the simpler axiom \eqref{eq:def:boolean_algebra/conditional}.

    \thmitem{def:boolean_algebra/submodel} The Boolean subalgebras are the \hyperref[def:semilattice/submodel]{bounded sublattices} which are closed under compementation.

    \thmitem{def:boolean_algebra/trivial} The \hyperref[thm:substructures_form_complete_lattice/bottom]{trivial} Boolean algebra is the \hyperref[def:semilattice/trivial]{one-element bounded lattice}.

    \thmitem{def:boolean_algebra/homomorphism} \hyperref[def:first_order_homomorphism]{Homomorphisms} between Boolean algebras are simply lattice homomorphisms.

    Complements are automatically preserved because for any lattice homomorphism \( \varphi \) between the Boolean algebras \( X \) and \( Y \),
    \begin{equation*}
      \varphi(x) \vee_Y \varphi(\overline x) = \varphi(x \vee_X \overline x) = \varphi(\top_X) = \top_Y,
    \end{equation*}
    and similarly for \( \wedge \), hence, due to \fullref{thm:distributive_bounded_lattice_unique_complement},
    \begin{equation*}
      \varphi(\overline x) = \overline {\varphi(x)}.
    \end{equation*}

    Implications are also automatically preserved because of \eqref{eq:def:boolean_algebra/conditional}.

    \thmitem{def:boolean_algebra/category} The \hyperref[def:category_of_small_first_order_models]{category of \( \mscrU \)-small models} for Boolean algebras \( \cat{Bool} \) is a full subcategory the \hyperref[def:heyting_algebra/category]{category \( \cat{Heyt} \) of Heyting algebras}.

    \thmitem{def:boolean_algebra/opposite} The \hyperref[def:semilattice/duality]{principle of duality for lattices} holds for Boolean algebras without interchanging complements.
  \end{thmenum}
\end{definition}

\begin{example}\label{ex:boolean_algebras}
  Examples of \hyperref[def:boolean_algebra]{Boolean algebras} include:

  \begin{itemize}
    \thmitem{ex:boolean_algebras/lindenbaum_tarski} The \hyperref[def:lindenbaum_tarski_algebra]{Lindenbaum-Tarski algebras} for classical logic. We prove in \fullref{thm:intuitionistic_lindenbaum_tarski_algebra} that it is a Boolean algebra.
    \thmitem{ex:boolean_algebras/f2} The \hyperref[thm:finite_fields]{prime field} \( \BbbF_2 \) with suitably defined operations discussed in \fullref{thm:f2_is_boolean_algebra}.
    \thmitem{ex:boolean_algebras/power_set} The power set of any set, usually taken to be a space with additional structure (see \fullref{thm:boolean_algebra_of_subsets}).
  \end{itemize}
\end{example}

\begin{proposition}\label{thm:binary_boolean_algebra}
  All two-element \hyperref[def:boolean_algebra]{Boolean algebras} are isomorphic.
\end{proposition}
\begin{proof}
  Follows from the requirement that \hyperref[def:semilattice/homomorphism]{lattice homomorphisms} preserve constants.
\end{proof}

\begin{corollary}\label{thm:f2_is_boolean_algebra}
  For certain purposes, for example \hyperref[def:zhegalkin_polynomial]{Zhegalkin polynomials}, we may regard the \hyperref[thm:finite_fields]{prime field} \( \BbbF_2 \) as a Boolean algebra with \( 1 \) as the \hyperref[def:partially_ordered_set_extremal_points/top_and_bottom]{top} and \( 0 \) as the \hyperref[def:partially_ordered_set_extremal_points/top_and_bottom]{bottom element}.
\end{corollary}
\begin{proof}
  Follows from \fullref{thm:binary_boolean_algebra}.
\end{proof}

\begin{proposition}\label{thm:boolean_algebras_are_heyting_algebras}
  Every \hyperref[def:boolean_algebra]{Boolean algebra} is a \hyperref[def:heyting_algebra]{Heyting algebra} with an identification given by \eqref{eq:def:boolean_algebra/conditional}.
\end{proposition}
\begin{proof}
  Fix any \( x, y \in X \) in a Boolean algebra \( X \). We will show that \( x \rightarrow y \) as defined in \eqref{eq:def:boolean_algebra/conditional} satisfies \eqref{eq:def:heyting_algebra/conditional}.

  Let
  \begin{equation*}
   A \coloneqq \set{ a \in X \given a \wedge x \leq y }
  \end{equation*}
  be the set from \eqref{eq:def:heyting_algebra/conditional}.

  We will show that \( \overline x \vee y \) is an \hyperref[def:partially_ordered_set_extremal_points/upper_and_lower_bounds]{upper bound} of \( A \).

  Fix some \( a_0 \in A \). By definition of \( A \), we have
  \begin{equation*}
   a_0 \wedge x \leq y.
  \end{equation*}

  But this means that
  \begin{equation*}
   \underbrace{(a_0 \wedge x) \vee \overline x}_{a_0 \vee \overline x} \leq y \vee \overline x.
  \end{equation*}

  Since \( a_0 \leq a_0 \vee b \) for any \( b \in X \), it follows that \( a_0 \leq y \vee \overline x \). Therefore, \( \overline x \vee y \) is indeed an upper bound of \( A \).

  Also note that
  \begin{equation*}
   (\overline x \vee y) \wedge x = \underbrace{(\overline x \vee x)}_{\top} \wedge (y \wedge x) = y \wedge x \leq y,
  \end{equation*}
  hence \( \overline x \vee y \in A \).

  Thus, \( \overline x \vee y \) is both an upper bound of \( A \) and an element of \( A \), i.e. it is the least upper bound of \( A \). Therefore,
  \begin{equation*}
   \overline x \vee y = \bigvee A.
  \end{equation*}
\end{proof}

\begin{theorem}[De Morgan's laws]\label{thm:de_morgans_laws}
  If \( X \) is a \hyperref[def:boolean_algebra]{Boolean algebra}, the following hold for any finite \hyperref[def:cartesian_product/indexed_family]{family} \( \{ x_k \}_{k \in \mscrK} \subseteq X \):
  \begin{align}
    \overline{\bigvee_{k \in \mscrK} x_k} = \bigwedge_{k \in \mscrK} \overline{x_k} \label{eq:thm:de_morgans_laws/complement_of_join} \\
    \overline{\bigwedge_{k \in \mscrK} x_k} = \bigvee_{k \in \mscrK} \overline{x_k} \label{eq:thm:de_morgans_laws/complement_of_meet}
  \end{align}

  If \( X \) is \hyperref[def:semilattice/complete]{complete}, \( \mscrK \) may be taken to be any family, not necessarily finite.
\end{theorem}
\begin{proof}
  We will only show \eqref{eq:thm:de_morgans_laws/complement_of_join} since \eqref{eq:thm:de_morgans_laws/complement_of_meet} is dual.

  In order for \( \wedge_{k \in \mscrK} \overline{x_k} \) to be the complement of \( \vee_{k \in \mscrK} x_k \), the conditions \eqref{def:bounded_lattice_complement/join} and \eqref{def:bounded_lattice_complement/meet} need to be satisfied.

  From distributivity, we have
  \begin{equation*}
    \parens*{ \bigwedge_{k \in \mscrK} \overline{x_k} } \vee \parens*{ \bigvee_{m \in \mscrK} x_m }
    \reloset {\eqref{eq:def:semilattice/distributive_lattice/arbitrary/join_over_meet}} =
    \bigwedge_{k \in \mscrK} \parens*{ \overline{x_k} \vee \bigvee_{m \in \mscrK} x_m }
    =
    \bigwedge_{k \in \mscrK} \parens*{ \underbrace{\overline{x_k} \vee x_k}_{\top} \vee \bigvee_{\mathclap{m \in K \setminus \set{k}}} x_m }
    =
    \bigwedge_{k \in \mscrK} \top
    =
    \top,
  \end{equation*}
  which proves \eqref{def:bounded_lattice_complement/join}. The proof of \eqref{def:bounded_lattice_complement/meet} is analogous.
\end{proof}


\documentclass{report}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\section{Perspective of Probability}
\subsection{Abstract}
In this issue, we will observe multivariate Gaussian distribution from the perspective of probability.
\subsection{Prior Knowledge}
$$
\begin{aligned}
x &\backsim N(\mu, \sigma^2)\\
\mu &\in \mathcal{R}^p, \sigma \in \mathcal{R}^p\\
x_i &\backsim N(\mu_i, \sigma_i)\\
p(x_i) &= \frac{1}{\sqrt{2\pi}\sigma_i} \exp(-\frac{(x_i - \mu_i)^2}{2\sigma_i^2})
\end{aligned}
$$
\subsection{Derivation}
First, let's assume that each $x_i$ is $iid (independent\ identically\ distribution)$ as below:
$$
\begin{aligned}
p(x)
&=\prod_{i=1}^p p(x_i)\\
&=\frac{1}{(2\pi)^{\frac{p}{2}}\prod_{i=1}^p \sigma_i} \exp(-\frac{1}{2}\sum_{i=1}^p (\frac{(x_i-\mu_i)^2}{\sigma_i^2}))\\
&=\frac{1}{(2\pi)^{\frac{p}{2}}|\Sigma|^{\frac{1}{2}}} \exp(-\frac{1}{2}
\left (
\begin{matrix}
x_1-\mu_1 & x_2-\mu_2 & ... & x_p - \mu_p
\end{matrix}
\right )
\left (
\begin{matrix}
\frac{1}{\sigma_1^2} & 0 & ... & 0 \\
... & ... & ... & ... \\
0 & ... & 0 & \frac{1}{\sigma_p^2}
\end{matrix}
\right )
\left (
\begin{matrix}
x_1-\mu_1\\
...&\\
...&\\
x_p-\mu_p
\end{matrix}
\right ))\\
&=\frac{1}{(2\pi)^{\frac{p}{2}}|\Sigma|^{\frac{1}{2}}} \exp(-\frac{1}{2}(x-\mu)^T \Sigma^{-1}(x-\mu))
\end{aligned}
\label{Gau.pdf}
$$
The above is the probability density function of multivariate Gaussian distribution.\\\\
We know that $\sigma$ is a positive semidefinite matrix, so we can perform singular value decomposition. So we have:
$$
\begin{aligned}
\Sigma
&=UVU^T\\
&=
\left ( \begin{matrix}
u_1 & ... & u_p
\end{matrix} \right )
\left ( \begin{matrix}
\lambda_1 & 0 & ... & 0\\
... & 0 & ... & ...\\
0 & ... & ... & \lambda_p
\end{matrix} \right )
\left ( \begin{matrix}
u_1^T \\
.\\
.\\
u_p^T
\end{matrix} \right )\\
&=
\left ( \begin{matrix}
u_1\lambda_1 & ... & u_p \lambda_p\\
\end{matrix} \right )
\left ( \begin{matrix}
u_1^T\\
.\\
.\\
u_p^T
\end{matrix} \right )\\
&=\sum_{i=1}^p u_i\lambda_i u_i^T
\end{aligned}
$$
then
$$
\begin{aligned}
\Sigma^{-1}
&=(UVU^T)^{-1}\\
&=(U^T)^{-1}V^{-1}U^{-1}\\
&=UV^{-1}U^T\\
&=\sum_{i=1}^p u_i \frac{1}{\lambda_i} u_i^T
\end{aligned}
$$
Let's set $\Delta = (x-\mu)^T \Sigma^{-1} (x-\mu)$\\\\
Substitute the results derived above into:
$$
\begin{aligned}
\Delta
&=(x-\mu)^T \Sigma^{-1} (x-\mu)\\
&=(x-\mu)^T \sum_{i=1}^p u_i \frac{1}{\lambda_i}u_i^T (x-\mu)\\
&=\sum_{i=1}^p(x-\mu)^T u_i \frac{1}{\lambda_i}u_i^T (x-\mu)
\end{aligned}
$$
Let's set $y_i=(x-\mu)^T u_i$\\\\
Here, $y_i $ represents the coordinate value of $x$ projected onto the new orthogonal basis $u_i$ after centralization.\\
so:
$$
\Delta=\sum_{i=1}^p \frac{y_i^2}{\lambda_i}
$$
Next, let's look at the probability density function of multivariate Gaussian distribution:
$$
p(x)=\frac{1}{(2\pi)^{\frac{p}{2}}|\Sigma|^{\frac{1}{2}}} \exp(-\frac{1}{2}(x-\mu)^T \Sigma^{-1}(x-\mu))
$$
You can see that only the exponential part of the formula is related to the variable $x $. The previous factor is to make the probability sum $1 $.\\
Therefore, the probability of Gaussian distribution is directly related to the value of $\Delta $.\\\\
We assume $p=2$, then:
$$
\frac{y_1^2}{\lambda_1}+\frac{y_2^2}{\lambda_2}=\Delta
$$
We were surprised to find that this is very similar to the elliptic equation. The value of $\Delta$ is not fixed, so for different $x$, these sample points form concentric ellipses in the plane. This is one of the properties of Gaussian distribution.
\end{document}


\documentclass{article}
\usepackage{tocloft}
\include{common_symbols_and_format}
\renewcommand{\cfttoctitlefont}{\Large\bfseries}
\begin{document}
\logo
\rulename{True Strength Index} %Argument is name of rule
\tblofcontents

\ruledescription{The True Strength Index (TSI) is a momentum indicator used to identify overbought and oversold signals. It can also be used to indicate trend reversals using bullish and bearish crossover of the signal line and TSI line.}

\howtotrade
{The strategy is to identify the oversold and overbought markets and a momentum indicator. \\
Bullish Momentum: when the TSI line cross above signal line. \\
Bearish Momentum: when signal line cross above TSI line
}

\ruleparameters
{Window size for Exponential moving average}{25}{This is the number of time steps over which exponential contributions are sourced.}{$\lookbacklength$}
{Window size for Exponential moving average}{13}{This is the number of time steps over which exponential contributions are sourced for smoothed momentum.}{$\lookbacklength_{s}$}
{Smoothing Factor}{2}{Smoothing factor represents the weighting applied to the most recent period’s value.}{$S$}
\stoptable

\newpage
\section{Equation}
\begin{equation}
    \Delta p_{\currenttime} = p_{\currenttime} - p_{\currenttime - 1}
\end{equation}

\begin{equation}
    EMA(\Delta p_{\currenttime}, S, \lookbacklength) = \Big(\Delta p_{\currenttime} * \Big(\frac{S}{1 + \lookbacklength}\Big)\Big) + EMA_{\currenttime-1} * \Big(1-\frac{S}{1 + \lookbacklength}\Big)
\end{equation}

\begin{equation}
    EMA(|\Delta p_{\currenttime}|, S, \lookbacklength) = \Big(|\Delta p_{\currenttime}| * \Big(\frac{S}{1 + \lookbacklength}\Big)\Big) + EMA_{\currenttime-1} * \Big(1-\frac{S}{1 + \lookbacklength}\Big)
\end{equation}

\begin{equation}
    TSI = 100 \times \frac{EMA(EMA(\Delta p_{\currenttime}, S, \lookbacklength), S, \lookbacklength_{s})}{EMA(EMA(|\Delta p_{\currenttime}|, S, \lookbacklength), S,\lookbacklength_{s})}
\end{equation}
\\

where: \\

$TSI$ is True Strength Index. \\

$EMA$ is exponentially weighted moving average. \\

$p_{\currenttime}$ is current stock value. \\

$\Delta p_{\currenttime}$ is change in stock value. \\

$|\Delta p_{\currenttime}|$ is absolute change in stock value. \\

$\lookbacklength$ \ is look back length. \\

$\lookbacklength_{s}$ is look back length for smoothed momentum. \\

$S$ is the smoothing factor.

\hspace{200mm}
\hspace{200mm}
\keyterms
\furtherlinks
\end{document}


\section{Outlook}

\begin{frame}{Motivation}
    \begin{block}{Verlinde Formula}
        \begin{itemize}
            \item Let $\mc{N}$ be the moduli space of stable $\SL_{2}$-bundles over $\Sigma_{2}$; it is isomorphic to $\CC\PP^{3}$ \cite{NR1969}.
            \item Geometric quantisation $\mc{Q}(\mc{N}) := H^{0}(\mc{N}; \mc{L}^{\otimes k})$; its dimension equals the \textbf{Verlinde formula} \cite{verlinde1988, JW1992},
            \begin{equation*}
                \begin{split}
                    \dim \mc{Q}(\mc{N}) = \Ver(k) &= \frac{k^{3}}{6} + k^{2} + \frac{11k}{6} + 1 \\
                    &= \frac{(k+1)(k+2)(k+3)}{3!}.
                \end{split}
            \end{equation*}
            \item Named after Dutch physicist Erik Verlinde, who was working on conformal field theories.
        \end{itemize}
    \end{block}
\end{frame}

\begin{frame}{Integration}
    \begin{block}{Riemann-Roch-Hirzebruch Theorem}
        For toric $X$, lattice point count of $\Delta_{X}$ equals to Euler characteristic,
        \vspace*{-12pt}
        $$ \chi(X) = \int_{X} e^{c_{1}( \mc{O}(k) )}\cdot \Td{(TX)}. $$
        \vspace*{-12pt}
    \end{block}
    \begin{block}{Example}
        For $X = \CC\PP^{3}$, have $e^{c_{1}(\mc{O}(k))} = 1 + kH + \tfrac{k^{2}}{2}H^{2} + \tfrac{k^{3}}{6}H^{3}$, and $\Td{(T\CC\PP^{3})} = 1 + 2H + \tfrac{11}{6}H^{2} + H^{3}$:
        $$ \chi(\CC\PP^{3}) = \int_{\CC\PP^{3}} \big( \tfrac{k^{3}}{6} + k^{2} + \tfrac{11k}{6} + 1 \big) \cdot H^{3} + \ldots = \Ver(k). $$
    \end{block}
\end{frame}

\begin{frame}{Our Direction}
    \begin{block}{Lattice Points}
    \begin{itemize}
        \item So $\Ver(k) = \chi(\CC\PP^{3}) = \#( k\cdot \Delta_{3} \cap \ZZ^{3} )$.
        \item Anything similar for hypertoric manifolds?
    \end{itemize}
    \end{block}
    \begin{block}{Equivariant Verlinde Formula}
        \begin{itemize}
            \item Recently, equivariant Verlinde formula for moduli spaces Higgs bundle, $\mc{M}$, popped up \cite{GP2017}.
            \item $\dim \mc{Q} (\mc{M}) = \infty$, but $\mc{M}$ has a $\CC^{\ast}$-action.
            \item Decompose into $\CC^{\ast}$-weight spaces:
            \vspace*{-6pt}
                $$ \dim \mc{Q} (\mc{M}) = \sum_{n} t^{n} \cdot \dim \mc{Q}_{n}(\mc{M}), $$
            \vspace*{-6pt}
            but now $\dim \mc{Q}_{n}(\mc{M}) < \infty$.
        \end{itemize}
    \end{block}
\end{frame}

\begin{frame}{Localisation}
    \begin{block}{Fixed-Point Formula}
        \vspace*{-12pt}
        $$ \sum_{q \in \Delta} e^{\langle q, \phi \rangle} = \sum_{p \in M^{T}} \frac{ e^{\langle p, \phi \rangle} }{ \prod_{k = 1}^{n} (1- e^{\langle \alpha_{k}^{p}, \phi \rangle}) }, $$
            with edge vectors $\alpha_{k}^{p}$, and $\langle \alpha_{k}^{p}, \phi \rangle \neq 0$, \cite{barvinok1993}.
        \begin{itemize}
            \item Letting $\phi \ra 0$ gets the lattice point count (for Delzant $\Delta$).
        \end{itemize}
    \end{block}
    \begin{block}{Example for $T^{\ast}\CC\PP^{3}$}
        For $(T^{\ast}\CC\PP^{3})_{\epsilon-\text{cut}}$, get
        $$ \frac{(\epsilon + 1)(\epsilon + 2)(\epsilon + 3)}{3!} \cdot \frac{(k + \epsilon +1)(k + \epsilon + 2)(k + \epsilon + 3)}{3!}. $$
        Observe that for $\epsilon = 0$, it becomes $\Ver(k)$.
    \end{block}
\end{frame}

\begin{frame}{Other Hypertoric Manifolds}
    \begin{block}{Non-Convex Core}
        Want to see what happens for hypertoric manifolds with non-convex cores.
    \end{block}
    \begin{block}{Example}
        \vspace{136pt}
    \end{block}
\end{frame}


% Written by Anders Sjoqvist and Ulf Lundstrom, 2009
% The main sources are: tinyKACTL, Beta and Wikipedia
% Transcribed to plain TeX by Richard Hladík in 2018.
{
% Quick fixes
\let\section\header
\def\subsection#1{\header{\subsectionfont#1}}
\def\subsubsection#1{\header{\subsubsectionfont#1}}
\chapter{Mathematics (text)}

\section{Equations}

$$ax^2+bx+c=0 \Rightarrow x = \frac{-b\pm\sqrt{b^2-4ac}}{2a}$$

The extremum is given by $x = -b/2a$.
%
$$\eqalign{ax+by&=e\cr cx+dy&=f\cr}
\,\Rightarrow\,
\eqalign{x&=\frac{ed-bf}{ad-bc}\cr y&=\frac{af-ec}{ad-bc}\cr}$$
%
In general, given an equation $Ax = b$, the solution to a variable $x_i$ is given by
$$x_i = \frac{\det A_i'}{\det A} $$
where $A_i'$ is $A$ with the $i$'th column replaced by $b$.

\section{Recurrences}

If $a_n = c_1 a_{n-1} + \dots + c_k a_{n-k}$, and $r_1, \dots, r_k$ are distinct roots of $x^k + c_1 x^{k-1} + \dots + c_k$, there are $d_1, \dots, d_k$ s.t.
$$a_n = d_1r_1^n + \dots + d_kr_k^n. $$
Non-distinct roots $r$ become polynomial factors, e.g. $a_n = (d_1n + d_2)r^n$.

\section{Trigonometry}

$$\eqalign{
\sin(v+w)&=\sin v\cos w+\cos v\sin w\cr
\cos(v+w)&=\cos v\cos w-\sin v\sin w\cr
\tan(v+w)&=\frac{\tan v+\tan w}{1-\tan v\tan w}\cr
\sin v+\sin w&=2\sin\frac{v+w}{2}\cos\frac{v-w}{2}\cr
\cos v+\cos w&=2\cos\frac{v+w}{2}\cos\frac{v-w}{2}\cr
(V+W)\tan(v-w)/2&=(V-W)\tan(v+w)/2\cr}$$
where $V, W$ are lengths of sides opposite angles $v, w$.
$$\eqalign{a\cos x+b\sin x&=r\cos(x-\phi)\cr
a\sin x+b\cos x&=r\sin(x+\phi)\cr}$$
where $r=\sqrt{a^2+b^2}$, $\phi=\mathop{\rm atan2}(b,a)$.

\section{Geometry}

\subsection{Triangles}

Side lengths: $a,b,c$

Semiperimeter: $p=\frac{a+b+c}{2}$

Area: $A=\sqrt{p(p-a)(p-b)(p-c)}$

Circumradius: $R=\frac{abc}{4A}$

Inradius: $r=\frac{A}{p}$

Length of median (divides triangle into two equal-area triangles):$$m_a=\frac{1}{2}\sqrt{2b^2+2c^2-a^2}$$

Length of bisector (divides angles in two): $s_a=\sqrt{bc\left[1-\left(\frac{a}{b+c}\right)^2\right]}$

Law of sines: $\frac{\sin\alpha}{a}=\frac{\sin\beta}{b}=\frac{\sin\gamma}{c}=\frac{1}{2R}$

Law of cosines: $a^2=b^2+c^2-2bc\cos\alpha$

Law of tangents: $$\frac{a+b}{a-b}=\frac{\tan\frac{\alpha+\beta}{2}}{\tan\frac{\alpha-\beta}{2}}$$

\subsection{Quadrilaterals}

With side lengths $a,b,c,d$, diagonals $e, f$, diagonals angle $\theta$, area $A$ and
magic flux $F=b^2+d^2-a^2-c^2$:

$$ 4A = 2ef \cdot \sin\theta = F\tan\theta = \sqrt{4e^2f^2-F^2} $$

 For cyclic quadrilaterals the sum of opposite angles is $180^\circ$,
$ef = ac + bd$, and $A = \sqrt{(p-a)(p-b)(p-c)(p-d)}$.

\subsection{Spherical coordinates}
\figure{kactl/math/sphericalCoordinates.pdf}

$$\eqalign{x &= r\sin\theta\cos\phi\cr
y &= r\sin\theta\sin\phi\cr
z &= r\cos\theta\cr}\;\eqalign{
	r &= \sqrt{x^2+y^2+z^2}\cr
\theta &= \mathop{\rm acos}\left(z/\sqrt{x^2+y^2+z^2}\right)\cr
\phi &= \mathop{\rm atan2}\left(y,x\right)\cr}$$

\section{Derivatives/Integrals}

$$\eqalign{
\frac{d}{dx}\arcsin x &= \frac{1}{\sqrt{1-x^2}}\cr
\frac{d}{dx}\arccos x &= -\frac{1}{\sqrt{1-x^2}}\cr
\frac{d}{dx}\tan x &= 1+\tan^2 x\cr
\frac{d}{dx}\arctan x &= \frac{1}{1+x^2}\cr}\;\;\;\eqalign{
\int\tan ax &= -\frac{\ln|\cos ax|}{a}\cr
\int x\sin ax &= \frac{\sin ax-ax \cos ax}{a^2} \cr
\int e^{-x^2} &= \frac{\sqrt \pi}{2} \text{erf}(x)\cr
\int xe^{ax}dx &= \frac{e^{ax}}{a^2}(ax-1)\cr}$$

Integration by parts:
$$\int_a^bf(x)g(x)\d x = [F(x)g(x)]_a^b-\int_a^bF(x)g'(x)\d x$$

\section{Sums}

$$c^a + c^{a+1} + \dots + c^{b} = \frac{c^{b+1} - c^a}{c-1},\; c \neq 1$$
%
$$\eqalign{
	1 + 2 + 3 + \dots + n &= \frac{n(n+1)}{2} \cr
	1^2 + 2^2 + 3^2 + \dots + n^2 &= \frac{n(2n+1)(n+1)}{6} \cr
	1^3 + 2^3 + 3^3 + \dots + n^3 &= \frac{n^2(n+1)^2}{4} \cr
	1^4 + 2^4 + 3^4 + \dots + n^4 &= \frac{n(n+1)(2n+1)(3n^2 + 3n - 1)}{30} \cr
}$$

\section{Series}

$$e^x = 1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\dots,\quad(-\infty<x<\infty)$$
$$\ln(1+x) = x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}+\dots,\quad(-1<x\leq1)$$
$$\sqrt{1+x} = 1+\frac{x}{2}-\frac{x^2}{8}+\frac{2x^3}{32}-\frac{5x^4}{128}+\dots,\quad(-1\leq x\leq1)$$
$$\sin x = x-\frac{x^3}{3!}+\frac{x^5}{5!}-\frac{x^7}{7!}+\dots,\quad(-\infty<x<\infty)$$
$$\cos x = 1-\frac{x^2}{2!}+\frac{x^4}{4!}-\frac{x^6}{6!}+\dots,\quad(-\infty<x<\infty)$$

\section{Probability theory}

Let $X$ be a discrete random variable with probability $p_X(x)$ of assuming the
value $x$. It will then have an expected value (mean)
$\mu={\mathbb E}(X)=\sum_xxp_X(x)$ and variance
$\sigma^2=V(X)={\mathbb E}(X^2)-({\mathbb E}(X))^2=\sum_x(x-{\mathbb E}(X))^2p_X(x)$
where $\sigma$ is the standard deviation. If $X$ is instead continuous it will
have a probability density function $f_X(x)$ and the sums above will instead be
integrals with $p_X(x)$ replaced by $f_X(x)$.

Expectation is linear:
$${\mathbb E}(aX+bY) = a{\mathbb E}(X)+b{\mathbb E}(Y)$$
For independent $X$ and $Y$, $$V(aX+bY) = a^2V(X)+b^2V(Y).$$

\subsection{Discrete distributions}

\subsubsection{Binomial distribution}
The number of successes in $n$ independent yes/no experiments, each of which yields success with probability $p$ is $\textrm{Bin}(n,p),\,n=1,2,\dots,\, 0\leq p\leq1$.
$$p(k)=\binom{n}{k}p^k(1-p)^{n-k}$$
$$\mu = np,\,\sigma^2=np(1-p)$$
$\textrm{Bin}(n,p)$ is approximately $\textrm{Po}(np)$ for small $p$.

\subsubsection{First success distribution}
The number of trials needed to get the first success in independent yes/no experiments, each of which yields success with probability $p$, is $\textrm{Fs}(p),\,0\leq p\leq1$.
$$p(k)=p(1-p)^{k-1},\,k=1,2,\dots$$
$$\mu = \frac1p,\,\sigma^2=\frac{1-p}{p^2}$$

\subsubsection{Poisson distribution}
The number of events occurring in a fixed period of time $t$ if these events occur with a known average rate $\kappa$ and independently of the time since the last event is $\textrm{Po}(\lambda),\,\lambda=t\kappa$.
$$p(k)=e^{-\lambda}\frac{\lambda^k}{k!}, k=0,1,2,\dots$$
$$\mu=\lambda,\,\sigma^2=\lambda$$

\subsection{Continuous distributions}

\subsubsection{Uniform distribution}
If the probability density function is constant between $a$ and $b$ and 0 elsewhere it is $\textrm{U}(a,b),\quad a<b$.
$$f(x) = \cases{{1\over b-a}& $a<x<b$;\cr0& otherwise.\cr}$$
%
$$\mu=\frac{a+b}{2},\quad\sigma^2=\frac{(b-a)^2}{12}$$

\subsubsection{Exponential distribution}
The time between events in a Poisson process is $\textrm{Exp}(\lambda),\lambda>0$.
$$f(x) = \cases{\lambda e^{-\lambda x}&$x\ge 0$,\cr 0&otherwise.\cr}$$
$$\mu=\frac{1}{\lambda},\quad\sigma^2=\frac{1}{\lambda^2}$$

\subsubsection{Normal distribution}
Most real random values with mean $\mu$ and variance $\sigma^2$ are well described by ${\cal N}(\mu,\sigma^2)$, where $\sigma>0$.
$$ f(x) = \frac{1}{\sqrt{2\pi\sigma^2}}e^{-\frac{(x-\mu)^2}{2\sigma^2}} $$
If $X_1 \sim {\cal N}(\mu_1,\sigma_1^2)$ and $X_2 \sim {\cal N}(\mu_2,\sigma_2^2)$ then
$$ aX_1 + bX_2 + c \sim {\cal N}(\mu_1+\mu_2+c,a^2\sigma_1^2+b^2\sigma_2^2) $$

\section{Markov chains}
A \emph{Markov chain} is a discrete random process with the property that the next state depends only on the current state.
Let $X_1,X_2,\ldots$ be a sequence of random variables generated by the Markov process.
Then there is a transition matrix $\mathbf{P} = (p_{ij})$, with $p_{ij} = \Pr(X_n = i | X_{n-1} = j)$,
and $\mathbf{p}^{(n)} = \mathbf P^n \mathbf p^{(0)}$ is the probability distribution for $X_n$ (i.e., $p^{(n)}_i = \Pr(X_n = i)$),
where $\mathbf{p}^{(0)}$ is the initial distribution.

% \subsubsection{Stationary distribution}
$\mathbf{\pi}$ is a stationary distribution if $\mathbf{\pi} = \mathbf{\pi P}$.
If the Markov chain is \emph{irreducible} (it is possible to get to any state from any state),
% TODO: make \scriptfont\mathbb work
then $\pi_i = \frac{1}{{\mathbb E}(T_i)}$ where ${\mathbb E}(T_i)$  is the expected time between two visits in state $i$.
$\pi_j/\pi_i$ is the expected number of visits in state $j$ between two visits in state $i$.

For a connected, undirected and non-bipartite graph, where the transition probability is uniform among all neighbors, $\pi_i$ is proportional to node $i$'s degree.

% \subsubsection{Ergodicity}
A Markov chain is \emph{ergodic} if the asymptotic distribution is independent of the initial distribution.
A finite Markov chain is ergodic iff it is irreducible and \emph{aperiodic} (i.e., the gcd of cycle lengths is 1).
$\lim_{k\rightarrow\infty}\mathbf{P}^k = \mathbf{1}\pi$.

% \subsubsection{Absorption}
A Markov chain is an A-chain if the states can be partitioned into two sets $\mathbf{A}$ and $\mathbf{G}$, such that all states in $\mathbf{A}$ are absorbing ($p_{ii}=1$), and all states in $\mathbf{G}$ leads to an absorbing state in $\mathbf{A}$.
The probability for absorption in state $i\in\mathbf{A}$, when the initial state is $j$, is $a_{ij} = p_{ij}+\sum_{k\in\mathbf{G}} a_{ik}p_{kj}$.
The expected time until absorption, when the initial state is $i$, is $t_i = 1+\sum_{k\in\mathbf{G}}p_{ki}t_k$.

\section{Number-theoretical}

\subsection{Pythagorean Triples}
 The Pythagorean triples are uniquely generated by
 $$a=k\cdot (m^{2}-n^{2}),\ \,b=k\cdot (2mn),\ \,c=k\cdot (m^{2}+n^{2}),$$
 with $m > n > 0$, $k > 0$, $m \bot n$, and either $m$ or $n$ even.

\subsection{Primes}
	$p=962592769$ is such that $2^{21} \mid p-1$, which may be useful. For hashing
	use 970592641 (31-bit number), 31443539979727 (45-bit), 3006703054056749
	(52-bit). There are 78498 primes less than $1\,000\,000$.

	Primitive roots exist modulo any prime power $p^a$, except for $p = 2, a > 2$, and there are $\phi(\phi(p^a))$ many.
	For $p = 2, a > 2$, the group ${\mathbb Z}_{2^a}^\times$ is instead isomorphic to ${\mathbb Z}_2 \times {\mathbb Z}_{2^{a-2}}$.

\subsection{Estimates}
	$\sum_{d|n} d = O(n \log \log n)$.

	The number of divisors of $n$ is at most around 100 for $n < 5e4$, 500 for $n < 1e7$, 2000 for $n < 1e10$, $200\,000$ for $n < 1e19$.

\chapter{Combinatorial (text)}

%\section{The Twelvefold Way}
%	\import{twelvefoldway.tex}

\section{Permutations}
%\subsection{Factorial}
%	\import{factorial.tex}
%	\kactlimport{intperm.h}

\subsection{Cycles}
	Let the number of $n$-permutations whose cycle lengths all belong to the set $S$ be denoted by $g_S(n)$. Then
	$$\sum_{n=0} ^\infty g_S(n) \frac{x^n}{n!} = \exp\left(\sum_{n\in S} \frac{x^n} {n} \right)$$

\subsection{Involutions}
	An involution is a permutation with maximum cycle length 2, and it is its own inverse.
	$$a(n) = a(n-1) + (n-1)a(n-2)$$
	$$a(0) = a(1) = 1$$
	1, 1, 2, 4, 10, 26, 76, 232, 764, 2620, 9496, 35696, 140152

\subsection{Stirling numbers of the first kind}
	$$s(n,k) = (-1)^{n-k}c(n,k)$$
	$c(n,k)$ is the unsigned Stirling numbers of the first kind, and they count the number of permutations on $n$ items with $k$ cycles.
	$$s(n,k) = s(n-1,k-1) - (n-1) s(n-1,k)$$
	$$s(0,0) = 1, s(n,0) = s(0,n) = 0$$
	$$c(n,k) = c(n-1,k-1) + (n-1) c(n-1,k)$$
	$$c(0,0) = 1, c(n,0)=c(0,n)=0$$

\subsection{Eulerian numbers}
	Number of permutations $\pi \in S_n$ in which exactly $k$ elements are greater than the previous element. $k$ $j$:s s.t. $\pi(j)>\pi(j+1)$, $k+1$ $j$:s s.t. $\pi(j)\geq j$, $k$ $j$:s s.t. $\pi(j)>j$.
	$$E(n,k) = (n-k)E(n-1,k-1) + (k+1)E(n-1,k)$$
	$$E(n,0) = E(n,n-1) = 1$$
	$$E(n,k) = \sum_{j=0}^k(-1)^j\binom{n+1}{j}(k+1-j)^n$$

\subsection{Burnside's lemma}
	Given a group $G$ of symmetries and a set $X$, the number of elements of $X$ \emph{up to symmetry} equals
	 $$ {\frac {1}{|G|}}\sum _{{g\in G}}|X^{g}|, $$
	 where $X^{g}$ are the elements fixed by $g$ ($g.x = x$).

	 If $f(n)$ counts "configurations" (of some sort) of length $n$, we can ignore rotational symmetry using $G = \mathbb Z_n$ to get
	 $$ g(n) = \frac 1 n \sum_{k=0}^{n-1}{f(\text{gcd}(n, k))} = \frac 1 n \sum_{k|n}{f(k)\phi(n/k)}. $$

\section{Partitions and subsets}
\subsection{Partition function}
	Partitions of $n$ with exactly $k$ parts, $p(n,k)$, i.e., writing $n$ as a sum of $k$ positive integers, disregarding the order of the summands.
	$$p(n,k) = p(n-1,k-1)+p(n-k,k)$$
	$$p(0,0)=p(1,n)=p(n,n)=p(n,n-1)=1$$

	For partitions with any number of parts, $p(n)$ obeys
	$$ p(0) = 1,\ p(n) = \sum_{k \in \mathbb Z \setminus \{0\}}{(-1)^{k+1} p(n - k(3k-1) / 2)} $$
	$$ p(n) \sim 0.145 / n \cdot \exp(2.56 \sqrt{n}) $$

%	\begin{center}
%	\begin{tabular}{c|c@{\ }c@{\ }c@{\ }c@{\ }c@{\ }c@{\ }c@{\ }c@{\ }c@{\ }c@{\ }c@{\ }c@{\ }c}
%		$n$    & 0 & 1 & 2 & 3 & 4 & 5 & 6  & 7  & 8  & 9  & 20  & 50  & 100 \\ \hline
%		$p(n)$ & 1 & 1 & 2 & 3 & 5 & 7 & 11 & 15 & 22 & 30 & 627 & $\mathtt{\sim}$2e5 & $\mathtt{\sim}$2e8 \\
%	\end{tabular}
%	\end{center}
%
%
\subsection{Stirling numbers of the second kind}
	Partitions of $n$ distinct elements into exactly $k$ groups.
	$$S(n,k) = S(n-1,k-1) + k S(n-1,k)$$
	$$S(n,1) = S(n,n) = 1$$
	$$S(n,k) = \frac{1}{k!}\sum_{j=0}^k (-1)^{k-j}\binom{k}{j}j^n$$

\subsection{Bell numbers}
	Total number of partitions of $n$ distinct elements.
	$$B(n) = \sum_{k=1}^n \binom{n-1}{k-1}B(n-k) = \sum_{k=1}^n S(n,k)$$
	$$B(0) = B(1) = 1$$
	The first are 1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147, 115975, 678570, 4213597.
	For a prime $p$
	$$B(p^m+n)\equiv mB(n)+B(n+1) \pmod{p}$$

\subsection{Triangles}
	Given rods of length $1,\ldots,n$,
	$$T(n) = \frac{1}{24} \cases{n(n-2)(2n-5) & $n$ even\cr(n-1)(n-3)(2n-1) & $n$ odd}.$$
	is the number of distinct triangles (positive are) that can be constructed, i.e., the \# of 3-subsets of $[n]$ s.t. $x\leq y\leq z$ and $z\neq x+y$.

\section{General purpose numbers}
\subsection{Catalan numbers}
	$$C_n=\frac{1}{n+1}\binom{2n}{n}= \binom{2n}{n}-\binom{2n}{n+1} = \frac{(2n)!}{(n+1)!n!}$$
	$$C_{n+1} = \frac{2(2n+1)}{n+2}C_n$$
	$$C_0=1, C_{n+1}=\sum C_iC_{n-i}$$
	First few are 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900.
		\itemitem{$\bullet$}\# of monotonic lattice paths of a $n\times n$-grid which do not pass above the diagonal.
		\itemitem{$\bullet$}\# of expressions containing $n$ pairs of parenthesis which are correctly matched.
		\itemitem{$\bullet$}\# of full binary trees with with $n+1$ leaves (0 or 2 children).
		\itemitem{$\bullet$}\# of non-isomorphic ordered trees with $n+1$ vertices.
		\itemitem{$\bullet$}\# of ways a convex polygon with $n+2$ sides can be cut into triangles by connecting vertices with straight lines.
		\itemitem{$\bullet$}\# of permutations of $[n]$ with no three-term increasing subsequence.

\subsection{Super Catalan numbers}
	The number of monotonic lattice paths of a $n\times n$-grid that do not touch the diagonal.
	$$S(n) = \frac{3(2n-3)S(n-1)-(n-3)S(n-2)}{n}$$
	$$S(1)=S(2)=1$$
	1, 1, 3, 11, 45, 197, 903, 4279, 20793, 103049, 518859

\subsection{Motzkin numbers}
	Number of ways of drawing any number of nonintersecting chords among $n$ points on a circle. Number of lattice paths from $(0,0)$ to $(n,0)$ never going below the $x$-axis, using only steps NE, E, SE.
	$$M(n) = \frac{3(n-1)M(n-2)+(2n+1)M(n-1)}{n+2}$$
	$$M(0) = M(1) = 1$$
	1, 1, 2, 4, 9, 21, 51, 127, 323, 835, 2188, 5798, 15511, 41835, 113634

\subsection{Narayana numbers}
	Number of lattice paths from $(0,0)$ to $(2n,0)$ never going below the $x$-axis, using only steps NE and SE, and with $k$ peaks.
	$$N(n,k) = \frac{1}{n}\binom{n}{k}\binom{n}{k-1}$$
	$$N(n,1) = N(n,n) = 1$$
	$$\sum_{k=1}^n N(n,k) = C_n$$
	1, 1, 1, 1, 3, 1, 1, 6, 6, 1, 1, 10, 20, 10, 1, 1, 15, 50

\subsection{Schr\" oder numbers}
	Number of lattice paths from $(0,0)$ to $(n,n)$ using only steps N,NE,E, never going above the diagonal. Number of lattice paths from $(0,0)$ to $(2n,0)$ using only steps NE, SE and double east EE, never going below the $x$-axis. Twice the Super Catalan number, except for the first term.
	1, 2, 6, 22, 90, 394, 1806, 8558, 41586, 206098

}


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

\section*{Fri Oct 18 2019}

\subsection{Covariant differentiation}

We want to do derivatives, as in:
%
\begin{equation}
  f(x + \dd{x} ) = f(x) + \pdv{f}{x} \dd{x}
\,,
\end{equation}
%
which allow us to ``move around''. In more dimensions,  the rule will be
%
\begin{equation}
  f(x + \dd{x} ) - f(x) = \dd{x^{\mu }} \partial_\mu f
\,.
\end{equation}
%

Now, we want to prove that, in Minkowski spacetime, \(\partial_\mu f\) is a rank (0,1) tensor if \(f\) is a function.

Under a change of variables \(x^{\mu } \rightarrow x^{\prime \mu }\) we have
%
\begin{equation}
  \pdv{f(x)}{x^{\mu }} \rightarrow \pdv{f (x')}{x^{\prime \mu }} = \pdv{x^{\alpha }}{x^{\prime \mu }} \pdv{}{x^{\alpha }} f(x) \marginnote{Since \(x'\) and \(x\) represent the same point, \(f(x') = f(x)\).}
\,,
\end{equation}
%
which is the transformation law of a covariant vector, or (0,1) tensor.

However, for a vector \(\dd{x^{\nu }} \partial_\nu A^{\mu }\) is \emph{not} a tensor!

Under a change of coordinates,
%
\begin{subequations}
\begin{align}
  \pdv{A^{\mu}(x)}{x^{\nu }}  &= \pdv{}{x^{\prime \nu }} A^{\mu }(x')   \\
  &= \pdv{x^{\alpha }}{x^{\prime \nu }} \pdv{}{x^{\alpha }} \qty(\pdv{x^{\prime \mu }}{x^{\beta }} A^{\beta  }(x))    \\
  &= \pdv{x^{\alpha }}{x^{\prime \nu }} \pdv[2]{x^{\prime \mu }}{x^{\alpha }}{x^{\beta }} +
  \pdv{x^{\alpha }}{x^{\prime \nu }} \pdv{x^{\prime \mu }}{x^{\beta }} \pdv{A^{\beta }}{x^{\alpha }}
  \,,
\end{align}
\end{subequations}
%
and we can see that the second term is the transformation we want, but the first term spoils the transformation.

This is not an issue in SR: there, the second derivative vanishes:
%
\begin{equation}
    \pdv[2]{x^{\prime \mu }}{x^{\alpha }}{x^{\beta }}
    = \pdv{}{x^{\alpha }} \Lambda^{\mu }_{\beta } = 0
\,,
\end{equation}
%
since Lorentz matrices are constant.

So, we construct a \emph{Covariant Derivative} which transforms as a tensor under diffeomorphisms.

We denote it as \(\nabla_\nu A^{\mu }\).
For any tensor \(T\) of arbitrary rank \((p, q)\) we request \(\nabla_\nu T\) to be a tensor of rank \((p, q+1)\).
Also, we request \(\nabla_\mu \rightarrow \partial_\mu\) for flat spacetime.

We define the Christoffel symbols:
%
\begin{equation}
  \Gamma_{\mu \nu }^{\alpha } =
  \frac{1}{2} g^{\alpha \lambda } \qty(g_{\lambda \mu , \nu }+ g_{\lambda \nu , \mu } - g_{\mu \nu , \lambda })
\,,
\end{equation}
%
where we introduced comma notation for partial non-covariant differentiation: the full notation is
%
\begin{align}
\partial_{\mu } x_{A} \overset{\text{def}}{=}  x_{A, \mu }
\qquad \text{and} \qquad
\nabla_{\mu } x_{A} \overset{\text{def}}{=} x_{A;\mu }
\,.
\end{align}
%

They are symmetric in the two lower indices and they are not tensors. Their transformation law is:
%
\begin{equation}
  \Gamma_{\nu \kappa }^{\mu }\rightarrow
  \pdv{x^{\prime \mu }}{x^{\alpha }} \pdv{x^{\beta }}{x^{\prime \nu }} \pdv{x^{\gamma }}{x^{\prime \mu }} \Gamma^{\alpha }_{\beta \gamma } +
  \pdv{x^{\prime \mu }}{x^{\alpha }} \pdv[2]{x^{\prime \mu }}{x^{\prime \nu }}{x^{\prime \kappa }}
\,,
\end{equation}
%
which we note is \emph{not tensorial}!

We define
%
\begin{equation}
    \nabla_{\nu }V_{\mu } = \partial_{\nu } V_\mu - \Gamma_{\nu \mu }^{\alpha } V_{\alpha }
\,,
\end{equation}
%
and
%
\begin{equation}
    \nabla_{\nu }V^{\mu} = \partial_{\nu } V_\mu + \Gamma_{\nu \alpha  }^{\mu  } V^{\alpha }
\,.
\end{equation}
%

How does it transform? For the covariant derivative, we have:
%
\begin{subequations}
\begin{align}
  \nabla_{\nu }' V_{\kappa }' &= \pdv{}{x^{\prime \nu }} V'_\kappa - \Gamma^{\prime \mu }_{\nu \kappa } V_{\mu  }'  \\
  &= \pdv{x^{\mu }}{x^{\prime \nu }} \partial_{\mu } \qty(\pdv{x^{\lambda }}{x^{\prime \kappa}}V_{\lambda }) -  \qty(\pdv{x^{\prime \mu }}{x^{\alpha }} \pdv{x^{\beta }}{x^{\prime \nu }} \pdv{x^{\gamma }}{x^{\prime \mu }} \Gamma^{\alpha }_{\beta \gamma } +
  \pdv{x^{\prime \mu }}{x^{\alpha }} \pdv[2]{x^{\prime \mu }}{x^{\prime \nu }}{x^{\prime \kappa }} )
  \qty(\pdv{x^{\lambda }}{x^{\prime \mu }} V_{\lambda })  \\
  &= \pdv[2]{x^{\lambda }}{x^{\prime \nu }}{x^{\prime \mu }} V_{\lambda }
  + \pdv{x^{\lambda }}{x^{\prime \mu}} \pdv{V_{\lambda }}{x^{\prime \nu }} -
  \pdv{x^{\prime \mu }}{x^{\alpha }} \qty(\pdv{x^{\beta }}{x^{\prime \nu }}\pdv{x^{\gamma }}{x^{\prime \kappa }} \Gamma^{\alpha }_{\beta \gamma }  + \pdv[2]{x^{\alpha }}{x^{\prime \nu }}{x^{\prime \kappa }} ) \pdv{x^{\lambda }}{x^{\prime \mu }} V_{\lambda }   \\
  &=\pdv[2]{x^{\lambda }}{x^{\prime \nu }}{x^{\prime \mu }} V_{\lambda }
  + \pdv{x^{\lambda }}{x^{\prime \kappa }} \pdv{x^{\alpha }}{x^{\prime \nu }} \pdv{V_{\lambda } }{x^{\alpha }}
  - \qty(\pdv{x^{\beta }}{x^{\prime \nu }}\pdv{x^{\gamma }}{x^{\prime \kappa }} \Gamma^{\alpha }_{\beta \gamma }  + \pdv[2]{x^{\alpha }}{x^{\prime \nu }}{x^{\prime \kappa }} ) \delta^{\lambda }_{\alpha }V_{\lambda }   \\
  &= \pdv[2]{x^{\lambda }}{x^{\prime \nu }}{x^{\prime \kappa }} V_{\lambda }
  + \pdv{x^{\lambda }}{x^{\prime \kappa }} \pdv{x^{\alpha }}{x^{\prime \nu }} \pdv{V_{\lambda } }{x^{\alpha }}
  - \pdv{x^{\beta }}{x^{\prime \nu }} \pdv{x^{\gamma }}{x^{\prime \kappa }} \Gamma^{\alpha }_{\beta \gamma }V_{\alpha }
  -\pdv[2]{x^{\lambda }}{x^{\prime \nu }}{x^{\prime \kappa }} V_{\lambda }   \\
  &= \pdv{x^{\lambda }}{x^{\prime \kappa }} \pdv{x^{\alpha }}{x^{\prime \nu }}
  \qty(\pdv{V_{\lambda }}{x^{\alpha } } - \Gamma^{\sigma }_{\alpha \lambda }V_{\sigma })  \\
  &= \pdv{x^{\lambda }}{x^{\prime \kappa }} \pdv{x^{\alpha }}{x^{\prime \nu }}
  \nabla_{\alpha }V_{\lambda }
  \,,
\end{align}
\end{subequations}
%
where we used: relabeling of indices, contraction of the Jacobian matrix with its inverse, the chain rule, the product rule, the transformation law of the Christoffel symbols (some steps are wrong... oh well, there's more interesting stuff to do).

The derivative of a contravariant tensor is a tensor: this can be proven by noticing that \(\nabla_\mu (A^{\alpha }B_{\alpha }) = \partial_\mu (A^{\alpha }B_{\alpha }) = B_{\alpha } \nabla_{\mu }A^{\alpha } + A^{\alpha }\nabla_{\mu }B_{\alpha }\). Otherwise, we can compute away:
%
\begin{subequations}
\begin{align}
  \nabla_{\nu }' V^{\prime \mu }  &= \pdv{V^{\prime \mu }}{x^{\prime \nu }} + \Gamma^{\prime \mu }_{\nu \kappa }V^{\prime \kappa }  \\
  &= \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv{}{x^{\lambda }} \qty(\pdv{x^{\prime \mu }}{x^{\alpha }} V^{\alpha })
  +   \qty(\pdv{x^{\prime \mu }}{x^{\alpha }} \pdv{x^{\beta }}{x^{\prime \nu }} \pdv{x^{\gamma }}{x^{\prime \mu }} \Gamma^{\alpha }_{\beta \gamma }
  + \pdv{x^{\prime \mu }}{x^{\alpha }} \pdv[2]{x^{\prime \mu }}{x^{\prime \nu }}{x^{\prime \kappa }}) \qty(\pdv{x^{\prime \kappa }}{x^{\sigma }} V^{\sigma })  \\
  &= \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv[2]{x^{\prime \mu }}{x^{\lambda }}{x^{\alpha }} V^{\alpha }
  + \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv{x^{\prime \mu }}{x^{\alpha }} \pdv{V^{\alpha }}{x^{\lambda }}
  + \pdv{x^{\prime \mu }}{x^{\alpha }} \pdv{x^{\beta }}{x^{\prime \nu }} \delta^{\gamma}_{\sigma } \Gamma^{\alpha }_{\beta \gamma } V^{\gamma }+ \pdv{x^{\prime \mu }}{x^{\alpha }} \pdv[2]{x^{\prime \alpha }}{x^{\nu }}{x^{\mu }} \pdv{x^{\prime \kappa }}{x^{\sigma}} V^{\sigma }    \\
  &= \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv[2]{x^{\prime \mu }}{x^{\lambda }}{x^{\alpha }} V^{\alpha }
  + \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv{x^{\prime \mu }}{x^{\alpha }} \qty(\pdv{V^{\alpha }}{x^{\lambda }} + \Gamma^{\alpha }_{\lambda \gamma } V^{\gamma })  \\
  & = \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv{x^{\prime \mu }}{x^{\alpha }} \nabla_{\lambda }V^{\alpha }
  + \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv[2]{x^{\prime \mu }}{x^{\lambda }}{x^{\alpha }}V^{\alpha }
  + \pdv{x^{\prime \mu }}{x^{\alpha }} \pdv[2]{x^{ \alpha }}{x^{\prime \sigma }}{x^{\prime \kappa }} \pdv{x^{\prime \kappa }}{x^{ \sigma }} V^{\sigma }
  \,,
\end{align}
\end{subequations}
%
and we would like to see that the two last terms cancel: is
%
\begin{equation}
    \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv[2]{x^{\prime \mu }}{x^{\lambda }}{x^{\alpha }}V^{\alpha }
    + \pdv{x^{\prime \mu }}{x^{\alpha }} \pdv[2]{x^{ \alpha }}{x^{\prime \sigma }}{x^{\prime \kappa }} \pdv{x^{\prime \kappa }}{x^{ \sigma }} V^{\sigma }  \overset{?}{=} 0
\,,
\end{equation}
%
for all \(V^{\mu }\)? Let us factor the vector, changing the indices:
%
\begin{equation}
    \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv[2]{x^{\prime \mu }}{x^{\lambda }}{x^{\alpha }}
    + \pdv{x^{\prime \mu }}{x^{\sigma }} \pdv[2]{x^{ \sigma }}{x^{\prime \alpha }}{x^{\prime \kappa }} \pdv{x^{\prime \kappa }}{x^{ \alpha }} \overset{?}{=} 0
\,,
\end{equation}
%
we can rewrite it as
%
\begin{equation}
    \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv{}{x^{\alpha }}  \pdv{x^{\prime \mu }}{x^{\lambda }}
    + \pdv{x^{\prime \mu }}{x^{\lambda  }}
    \pdv{}{x^{\prime \kappa }}
    \pdv{x^{ \lambda }}{x^{\prime \nu }}
    \pdv{x^{\prime \mu }}{x^{ \alpha }} \overset{?}{=} 0
\,,
\end{equation}
%
which can be recombined into:
%
\begin{equation}
    \pdv{x^{\lambda }}{x^{\prime \nu }} \pdv{}{x^{\alpha }}  \pdv{x^{\prime \mu }}{x^{\lambda }}
    + \pdv{x^{\prime \mu }}{x^{\lambda  }}
    \pdv{}{x^{\alpha  }}
    \pdv{x^{ \lambda }}{x^{\prime \nu }}
    \overset{?}{=} 0
\,,
\end{equation}
%
and becomes
%
\begin{equation}
  \pdv{}{x^{\alpha }} \qty(\pdv{x^{\lambda }}{x^{\prime \nu }} \pdv{x^{\prime \mu }}{x^{\lambda }} )
  = \pdv{}{x^{\alpha }} \delta^{\mu}_{\nu }
  = 0
\,.
\end{equation}
%

For any order tensor,  we add a Christoffel symbol for every index, such as in:
%
\begin{equation}
  \nabla_{\mu }V_{\alpha \beta }
  = \partial_\mu V_{\alpha \beta } - \Gamma^{\lambda}_{\mu \alpha }V_{\lambda \beta }- \Gamma^{\lambda }_{\mu \beta }V_{\alpha \lambda }
\,,
\end{equation}
%
or
%
\begin{equation}
    \nabla_{\mu }V_{\alpha}^{\beta }
    = \partial_\mu V_{\alpha}^{\beta }
    - \Gamma^{\lambda}_{\mu \alpha }V_{\lambda}^{\beta }
    + \Gamma^{\beta }_{\mu \lambda  }V_{\alpha}^{\lambda }
\,.
\end{equation}

\begin{bluebox}

The general formula reads:
%
\begin{align}
\nabla_{\pi } T^{\mu_1 \dots \mu_{n}}_{\nu_1 \dots \nu_{p}} =
\partial_{\pi } T^{\mu_1 \dots \mu_{n}}_{\nu_1 \dots \nu_{p}}
+ \sum_{i=1}^{n} \Gamma^{\mu_{i}}_{\pi \sigma }
T^{\mu_1 \dots \mu_{i-1} \sigma \mu_{i+1} \dots \mu_{n}}_{\nu_1 \dots \nu_{p}}
- \sum _{j=1}^{p} \Gamma^{\sigma }_{\pi \nu_j}
T^{\mu_1 \dots \mu_{n}}_{\nu_1 \dots \nu_{i-1} \sigma \nu_{i+1} \dots \nu_{p}}
\,,
\end{align}
%
which can be generalized to tensor \emph{densities} beyond regular tensors: any tensor tensity \(\mathfrak{T}\) (with any amount of indices, omitted for simplicity) of weight \(w\) (that is, which transforms almost like a tensor, with an extra factor of the determinant of the metric raised to the \(w\)th power) can be written as \(\mathfrak{T} = \sqrt{-g}^{w} T\), where \(g\) is the determinant of the metric while \(T\) is a regular tensor, since as we saw \(\sqrt{-g}\) is a density of weight +1.

Then, we can use this to calculate the covariant derivative of a tensor density: we can express \(T = \sqrt{-g}^{-w} \mathfrak{T}\), so the rule will be
%
\begin{align}
\nabla_{\mu } \mathfrak{T} = \nabla_{\mu } \qty(\sqrt{-g}^{w} \sqrt{-g}^{-w} \mathfrak{T})
= \sqrt{-g}^{w} \nabla_{\mu } \qty(\sqrt{-g}^{-w} \mathfrak{T})
\,,
\end{align}
%
where we used the fact that
%
\begin{align}
\nabla_{\mu} \sqrt{-g} = 0
\,,
\end{align}
%
which follows from the fact that the metric is covariantly constant: if we compute it in a LIF, then we get
%
\begin{align}
\nabla_{ \mu} \qty(\sqrt{-g})^{w} = \partial_{\mu } \sqrt{-g}^{w}
- w \Gamma^{\alpha }_{\alpha \mu} \sqrt{-g}
\,,
\end{align}
%
which is zero:\footnote{For a derivation of this expression, see \url{https://yarikraak.nl/tensor_densities.pdf}} there, the coordinate derivatives of the metric are zero, and therefore the Christoffel symbols are also zero.
\end{bluebox}

\subsection{Properties of the covariant derivative}

\begin{itemize}
    \item The covariant derivative of a tensor is a tensor;
    \item the covariant derivative obeys the Leibniz rule: \(\nabla_{\mu} (AB) = B \nabla_{\mu }A + A \nabla_{\mu }B\);
    \item the metric is covariantly constant: \(\nabla_{\mu }g_{\alpha \beta }=0\).
\end{itemize}

The fact that the metric is covariantly constant could actually be assumed instead of the explicit expression of the Christoffel symbols in terms of derivatives of the metric. These two are equivalent.

Notice that covariant derivatives do \emph{not} commute!

We can check that \(\partial_{\mu} (A^{\alpha }B_{\alpha }) = \nabla_{\mu } (A^{\alpha }B_{\alpha })\). It is
%
\begin{equation}
  \qty(\partial_{\mu }A_{\alpha } - \Gamma^{\lambda }_{\mu \alpha }A_{\lambda })B^{\alpha }
  + A_{\alpha }\qty(\partial_{\mu }B^{\alpha } + \Gamma_{\mu \lambda }^{ \alpha }B^{\lambda })
\,,
\end{equation}
%
expanding and relabeling indices we get the desired cancellation. Now, for parallel transport:

\subsection{Parallel transport}

Take a curve \(x^{\alpha }(\lambda )\) and a vector \(V^{\mu }\) defined at a certain point along the curve.
For infinitesimal displacement we will have \(\dd{V} = \dd{x} \cdot \nabla V\): in components \(\dd{V^{\mu }} = \dd{x^{\alpha }} \nabla_{\alpha }V^{\mu }\).

Parallel transport means that the vector does not change when it is transported: \(\nabla_t V^{\mu }=0\) where the index \(t \) indicates derivation along the curve's tangent vector \(t^{\alpha }= \dv*{x^{\alpha }}{\lambda } \): more explicitly, \(V^{\mu }\) is parallel-transported along the curve parametrized as \(x^{\alpha }(\lambda )\) if
%
\begin{align}
\dv{}{\lambda } \qty(V^{\mu }(x^{\alpha }(\lambda )))
=
\dv{x^{\alpha }}{\lambda } \nabla_{\alpha } V^{\mu }
= 0
\,.
\end{align}

\end{document}