\documentclass[]{article}

\usepackage{graphicx}

\usepackage[margin=1in]{geometry}

\setlength\parindent{0pt}

\usepackage{physics}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{listings}

\usepackage{enumitem}
\renewcommand{\theenumi}{\alph{enumi}}
\renewcommand*{\thesection}{Problem \arabic{section}}
\renewcommand*{\thesubsection}{\arabic{section}\alph{subsection})}
\renewcommand*{\thesubsubsection}{\quad \roman{subsubsection})}

%Custom Commands
\newcommand{\Rel}{\mathcal{R}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}

%opening

\title{MATH 5301 Elementary Analysis - Homework 2}

\author{Jonas Wagner}

\date{2021, September 08}

\begin{document}

\maketitle

% Problem 1
\section{}
For a function $f : A \rightarrow B$, show the follwoing for any $X \subset A, Y, Z \subset B$

\subsection{$X \subset f^{-1}(f(X))$}

\begin{align*}
	f(X) &= \{y \in B : \exists x \in X : y = f(x)\}\\
	f^{-1}(Y) &= \{x \in A : \exists y \in Y : y = f(x)\}\\
	f(f^{-1}(X)) &= \{\tilde{x} \in \tilde{X} : \exists x \in A : \tilde{x} = f(f^{-1}(x))\}\\
	&= \{\tilde{x} \in \tilde{X} : \exists y \in Y : y = f(\tilde{x}) :
		\exists x \in X : y = f(x)\} \implies\\
	&\implies \tilde{X} \subset X\\
	&\therefore X \subset f^{-1}(f(X))
\end{align*}

% Let, $$Y = f(X) \subset B$$
% The preimage of $Y$ is then $$\tilde{X} = f^{-1}(Y) \subset A$$
% Additionally, from the knowledge of image then pre-image properties functions,
% $$\tilde{X} \subset X$$
% Therefore, $$ X \subset \tilde{X} = f^{-1}(f(X))$$

\subsection{$f(f^{-1}(Y)) \subset Y$}
% Let, $$X = f^{-1}(Y) \subset A$$
% The maping of $X$ is then $$\tilde{Y} = f(X) \subset B$$
% Additionally, from knowledge pre-image and maping properties functions,
% $$\tilde{Y} \subset Y$$
% Therefore, via the transitive property, $$f(f^{-1}(Y)) \subset Y$$

\begin{align*}
	f^{-1}(Y) &= \{x \in A : \exists y \in Y : y = f(x)\}\\
	f(X) &= \{y \in B : \exists x \in X : y = f(x)\}\\
	f^{-1}(f(Y)) &= \{\tilde{x} \in \tilde{X} : \exists x \in A : \tilde{x} = f^{-1}(f(x))\}\\
	&= \{\tilde{x} \in \tilde{X} : \exists y \in Y, \exists x \in X : (y = f(\tilde{x}))
		\land (y = f(x)\} \implies\\
	&\implies \tilde{X} \subset X\\
	&\therefore X \subset f^{-1}(f(X))
\end{align*}

\newpage
\subsection{$f^{-1}(Y \cup Z) = f^{-1}(Y) \cup f^{-1}(Z)$}
\begin{align*}
	f^{-1}(Y) &= \{x \in A : \exists y \in Y : y = f(x)\}\\
	f^{-1}(Z) &= \{x \in A : \exists z \in Z : z = f(x)\}\\
	f^{-1}(Y \cup Z) &= \{x \in A : (\exists y \in Y y = f(x))
		\lor (\exists z \in Z : z = f(x))\}\\
	&= \{x \in A : (\exists y \in Y y = f(x))\}
		\cup \{x \in A :\lor (\exists z \in Z : z = f(x))\}\\
	&= f^{-1}(Y) \cup f^{-1}(Z)\\
	&\therefore f^{-1}(Y \cup Z) = f^{-1}(Y) \cup f^{-1}(Z)
\end{align*}

\subsection{$f^{-1}(Y \cap Z) = f^{-1}(Y) \cap f^{-1}(Z)$}
\begin{align*}
	f^{-1}(Y) &= \{x \in A : \exists y \in Y : y = f(x)\}\\
	f^{-1}(Z) &= \{x \in A : \exists z \in Z : z = f(x)\}\\
	f^{-1}(Y \cap Z) &= \{x \in A : (\exists y \in Y y = f(x))
		\land (\exists z \in Z : z = f(x))\}\\
	&= \{x \in A : (\exists y \in Y y = f(x))\}
		\cap \{x \in A :\lor (\exists z \in Z : z = f(x))\}\\
	&= f^{-1}(Y) \cap f^{-1}(Z)\\
	&\therefore f^{-1}(Y \cap Z) = f^{-1}(Y) \cap f^{-1}(Z)
\end{align*}

\newpage
% Problem 2
\section{}
Show that:

\subsection{
	$A \cap \bigcup\limits_{\lambda \in \Lambda}  A_\lambda
	= \bigcup\limits_{\lambda \in \Lambda} (A_\lambda \cap A)$
}

Let $\Lambda := \{1, 2, \cdots, n\}$,

\begin{align*}
	A \cap \bigcup\limits_{\lambda \in \Lambda}  A_\lambda
	&= A \cap \qty(A_1 \cup A_2 \cup \cdots \cup A_n)\\
	&= (A \cap A_1) \cup (A \cap A_2) \cup \cdots \cup (A \cap A_n)\\
	% A \cap \bigcup\limits_{\lambda \in \Lambda}  A_\lambda
	&= \bigcup\limits_{\lambda \in \Lambda} (A_\lambda \cap A)
\end{align*}

Therefore,
\begin{displaymath}
	\boxed{A \cap \bigcup\limits_{\lambda \in \Lambda}  A_\lambda
	= \bigcup\limits_{\lambda \in \Lambda} (A_\lambda \cap A)}
\end{displaymath}

\subsection{
	$\qty(\bigcap\limits_{\lambda\in\Lambda} A_{\lambda}) \cup
	 \qty(\bigcap\limits_{\lambda\in\Lambda} B_{\lambda})
	 \subseteq \bigcap\limits_{\lambda\in\Lambda} (A_\lambda \cup B_\lambda)$
}

Let $\Lambda_A := \{1, 2, \cdots, n\}$ and $\Lambda_B := \{1, 2, \cdots, m\}$,

\begin{align*}
	\bigcap\limits_{\lambda\in\Lambda} (A_\lambda \cup B_\lambda)
	&= (A_1 \cup B_1) \cap (A_1 \cup B_2) \cap
	\cdots \cap (A_1 \cup B_m) \cap (A_2 \cup B_1) \cap
	\cdots \cap (A_n \cup B_m)\\
	% &= \qty((A_1 \cap A_2) \cup (A_1 \cap B_2) \cup (B_1 \cap A_2) \cup (B_1 \cap B_2)) \cap
	% (A_1)
	&= \qty(A_1 \cup \qty(B_1 \cap B_2 \cap \cdots \cap B_m)) \cap \cdots
	\cap \qty(A_n \cup \qty(B_1 \cap B_2 \cap \cdots \cap B_m))\\
	&= (A_1 \cap A_2) \cup (A_1 \cap A_3) \cup \cdots (A_2 \cap A_3) \cdots
	\cup (A_{n-1} \cap A_n)\\
	&\qquad \cup (A_1 \cap B_1) \cup \cdots \cup (A_1 \cap B_m) \cup \cdots \cup (A_n \cap B_m)\\
	&\qquad \cup (B_1 \cap B_2) \cup \cdots	\cup (B_1 \cap B_m) \cup \cdots \cup (B_{m-1} \cap B_{m})\\
	&= \qty(\bigcap\limits_{\lambda\in\Lambda} A_{\lambda}) \cup
	\qty(\bigcap\limits_{\lambda\in\Lambda} B_{\lambda})
	\cup (A_1 \cap B_1) \cup \cdots \cup (A_1 \cap B_m) \cup \cdots \cup (A_n \cap B_m)\\
\end{align*}
Therefore,
\begin{align*}
	\boxed{
	\qty(\bigcap\limits_{\lambda\in\Lambda} A_{\lambda}) \cup
	\qty(\bigcap\limits_{\lambda\in\Lambda} B_{\lambda})
	\subseteq \qty(\bigcap\limits_{\lambda\in\Lambda} A_{\lambda}) \cup
	\qty(\bigcap\limits_{\lambda\in\Lambda} B_{\lambda})
	\cup (A_1 \cap B_1) \cup \cdots \cup (A_1 \cap B_m) \cup \cdots \cup (A_n \cap B_m)
	}
\end{align*}

\newpage
% Problem 3
\section{}
\textbf{Problem:} Which of these are equivalence relations?\\

% \textbf{Note:}
% Equivalence relations must satisfy the following:
% \subsubsection{Reflective:}
% $$x \Rel x$$
% \subsubsection{Symetric:}
% $$x \Rel y \implies y \Rel x$$
% \subsubsection{Transitive:}
% $$x \Rel y \land y \Rel z \implies x \Rel z$$

\textbf{Solution:}
a, c, \& d\\
(The following explain why)

\subsection{}
for $a, b \in \R$,
let $a \Rel b$
if $a - b \in \Q$

\subsubsection{Reflective:}
\begin{align*}
	x \Rel x
		&= x - x = 0 \in \Q
\end{align*}

\subsubsection{Symetric:}
\begin{align*}
	x \Rel y
		&\implies y \Rel x\\
	x \Rel y = x - y \in \Q
		&\implies y - x \in \Q
	\intertext{Since $x-y = -(y-x)$, $(x-y)$ and $(y-x)$ will both be either rational
	or not rational, this is true.}
\end{align*}

\subsubsection{Transitive:}
\begin{align*}
	x \Rel y \land y \Rel z
		&\implies x \Rel z\\
		\qty(x - y \in \Q) \land \qty(y - z \in \Q)
		&\implies \qty(x - z \in \Q)\\
	\qty(\frac{x_a}{x_b} - \frac{y_a}{y_b} \in \Q) \land \qty(\frac{y_a}{y_b} - \frac{z_a}{z_b} \in \Q)
		&\implies \qty(\frac{x_a}{x_b} - \frac{z_a}{z_b} \in \Q)
\end{align*}
This also means that:
\begin{align*}
	(x_a y_b - x_b y_a \in \N) \land (x_b y_b \neq 0 \in N)
		&\land (y_a z_b - y_b z_a \in \N) \land (y_b z_b \neq 0 \in N)\\
		&\implies (x_a z_b - x_b z_a \in \N) \land (x_b z_b \neq 0 \in N)
\end{align*}
Since this statments indicates that $x_b, y_b, z_b \neq 0$
and that $x_a y_b - x_b y_a, y_a z_b - y_b z_b \in \N$,
the following will always be true as well: $x_a z_b - x_b z_a$.
Therefore, the relation is transitive.

\subsection{}
for $a, b \in \R$,
let $a \Rel b$
if $a - b \notin \Q$

\subsubsection{Reflective:}
The relationship is NOT reflective:
\begin{align*}
	a \Rel b &= a - b \notin \Q\\
	x \Rel x
		&= x - x = 0 \in \Q
\end{align*}

\newpage
\subsection{}
for $a, b \in \R$,
let $a \Rel b$
if $a - b$ is a square root of a rational number.\\
i.e.
$$a \Rel b = (a-b)^2 \in \Q$$

\subsubsection{Reflective:}
\begin{align*}
	a \Rel b &= (a-b)^2 \in \Q\\
	x \Rel x &= (x-x)^2 = 0^2 = 0 \in \Q
\end{align*}

\subsubsection{Symetric:}
\begin{align*}
	x \Rel y
		&\implies y \Rel x\\
	(x - y)^2 \in \Q
		&\implies (y-x)^2 \in \Q\\
	(x-y)^2 = (y-x)^2
		&\therefore \ x \Rel y \implies y \Rel x
\end{align*}

\subsubsection{Transative:}
\begin{align*}
	x \Rel y \land y \Rel z
		&\implies x \Rel z\\
	\qty((x - y)^2 \in \Q) \land \qty((y - z)^2 \in \Q)
		&\implies \qty((x-z)^2 \in \Q)\\
	\qty(x^2 - 2xy + y^2 \in \Q) \land \qty(y^2 - 2yz + z^2 \in \Q)
		&\implies \qty(x^2 - 2xz + z^2\in \Q)\\
	(x^2 \in \Q) \land (y^2 \in \Q) \land (z^2 \in \Q) \land (-2xy \in \Q) \land (-2yz \in \Q)
		&\implies (x^2 \in \Q) \land (z^2 \in \Q) \land (-2xz \in \Q)\\
	(xy \in \Q) \land (yz \in \Q)
		&\implies (xz \in \Q)
\end{align*}
Which is clearly transitive, so $a \Rel b = (a-b)^2 \in \Q$ is transitive.

\subsection{}
Let $X = \Z \cross \N$,
$x = (x_1, x_2)$ and $y = (y_1, y_2)$
are in $\Rel$ if $x_1 y_2 = x_2 y_1$.

i.e.
$$a_1, b_1 \in \Z, a_2, b_2 \in \N,$$
$$a_1 b_2 = a_2 b_1 \implies (a_1, a_2) \Rel (b_1, b_2)$$

\subsubsection{Reflective:}
\begin{align*}
	a_1 b_2 = a_2 b_1 &\implies (a_1, a_2) \Rel (b_1, b_2)\\
	x_1 x_2 = x_2 x_1 &\implies (x_1, x_2) \Rel (x_1, x_2)
\end{align*}

\subsubsection{Symetric:}
\begin{align*}
	x \Rel y
		&\implies y \Rel x\\
	(x_1 y_2 = x_2 y_1 \implies (x_1, x_2) \Rel (y_1, y_2))
		&\implies (y_1 x_2 = y_2 x_1 \implies (y_1, y_2) \Rel (x_1, x_2))
\end{align*}

\subsubsection{Transative:}
\begin{align*}
	x \Rel y \land y \Rel z
		&\implies x \Rel z\\
	(x_1 y_2 = x_2 y_1 \implies (x_1, x_2) \Rel (y_1, y_2))
	\land (y_1 z_2 = y_2 z_1 \implies (y_1, y_2) \Rel (z_1, z_2))
	&\implies (x_1 z_2 = x_2 z_1 \implies (x_1, x_2) \Rel (z_1, z_2))\\
	(x_1 y_2 = x_2 y_1) \land (y_1 z_2 = y_2 z_1)
	&\implies (x_1 z_2 = x_2 z_1)\\
\end{align*}

Which is clearly transitive, so $(a_1,a_2) \Rel (b_1,b_2)$ is transitive, and therefore
an equivalence relation.

\newpage
% Problem 4
\section{}
For the relation $(x,y) \succeq (a,b)$ if $(x \geq a)$ and $(y \geq b)$ on the set
of ordered pairs of $\{1,2,3\} \cross \{1,2,3\}$.
i.e. $x,a \in \{1,2,3\}$ and $y,b \in \{1,2,3\}$,
$$(x \geq a) \land (y \geq b) \implies (x,y) \succeq (a,b)$$

\subsection{Show that the above relation is an order relation.}
An ordered relation requires (i) reflexitivity, (ii) anti-symmetry, and (iii) transivity.

\subsubsection{Reflective:}
\begin{align*}
	(x \geq a) \land (y \geq b)
		&\implies (x,y) \succeq (a,b)\\
	(x \geq x) \land (y \geq y)
		&\implies (x,y) \succeq (x,y)
\end{align*}

\subsubsection{Anti-Symmetry:}
\begin{align*}
	((x,y) \succeq (a,b)) \land ((a,b) \succeq (x,y))
		&\implies (x,y) = (a,b)\\
	((x \geq a) \land (y \geq b)) \land ((a \geq x) \land (b \geq y))
		&\implies (x,y) = (a,b)\\
	((x \geq a) \land (a \geq x)) \land ((b \geq y) \land (y \geq b))
		&\implies (x,y) = (a,b)
\end{align*}

\subsubsection{Transivity}
\begin{align*}
	(x,y) \Rel (a,b) \land (a,b) \Rel (\alpha,\beta)
		&\implies (x,y) \Rel (\alpha,\beta)\\
	((x \geq a) \land (y \geq b)) \land ((a \geq \alpha) \land (b \geq \beta))
		&\implies (x \geq \alpha) \land (y \geq \beta)\\
	((x \geq a) \land (a \geq \alpha)) \land ((y \geq b) \land (b \geq \beta))
		&\implies (x \geq \alpha) \land (y \geq \beta)\\
	(x \geq a \geq \alpha) \land (y \geq b \geq \beta)
		&\implies (x \geq \alpha) \land (y \geq \beta)\\
\end{align*}

Therefore, the relation $(x,y) \succeq (a,b)$ is an order relation.

\subsection{Can you make it the total order?}

\subsubsection{Totality:}
\begin{align*}
	\forall (x,y),(a,b) \in \{1,2,3\} \cross \{1,2,3\}
		&\implies ((x,y) \succeq (a,b)) \lor ((a,b) \succeq (x,y))\\
	\forall x,a \in \{1,2,3\}, \forall y,b \in \{1,2,3\}
		&\implies ((x \geq a) \land (y \geq b)) \lor ((a \geq x) \land (y \geq b))
\end{align*}

% However, it is not a universal total order. A counter example is:
% \begin{align*}
% 	(x,y) &= (1,3)\\
% 	(a,b) &= (3,1)\\
% 	(x,y) \succeq (a,b) &= ((x \geq a) \land (y \geq b)) \lor ((a \geq x) \land (b \geq y))\\
% 	&= ((1 \geq 3) \land (3 \geq 1)) \lor ((3 \geq 1) \land (1 \geq 3))
% \end{align*}
% which is false, so a it is not a complete total order.

\subsection{How many different total orderings can be constructed?}
Multiple total orderings of relation on subsets can satisfy this.
A network constructed from the following relations would demonstrate the multiple paths.
\begin{align*}
	(3,3) &\succeq (x,y) \forall (x,y) \in \{1,2,3\}\cross\{1,2,3\}\\
	(3,2) &\succeq (x,y) \forall (x,y) \in \{1,2,3\}\cross\{1,2\}\\
	(3,1) &\succeq (x,y) \forall (x,y) \in \{1,2,3\}\cross\{1\}\\
	(2,3) &\succeq (x,y) \forall (x,y) \in \{1,2\}\cross\{1,2,3\}\\
	(2,2) &\succeq (x,y) \forall (x,y) \in \{1,2\}\cross\{1,2\}\\
	(2,1) &\succeq (x,y) \forall (x,y) \in \{1,2\}\cross\{1\}\\
	(1,3) &\succeq (x,y) \forall (x,y) \in \{(1,1),(1,2),(1,3)\}\\
	(1,2) &\succeq (x,y) \forall (x,y) \in \{(1,1),(1,2)\}\\
	(1,1) &\succeq (1,1)
\end{align*}

If you only count the total orders of length 2
(the number of actual network edges with self-edges) this would be 36.
If drawns as a tree, these 36 pairs would be created as directed edges and the
total number of unique tree paths can also be counted using various algorithms.

\newpage
% Problem 5
\section{}
Provide and example of $f : \Z \to \N$ such that

\subsection{$f$ is surjective, but not injective}

\begin{displaymath}
	y = f(x) =
	\begin{cases}
		x & x \geq 0\\
		-x & x < 0
	\end{cases}
\end{displaymath}

\subsection{$f$ is injective, but not surjective}
\begin{displaymath}
	y = f(x) =
	\begin{cases}
		x^2 & x \geq 0\\
		x^2 + 1 & x < 0
	\end{cases}
\end{displaymath}

\subsection{$f$ is surjective and injective (bijective)}

\begin{displaymath}
	y = f(x) =
	\begin{cases}
		2 x & x \geq 0\\
		-2 x - 1 & x < 0
	\end{cases}
\end{displaymath}

\subsection{$f$ is niether surjective nor injective}

\begin{displaymath}
	y = f(x) = 0
\end{displaymath}

\newpage
% Problem 6
\section{}
\textbf{Problem:}
Is the following statement correct?\\

\textbf{Theorem 1.}
\textit{If the relation $\R$ on $A$ is symetric and transistive, then it is reflexive.}\\
\textit{Proof:}
For any $a \in A$ let $b \in A$ is such that $a \Rel b$. Then by symmetry $b \Rel a$.
Then by symmetry $a \Rel a$.\\

\textbf{Solution:}
No. Specifically, the final statement of the proof states to use symmetry to conclude that
it is reflexive, but it actually requires the transivity property to make that conclusion.\\

The following is a proposed corrected statement:\\

\textbf{Theorem 1.}
\textit{If the relation $\Rel$ is symetric and transistive on $A$, then $Rel$ is also reflexive on $A$.}\\
\textit{Proof:}
Let $a \in A$ and $b \in A$ be selected so that $a \Rel b$
Since $\Rel$ is symetric: $$a \Rel b \implies b \Rel a$$
Since $\Rel$ is transitive: $$(a \Rel b) \land (b \Rel a) \implies a \Rel a$$
Therefore, $\Rel$ is also reflexive.

\end{document}


\documentclass{article}
\usepackage[utf8]{inputenc}

\title{MAT257 Notes}
\author{Jad Elkhaleq Ghalayini}
\date{February 8 2019}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{cancel}

\usepackage[margin=1in]{geometry}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{definition}{Definition}
\newtheorem*{corollary}{Corollary}
\newtheorem{exercise}{Exercise}
\newtheorem{claim}{Claim}

\DeclareMathOperator{\Int}{Int}
\DeclareMathOperator{\grad}{grad}
\DeclareMathOperator{\Div}{div}
\DeclareMathOperator{\curl}{curl}
\DeclareMathOperator{\Ker}{Ker}
\DeclareMathOperator{\Ima}{Im}
\DeclareMathOperator{\Vol}{vol}
\DeclareMathOperator{\D}{D}

\newcommand{\reals}[0]{\mathbb{R}}
\newcommand{\nats}[0]{\mathbb{N}}
\newcommand{\ints}[0]{\mathbb{Z}}
\newcommand{\rationals}[0]{\mathbb{Q}}
\newcommand{\brac}[1]{\left(#1\right)}
\newcommand{\sbrac}[1]{\left[#1\right]}
\newcommand{\mc}[1]{\mathcal{#1}}
\newcommand{\eval}[3]{\left.#3\right|_{#1}^{#2}}
\newcommand{\ip}[2]{\left\langle#1,#2\right\rangle}
\newcommand{\prt}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\mb}[1]{\mathbf{#1}}
\newcommand{\hlfspc}[0]{\mathbb{H}}
\newcommand{\loint}[0]{\operatorname{L}\int}
\newcommand{\hiint}[0]{\operatorname{U}\int}
\newcommand{\indic}[1]{\chi_{#1}}

\begin{document}

\maketitle

\section{Vector Fields and Differential Forms}
Recall the definitions of the \underline{tangent space to \(\reals^n\) at \(a\)}, \(\text{T}\reals^n_a\) or \(\reals^n_a\). We write the standard bases of \(\reals^n_a\) as
\begin{equation}
  e_{1,a},...,e_{n,a}
\end{equation}
and define the stadard inner product
\begin{equation}
  \ip{v_a}{w_a}_a = \ip{v}{w}
\end{equation}
Using the definitions from last time, we obtain a \underline{standard orientation} of \(\reals^n_a\)
\begin{equation}
  [e_{1,a},...,e_{n,a}]
\end{equation}
Recall the following definition:
\begin{definition}
  The \underline{tangent vector} to a \(\mc{C}^1\) curve \(\gamma: [0, 1] \to \reals^n\) at \(t \in [0, 1]\) is given by
  \begin{equation}
    \gamma'(t)_{\gamma(t)} = (\gamma_1'(t),...,\gamma_n'(t))_{\gamma(t)} = \sum_{i = 1}^n\gamma_i'(t)e_{i, \gamma(t)} \in \reals^n_{\gamma(t)}
  \end{equation}
  We write
  \begin{equation}
    \gamma'(t)_{\gamma(t)} = \gamma_{*t}(e_{1, t})
  \end{equation}
  where \(e_{1, t} \in \reals^1_t\), thinking of the derivative of \(\gamma\) \(\D\gamma\) inducing a mapping
  \begin{equation}
    \gamma_{*t}: \reals_t^1 \to \reals^n_{\gamma(t)}, \gamma_{*t}(ae_{1, t}) = \D\gamma(a + t)(e_1)_{\gamma(t)}
  \end{equation}
\end{definition}
Consider now a function \(\varphi : \reals^n \to \reals^p\), and consider the curve \((\varphi \circ \gamma): [0, 1] \to \reals^p\). What's the tangent vector to \(\varphi \circ \gamma\) at \(t\)? Well, by definition, it's
\begin{equation}
  (\varphi \circ \gamma)_{*t}(e_{1, t}) = \D(\varphi \circ \gamma)(t)(e_1)_{\varphi(\gamma(t))} \label{starphi}
\end{equation}
By the Chain Rule, \ref{starphi} simplifies to
\begin{equation}
  \D\varphi(\gamma(t)) \circ \D\gamma(t) (e_1)_{\varphi(\gamma(t))} = \varphi_{*\gamma(t)}(\D\gamma(t)(e_1)_{\gamma(t)}) = \varphi_{*\gamma(t)} \circ \gamma_{*t}(e_{1, t})
\end{equation}
Writing this in words, the tangent vector to \(\varphi \circ \gamma\) at \(t\) is equal to the linear mapping between tangent spaces \(\varphi_{*\gamma(t)}: \reals^n_{\gamma(t)} \to \reals^p_{\varphi(\gamma(t))}\) applied to the tangent vector to \(\gamma\) at \(t\).

We're now going to consider functions which, for every point in \(\reals^n\), give us a vector in the tangent space at that point. And that's what's called a \textit{vector field}. Formally,
\begin{definition}
  A \underline{vector field} \(F\) on \(\reals^n\) is a function such that for every point \(a\), \(F(a) \in \reals^n_a\), i.e.
  \begin{equation}
    F(a) = (F_1(a),...,F_n(a))_a
  \end{equation}
\end{definition}
This trivially gives the following definition
\begin{definition}
  A vector field \(F\) is \(\mc{C}^r\) if each component \(F_i\) is \(\mc{C}^r\).
\end{definition}
Now, why is it that we really want to think of these things as having values in different tangent spaces? Let's look at some examples:
\begin{enumerate}

  \item In the plane, let's look at \(F(x, y) = (x, y)_{(x, y)}\), i.e. the vector \((x, y)\) ``pointing out of'' \(x, y\). In terms of the basis,
  \begin{equation}
    xe_{1, (x, y)} + ye_{2, (x, y)}
  \end{equation}
  We can imagine plotting this with every point having, coming out of it, the line between it and the origin, with a ``source'' at the origin. Imagining these to be the velocity vectors of a particle at each point, the points accelerate outwards from the origin with increasing rapidity.

  \item Consider now \(F(x, y) = (x, -y)\). If we trace a particle following the velocity vectors, this gives us a ``saddle'' shape.

  \item Consider the following important example
  \begin{equation}
    F(x) = \grad f(x) = \left(\prt{f}{x_1}(x),...,\prt{f}{x_n}\right)_x
  \end{equation}
  \(F\) is \(\mc{C}^r\) if \(f\) is \(\mc{C}^{r + 1}\). Finding if such an \(f\) exists is an interesting problem in differential equations. We can think of it as finding a potential function whose gradient at each point is equal to the vector field.

\end{enumerate}
We can apply operations on vectors pointwise to vector fields:
\begin{equation}
  (F + G)(x) = F(x) + G(x)
\end{equation}
\begin{equation}
  \ip{F}{G}(x) = \ip{F(x)}{G(x)}
\end{equation}
\begin{equation}
  (f \cdot F)(x) = f(x)F(x)
\end{equation}
In \(\reals^n\) we can take the cross product
\begin{equation}
  (F_1 \times ... \times F_{n - 1})(x) = F_1(x) \times ... \times F_{n - 1}(x)
\end{equation}
There are several very important classical operations we're going to be interested in, chief of them being \(\grad\), \(\Div\) and \(\curl\).
\begin{definition}
 We define the \underline{divergence of \(F\)}, \(\Div F\), as
 \begin{equation}
  \Div F = \sum_{i = 1}^n\D_iF_i = \sum_{i = 1}^n\prt{F_i}{x_i}
 \end{equation}
 This is often considered to be the ``inner product'' of \(F\) with a certain \underline{operator},
 \begin{equation}
  \ip{\nabla}{F}
 \end{equation}
 where
 \begin{equation}
  \nabla = \sum\prt{}{x_i}e_i
 \end{equation}
\end{definition}
\begin{definition}
  We define the \underline{curl of \(F\)} (in \(\reals^3\)), \(\curl F\), as
  \begin{equation}
    \curl F = \nabla \times F = (\D_2F_3 - \D_3F_2)e_1 + (\D_3F_1 - \D_1F_2)e_2 + (\D_1F_2 - \D_2F_1)e_3
  \end{equation}
\end{definition}
We're going to prove a very general version of Stokes' theorem, but we want to see what holds in these special cases. Maybe that's enough for today

\end{document}


\chapter{Exercises}

Execute the whole generalized Hamiltonian procedure with the following Lagrangians and answer the beneath questions.

\begin{exercise}
\begin{align*}
L = \frac{1}{2} (\dot{x} + x \dot{y})^2
\end{align*}
Primary constraints as generators of gauge transformations for systems with a finite number of degrees of freedom.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = (\dot{x} + x \dot{y}) \\
p_y &= \frac{\partial L}{\partial \dot{y}} = x (\dot{x} + x \dot{y}).
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = x p_x - p_y = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H = p_x \dot{x} + p_y \dot{y} - \frac{1}{2} (\dot{x} + x \dot{y})^2 = p_x (\dot{x} + x \dot{y}) - \frac{1}{2} (\dot{x} + x \dot{y})^2 = \frac{1}{2} p_x^2.
\end{align*}
The total Hamiltonian at the moment is therefore
\begin{align*}
H_T = \frac{1}{2} p_x^2 + u_1 (x p_x - p_y).
\end{align*}
Is the constraint conserved?
\begin{align*}
0 \overset{?}{=} \dot{\phi}_1 = \left \{ \phi_1,H \right \} + u_1 \left \{ \phi_1,\phi_1 \right \} = \left \{ x p_x - p_y,\frac{1}{2} p_x^2 \right \} = p_x^2.
\end{align*}
So, we get a secondary constraint
\begin{align*}
\phi_2 = p_x = 0.
\end{align*}
Checking the conservation of this constraint, we get
\begin{align*}
\dot{\phi}_2 = \left \{ \phi_2,H_T \right \} = \left \{ p_x,\frac{1}{2} p_x^2 \right \} + u_1 \left \{ p_x,x p_x - p_y \right \} = - u_1 p_x \approx 0.
\end{align*}
Now, everything is consistent and we can classify the constraints. Since
\begin{align*}
\left \{ \phi_1,\phi_2 \right \} = \left \{ x p_x - p_y,p_x \right \} = p_x \approx 0,
\end{align*}
both constraints are first-class. \\
Which transformations do they generate?
\begin{align*}
\Delta x &= \varepsilon \left \{ x,\phi_1 \right \} = \varepsilon \left \{ x,x p_x - p_y \right \} = \varepsilon x \\
\Delta y &= \varepsilon \left \{ y,\phi_1 \right \} = - \varepsilon \\
\Delta p_x &= \varepsilon \left \{ p_x,\phi_1 \right \} = - \varepsilon p_x \\
\Delta p_y &= \varepsilon \left \{ p_y,\phi_1 \right \} = 0
\end{align*}
and
\begin{align*}
\Delta x &= \varepsilon \left \{ x,\phi_2 \right \} = \varepsilon \left \{ x,p_x \right \} = \varepsilon \\
\Delta y &= \varepsilon \left \{ y,\phi_2 \right \} = 0 \\
\Delta p_x &= \varepsilon \left \{ p_x,\phi_2 \right \} = 0 \\
\Delta p_y &= \varepsilon \left \{ p_y,\phi_2 \right \} = 0.
\end{align*}

The role of primary constraints as generators for gauge transformations can be found in section~\vref{sec:gauge_transformations}.
\end{solution}

\begin{exercise}
\begin{align*}
L = \frac{1}{2} \dot{y}^2 + yx\dot{x}
\end{align*}
Connection between infintely small and finite gauge transformations.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = yx \\
p_y &= \frac{\partial L}{\partial \dot{y}} = \dot{y}.
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = p_x - yx = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H = p_x \dot{x} + p_y \dot{y} - \frac{1}{2} \dot{y}^2 - yx\dot{x} = \frac{1}{2} p_y^2.
\end{align*}
Therefore
\begin{align*}
H_T = \frac{1}{2} p_y^2 + u_1 (p_x - yx).
\end{align*}
Is the constraint conserved?
\begin{align*}
0 \overset{?}{=} \dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ p_x - yx,\frac{1}{2} p_y^2 \right \} = - x p_y.
\end{align*}
We get a secondary constraint
\begin{align*}
\phi_2 = x p_y = 0.
\end{align*}
Checking the conservation of this constraint, we get
\begin{align*}
\dot{\phi}_2 = \left \{ \phi_2,H_T \right \} = \left \{ x p_y,\frac{1}{2} p_y^2 \right \} + u_1 \left \{ x p_y,p_x - yx \right \} = u_1 (p_y + x^2),
\end{align*}
which is a condition on $u_1$, saying that $u_1 = 0$. \\
So everything is consistent now and we can classify the constraints. Since
\begin{align*}
\left \{ \phi_1,\phi_2 \right \} \neq 0
\end{align*}
both constraints are second-class. It turns out that they are true second-class constraints and, in agreement with our theorem, the number is even. \\
Since $u_1$ is determined, we have no degrees of freedom and the constraint does not generate gauge transformations. \\

The connection between infintely small and finite gauge transformations can be found in section~\vref{sec:finite_gauge_transformations}.
\end{solution}

\begin{exercise}
\begin{align*}
L = \frac{1}{2} (\dot{x}y + \dot{y}x)^2
\end{align*}
Constraints as generators of gauge transformations in electrodynamics.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = y (\dot{x}y + \dot{y}x) \\
p_y &= \frac{\partial L}{\partial \dot{y}} = x (\dot{x}y + \dot{y}x).
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = x p_x - y p_y = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H = p_x \dot{x} + p_y \dot{y} - \frac{1}{2} (\dot{x}y + \dot{y}x)^2 = p_x \left(\dot{x} + \frac{x \dot{y}}{y}\right) - \frac{1}{2} \left(\frac{p_x}{y}\right)^2 = \frac{p_x^2}{2 y^2}.
\end{align*}
The total Hamiltonian at the moment is therefore
\begin{align*}
H_T = \frac{p_x^2}{2 y^2} + u_1 (x p_x - y p_y).
\end{align*}
Is the constraint conserved?
\begin{align*}
\dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ x p_x - y p_y,\frac{p_x^2}{2 y^2} \right \} = p_x \frac{p_x}{y^2} + y p_x^2 \frac{(-2)}{2 y^3} = 0.
\end{align*}
So it is conserved identically at any time and we get no secondary constraints. The constraint is first-class and generates the following gauge transformations:
\begin{align*}
\Delta x &= \varepsilon \left \{ x,\phi_1 \right \} = \varepsilon \left \{ x,x p_x - y p_y \right \} = \varepsilon x \\
\Delta y &= \varepsilon \left \{ y,\phi_1 \right \} = - \varepsilon y \\
\Delta p_x &= \varepsilon \left \{ p_x,\phi_1 \right \} = - \varepsilon p_x \\
\Delta p_y &= \varepsilon \left \{ p_y,\phi_1 \right \} = \varepsilon p_y.
\end{align*}

Constraints as generators of gauge transformations in electrodynamics can be found in chapter~\vref{sec:electrodynamics_transformations}.
\end{solution}

\begin{exercise}
\begin{align*}
L = \frac{1}{2} (\dot{x}^2 - x^2) + \frac{1}{2} (\dot{y}^2 - y^2) + \dot{x}\dot{y}
\end{align*}
Show that the primary Poisson bracket is also a generator of gauge transformations.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = \dot{x} + \dot{y} \\
p_y &= \frac{\partial L}{\partial \dot{y}} = \dot{y} + \dot{x}.
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = p_x - p_y = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H &= p_x \dot{x} + p_y \dot{y} - \frac{1}{2} (\dot{x}^2 - x^2) - \frac{1}{2} (\dot{y}^2 - y^2) - \dot{x}\dot{y} \\
&= p_x (\dot{x} + \dot{y}) - \frac{1}{2} (\dot{x} + \dot{y})^2 + \frac{1}{2} (x^2 + y^2) \\
&= \frac{1}{2} p_x^2 + \frac{1}{2} (x^2 + y^2).
\end{align*}
The total Hamiltonian at the moment is therefore
\begin{align*}
H_T = \frac{1}{2} p_x^2 + \frac{1}{2} (x^2 + y^2) + u_1 (p_x - p_y).
\end{align*}
Is the constraint conserved?
\begin{align*}
0 \overset{?}{=} \dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ p_x - p_y,\frac{1}{2} p_x^2 + \frac{1}{2} (x^2 + y^2) \right \} = -x + y.
\end{align*}
We get a secondary constraint
\begin{align*}
\phi_2 = y - x = 0.
\end{align*}
Checking the conservation of this constraint, we get
\begin{align*}
0 \overset{!}{=} \dot{\phi}_2 = \left \{ \phi_2,H_T \right \} = \left \{ y - x,\frac{1}{2} p_x^2 + \frac{1}{2} (x^2 + y^2) \right \} + u_1  \left \{ y - x,p_x - p_y \right \} = - p_x - 2 u_1,
\end{align*}
which leaves us with the condition : $2 u_1 = - p_x$. \\
Since the function $u_1$ is determined, we have no degrees of freedom and no gauge transformations. We can see this also because we have no first-class constraints:
\begin{align*}
\left \{ \phi_1,\phi_2 \right \} = \left \{ p_x - p_y,y - x \right \} = 2 \neq 0.
\end{align*}

To show that the primary Poisson bracket is also a generator of gauge transformations see section~\vref{sec:gauge_transformations}.
\end{solution}

\begin{exercise}
\begin{align*}
L = \frac{1}{2} (\dot{x} + \dot{y})^2 + \frac{1}{2} (x + y)^2
\end{align*}
Transition to Hamiltonian systems with an infinite number of degrees of freedom. \\
Properties of the functional derivative.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = (\dot{x} + \dot{y}) \\
p_y &= \frac{\partial L}{\partial \dot{y}} = (\dot{x} + \dot{y}) .
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = p_x - p_y = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H &= p_x \dot{x} + p_y \dot{y} - \frac{1}{2} (\dot{x} + \dot{y})^2 - \frac{1}{2} (x + y)^2 \\
&= p_x (\dot{x} + \dot{y}) - \frac{1}{2} (\dot{x} + \dot{y})^2 - \frac{1}{2} (x + y)^2 \\
&= \frac{1}{2} p_x^2 - \frac{1}{2} (x + y)^2.
\end{align*}
The total Hamiltonian at the moment is therefore
\begin{align*}
H_T = \frac{1}{2} p_x^2 - \frac{1}{2} (x + y)^2 + u_1 (p_x - p_y).
\end{align*}
Is the constraint conserved?
\begin{align*}
0 \overset{?}{=} \dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ p_x - p_y,\frac{1}{2} p_x^2 - \frac{1}{2} (x + y)^2 \right \} = 0.
\end{align*}
Yes it is and we get no secondary constraints. \\
The function $u_1$ is still arbitrary and $\phi_1$ generates the following gauge transformations:
\begin{align*}
\Delta x &= \varepsilon \left \{ x,\phi_1 \right \} = \varepsilon \left \{ x,p_x - p_y \right \} = \varepsilon \\
\Delta y &= \varepsilon \left \{ y,\phi_1 \right \} = - \varepsilon \\
\Delta p_x &= \varepsilon \left \{ p_x,\phi_1 \right \} = 0 \\
\Delta p_y &= \varepsilon \left \{ p_y,\phi_1 \right \} = 0.
\end{align*}

The transition to Hamiltonian systems with an infinite number of degrees of freedom and the properties of the functional derivative can be found in chapter~\ref{sec:field_theory}.
\end{solution}

\begin{exercise}
\begin{align*}
L = x \dot{y} - y \dot{x} - x - y
\end{align*}
Mechanical analogy to the scalar Klein-Gordon-Fock field.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = -y \\
p_y &= \frac{\partial L}{\partial \dot{y}} = x.
\end{align*}
We get two constraints:
\begin{align*}
\phi_1 &= p_x + y = 0 \\
\phi_2 &= p_y - x = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H &= p_x \dot{x} + p_y \dot{y} - x \dot{y} + y \dot{x} + x + y \\
&= x + y.
\end{align*}
The total Hamiltonian at the moment is therefore
\begin{align*}
H_T = x + y + u_1 (p_x + y) + u_2 (p_y - x).
\end{align*}
Are the constraints conserved?
\begin{align*}
0 &\overset{?}{=} \dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ p_x + y,x + y \right \} + u_2 \left \{ p_x + y,p_y - x \right \} = -1 + 2 u_2. \\
0 &\overset{?}{=} \dot{\phi}_2 = \left \{ \phi_2,H_T \right \} = \left \{ p_y - x,x + y \right \} + u_1 \left \{ p_y - x,p_x + y \right \} = -1 - 2 u_1.
\end{align*}
We get no secondary constraints. These are just equations that determine $u_1$ and $u_2$, which is clear since our constraints are second-class:
\begin{align*}
\left \{ \phi_1,\phi_2 \right \} \neq 0.
\end{align*}
Since the constraints are second-class and we have no degrees of freedom left, they do not generate gauge transformations. \\

The mechanical analogy to the scalar Klein-Gordon-Fock field is the standard harmonic oscillator.
\end{solution}

\begin{exercise}
\begin{align*}
L = \frac{1}{2} (\dot{x} - y)^2
\end{align*}
Dirac bracket (generalized Poisson bracket).
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = (\dot{x} - y) \\
p_y &= \frac{\partial L}{\partial \dot{y}} = 0.
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = p_y = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H &= p_x \dot{x} + p_y \dot{y} - \frac{1}{2} (\dot{x} - y)^2 = p_x (p_x + y) - \frac{1}{2} p_x^2 = \frac{1}{2} p_x^2 + p_x y.
\end{align*}
The total Hamiltonian at the moment is therefore
\begin{align*}
H_T = \frac{1}{2} p_x^2 + p_x y + u_1 p_y.
\end{align*}
Is the constraint conserved?
\begin{align*}
0 \overset{?}{=} \dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ p_y,\frac{1}{2} p_x^2 + p_x y \right \} = - p_x.
\end{align*}
We get a secondary constraint
\begin{align*}
\phi_2 = p_x = 0.
\end{align*}
Checking the consistency condition, we get
\begin{align*}
\dot{\phi}_2 = \left \{ \phi_2,H_T \right \} = \left \{ p_x,\frac{1}{2} p_x^2 + p_x y \right \} + u_1 \left \{ p_x,p_y \right \} = 0.
\end{align*}
Since
\begin{align*}
\left \{ \phi_1,\phi_2 \right \} = 0
\end{align*}
both constraints are first-class and generate the following gauge transformations:
\begin{align*}
\Delta x &= \varepsilon \left \{ x,\phi_1 \right \} = \varepsilon \left \{ x,p_y \right \} = 0 \\
\Delta y &= \varepsilon \left \{ y,\phi_1 \right \} = \varepsilon \\
\Delta p_x &= \varepsilon \left \{ p_x,\phi_1 \right \} = 0 \\
\Delta p_y &= \varepsilon \left \{ p_y,\phi_1 \right \} = 0
\end{align*}
and
\begin{align*}
\Delta x &= \varepsilon \left \{ x,\phi_2 \right \} = \varepsilon \left \{ x,p_x \right \} = \varepsilon \\
\Delta y &= \varepsilon \left \{ y,\phi_2 \right \} = 0 \\
\Delta p_x &= \varepsilon \left \{ p_x,\phi_2 \right \} = 0 \\
\Delta p_y &= \varepsilon \left \{ p_y,\phi_2 \right \} = 0.
\end{align*}

The Dirac bracket and its properties can be found in section~\vref{sec:dirac_bracket}.
\end{solution}

\begin{exercise}
\begin{align*}
L = \frac{1}{2} (\dot{x} + \dot{y})^2 - \frac{x^2}{2}
\end{align*}
Show that there only exists an even number of secondary constraints.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = (\dot{x} + \dot{y}) \\
p_y &= \frac{\partial L}{\partial \dot{y}} = (\dot{x} + \dot{y}).
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = p_x - p_y = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H &= p_x \dot{x} + p_y \dot{y} - \frac{1}{2} (\dot{x} + \dot{y})^2 + \frac{x^2}{2} = \frac{1}{2} p_x^2 + \frac{x^2}{2}.
\end{align*}
The total Hamiltonian at the moment is therefore
\begin{align*}
H_T = \frac{1}{2} p_x^2 + \frac{x^2}{2} + u_1 (p_x - p_y).
\end{align*}
Is the constraint conserved?
\begin{align*}
0 \overset{?}{=} \dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ p_x - p_y,\frac{1}{2} p_x^2 + \frac{x^2}{2} \right \} = - x.
\end{align*}
We get a secondary constraint
\begin{align*}
\phi_2 = x = 0.
\end{align*}
Checking the consistency condition, we get
\begin{align*}
0 \overset{!}{=} \dot{\phi}_2 = \left \{ \phi_2,H_T \right \} = \left \{ x,\frac{1}{2} p_x^2 + \frac{x^2}{2} \right \} + u_1 \left \{ x,p_x - p_y \right \} = p_x + u_1.
\end{align*}
This leaves us with the condition $u_1 = - p_x$. We note that
\begin{align*}
\left \{ \phi_1,\phi_2 \right \} = \left \{ p_x - p_y,x \right \} = - 1 \neq 0
\end{align*}
wich means that both constraints are second-class, so we don't have any degrees of gauge freedom. \\

The proof that there only exists an even number of secondary constraints can be found in section~\vref{sec:number_secondary_constraints}.
\end{solution}

\begin{exercise}
\begin{align*}
L = \frac{1}{2} (\dot{x} - \dot{y})^2 - \frac{1}{2} (x + y)^2
\end{align*}
Conservation of secondary constraints in electrodynamics.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = (\dot{x} - \dot{y}) \\
p_y &= \frac{\partial L}{\partial \dot{y}} = - (\dot{x} - \dot{y}).
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = p_x + p_y = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H &= p_x \dot{x} + p_y \dot{y} - \frac{1}{2} (\dot{x} - \dot{y})^2 + \frac{1}{2} (x + y)^2 = \frac{1}{2} p_x^2 + \frac{1}{2} (x + y)^2.
\end{align*}
The total Hamiltonian at the moment is therefore
\begin{align*}
H_T = \frac{1}{2} p_x^2 + \frac{1}{2} (x + y)^2 + u_1 (p_x + p_y).
\end{align*}
Is the constraint conserved?
\begin{align*}
0 \overset{?}{=} \dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ p_x + p_y,\frac{1}{2} p_x^2 + \frac{1}{2} (x + y)^2 \right \} = - 2 (x + y).
\end{align*}
We get a secondary constraint
\begin{align*}
\phi_2 = x + y = 0.
\end{align*}
Checking the consistency condition, we get
\begin{align*}
0 \overset{!}{=} \dot{\phi}_2 = \left \{ \phi_2,H_T \right \} = \left \{ x + y,\frac{1}{2} p_x^2 + \frac{1}{2} (x + y)^2 \right \} + u_1 \left \{ x + y,p_x + p_y \right \} = p_x + 2 u_1.
\end{align*}
This leaves us with the condition $u_1 = - p_x / 2$. We note that
\begin{align*}
\left \{ \phi_1,\phi_2 \right \} = \left \{ p_x + p_y,x + y \right \} = - 2 \neq 0
\end{align*}
wich means that both constraints are second-class, so we don't have any degrees of gauge freedom. \\

Secondary constraints in electrodynamics can be found in chapter~\vref{sec:electrodynamics_secondary_constraints}.
\end{solution}

\begin{exercise}
\begin{align*}
L = \frac{1}{2} (\dot{x} + \dot{y})^2 + \dot{x} + \dot{y}
\end{align*}
Secondary constraints in electrodynamics.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = (\dot{x} + \dot{y}) + 1 \\
p_y &= \frac{\partial L}{\partial \dot{y}} = (\dot{x} + \dot{y}) + 1.
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = p_x - p_y = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H &= p_x \dot{x} + p_y \dot{y} - \frac{1}{2} (\dot{x} + \dot{y})^2 - \dot{x} - \dot{y} \\
&= p_x (p_x - 1) - \frac{1}{2} (p_x - 1)^2 - p_x + 1 \\
&= \frac{1}{2} p_x^2 - p_x + \frac{1}{2} \\
&= \frac{1}{2} (p_x - 1)^2.
\end{align*}
The total Hamiltonian is therefore
\begin{align*}
H_T = \frac{1}{2} (p_x - 1)^2 + u_1 (p_x - p_y).
\end{align*}
Is the constraint conserved?
\begin{align*}
\dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ p_x - p_y,\frac{1}{2} (p_x - 1)^2 \right \} = 0.
\end{align*}
Yes it is, so we get no secondary constraints. The function $u_1$ is still arbitrary and $\phi_1$ generates the following gauge transformations:
\begin{align*}
\Delta x &= \varepsilon \left \{ x,\phi_1 \right \} = \varepsilon \left \{ x,p_x - p_y \right \} = \varepsilon \\
\Delta y &= \varepsilon \left \{ y,\phi_1 \right \} = - \varepsilon \\
\Delta p_x &= \varepsilon \left \{ p_x,\phi_1 \right \} = 0 \\
\Delta p_y &= \varepsilon \left \{ p_y,\phi_1 \right \} = 0.
\end{align*}

Secondary constraints in electrodynamics can be found in chapter~\vref{sec:electrodynamics_secondary_constraints}.
\end{solution}

\begin{exercise}
\begin{align*}
L = \frac{1}{2} (\dot{x} + \dot{y})^2 + \dot{x} + 2 \dot{y}
\end{align*}
Hamiltonian of electrodynamics.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = (\dot{x} + \dot{y}) + 1 \\
p_y &= \frac{\partial L}{\partial \dot{y}} = (\dot{x} + \dot{y}) + 2.
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = p_x - p_y + 1 = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H &= p_x \dot{x} + p_y \dot{y} - \frac{1}{2} (\dot{x} + \dot{y})^2 - \dot{x} - 2 \dot{y} \\
&= p_x \dot{x} + (p_x + 1) \dot{y} - \frac{1}{2} (\dot{x} + \dot{y})^2 - \dot{x} - 2 \dot{y} \\
&= p_x (p_x - 1) - \frac{1}{2} (p_x - 1)^2 - (p_x - 1) \\
&= \frac{1}{2} (p_x - 1)^2.
\end{align*}
The total Hamiltonian is therefore
\begin{align*}
H_T = \frac{1}{2} (p_x - 1)^2 + u_1 (p_x - p_y + 1).
\end{align*}
Is the constraint conserved?
\begin{align*}
\dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ p_x - p_y + 1,\frac{1}{2} (p_x - 1)^2 \right \} = 0.
\end{align*}
Yes it is, so we get no secondary constraints. The function $u_1$ is still arbitrary and $\phi_1$ generates the following gauge transformations:
\begin{align*}
\Delta x &= \varepsilon \left \{ x,\phi_1 \right \} = \varepsilon \left \{ x,p_x - p_y + 1 \right \} = \varepsilon \\
\Delta y &= \varepsilon \left \{ y,\phi_1 \right \} = - \varepsilon \\
\Delta p_x &= \varepsilon \left \{ p_x,\phi_1 \right \} = 0 \\
\Delta p_y &= \varepsilon \left \{ p_y,\phi_1 \right \} = 0.
\end{align*}

The Hamiltonian of electrodynamics can be found in chapter~\vref{sec:electrodynamics_hamiltonian}.
\end{solution}

\begin{exercise}
\begin{align*}
L = \frac{1}{2} (\dot{x} - \dot{y})^2 - \dot{x} - \frac{x^2}{2}
\end{align*}
Primary constraints in electrodynamics.
\end{exercise}
\begin{solution}
The generalized momenta are
\begin{align*}
p_x &= \frac{\partial L}{\partial \dot{x}} = (\dot{x} - \dot{y}) - 1 \\
p_y &= \frac{\partial L}{\partial \dot{y}} = -(\dot{x} - \dot{y}).
\end{align*}
We get the constraint
\begin{align*}
\phi_1 = p_x + p_y + 1 = 0.
\end{align*}
The Hamiltonian is
\begin{align*}
H &= p_x \dot{x} + p_y \dot{y} - \frac{1}{2} (\dot{x} - \dot{y})^2 + \dot{x} + \frac{x^2}{2} \\
&= (-p_y - 1) \dot{x} + p_y \dot{y} - \frac{1}{2} p_y^2 + \dot{x} + \frac{x^2}{2} \\
&= p_y (\dot{y} - \dot{x}) - \frac{1}{2} p_y^2 + \frac{x^2}{2} \\
&= \frac{1}{2} p_y^2 + \frac{x^2}{2}.
\end{align*}
The total Hamiltonian is therefore
\begin{align*}
H_T = \frac{1}{2} p_y^2 + \frac{x^2}{2} + u_1 (p_x + p_y + 1).
\end{align*}
Is the constraint conserved?
\begin{align*}
0 \overset{?}{=} \dot{\phi}_1 = \left \{ \phi_1,H_T \right \} = \left \{ p_x + p_y + 1, \frac{1}{2} p_y^2 + \frac{x^2}{2} \right \} = - x.
\end{align*}
We get a secondary constraint
\begin{align*}
\phi_2 = x = 0.
\end{align*}
Checking the consistency condition, we get
\begin{align*}
0 \overset{!}{=} \dot{\phi}_2 = \left \{ \phi_2,H_T \right \} = \left \{ x,\frac{1}{2} p_y^2 + \frac{x^2}{2} \right \} + u_1 \left \{ x,p_x + p_y + 1 \right \} = u_1.
\end{align*}
This leaves us with the condition $u_1 = 0$. We note that
\begin{align*}
\left \{ \phi_1,\phi_2 \right \} = \left \{ p_x + p_y + 1,x \right \} = - 1 \neq 0,
\end{align*}
wich means that both constraints are second-class, so we don't have any degrees of gauge freedom. \\

The primary constraints of electrodynamics can be found in chapter~\vref{sec:electrodynamics_primary_constraints}.
\end{solution}


\section{Related Work}
\label{sec:related}
\subsection{Semi-supervised Learning on Graphs}
The main focus in this paper is semi-supervised classification on graphs. Given a graph with limited labels on a set of nodes, the goal of learning is to predict the label of the remaining vertices.

In the past few decades, graph-based semi-supervised algorithms often rely on the clustering assumption \citep{ChapelleZ05}, which assumes that spatially close vertices on a graph usually share the same label. Min-cuts, randomized min-cuts, spectral graph transducer, label propagation, iterative classification are examples of this line of research.

In many applications, vertex instances often come along with feature vectors that needs to be considered apart from the graph. Regularization-based algorithms like LapSVM \citep{BelkinNS06} and Planetoid \citep{YangCS16} rely on adding graph Laplacian regularizer to supervised learners.
Graph embedding is a class of algorithms aimed to learn low dimensional representations that jointly model vertex attributes and graph structure. In semi-supervised classification, the learnt embeddings serve as input features of downstream classification engines such as logistics, SVM, and MLP classifiers \dan{cite?}. There are various embedding methods designed for homogeneous graphs, which generally falls into three categories: deep neural network methods\cite{WangC016}, random walk based methods\cite{GroverL16,PerozziAS14}, matrix factorization methods and label propagation methods.

Heterogeneous graph embedding methods differ from homogeneous ones, in the sense that meta-path based structure information is considered.
ESim\citep{ShangQLKHP16} is proposed to learn structure-embedded similarity by sampling meta-path instances.
Metapath2vec \cite{DongCS17} proposes a meta-path based random walk and feed these walk instances to skip-gram engine.
HIN2Vec \cite{FuLL17} considers a joint loss of multiple tasks, where embeddings of vertex and meta-path are learnt simultaneously.
\citet{Sun00CXWY18} proposes a meta-graph model, which captures hidden relations in a meta-graph by tensor decomposition.

\subsection{Graph Convolution Networks}
Recently, graph convolution neural networks (GCNNs) have became popular approaches in graph embedding tasks. Inspired by convolution neural networks (CNNs), GCNNs neatly combine graph structures and vertex features, by propagating features of labeled vertices  to unlabeled neighbors through multiple layers of convolution.
These methods generally fall into two categories: spectral GCNNs and spatial GCNNs.
Spectral GCNNs generally decompose graph signals on the spectral domain using graph Fourier transform, and then convolve on the spectral components. \citet{BrunaZSL13} generalizes CNNs to graphs by finding Fourier basis of graph Laplacian.
To reduce computation cost in large graphs, \citet{DefferrardBV16} employs a K-order Chebyshev polynomial approximation to provide a faster filtering.
Spatial GCNNs view convolutions differently, where a new feature vector is constructed for each vertex using an aggregation of spatially close neighbors. \citet{HamiltonYL17} proposes GraphSAGE for inductive learning on unseen data. GraphSAGE learns a function that aggregate node embeddings from a fixed size neighborhood.

It is also worth mentioning Graph Attention Networks \citep{VelickovicCCRLB18}, where attention mechanisms \citep{VaswaniSPUJGKP17,BahdanauCB14} are applied to discriminate different nodes in a neighborhood. New embeddings are generated as a weighted sum of attention coefficients and neighbor feature vectors.

More recently, HAN \citep{WangJSWYCY19} is proposed to compute node embeddings on heterogeneous graphs, where all meta-paths are simultaneously considered. This method, however, only consider meta-path specific neighbors of target nodes and is unable to discriminate different intermediate nodes in meta-path instances.

%\subsection{Graph-Based semi-supervised learning}
%\dan{TODO}