\Lecture{Jayalal Sarma}{Nov 11, 2020}{29}{Applying Cycle Index in Polya's Theorem}{Bhupathi Narasimha Rao}{$\alpha$}{JS}
\section{Recall the definitions of Type and Cycle Index Polynomial}
Let $G$ be the set of some permutations of $\Omega$ , every $g \in G$ can be decomposed into a collection of disjoint cycles .\\
\textbf{Example 1:-} Consider $g=\{2,3,1,5,4\}$ which is a permutation on set $\{1,2,3,4,5\}$ . So , the permutation $g$ can be written as $(1~2~3)(4~5)$ .\\
\textbf{Example 2:-} Identity on set $[n]$ can be written as $g=(1)(2)(3)\dots(n)$ which is $n$-cycles of length $1$.\\\\
\textbf{Type of a permutation :-} A permutation $\pi$ is said to be of type $(b_1,b_2,\dots,b_m)$ if
$$b_i = \textrm{\# of $i$-length cycles in the cyclic representation of $\pi$}$$
\textbf{Example 1:-} Type of an identity permutation is $(n,0,\dots,0)$ .\\
\textbf{Example 2:-} Type of the permutation $g=(1~2~3)(4~5)$ is $(0,1,1,0,0)$ .\\\\
\textbf{Cycle index Polynomial :-}As discussed in previous lectures , a monomial is associated corresponding to every type as follows :
$$(b_1,b_2,\dots,b_m)\longleftrightarrow x_1^{b_1}x_2^{b_2}\dots x_m^{b_m}$$
And the cycle index polynomial of $G$ is defined as:
$$P_G(x_1,x_2,\dots,x_n)=\frac{1}{|G|}\sum_{g\in G}(x_1^{b_1}x_2^{b_2}\dots x_n^{b_n})~~~\textrm{where $(b_1,b_1,\dots,b_n)$ is the type of $g$}$$
\textbf{Example 1:-} Let $G=\{e,(1~2),(3~4),(1~2)(3~4)\}\leq S_4$ , then
$$P_G(x_1,x_2,x_3,x_4) = \frac{1}{4}\left(x_1^{4}+x_1^{2}x_2+x_1^{2}x_2+x_2^{2}\right)$$
\textbf{Example 2:-} Let $G=\{e,(1~2),(1~3),(2~3),(1~2~3),(1~3~2)\}=S_3$ , then
$$P_G(x_1,x_2,x_3) = \frac{1}{6}\left(x_1^{3}+x_{1}x_{2}+x_{1}x_{2}+x_{1}x_{2}+x_3+x_3\right)=\frac{1}{6}\left(x_1^{3}+3x_{1}x_{2}+2x_3\right)$$
\textbf{Why are we doing this :} The connection to Polya's Theorem will be found by the end of this lecture .
\section{Polya's Theorem (Simpler version)}
\begin{theorem}Let $G$ be the group of symmetry acting on $\Omega$ (set of different coloring of the underlying object) , then
$$\textrm{\# of distinct color patterns with $k$-colrs } = P_G(k,k,\dots,k)$$
\begin{proof}
Let the Domain be of size $m$ and we have $k$ colors , then  $|\Omega|=k^m$ . Using Burnsides's Lemma ,
\begin{align*}
    \textrm{\# of distinct colorings} &= \textrm{\# of different orbits of G acting on} \Omega\\
    &= \frac{1}{|G|}\sum_{g\in G} |fix(G)|
\end{align*}
We have to compute $|fix(g)|$ for $g\in G$ . For example , the cyclic structure of $g$ be $(1~2)(3~4)$ , the coloring should be such that the domain under the permutation looks the same . So , the corners $1,2$ should have same color and $3,4$ should have same color . So , total number of colorings such that the domain looks the same under the permutation $g = k^2$ . Hence all the corners in one cycle should get the same color . So , consider the type of some permutation $g=(b_1,b_2,\dots,b_m)$ , then
\begin{align*}
    &\textrm{$b_1$ cycle of length $1$ can have $k^{b_1}$ possible coloring}\\
    &\textrm{$b_2$ cycle of length $2$ can have $k^{b_2}$ possible coloring}\\
    &\dots\\
    &\dots\\
    &\textrm{$b_m$ cycle of length $m$ can have $k^{b_m}$ possible coloring}
\end{align*}
Therefore , \# of colors fixed by $g=|fix(g)|=k_{b_1}*k^{b_2}*\dots*k^{b_m} = x_1^{b_1}*x_2^{b_2}*\dots*x_m^{b_m} ~~~\\\textrm{where } x_i=k~\forall i\in [k]$

Hence , \# of distinct color patterns with $k$-colors is
$$\frac{1}{|G|}\sum_{g\in G}\left(k^{b_1}*k^{b_2}*\dots*k^{b_m}\right)= P_G(k,k,\dots,k)$$
\end{proof}
\end{theorem}
\section{Examples}
\textbf{Example 1:-} Coloring necklace with 3 regular beads with black and white colors . Symmetries are rotation with respect to the axis passing through the center and rotation with respect to the axis passing through one vertex and center of the opposite edge . Hence ,   $$G=\{e,R_{120},R_{240},F_{12},F_{23},F_{31}\}$$ and cyclic representations are $\{(1)(2)(3),(1~2~3),(1~3~2),(1~2),(2~3),(3~1)\}=S_3$ . Cyclic index polynomial corresponding to $G$ is:
$$P_G(x_1,x_2,x_3) = \frac{1}{6}\left(x_1^3+3x_1x_2+2x_3\right)$$
Hence \# of different colorings with $2$ colors $=\frac{1}{6}\left(2^3+3*2^2+2*2\right) = 4$\\
\textbf{Example 2:-} Consider cube coloring on faces and the symmetries group $G$ defined previously as :

\begin{tabular}{|l|l|}
    \hline
\textbf{Permutation} & \textbf{Corresponding Monomial} \\\hline
Identity $(e)$ & $x_1^6$\\
$180^0$ rotation wrt axis through centers of opposite faces ($3$ of them) &  $3x_1^{2}x_2^{2}$\\
$180^0$ rotation wrt axis through centers of opposite edges ($6$ of them) &  $6x_2^3$\\
$90^0$ rotation wrt axis through centers of opposite faces ($3$ of them) &  $3x_1^2x_4$\\
 $270^0$ rotation wrt axis through centers of opposite faces ($3$ of them) & $3x_1^2x_4$\\
 $120^0$ rotation wrt axis thorough center and opposite corners ($4$ of them) & $4x_3^2$ \\
 $240^0$ rotation wrt axis through center and opposite corners ($4$ of them)  &  $4x_3^2$\\ \hline
    \end{tabular}

Hence cyclic index polynomial corresponding to above symmetries is:
$$P_G(x_1,x_2,x_3,x_4,x_5,x_6)=\frac{1}{24}\left(x_1^6+3x_1^2x_2^2+6x_2^3+3x_1^2x_4+3x_1^2x_4+4x_3^2+4x_3^2\right)$$
$$\implies P_G(x_1,x_2,x_3,x_4,x_5,x_6)=\frac{1}{24}\left(x_1^6+6x_1^2x_4+3x_1^2x_2^2+8x_3^2+6x_2^3\right)$$
\textit{Question:-} If the coloring is done on the corners rather than faces with same $G$, does the polynomial change ?
\\
\textbf{Example 3:-} Square Problem discussed in previous lectures , $$G=\{e,R_{90},R_{180},R_{270},H,V,D,D^{\prime}\}$$ and corresponding cyclic representations are $$\{(1)(2)(3)(4),(1~2~3~4),(1~3)(2~4),(1~4~3~2),(1~4)(2~3),(1~2)(3~4),(1~3),(2~4)\} {\ensuremath <} S_4$$
There is some connection between $(1~2~3~4)$ and $(1~3)(2~4)$ . If the permutation $(1~2~3~4)$ is applied twice to the domain (square) , we get the permutation $(1~3)(2~4)$ . That is $(1~2~3~4)$ composed with itself gives $(1~3)(2~4)$ . $(1~3)(2~4)$ composed with $(1~2~3~4)$ gives $(1~4~3~2)$ .

Hence the set $\{e,R_{90},R_{180},R_{270}\}$ forms a subgroup . Suppose the permutation $(1~2~3~4)$ be $g$ , then corresponding permutations are $\{e,g,g^2,g^3\}$ ($g^4$ is an identity) \\

Suppose we have a group of symmetry as (considering $n$ to be even): $$G=\{e,g,g^2,g^3,\dots,g^k\}=\{e,(1~2~3\dots~n),(1~3~5~\dots~n-1)(2~4~4~\dots~n),\dots\dots\}~~~\textrm{with $g^{k+1}$ as identity}$$
Groups of type $G$ are called as cyclic groups . The monomials corresponding to each permutations are as follows:\\
\begin{tabular}{|l|l|}
    \hline
\textbf{Permutation} & \textbf{Corresponding Monomial} \\\hline
$e$ & $x_1^n$\\
$g$ & $x_n$\\
$g^2$ & $x_{\frac{n}{2}}^2$\\
$g^3$ & $x_{\frac{n}{4}}^4$\\
\dots & \dots\\ \hline
    \end{tabular}\\
So , the cyclic index polynomial corresponding to $G$ can be written as:
$$P_G(x_1,x_2,\dots,x_n)=\frac{1}{n}\sum_{d\mid n}\phi(\frac{n}{d})x_{\frac{n}{d}}^d$$
where $\phi(.)$ is the Euler's function . $\phi(n)$ = \# of positive integers up to $n$ that are relatively prime to $n$ . If $n$ is odd ,
$$P_G(x_1,x_2,\dots,x_n) = \frac{1}{2n}\sum_{d\mid n}x_{\frac{n}{d}}^d + \frac{1}{2}x_1x_2^{\frac{n-1}{2}}$$
\section{Dihedral Group}
For the permutations $\sigma=(1~2~\dots~n)$ and $\pi=(2~n)(3~n-1)$ , the group defined as:
$$D_n = \{e,\sigma,\sigma^2,\dots,\sigma^{n-1},\pi\sigma,\pi\sigma^2,\dots,\pi\sigma^{n-1}\}$$
are called Dihedral groups . Here $D_n$ is a Dihedral group .\\
\textbf{Example 1:-}
Consider permutation on a square $\sigma = (1~2~3~4)$ and $\pi=(2~4)(3~3)=(2~4)(3)(1)$ , then
\begin{align*}
    \pi\sigma &= (2~4)(3)(1)(1~2~3~4)\\
    &= (2~1)(3~4)\\
    &= V
\end{align*}
\textbf{Observation:-}$|D_3|=6=|S_3|$ and $|D_4|=8\le|S_4|$

\section{Polya's Theorem (General Version)}
\textbf{Motivating Question:- }How many in-equivalent colorings are there using $3$ black and $1$ white ?
\begin{figure}[h!]
    \centering
    \includegraphics[width=0.6\linewidth]{images/Set-G.jpeg}
    \caption{Symmetries on square}
\end{figure}
\begin{figure}[h!]
    \centering
    \includegraphics[width=0.6\linewidth]{images/Square-colorings-black-white.png}
    \caption{All possible coloring on square with black and white}
\end{figure}

\textbf{AIM :-} To write a polynomial $Q(b,w)$ such that coefficient of $b^2w^2=$ \# of inequivalent colorings with $2$ Black and $2$ White colors . Similarly , coefficient fo $b^3w=$\# of inequivalent colorings with $3$ Black and $1$ White colors .

\qquad Consider the identity permutation $e$ , no.of colorings fixed by $e$ considering $2$ colors = $16$ . And no.of colorings fixed by $e$ considering $3$ Black and $1$ White = $4$ (from the above fig.)
If we write this down for the permutations fixed by $e$ , the expression will be as :
$$b^4+4b^3w+4bw^3+6b^2w^2+w^4=(b+w)^4$$
Let us classify elements of $\Omega=\{C_1,C_2,\dots,C_{16}\}$ into their corresponding coloring structures . The classification will be as follows :
\begin{align*}
    b^4 &\longleftrightarrow T_1=\{C_1\}\\
    b^3w &\longleftrightarrow T_2=\{C_2,C_3,C_4,C_5\}\\
    b^2w^2 &\longleftrightarrow T_3=\{C_6,C_7,C_8,C_9,C_{10},C_{11}\}\\
    bw^3 &\longleftrightarrow T_4=\{C_{12},C_{13},C_{14},C_{15}\}\\
    w^4 &\longleftrightarrow T_5=\{C_{16}\}
\end{align*}
Suppose we want to know how many inequivalent colorings are possible with $3$ Black and $1$ White on a square when group $G$ is applied , then it is enough to apply the group $G$ on $T_2$ and count the inequivalent colorings . So , now we need to understand how many inequivalent colorings are there in each $T_i$ .

\qquad $G$ acting on $T_i$ is well-defined . It is because when a rotation/flip is applied on a square , the number of colors or number of vertices is not changed . The image will be one of the elements of $T_i$ itself . Hence , it is well-defined . So , for finding number of inequivalent colorings of a specific structure (like $3$ Black and $1$ White) , it is enough to apply $G$ on corresponding $T_i$ ($T_2$ if $3$ Black and $1$ White) and apply Burnside's lemma (\textit{i.e.,} compute $|fix(g)| \forall g\in G$) .\\\\
\textbf{Example 1:-} Find the number of inequivalent colorings using $3$ Black and $1$ White when $G=\{e,R_{90},R_{180},R_{270},H,V,D,D^{\prime}\}$ applied on $\Omega$ . \\
\textbf{Solution :-} Consider action of $G$ on $T_2=\{C_2,C_3,C_4,C_5\}$ ,
\begin{align*}
    \textrm{\# of inequivalent colorings }&= \frac{1}{|G|}\sum_{g\in G}|fix(g)|\\
    &= \frac{1}{8}\left(|fix(e)|+|fix(D)|+|fix(D^{\prime})|\right)~~~\textrm{Action of other $g$'s gives $|fix(g)|=0$}\\
    &= \frac{1}{8}\left(4+2+2\right)\\
    &= 1
\end{align*}\\
\textbf{Example 2:-} Find the number of inequivalent colorings using $2$ Black and $2$ White when $G=\{e,R_{90},R_{180},R_{270},H,V,D,D^{\prime}\}$ applied on $\Omega$ . \\
\textbf{Solution :-} Consider action of $G$ on $T_3=\{C_6,C_7,C_8,C_9,C_{10},C_{11}\}$ ,
\begin{align*}
    \textrm{\# of inequivalent colorings }&= \frac{1}{|G|}\sum_{g\in G}|fix(g)|\\
    &= \frac{1}{8}\left(|fix(e)|+|fix(R_{180})|+|fix(H)|+|fix(V)|+|fix(D)|+|fix(D^{\prime})|\right)\\
    &= \frac{1}{8}\left(6+2+2+2+2+2\right)\\
    &= 2
\end{align*}\\
\textbf{Example 3:-} Given a permutation $g$ with cycle structure $(1~2)(3)(4)$ . How many inequivalent colorings are possible with different combinations of Black and White colors ?\\
\textbf{Solution :-} We have to count number of colorings that are fixed by $g$ . So , $1,2$ should have same color , $3,4$ can have any color . Hence , the expression $(b^2+w^2)(b+w)(b+w)$ represents the possible colorings where coefficient of each term correspond to the number of colorings which are inequivalent with that color structure .
$$(b^2+w^2)(b+w)(b+w) = b^4+2b^3w+2b^2w^2+2bw^3+w^4$$
Hence , $g$ fixes square with $4$ corners coloured Black , $4$ corners colored White , $2$ squares colored with $3$ Black and $1$ White , $2$ squares colored with $2$ Black and $2$ White , $2$ squares colored with $1$ Black and $3$ White .\\
\textbf{Example 4:-} Given permutation $g$ with cycle structure $(1~2)(3)(4)(5~6~7)$ , the colorings which are fixed by $g$ is given by $(b^2+w^2)(b+w)(b+w)(b^3+w^3)$ .\\
\section{Polya's Theorem}
\begin{theorem}
If the colors $\alpha_1,\alpha_2,\dots,\alpha_k$ are used , then
$$\textrm{\# of inequivalent colorings expressed as generating function } = P_G(\sum_{i=1}^{k}\alpha_i,\sum_{i=1}^{k}\alpha_i^2,\dots)$$
\end{theorem}

\textbf{Example 1:-} Consider the necklace with $3$-half beads colored with Black and White . The group of symmetry is $G=\{e,R_{120},R_{240}\}$ . Then generating function is :
$$P_G(x_1,x_2,x_3) = \frac{1}{3}\left(x_1^3+2x_3\right)$$
Substitute $x_1$ with $(b+w)$ , $x_2$ with $(b^2+w^2)$ and $x_3$ with $(b^3+w^3)$ . Then the generating function using Polya's theorem is:
\begin{align*}
    P_G(b+w,B62+w^2,b^3+w^3) &= \frac{1}{3}\left((b+w)^3+2(b^3+w^3)\right)\\
    &= b^3+w^3+b^2w+bw^2
\end{align*}

\Lecture{Jayalal Sarma}{Nov 12, 2020}{30}{Partial Order}{Prasannasai Babu}{$\alpha$}{JS}
\section{Formal Definition and Examples}
A partial order is a homogeneous binary relation $\leq$ over a set $X$ satisfying particular axioms which are discussed below. When $x\leq y$, we say that $x$ is related to $y$. (This does not imply that $y$ is also related to $x$, because the relation need not be symmetric.)\\\\
The axioms for a partial order state that the relation $\leq$ is reflexive, antisymmetric, and transitive. That is, $\forall a, b, c \in X$, it must satisfy:\\\\
\textbf{Reflexivity:} $a\leq a$\\
\textbf{Transitivity:} if $a\leq b \And b \leq c$ then $a \leq c$\\
\textbf{Antisymmetry:} if $a \leq b \And b \leq c$ then $a = b$\\\\
Partial Ordered set is also called as \textbf{"Poset"}\\\\
\textbf{Example 1:} Natural numbers $\mathbb{N}$ with $\leq$ order\\
\textbf{Example 2:} Natural numbers $\mathbb{N}$ with $|~$(division) relation, That is $a\leq b$ if $a | b$\\
\textbf{Example 3:} Set $X = \{1,2,4,3,7,6,9,10\}$ with $|$ relation. In this example $1$ is less than or equal to every other element in the set as $1$ divides every other element in the set. Now take two elements $3$ and $7$, now we can't say $3 \leq 7 \And 7 \leq 3$ as $3$ doesn't divide $7$ and $7$ doesn't divide $3$. So elements $3$ and $7$ are incomparable.\\
This leads to the notion of comparable and incomparable elements.\\
\textbf{Example 4:} Polynomials over $|~$ (division) relation.\\
\textbf{Example 5:} Words(over English alphabets) over lexicographic order or dictionary order or graded lexicographic order.\\\\
A partial order is said to be total order of there are no incomparable elements.\\\\
\textbf{Example 6:} Set of subsets of $[n]$ and the ordering is by inclusion. This is not a total order.\\
\textbf{Example 7:} Set of the strings over the alphabet $\{0,1\}$ of length $n$ over the ordering for two strings $x,y$ we say $x\leq y$ if $\forall i \in [n],~x_i \leq y_i$\\\\
We know that there is a bijection between the sets in Example $6$ and Example $7$, and it turns out that the bijection is not only a bijection and it also preserves the ordering. Our claim here is
for $A,B \subseteq [N]$, $A \subseteq B \iff \phi(A) \leq \phi(B)$, where $\phi$ is the bijective function.
\section{Representation of Posets}
A poset $p = (X,\leq)$ can naturally representes as a directed graph with $X$ as the vertex set and the directed edges $xy$ if $x$ and $y$ have a relation $x \leq y$. For example take three elements $a, b, c$ from $X$, now we will draw edge from $a$ to $b$ if $a\leq b$ and edge from $b$ to $c$ if $b \leq c$, Now we don't need to draw edge from $a$ to $c$, although we know $a \leq c$ through transitivity, because it unnecessarily increases the size of the graph.\\
Graph $G$ has vertices V as $V = X$ and edges E as $E = \{(x,y) | x,y \in X, x \leq y \}$\\
The graphs that represents these posets are called as \textbf{Hasse diagram}. So transitive closure of the graph $G$ is the graph of the relation.
\section{New terms and Notations}
\textbf{Chain:} $C \subseteq X$ is said to be a chain if every pair of elements in $C$ is comparable. The chain C is a total order.\\\\
\textbf{Height of Poset:} Length of the longest chain.\\\\
\textbf{Anti-Chain:} $A \subseteq X$ is said to be anti-chain if every pair of elements in $A$ is incomparable.\\\\
\textbf{Width of Poset:} Size of largest Anti-Chain.\\\\
\textbf{Maximal Elements:}  $\{x \in X | \forall y \in X, y \leq x ~or~ x || y$\}. Here the symbol $||$ represents incomparability.\\\\
\textbf{Minimal Elements:} $\{x \in X | \forall y \in X, x \leq y ~or~ x || y\}$. Here the symbol $||$ represents incomparability.\\\\
\textbf{Note:} Maximal elements set and Minimal elements set, both are anti-chains.
\section{Theorems on partitioning poset into chains and anti-chains}
\begin{theorem}
Every poset $P(X,\leq)$ can be partitioned into height($P$) many antichains(and not less).
\begin{proof}
We know that every element in anti-chain are incomparable. Now take the set of the elements in the longest chain. The length of the chain is height($P$). We know every element in the chain are comparable. So every element in the longest chain must belong to different anti-chain. So there must be atleast height($P$) many anti-chains.

Now, let's look at alternate proof using induction.

\textbf{Claim:} For any max chain $C$ of poset $P$, min($P$) $\cap ~ C ~\neq~ \phi$

We will do induction on height($P$). Now consider the longest chain C and remove min($P$) from $P$ to get $P'$, so height of $P'$ is height($P$) $ - 1$. We assume that the theorem is true for $P'$.

Applying induction hypothesis, now add min($P$) to $P'$, the height will be increased by $1$ that is height($P$) $=$ height($P'$) $+ 1$ and adding min(P) will result in increasing number of anti-chains by $1$ to get full partition of $P$.
\end{proof}
\end{theorem}
\begin{theorem}
\textbf{Dilworth's Theorem:} Every poset $P(X,\leq)$ can be partitioned into width($P$) many chains(and no less).
\begin{proof}
We will prove this by applying induction on the size of set $X$ i.e., $|X|$
Let's take the width of the poset as $w$. Let $A \subseteq X$ be the anti-chain with size $w$. Now we will decompose $P$ into $P_1 = (X_1,\leq)$ and $P_2 = (X_2,\leq)$.
$$X_1 = \{y \in X | \exists~ x ~ \in ~ A, x \leq y\}$$
$$X_2 = \{y \in X | \exists~ x ~ \in ~ A, y \leq x\}$$
\textbf{Claim:} $X_1 \cap X_2 = A$. So $A \subseteq X_1 \cap X_2$.\\
Suppose $y \in X_1 \cap X_2$, then $\exists~ x_1, x_2$ such that $x_1 \leq y \leq x_2$.\\
Now $x_1$ becomes comparable to $x_2$. But $x_1, x_2 \in A$ which is anti-chain.\\
$\Rightarrow x_1 = x_2 = y$\\
$\Rightarrow y \in A$\\
Suppose $|X_1| < |X| \And |X_2| < |X|$
We can apply induction hypothesis on $P_1$ and $P_2$ to get chains $C_1, C_2, C_3, \ldots C_w$ and ${C'}_1, {C'}_2, {C'}_3, \ldots {C'}_w$ each of length $w$.\\
We know,\\
$$A = min(P_1) = max(P_2)$$
We can join the corresponding chains to get chains of poset $P$. Let the elements of set $A = \{a_1,a_2,a_3,\ldots,a_w\}$.\\
Without loss of generality, let's assume that $C_1$ ends at $a_1$, $C_2$ ends at $a_2$ and so on upto $C_w$ ends at $a_w$. Similarly $C_1'$ starts as $a_1$, $C_2'$ starts at $a_2$ and so on upto $C_w'$ starts at $a_w$. Now partition of $X$ for $P$ can be $C_1 \cdot {C_1'}, ~C_2 \cdot {C_2'}$ and so on upto $C_w \cdot {C_w'}$.\\\\
We need to handle the case when $|X_1| = |X|$ or $|X_2| = |X|$.\\
If $|X_1| = |X|$ that means $X_1 = X$, which in turn means $A = min(P)$. Similarly if we choose $A = max(P)$ then $X_2 = X$ and $|X_2| = |X|$. If there are anti-chains of size $w$ which are not min($P$) and max($P$), then we can do the same like above.\\\\
But if it is the case that the only max sized anti-chains are max($P$) or min($P$) or both, we should look for alternate approach.\\\\
Now consider any max chain in P, and remove that chain $C$ from $P$ to get $P'$. So now,\\
$$max(P) \cap C \neq \phi \And min(P) \cap C \neq \phi$$
We can apply induction hypothesis to get a decomposition of $P'$ in less than $w$ many chains. Now put the $C$ back to get decomposition into $w$ many chains which partition $X$.

\end{proof}
\end{theorem}

\section{Applications of Dilworth's Theorem}
\textbf{Application 1:} Proof of Erdős–Szekeres theorem\\
\begin{theorem}
Every sequence of $rs+1$ distinct integers, there must exist an increasing sequence of length $r+1$ or decreasing sequence of length $s+1$.
\begin{proof}
Let $a_1,a_2,a_3,\ldots,a_n$ be the sequence of length $n$ where $n = rs+1$.\\
Define ordering of the sequence as $a_i \leq a_j$ if $i\leq j$ and $a_i \leq a_j$. It is transitive, reflexive and anti-symmetric. So it is a partial order. So we define chains and anti-chains in this poset. A chain in this poset means the elements are in the increasing order.\\
$\Rightarrow$ A chain in this poset $\rightarrow$ increasing sub-sequence.\\
Similarly an anti-chain in this poset means the elements are in the decreasing order.\\
$\Rightarrow$ An anti-chain in this poset $\rightarrow$ decreasing sub-sequence.\\
Suppose there is no anti-chain(decreasing sub-sequence) of size $s+1$.
$$\Rightarrow w(P) \leq s$$
By Dilworth's theorem there is a decomposition of $P$ into atmost $s$ many chains. So there exists at least one chain with $r+1$ elements, otherwise there will be only $r\times s$ elements in the ground set. But we have $rs+1$ elements. Therefore there must exist a chain with $r+1$ elements which is an increasing sub-sequence.
\end{proof}
\end{theorem}
.\\
\textbf{Example for size of chain and anti-chain}\\
We know there is a bijection between example $6$ and example $7$ in section $30.1$ i.e., between the sets\\
$\Rightarrow$ subset poset of subsets of [n] $\rightarrow$ Boolean strings poset of length $n$.\\
The max length of the chain is $n+1$. Intutively we can say that maximum size of the anti-chain is $n \choose \frac{n}{2}$. Let's look how to prove it in the next lecture by Sperner's theorem.
%\Lecture{Jayalal Sarma}{Nov 13, 2020}{31}{Sperner's Theorem}{Prasannasai Babu}{$\alpha$}{JS}
%\section{{Sperner's theorem}}
\begin{theorem}
\textbf The maximum size of any anti-chain in the subset poset(Example $6$ of $30.1$) is $n \choose \frac{n}{2}$.
\begin{proof}
The subset poset is equivalent to boolean strings of length $n$ poset. Now let's represent boolean string poset as $B_n$. We need to prove width($B_n$) = $n \choose \frac{n}{2}$.\\
Let us first show that width($B_n$) is atleast $n \choose \frac{n}{2}$. We can show one anti-chain of size $n \choose \frac{n}{2}$, that is subsets of size $\frac{n}{2}.$\\
Now we need to show that any anti-chain in $B_n$ must have size $\leq ~{n \choose \frac{n}{2}}$\\\\
Let F be any anti-chain in $B_n$. We need to show $|F| \leq {n \choose \frac{n}{2}}$. Let us say,\\\\
A permutation $\pi \in S_n$ is said to meet $A \subseteq \{1,2,\ldots,n\}$ if $A$ forms prefix of $\pi$. This statement meaning is, Let's say $|A| = k$ then $\pi$ said to meet $A$ if $A = \{\pi(1),\pi(2),\ldots,\pi(k)\}$.\\\\

Consider each subset in $F$ and consider permutations meeting them, As we are taking subsets from $F$, they are incomparable. Hence a single permutation can't meet both $A$ and $B$.Now let's count the size of
$$\sum_{A\in F} \bigg|\{\pi | \pi ~meets~ A\}\bigg|$$
As single permutation can meet only one subset of F,
$$\sum_{A\in F} \bigg|\{\pi | \pi ~meets~ A\}\bigg| \leq n!$$
Now number of permutations that can meet set $A$ of size $k$ is $k! \times (n-k)!$.So,
$$\sum_{A\in F} |A|! \times (n-|A|)! ~~~\leq~~~ n!$$
Bring that RHS term to LHS, now
$$\sum_{A\in F} \frac{1}{\frac{n!}{|A|! \times (n-|A|)!}} ~~~\leq~~~ 1$$
$$\sum_{A\in F} \frac{1}{{n \choose {|A|}}} ~~~ \leq ~~~ 1$$
We can substitute $n \choose \frac{n}{2}$ in place of $|A|$ and the inequality still holds.
$$\sum_{A\in F} \frac{1}{{n \choose \frac{n}{2}}} ~~~ \leq ~~~ 1$$
$$\sum_{A\in F} 1  ~~~ \leq ~~~ {n \choose \frac{n}{2}}$$
$$|F| ~~~\leq~~~ {n \choose \frac{n}{2}}$$
We showed that,
$$|F| ~~~\leq~~~ {n \choose \frac{n}{2}} \And |F| ~~~\geq~~~ {n \choose \frac{n}{2}}$$
Hence the max size of the anti-chain $F$ is
$$|F| ~~~=~~~ {n \choose \frac{n}{2}} $$
Hence proved.
\end{proof}
\end{theorem}


\section{Technicalities}

\subsection{Parity Games}

A \emph{parity game} is a tuple $G = (V,V_0,V_1,E,\Omega)$ where $(V,E)$ forms a directed graph
whose node set is partitioned into $V = V_0 \cup V_1$ with $V_0 \cap V_1 = \emptyset$, and
$\Omega : V \to \Nat$ is the \emph{priority function} that assigns to each node a natural number
called the \emph{priority} of the node. We assume the underlying graph to be total, i.e.\ for every
$v \in V$ there is a $w \in W$ s.t.\ $(v,w) \in E$.

We also use infix notation $vEw$ instead of $(v,w) \in E$ and define the set of all \emph{successors} of
$v$ as $vE := \{ w \mid vEw \}$, as well as the set of all \emph{predecessors} of $w$ as
$Ew := \{ v \mid vEw \}$.

The game is played between two players called $0$ and $1$ in the following way. Starting in a node
$v_0 \in V$ they construct an infinite path through the graph as follows. If the construction so far
has yielded a finite sequence $v_0\ldots v_n$ and $v_n \in V_i$ then player $i$ selects a $w \in v_nE$
and the play continues with the sequence $v_0\ldots v_n w$.

Every play has a unique winner given by the \emph{parity} of the greatest priority that occurs infinitely
often in a play. The winner of the play $v_0 v_1 v_2 \ldots$ is player $i$ iff
$\max \{ p \mid \forall j \in \Nat \exists k \geq j:\, \Omega(v_k) = p \} \equiv_2 i$ (where $i \equiv_2 j$ holds iff $|i - j| \mod 2 = 0$). That is, player $0$ tries to make an even
priority occur infinitely often without any greater odd priorities occurring infinitely often, player
$1$ attempts the converse.

% The priorities occurring in a game are often ordered w.r.t. their usefulness to one of the players $i \in \{0, 1\}$ by the \emph{reward order $\preceq_i$} which is defined as follows:
% \begin{displaymath}
% p_1 \preceq_i p_2 \,:\iff\,\, rew_i(p_1) \leq rew_i(p_2)
% \end{displaymath}
% where $rew_i(p) := p$ if $p \equiv_2 i$ and $rew_i(p) := -p$ otherwise.
% \TODO{Paragraph nach hinten}

In the following we will restrict ourselves to finite parity games. It is easy to see that in a finite
parity game the winner of a play is determined uniquely since the range of $\Omega$ must necessarily
be finite as well. Technically, we are considering so-called max-parity games. There is also the
min-parity variant in which the winner is determined by the parity of the \emph{least} priority occuring
infinitely often. On finite graphs, though, these two games are equivalent in the sense that a max-parity
game $G = (V,V_0,V_1,E,\Omega)$ can be converted into a min-parity game $G' = (V,V_0,V_1,E,\Omega')$
whilst preserving important notions like winning regions, strategies, etc. Simply let $p$ an even upper
bound on all the priorities $\Omega(v)$ for any $v \in V$. Then define $\Omega'(v) := p - \Omega(v)$.
This construction also works the other way round, i.e.\ in order to transform a min-parity into a
max-parity game.

A \emph{strategy} for player $i$ is a partial function $\sigma: V^*V_i \to V$, s.t.\ for all sequences
$v_0 \ldots v_n$ with $v_{i+1} \in v_iE$ for all $j=0,\ldots,n-1$, and all $v \in V_i$:
$\sigma(v_0\ldots v_n) \in v_nE$. That is, a strategy for player $i$ assigns to every finite path through
$G$ that ends in $V_i$ a successor of the ending node. A play $v_0 v_1 \ldots$ \emph{conforms} to a strategy
$\sigma$ for player $i$ if for all $j \in \Nat$ we have: if $v_j \in V_i$ then
$v_{j+1} = \sigma(v_0\ldots v_j)$.
Intuitively, conforming to a strategy means to always make those choices that are prescribed by the strategy.
A strategy $\sigma$ for player $i$ is a \emph{winning strategy} starting in some node $v \in V$ if player $i$ wins
every play that conforms to this strategy and begins in $v$. We say that player $i$ \emph{wins} the game $G$
starting in $v$ iff he/she has a winning strategy for $G$ starting in $v$.

With $G$ we associate two sets $W_0,W_1 \subseteq V$ with the following definition. $W_i$ is the set of
all nodes $v$ s.t.\ player $i$ wins the game $G$ starting in $v$. We write $W_i^G$ in order to name the parity
game that the winning regions refer to, for example when it cannot uniquely be identified from the context.

Clearly, we must have
$W_0 \cap W_1 = \emptyset$ for otherwise assume that there is a node $v$ such that both players $0$ and $1$
have winning strategies $\sigma_0$ and $\sigma_1$ for $G$ starting in $v$. Then there is a unique play
$\pi = v_0 v_1 \ldots$ such that $v_0 = v$ and $\pi$ conforms to both $\sigma_0$ and $\sigma_1$. It is
obtained by simply playing the game while both players perform their choices according to their respective
strategies. However, by definition $\pi$ is won by both players, and therefore the maximal priority occurring
infinitely often would have to be both even and odd.

On the other hand, it is not obvious that every node should belong to either of $W_0$ or $W_1$. However, this
is indeed the case and known as \emph{determinacy}: a player has a strategy for a game iff the opponent does
not have a strategy for that game.

\begin{theorem}[\cite{Mart75,Gurevich-Harrington/82,focs91*368}]
Let $G = (V,V_0,V_1,E,\Omega)$ be a parity game. Then $W_0 \cap W_1 = \emptyset$ and $W_0 \cup W_1 = V$.
\end{theorem}

A strategy $\sigma$ for player $i$ is called \emph{positional} or \emph{memory-less} or \emph{history-free} if
for all $v_0\ldots v_n \in V^*V_i$ and all $w_0\ldots w_m \in V^*V_i$ we have: if $v_n = w_m$ then
$\sigma(v_0\ldots v_n) = \sigma(w_0\ldots w_m)$. That is, the value of the strategy on a finite path
only depends on the last node on that path. An important feature of parity games is the fact that such
strategies suffice.

\begin{theorem}[\cite{focs91*368}]
Let $G = (V,V_0,V_1,E,\Omega)$ be a parity game, $v \in V$, and $i \in \{0,1\}$. Player $i$ has a winning
strategy for $G$ starting in $v$ iff player $i$ has a positional winning strategy for $G$ starting in $v$.
\end{theorem}

A positional strategy $\sigma$ for player $i$ induces a \emph{subgame}
$G|_\sigma := (V, V_0, V_1, E|_\sigma, \Omega)$ where
$E|_\sigma := \{(u, v) \in E \mid u \in dom(\sigma) \Rightarrow \sigma(u) = v\}$. Such a subgame $G|_\sigma$
is, roughly speaking, basically the same game as $G$ with the restriction that whenever $\sigma$ provides a
strategy decision for a node $u \in V_i$ all transitions from $u$ but $\sigma(u)$ are no longer accessible.

A set $U \subseteq V$ is said to be $i$-closed iff player $i$ can force any play to stay within $U$. This
means that player $1-i$ must not able to leave $U$ but player $i$ must always have the choice to remain
inside $U$:
\begin{displaymath}
\forall v \in U:\, \big(\ v \in V_{1-i}\, \Rightarrow \, vE \subseteq U\ \big)
\enspace \mbox{and} \enspace
\big(\ v \in V_i\, \Rightarrow \, vE \cap U \ne \emptyset\ \big)
\end{displaymath}
Note that $W_0$ is $0$-closed and $W_1$ is $1$-closed.

A set $U \subseteq V$ induces a \emph{subgame}
$G|_U := (U, U \cap V_0, U \cap V_1, E \cap U \times U, \Omega|_U)$ iff the underlying transition relation
$E \cap U \times U$ remains total i.e. for all $u \in U$ there is at least one $v \in U$ s.t.\ $uEv$. Clearly,
each $i$-closed set $U$ induces a subgame. We often identify a set $U \subseteq V$ that induces a subgame
w.r.t.\ a fixed parity game with the induced subgame itself.

\subsection{Dominions}

A set $U \subseteq V$ is called an \emph{$i$-dominion} iff $U$ is $i$-closed and the induced subgame is won by player $i$. Clearly, $W_0$ is a $0$-dominion and $W_1$ is a $1$-dominion. That is, an $i$-dominion $U$ covers the idea of a region in the game graph that is won by player $i$ by forcing player $1-i$ to stay in $U$ on the one hand; but on the other hand an $i$-dominion $U$ is only won by player $i$ when using a winning strategy on $U$.

To see more precisely what the concept of dominions is used for we need to introduce \emph{attractors} and
\emph{SCC decompositions} of parity games.

\subsection{Attractors and Attractor Strategies}
Let $U \subseteq V$ and $i \in \{0,1\}$. Define for all $k \in \Nat$
\begin{align*}
\attr{0}{i}{U} \enspace := \enspace &U \\
\attr{k+1}{i}{U} \enspace := \enspace &\attr{k}{i}{U} \\
\cup\enspace &(V_i \cap \{ v \mid vE \cap \attr{k}{i}{U} \ne \emptyset \}) \\
\cup\enspace &(V_{1-i} \cap \{ v \mid vE \subseteq \attr{k}{i}{U} \}) \\
\attr{}{i}{U} \enspace := \enspace &\bigcup\limits_{k \in \Nat} \attr{k}{i}{U}
\end{align*}
Intuitively, $\attr{k}{i}{U}$ consists of all nodes s.t.\ player $i$ can force any play to reach $U$ in
at most $k$ moves.
%Attractors are necessary in order to be able to use local solvers for the global problem.

\begin{lemma}[\cite{TCS::Zielonka1998,Stirling95}]
\label{lem:minusattr}
Let $G = (V,V_0,V_1,E,\Omega)$ be a parity game and $U \subseteq V$. Let $V' := V \setminus \attr{}{i}{U}$.
Then $G' = (V',V_0 \cap V',V_1 \cap V', E \cap V'\times V',\Omega)$ is again a parity game with its
underlying graph being total.
\end{lemma}

In other words $V \setminus \attr{}{i}{U}$ is $(1-i)$-closed; if additionally $U$ is an $i$-dominion then
$\attr{}{i}{U}$ also is an $i$-dominion. This yields a general procedure for solving parity games: find a
dominion in the game graph that is won by one of the two players, build its attractor of the dominion and
investigate the complement subgame.

Each attractor for player $i$ induces an \emph{attractor strategy} for player $i$. It is defined for all
$v \in \attr{k}{i}{U} \cap V_i$ for any $k \ge 1$ as $\sigma(v) = w$ iff $w \in \attr{k-1}{i}{U}$.

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% End:


\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage{physics}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1em}
\relpenalty=10000
\binoppenalty=10000
\DeclareMathOperator{\lcm}{lcm}

\begin{document}
\section*{Miscelleanous revision problems for BMO}

\begin{enumerate}
  \item $(x,y,z)$ is a point on unit sphere. Find the maximal value of $x+2y+3z$.

  % http://artofproblemsolving.com/wiki/index.php?title=2004_USAMO_Problems/Problem_5
  \item Prove for $x \geq 0$ that $x^5+1 \geq x^3 + x^2$.
  \item Prove for $x,y,z \geq 0$
  $$3(x^3+y^3+z^3)^2 \geq (x^2+y^2+z^2)^3 $$
  \item Prove for $a,b,c \geq 0$
  $$(a^5-a^2+3)(b^5-b^2+3)(c^5-c^2+3)\geq (a+b+c)^3$$

  % vorrat 104
	\item Given positive real numbers $x_1,\dots,x_n$ for which $x_1^2+\dots+x_n^2=1$, find the minimal value of the expression
	$$\frac{x_1^5}{x_2+x_3+\dots+x_n} + \frac{x_2^5}{x_1+x_3+\dots+x_n} + \dots +\frac{x_n^5}{x_1+x_2+\dots+x_{n-1}}$$

	% vorrat 101
	\item Let $x_1,\dots,x_n$ be positive real numbers for which $x_1+\dots+x_n=1$. Prove that
	$$\frac{x_1}{\sqrt{1-x_1}} + \dots + \frac{x_n}{\sqrt{1-x_n}}
	\geq
	\frac{\sqrt{x_1}+\dots+\sqrt{x_n}}{\sqrt{n-1}} $$

  \item % http://www.math.olympiaadid.ut.ee/arhiiv/varia/bwtr/bw18tr/bw18tren.pdf
  Find all factors of $10^{2013}-1$ which are smaller than $100$.

  \item % http://www.math.olympiaadid.ut.ee/arhiiv/varia/bwtr/bw18tr/bw18tren.pdf
  Find the number of possible values for positive integer $k$ if it is known that $\lcm(6^6,8^8,k)=12^{12}$

\end{enumerate}
\end{document}


%!TEX root = ../TTT4150-Summary.tex
\section{Spherical geometry}

\begin{figure}[htbp]
	\centering
	\includegraphics[width=.6\linewidth]{img/spherical_triangle}
	\caption{A triangle on a sphere}
	\label{fig:spherical-triangle}
\end{figure}
A triangle on a sphere is defined by three points on the sphere, as in Figure \ref{fig:spherical-triangle}. Each corner $A$, $B$, and $C$ has an angle, and each line/arc segment has an angle $a$, $b$, and $c$.

Modified cosine rules
\begin{equation}
\begin{split}
	\cos a &= \cos b \cdot \cos c + \sin b \cdot \sin c \cdot \cos A \\
	\cos b &= \cos c \cdot \cos a + \sin c \cdot \sin a \cdot \cos B \\
	\cos c &= \cos a \cdot \cos b + \sin a \cdot \sin b \cdot \cos C
\end{split}
\end{equation}
and sine rules
\begin{equation}
	\frac{\sin A}{\sin a} = \frac{\sin B}{\sin b} = \frac{\sin C}{\sin c}
\end{equation}
apply.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Intersection between great circles}

Each great circle is defined by two points on the surface of a sphere.
\begin{enumerate}
	\item Convert the points to cartesian coordinates.
	\item blabla
\end{enumerate}


\chapter{Contrast Enhancement}
\section{Introduction}
Because some features are hardly detectable by eye in an image, we
often transform it before display. Histogram equalization is
one the most well-known methods for contrast enhancement.
Such an approach is generally useful for images
with a poor  intensity distribution. Since edges play a fundamental
role in image understanding, a way to enhance the contrast is to
enhance the edges. For example, we can add to the original image its Laplacian
($I^{'}= I + \gamma \Delta I$, where $\gamma$ is a parameter). Only
features at the finest scale are enhanced (linearly). For a high
$\gamma$ value, only the high frequencies are visible.
Multiscale edge enhancement \cite{col:velde99} can be seen
as a generalization of this approach to all resolution levels.

In color images, objects can exhibit variations in color saturation
with little or no correspondence in luminance variation.
Several methods have been proposed in the past for color image
enhancement \cite{col:toet92}.
  The retinex concept was introduced by Land \cite{col:land86} as a model
for human color constitancy.
The single scale retinex (SSR) method \cite{col:jobson97a} consists of
applying the following transform to each band $i$ of the color image:
\begin{eqnarray}
R_i(x,y) = \log( I_i(x,y)) - \log(F(x,y) * I_i(x,y))
\end{eqnarray}
where $R_i(x,y)$ is the retinex output, $I_i(x,y)$ is the image
distribution in the $i$th spectral band, and $F$ is a Gaussian function.
A gain/offset is applied to the retinex output which clips the highest and
lowest signal excursions. This can be done by a k-sigma clipping.
The retinex method is efficient for dynamic range compression, but does not provide good
tonal rendition \cite{col:rahman96}.
The Multiscale Retinex (MSR) combines several SSR outputs to produce
a single output image which has both good dynamic range compression and
color constancy, and good tonal rendition \cite{col:jobson97b}.
The MSR can be defined by:
\begin{eqnarray}
R_{MSR_i} = \sum_{j=1}^N w_j R_{i,j}
\end{eqnarray}
with
\begin{eqnarray}
R_{i,j}(x,y) = \log( I_i(x,y)) - \log(F_j(x,y) * I_i(x,y))
\end{eqnarray}
$N$ is the number of scales, $R_{i,j}$ is the $i$th spectral
component of the MSR output, and $w_j$ is the weight associated with
the scale $j$. The Gaussian $F_j$ is given by:
\begin{eqnarray}
F_j(x,y) = K \exp{- {r^2 \over c_j^2}}
\end{eqnarray}
$c_j$ defines the width of the Gaussian.
In \cite{col:jobson97b}, three scales were recommended with $c_j$ values
equal respectively to 15,80,250, and all weights $w_j$ fixed to ${1 \over N}$.
The Multiscale Retinex introduces the concept of multiresolution for
contrast enhancement. Velde \cite{col:velde99} has explicitly introduced
the wavelet transform and has proposed an algorithm which modifies the
wavelet coefficients in order to amplify faint features.
% \section{Contrast Enhancement using the Wavelet Transform}
% Velde \cite{col:velde99} proposed  to use the wavelet transform
% for edge enhancement.
 The idea is to first transform the image
using the dyadic wavelet transform (two directions per scale).
The gradient $G_{j,k}$ at scale $j$ and at pixel location $k$
is calculated at each scale $j$ from
the wavelet coefficients $w_{j,k}^{(h)}$ and  $w_{j,k}^{(v)}$ relative to
the horizontal and vertical wavelet bands:
$G_{j,k} = \sqrt{ (w_{j,k}^{(h)})^2 + (w_{j,k}^{(v)})^2}$. Then the two
wavelet coefficients at scale $j$ and at position $k$
are multiplied by  $y(G_{j,k})$, where $y$ is defined by:
\begin{eqnarray}
  y(x) & = & ({m \over c})^p \mbox{ if } \mid x \mid < c \nonumber \\
  y(x) & = & ({m \over \mid x \mid })^p  \mbox{ if } c \le \mid x \mid < m \nonumber \\
  y(x) & = & 1  \mbox{ if } \mid x \mid \ge m
\label{eqn_velde}
\end{eqnarray}
\begin{figure}[htb]
\vbox{
\centerline{
\hbox{
\psfig{figure=fig_velde.ps,bbllx=3cm,bblly=13cm,bburx=20cm,bbury=25.cm,width=6.5cm,height=4cm,clip=}
}}
}
\caption{Enhanced coefficients versus  original coefficients.
Parameters are m=30, c=3 and p=0.5.
}
\label{fig_velde}
\end{figure}
Three parameters are needed: $p$, $m$ and $c$.
$p$ determines the degree of non-linearity in the nonlinear rescaling
of the luminance, and must be in $]0,1[$.
Coefficients larger than $m$ are not modified by the algorithm.
The $c$ parameter corresponds to the noise level.
Figure~\ref{fig_velde} shows the modified wavelet coefficients versus
the original wavelet coefficients for a given set of parameters
($m=30$, $c=3$ and $p=0.5$).
Finally, the enhanced image is obtained by the inverse wavelet transform
from the modified wavelet coefficients.
For color images, a similar method can be used, but by calculating
the multiscale gradient $\Gamma_{j,k}$ from the multiscale gradient of
the three $L$, $u$, $v$ components: $\Gamma_j(i) = \sqrt{ \parallel G_{j,k}^L \parallel^2 +
                     \parallel G_{j,k}^u \parallel^2 +
		     \parallel G_{j,k}^v \parallel^2 }$.
All wavelet coefficients at scale $j$ and at position $k$
are multiplied by $y(\Gamma_{j,k})$,  the enhanced $\tilde L$, $\tilde u$, $\tilde v$ components are reconstructed
from the modified wavelet coefficients, and
the ($\tilde L$,$\tilde u$,$\tilde v$) image is transformed into
an RGB image. More details can be found in \cite{col:velde99}.

Wavelet bases present some limitations,
because they are not adapted to the detection of highly anisotropic elements,
such as alignments in an image, or sheets in a cube.
Recently, other multiscale
systems like ridgelets \cite{Harmnet} and
curvelets \cite{Curvelets-StMalo,starck:sta01_3}
which are very different from wavelet-like systems have been developed.
Curvelets and ridgelets take  the form of basis elements which
exhibit very high directional sensitivity and are highly anisotropic.
The curvelet transform uses the ridgelet transform in its digital
implementation. We first describe the ridgelet and the curvelet
transform, then we show how contrast enhancement can be obtained
from the curvelet coefficients.

\section{Contrast Enhancement by the Cur\-ve\-let Trans\-form}

Since the curvelet transform is well-adapted to represent images containing edges,
it is a good candidate for edge enhancement \cite{starck:capri02,starck:sta02_4}.
Curvelet coefficients
can be modified in order to enhance edges in an image. A function $y_c$
must be defined which modifies the values of the curvelet
coefficients. It could be a function similar to the one defined for the
wavelet coefficients \cite{col:velde99} (see equation~\ref{eqn_velde}).
This function presents however the drawback of amplifying the noise (linearly)
as well as the signal of interest. We introduce explicitly the noise standard
deviation $\sigma$ in the equation:
\begin{eqnarray}
  y_c(x, \sigma) & = & 1 \mbox{ if }   x < c \sigma \nonumber \\
  y_c(x, \sigma) & = & \frac{x-c\sigma}{c \sigma}(\frac{m}{c \sigma})^p + \frac{2c\sigma-x}{c \sigma}  \mbox{ if } x < 2c \sigma \nonumber \\
  y_c(x, \sigma) & = & (\frac{m}{x})^p  \mbox{ if } 2c\sigma \le x < m \nonumber \\
  y_c(x, \sigma) & = & (\frac{m}{x})^s \mbox{ if }x \ge m
\label{eqn_velde_curve}
\end{eqnarray}

\begin{figure}[htb]
\centerline{
\hbox{
\psfig{figure=fig_velde_mod.ps,bbllx=3cm,bblly=13cm,bburx=20cm,bbury=25.cm,width=6.5cm,height=4cm,clip=}
\psfig{figure=fig_velde_mod_sat.ps,bbllx=3cm,bblly=13cm,bburx=20cm,bbury=25cm,width=6.5cm,height=4cm,clip=}
}}
\caption{Enhanced coefficients versus  original coefficients. Left,
parameters are m=30,c=0.5,s=0, and p=0.5. Right,
parameters are m=30,c=0.5,s=0.7,p=0.9.
}
\label{fig_velde_cur_enhance}
\end{figure}

We have fixed $m=c=p=0.5$ and $s=0$ in all our experiments. $p$ determines
the
degree of non-linearity and $s$ introduces a saturation.
$c$ becomes a normalized parameter, and a $c$ value larger than $3$
guaranties that the noise
will not be amplified. The $m$ parameter can be defined either from
the noise standard deviation ($m = K_m \sigma$) or from the maximum curvelet
coefficient $M_c$ of the relative band ($m = l M_c$, with $l < 1$). The first
choice allows the user to define the coefficients to amplify as a function
of their signal-to-noise ratio, while the second one gives an easy
and general way to fix the $m$ parameter independently of the range of the
pixel values. Figure~\ref{fig_velde_cur_enhance} shows the curve representing
the enhanced coefficients versus the original coefficients for two
sets of parameters. In the second case, a saturation is added.

The curvelet enhancement method for grayscale images consists of
the following steps:
\begin{enumerate}
\item Estimate the noise standard deviation $\sigma$ in the input
image $I$.
\item Calculate the curvelet transform of the input image. We get a set
of bands $w_{j}$, each band $w_j$ contains $N_j$ coefficients
and corresponds to a given resolution level.
\item Calculate the noise  standard deviation $\sigma_j$ for each
band $j$ of the curvelet transform (see \cite{starck:sta01_3} more
details on this step).
\item For each band $j$ do
\begin{itemize}
\item Calculate the maximum $M_j$ of the band.
\item Multiply each curvelet coefficient $w_{j,k}$ by $y_c(\mid w_{j,k} \mid ,\sigma_j)$.
\end{itemize}
\item Reconstruct the enhanced image from the modified curvelet coefficients.
\end{enumerate}

For color images, we apply first the curvelet transform on the
three components $L,u,v$. For each cur\-velet coef\-fi\-cient, we
cal\-cu\-la\-te $e = \sqrt{ c_L^2 + c_u^2 + c_v^2}$, where $(c_L, c_u, c_v)$
are respectively the curvelet coefficients of the three components,
and the mo\-di\-fied coef\-fi\-cients are obtained by:
$(\tilde c_L, \tilde  c_u, \tilde c_v) =
(y_c(e, \sigma)c_L , y_c(e, \sigma)c_u, y_c(e, \sigma)c_v)$.

Values in the enhanced components can be larger than the
authorized upper limit (in general $255$),
and we found it necessary to add a final step to our method, which is
a sigma-clipping saturation.

\section{Examples}
\subsubsection*{Saturn Image}
\begin{figure}[htb]
\centerline{
\vbox{
\hbox{
\psfig{figure=fig_sat512.ps,bbllx=1.8cm,bblly=12.7cm,bburx=14.5cm,bbury=25.4cm,width=8cm,height=8cm,clip=}
\psfig{figure=fig_sat_contrast_histo.ps,bbllx=1.8cm,bblly=12.7cm,bburx=14.5cm,bbury=25.4cm,width=8cm,height=8cm,clip=}
}
\hbox{
\psfig{figure=fig_sat_contrast_wedge.ps,bbllx=1.8cm,bblly=12.7cm,bburx=14.5cm,bbury=25.4cm,width=8cm,height=8cm,clip=}
\psfig{figure=fig_sat_contrast_cur.ps,bbllx=1.8cm,bblly=12.7cm,bburx=14.5cm,bbury=25.4cm,width=8cm,height=8cm,clip=}
}}
}
\caption{Top, Saturn image and its histogram equalization. Bottom,
enhancement image by the wavelet transform and the curvelet transform.}
\label{fig_saturn_cur_enhance}
\end{figure}

Figure~\ref{fig_saturn_cur_enhance} shows respectively from left to right
and from top to bottom
the Saturn image, the histogram equalized image, the wavelet multiscale
edge enhanced image and the curvelet multiscale
edge enhanced image (parameters were $s=0$, $p=0.5$, $c=3$, and $l=0.5$).
The curvelet multiscale edge enhanced image shows clearly better the
rings and edges of Saturn.

\subsubsection*{Satellite Image}
\begin{figure}[htb]
\centerline{
\vbox{
\hbox{
\psfig{figure=fig_marseille.ps,bbllx=1.9cm,bblly=12.8cm,bburx=14.6cm,bbury=25.5cm,width=10.cm,height=10cm,clip=}
}
\hbox{
\psfig{figure=fig_cur_marseille.ps,bbllx=1.9cm,bblly=12.8cm,bburx=14.6cm,bbury=25.5cm,width=10.cm,height=10cm,clip=}
}}
}
\caption{Top, grayscale image, and bottom,
curvelet enhanced image.}
\label{fig_marseille_bw_cur_enhance}
\end{figure}

\begin{figure}[htb]
\centerline{
\vbox{
\hbox{
\psfig{figure=kodak140501.ps,bbllx=5.9cm,bblly=8.1cm,bburx=15cm,bbury=21.7cm,width=5.5cm,height=8cm,clip=}
\psfig{figure=kodak140501_ret.ps,bbllx=5.9cm,bblly=8.1cm,bburx=15cm,bbury=21.7cm,width=5.5cm,height=8cm,clip=}
}
\hbox{
\psfig{figure=kodak140501_mret.ps,bbllx=5.9cm,bblly=8.1cm,bburx=15cm,bbury=21.7cm,width=5.5cm,height=8cm,clip=}
\psfig{figure=kodak140501_cur.ps,bbllx=5.9cm,bblly=8.1cm,bburx=15cm,bbury=21.7cm,width=5.5cm,height=8cm,clip=}
}}
}
\caption{Top, color image (Kodak picture of the day 14/05/02) and retinex
method. Bottom, multiscale retinex method and multiscale edge enhancement.}
\label{fig_kodak_col_wt_enhance}
\end{figure}

\begin{figure}[htb]
\centerline{
\vbox{
\hbox{
\psfig{figure=K111201.ps,bbllx=4.3cm,bblly=10.8cm,bburx=16.7cm,bbury=19.1cm,width=12.5cm,height=8.2cm,clip=}
}
\hbox{
\psfig{figure=K111201_cur.ps,bbllx=4.3cm,bblly=10.8cm,bburx=16.7cm,bbury=19.1cm,width=12.5cm,height=8.2cm,clip=}
}}
}
\caption{Left, color image (Kodak picture of the day 11/12/01), and right,
curvelet enhanced image.}
\label{fig_kodak2_col_cur_enhance}
\end{figure}

Figure~\ref{fig_marseille_bw_cur_enhance}
shows the results for the enhancement of a grayscale satellite image, and
Figure~\ref{fig_kodak_col_wt_enhance}
shows the results for the enhancement of a color image (Kodak image of
the day 14/05/01) by the retinex,
the multiscale retinex and the curvelet multiscale edge enhancement methods.
 Figure~\ref{fig_kodak2_col_cur_enhance}
shows the results for the enhancement of a color image (Kodak image of
the day 11/12/01).

\section{Discussion}
A number of properties, respected by the curvelet filtering
described here, are important for contrast stretching:
\begin{enumerate}
\item Noise must not be amplified in enhancing edges.
\item Colors should not be unduly modified.  In multiscale retinex,
for example, a tendancy towards increased grayness is seen.  This is
not the case using curvelets.
\item It is very advantageous if block effects do not occur.
Block overlapping is usually not necessary in curvelet-based contrast
enhancement, unlike in the case of noise filtering.
\end{enumerate}
% A range of further examples can be seen at \\
% http://www-stat.stanford.edu/$\sim$jstarck/contrast.html.

% \clearpage
% \newpage


\section{Ordinary differential equations}

For the clearest description of the model, we refer the reader to our code repository, because our object-oriented approach to software development is intended to be highly transparent and readable. For those who prefer dynamical systems such as this presented in the form of ordinary differential equations, we present the following.

\[\frac{dS_{a,g}}{dt}=-\lambda_{a,g}(t) \sigma_{a} S_{a,g}\]
\[\frac{dE_{a,g,q=1}}{dt}=\lambda_{a,g}(t) \sigma_{a} S_{a,g} -\alpha E_{a,g,q=1} - \chi(t) E_{a,g,q=1} \]
\[\frac{dE_{a,g,q=2}}{dt}=-\alpha E_{a,g,q=2} + \chi(t) E_{a,g,q=1} \]
\[\frac{dP_{a,c,g,q}}{dt}=p_{a,c}(t) \alpha E_{a,g,q}-\nu P_{a,c,g,q}\]
\[\frac{dI_{a,c,g,q}}{dt}=\nu P_{a,c,g,q}-\gamma_{c}I_{a,c,g,q}\]
\[\frac{dL_{a,c,g,q}}{dt}=\gamma_{c}I_{a,c,g,q}-\delta_{a,c}L_{a,c,g,q}-\mu_{a,c}L_{a,c,g,q}\]
\[\frac{dR_{a,g}}{dt}=\sum_{c,q}{}\delta_{a,c}L_{a,c,g,q}\]
where
\[\lambda_{a,g}=\beta \sum_{g'}\textbf{G}_{g,g'} \sum_{j,c}\frac{\epsilon P_{j,c,g'}(t)+\iota_{c}I_{j,c,g'}(t)+\kappa_{c}L_{j,c,g'}(t)}{N_{j,g'}(t)} C_{a,j}(t)\]

\[\sum_{c}p_{a,c}(t)=1,\forall t\in\mathbb{R}\]

\[\chi(t) = \frac{\alpha q(t) u(t)}{1 - q(t) u(t)}\]

\[\textbf{C}_{0}=\textbf{C}_{H}+\textbf{C}_{S}+\textbf{C}_{W}+\textbf{C}_{L}\]

\[\textbf{C}_{g}(t)=\textbf{C}_{H}+s_{g}(t)^{2}\textbf{C}_{S}+w_{g}(t)^{2}\textbf{C}_{W}+l_{g}(t)^{2}\textbf{C}_{L}\]

\[l_{g}(t)=\frac{re_{g}(t)+gr_{g}(t)+pa_{g}(t)+tr_{g}(t)}{4}\]

\begin{table}[ht]
\renewcommand{\baselinestretch}{1}
    	\begin{tabular}{| p{2cm} | p{11.1cm} |}
    	\hline
    		Symbol & Explanation \\
	    	\hline
	    	$S$ & Persons susceptible to infection \\
    		$E$ & Persons in the non-infectious incubation period \\
    		$P$ & Persons in the incubation period \\
    		$I$ & Persons in the early active disease period, before isolation or hospitalisation may occur \\
    		$L$ & Persons in the late active disease period, after isolation or hospitalisation may have occurred \\
    		$R$ & Persons in the recovered period, from which re-infection cannot occur \\
    		\hline
	\end{tabular}
\end{table}

\begin{table}[ht]
\renewcommand{\baselinestretch}{1}
    	\begin{tabular}{| p{2cm} | p{11.1cm} |}
    	\hline
    		Symbol & Explanation \\
    		\hline
    		\textit{t} & Time  \\
    		$_{\textit{a}}$ & Compartment of age group a \\
    		$_{\textit{c}}$ & Compartment of clinical stratification c \\
    		$_{\textit{g}}$ & Compartment of geographical service stratification g \\
    		$_{\textit{q}}$ & Compartment of tracing stratification q \\
    		$\alpha$ & Rate of progression from non-infectious to infectious incubation period \\
    		$\nu$ & Rate of progression from infectious incubation to early active disease \\
    		$\gamma$ & Rate of progression from early active disease to late active disease \\
    		$\mu$ & Rate of disease-related death \\
    		$\epsilon$ & Relative infectiousness of pre-symptomatic compartment \\
    		$\iota$ & Clinical stratification infectiousness vector for early active compartment \\
    		$\kappa$ & Clinical stratification infectiousness vector for late active compartments \\
    		$\beta$ & Probability of infection per contact between an infectious and susceptible individual \\
	    	\textit{j} & Infectious populations \\
    		\textit{p} & Proportion progressing to each clinical stratification \\
    		\textbf{G} & Square matrix of dimensions \(9 \times 9\) for nine services, as presented in Table \ref{tab:intercluster_mixing} \\
    \hline
	\end{tabular}
\end{table}

\begin{table}[ht]
\renewcommand{\baselinestretch}{1}
    	\begin{tabular}{| p{2cm} | p{11.1cm} |}
    	\hline
    	Symbol & Explanation \\
    	\hline
    	\textbf{C} & Mixing matrix \\
    	\textbf{H} & Household contribution to mixing matrix \\
    	\textbf{W} & Workplace contribution to mixing matrix \\
    	\textbf{O} & Other locations contribution to mixing matrix \\
    	\textbf{S} & Schools contribution to mixing matrix \\
    	\textit{l} & Other locations macrodistancing function of time \\
    	\textit{w} & Function fit to Google mobility data for workplaces \\
    	\textit{s} & Function fit to Google mobility data for schools \\
    	\textit{re} & Function fit to Google mobility data for retail and recreation \\
    	\textit{gr} & Function fit to Google mobility data for grocery and pharmacy \\
    	\textit{pa} & Function fit to Google mobility data for parks \\
    	\textit{tr} & Function fit to Google mobility data for transit stations \\
    	\hline
	\end{tabular}
\end{table}


\chapter{Naive Bayes}
\label{ch:naive_bayes}

Naive Bayes \marginnote{Naive Bayes assumes class-wise independent features. For a data set where features would actually be independent, which rarely happens in practice, the naive Bayes would be the ideal classifier.} is also a classification method. To see how naive Bayes works, we will use a data set on passengers' survival in the Titanic disaster of 1912. The \textit{Titanic} data set describes 2201 passengers, with their tickets (first, second, thirds class or crew), age and gender.

\begin{figure}[h]
    \centering
    \vspace{-0.2cm}
    \includegraphics[scale=0.4]{workflow.png}
\end{figure}

We inspect naive Bayes models with the \widget{Nomogram} widget. There, we see a scale 'Points' and scales for each feature. Below we can see probabilities. Note the 'Target class' in upper left corner. If it is set to 'yes', the widget will show the probability that a passenger survived.

The nomogram shows that gender was the most important feature for survival. If we move the blue dot to 'female', the survival probability increases to 73\%. Furthermore, if that woman also travelled in the first class, she survived with probability of 90\%. The bottom scales show the conversion from feature contributions to probability.

\begin{figure}[h]
    \centering
    \includegraphics[scale=0.45]{nomogram.png}
    \caption{According to the probability theory individual contributions should be multiplied. Nomograms get around this by working in a log-space: a sum in the log-space is equivalent to multiplication in the original space. Therefore nomograms sum contributions (in the log-space) of all feature values and then convert them back to probability.}
\end{figure}


\section*{Exercises}

\begin{ex}
  Let $D=\begin{mymatrix}{rrr}
    -2 & 0 & 0 \\
    0 & 1 & 0 \\
    0 & 0 & 2 \\
  \end{mymatrix}$ and
  $E=\begin{mymatrix}{rrr}
    1 & 0 & 0 \\
    0 & -1 & 0 \\
    0 & 0 & 3 \\
  \end{mymatrix}$.
  Find $D+E$, $DE$, and $D^7$.
\end{ex}

\begin{ex}
  Find the eigenvalues and eigenvectors of the matrix
  \begin{equation*}
    \begin{mymatrix}{rrr}
      -13 & -28 & 28 \\
      4 & 9 & -8 \\
      -4 & -8 & 9
    \end{mymatrix}.
  \end{equation*}
  One eigenvalue is $3$. Diagonalize if possible.
  \begin{sol}
    The eigenvectors and eigenvalues are:
    \begin{equation*}
      \set{\begin{mymatrix}{c}
          2 \\
          0 \\
          1
        \end{mymatrix},
        \begin{mymatrix}{c}
          -2 \\
          1 \\
          0
        \end{mymatrix}} ~\mbox{for eigenvalue}~ {1},
      \quad
      \set{\begin{mymatrix}{c}
          7 \\
          -2 \\
          2
        \end{mymatrix}} ~\mbox{for eigenvalue}~ {3}.
    \end{equation*}
    The matrix $P$ needed to diagonalize the above matrix is
    \begin{equation*}
      \begin{mymatrix}{rrr}
        2 & -2 & 7 \\
        0 & 1 & -2 \\
        1 & 0 & 2
      \end{mymatrix}
    \end{equation*}
    and the diagonal matrix $D$ is
    \begin{equation*}
      \begin{mymatrix}{rrr}
        1 & 0 & 0  \\
        0 & 1 & 0 \\
        0 & 0 & 3
      \end{mymatrix}.
    \end{equation*}
  \end{sol}
\end{ex}

\begin{ex}
  Find the eigenvalues and eigenvectors of the matrix
  \begin{equation*}
    \begin{mymatrix}{rrr}
      5 & -18 & -32 \\
      0 & 5 & 4 \\
      2 & -5 & -11
    \end{mymatrix}.
  \end{equation*}
  One eigenvalue is $1$. Diagonalize if possible.
  \begin{sol}
    The eigenvalues are $-1$ and $1$. The eigenvectors corresponding to
    the eigenvalues are:
    \begin{equation*}
      \set{\begin{mymatrix}{c}
          10 \\
          -2 \\
          3
        \end{mymatrix}} ~\mbox{for eigenvalue}~ {-1},
      \quad
      \set{\begin{mymatrix}{c}
          7 \\
          -2 \\
          2
        \end{mymatrix}} ~\mbox{for eigenvalue}~ {1}.
    \end{equation*}
    Since there are only 2 linearly independent eigenvectors, this
    matrix is not diagonalizable.
  \end{sol}
\end{ex}

\begin{ex}
  Find the eigenvalues and eigenvectors of the matrix
  \begin{equation*}
    \begin{mymatrix}{rrr}
      8 &   0 &  10 \\
      -6 &  -3 &  -6 \\
      -5 &   0 &  -7 \\
    \end{mymatrix}.
  \end{equation*}
  One eigenvalue is $-3$. Diagonalize if possible.
  \begin{sol}
    The eigenvectors and eigenvalues are:
    \begin{equation*}
      \set{\begin{mymatrix}{c}
          0 \\
          1 \\
          0
        \end{mymatrix}} ~\mbox{for eigenvalue}~ {-3},
      \quad
      \set{\begin{mymatrix}{c}
          -2 \\
          1 \\
          1
        \end{mymatrix}} ~\mbox{for eigenvalue}~ {3},
      \quad
      \set{\begin{mymatrix}{c}
          -1 \\
          0 \\
          1
        \end{mymatrix}} ~\mbox{for eigenvalue}~ {-2}.
    \end{equation*}
    The matrix $P$ needed to diagonalize the above matrix is
    \begin{equation*}
      \begin{mymatrix}{rrr}
        0 &  -2 &  -1 \\
        1 &   1 &   0 \\
        0 &   1 &   1 \\
      \end{mymatrix}
    \end{equation*}
    and the diagonal matrix $D$ is
    \begin{equation*}
      \begin{mymatrix}{rrr}
        -3 &   0 &   0 \\
        0 &   3 &   0 \\
        0 &   0 &  -2 \\
      \end{mymatrix}.
    \end{equation*}
  \end{sol}
\end{ex}

\begin{ex}
  Find the eigenvalues and eigenvectors of the matrix
  \begin{equation*}
    \begin{mymatrix}{rrr}
      -1 & -2 & 2 \\
      0 & 5 & -8 \\
      0 & 4 & -7 \\
    \end{mymatrix}.
  \end{equation*}
  One eigenvalue is $1$. Diagonalize if possible.
  % \begin{sol}
  % \end{sol}
\end{ex}

\begin{ex}
  Find the eigenvalues and eigenvectors of the matrix
  \begin{equation*}
    \begin{mymatrix}{rrr}
      2 &  -1 &   6 \\
      -4 &  -1 &  -6 \\
      -2 &   1 &  -6 \\
    \end{mymatrix}.
  \end{equation*}
  One eigenvalue is $0$. Diagonalize if possible.
  % \begin{sol}
  % \end{sol}
\end{ex}

\begin{ex}
  Find the eigenvalues and eigenvectors of the matrix
  \begin{equation*}
    \begin{mymatrix}{rrr}
      3 &  -1 &   0 \\
      1 &   4 &  -1 \\
      -1 & -1 &   4 \\
    \end{mymatrix}
  \end{equation*}
  One eigenvalue is $3$. Diagonalize if possible.
  % \begin{sol}
  % \end{sol}
\end{ex}


\chapter{Conclusion and Outlook}

\section{Summary}
We defined an algebraic graph structure that expresses the Collatz sequences in the form of a tree. Next, the vertex reachability properties were unveiled by examining the relationship between successive nodes in $H_C$. Moreover, we dealt with graphs that represent other variants of Collatz sequences, for instance $5x+1$ or $181x+1$. The interesting part of both variants just mentioned is that for these sequences the existence of cycles is known. With regard to a proof of the Collatz conjecture, theorems~\ref{theo:2} and \ref{theo:3} seem promising. They serve as the basis for further investigations of the problem.

\section{Further Research}
In subsequent studies, the properties of vertices in $H_C$ might be elaborated upon more closely by taking into account a vertex's label as well as its properties. In addition, future steps may include a detailed analysis of theorems~\ref{theo:2} and \ref{theo:3}.


% 13riemannianmetrics.tex
% Fund Science! & Help Ernest finish his Physics Research! : quantum super-A-polynomials - a thesis by Ernest Yeung
% ernestyalumni.tilt.com
%
% Facebook     : ernestyalumni
% github       : ernestyalumni
% gmail        : ernestyalumni
% google       : ernestyalumni
% linkedin     : ernestyalumni
% tumblr       : ernestyalumni
% twitter      : ernestyalumni
% youtube      : ernestyalumni
% tilt.com    : ernestyalumni
%
% Ernest Yeung was supported by Mr. and Mrs. C.W. Yeung, Prof. Robert A. Rosenstone, Michael Drown, Arvid Kingl, Mr. and Mrs. Valerie Cheng, and the Foundation for Polish Sciences, Warsaw University.

\subsection*{Riemannian Manifolds}

Riemannian metric on $M$ - smooth symmetric 2-tensor field positive definite at each pt.   \\

Riemannian manifold - pair $(M,g)$ \\

If $g$ on $M$, then $\forall \, p \in M$, $g_p$ inner product on $T_pM$.  Because of this, we will often use the notation $\langle X, Y\rangle_g$ to denote

\[
g_p(X,Y) \in \mathbb{R} \quad \, \forall \, X, Y \in T_pM
\]

$\forall \, $ smooth, local coordinates $(x^i)$, write Riemannian metric
\[
g=g_{ij} dx^i \otimes dx^j
\]

where $g_{ij}$ symmetric positive definite matrix of smooth functions.  $g_{ij} = g_{ji}$

\[
\begin{gathered}
  g = g_{ij} dx^i \otimes dx^j = \frac{1}{2} (g_{ij} dx^i \otimes dx^j + g_{ji} dx^i \otimes dx^j ) = \frac{1}{2} (g_{ij} dx^i \otimes dx^j + g_{ij} dx^j \otimes dx^i ) = \\
  = g_{ij} dx^i dx^j \quad \, (\text{by Prop. 12.15(b)}) \quad \, \text{Notice that $dx^idx^j$ is symmetrized!}
\end{gathered}
\]

\textbf{Example 13.1 (The Euclidean Metric)}  Euclidean metric on $\mathbb{R}^n$, defined in standard coordinates
\[
g = \delta_{ij} dx^i dx^j
\]

It is common to use the abbreviation $\omega^2$ for the symmetric product of a tensor $\omega$ with itself, so the Euclidean metric can also be writen
\[
\overline{g} = (dx^1)^2 + \dots + (dx^n)^2
\]

Applied to $v,w \in T_p\mathbb{R}^n$
\[
\overline{g}_p(v,w) = \delta_{ij} v^i w^j = \sum_{i=1}^n v^i w^i = v\cdot w
\]
under coordinate change, use Corollary 11.10

\begin{proposition}[13.3] \textbf{(Existence of Riemannian Metrics)} \\
                          $\forall \, $ smooth manifold $M$, $M$ with or without $\partial M$, $\exists \, $ Riemannian metric $g$
\end{proposition}

\begin{proof}
Choose covering of $M$ by smooth coordinate charts $(U_{\alpha}, \varphi_{\alpha})$ \\
$\overline{g}$ Euclidean metric \\
$\forall \, U_{\alpha}$, $\exists \, $ Riemannian metric $g_{\alpha} = \varphi_{\alpha}^* \overline{g}$
\[
\varphi_{\alpha} : U_{\alpha} \to \mathbb{R}^n
\]
Let $\lbrace \psi_{\alpha} \rbrace$ smooth partition of unity subordinate to cover $\lbrace U_{\alpha} \rbrace$

Define $g= \sum_{\alpha} \psi_{\alpha} g_{\alpha}$

s.t. $\forall \, g_{\alpha}$, $\psi_{\alpha} g_{\alpha} = 0$ outside $\text{supp}{\psi_{\alpha}}$

By local finiteness, $\exists \, $ only finitely many $\psi_{\alpha} g_{\alpha} \neq 0$ in neighborhood of each pt.

so $g= \sum_{\alpha} \psi_{\alpha} g_{\alpha}$ defines a smooth tensor field

\end{proof}

defined on Riemannian manifold $(M,g)$

\begin{itemize}
  \item length or norm of $X \in T_pM$ defined

\[
|X|_g = \langle X, X \rangle_g^{1/2} = g_p(X,X)^{1/2}
\]
\item angle between $X,Y \in T_pM$, $X,Y \neq 0$ is unique $\theta \in [0,\pi]$ satisfying
\[
\cos{\theta} = \frac{ \langle X,Y \rangle_g }{ |X|_g |Y|_g}
\]
\item $X,Y \in T_pM$ orthogonal if $\langle X,Y\rangle_g = 0$
\item If $\gamma:[a,b] \to M$ piecewise smooth curve segment, length of $\gamma$ is
\[
L_g(\gamma) = \int_a^b |\gamma'(t)|_g dt
\]
\end{itemize}

Just as we did in Chapter 8 for $\mathbb{R}^n$ \\ % (pp. 253), \\
\quad define orthonormal frame for $M$ to be local frame $(E_1 \dots E_n)$ defined on some open subset $U \subset M$ s.t. \\
\quad \quad $( \left. E_1 \right|_p \dots \left. E_n \right|_p )$ orthonormal basis for $T_pM$ \quad \, $\forall \, p \in U$, or equivalently s.t. $\langle E_i, E_j \rangle_g = \delta_{ij}$ \\

Example 13.14.  coordinate frame $\left( \frac{ \partial }{ \partial x^i} \right)$ global orthonormal frame on $\mathbb{R}^n$

\begin{corollary}[13.8] (Existence of Local Orthonormal Frames).  Let $(M,g)$ Riemannian manifold. \\
$\forall \, p \in M$, $\exists \, $ smooth orthonormal frame on neighborhood of $p$.
\end{corollary}

Observe Corollary 13.8.  doesn't show that $\exists \, $ smooth coordinates near $p$ for which coordinate frame is orthonormal. \\

\subsubsection*{Pullback Metrics}

Suppose $\begin{aligned} & \quad \\
  & (M,g) \\
  & (\widetilde{M}, \widetilde{g}) \end{aligned}$ \quad Riemannian manifolds.  \\

isometry - smooth $F: M \to \widetilde{M}$ if $F$ diffeomorphism s.t. $F^* \widetilde{g} = g$ \\
if $\exists \, $ isometry $F$, $M, \widetilde{M}$ isometric. \\
$F$ local isometry is $\forall \, p \in M$, $\exists \, $ neighborhood $U$ s.t. $\left. F \right|_U$ isometry of $U$ onto open $\widetilde{U} \subset M$ \\
$g$ on $M$ flat if $\forall \, p \in M$, $\exists \,$ neighborhood $U\subset M$ s.t. $(U , \left. g \right|_U)$ isometric to open $\widetilde{U} \subset \mathbb{R}^n$ with Euclidean metric.   \\

\staveXXIX

Prob. 11-14 shows $\exists \, $ only if metric flat.

\subsubsection*{Riemannian Submanifolds}

\subsection*{Riemannian Submanifolds}

$S\subset M$ \\
define $ \left. g \right|_S = i^* g$, for $i:S \hookrightarrow M$
\[
( \left. g \right|_S)(X,Y) = i^* g(X,Y) = g( i_* X,i_* Y) = g(X,Y)
\]

20131023 EY

in general, $S \subset M$ \\
$F:S \to M$
e.g. $\begin{aligned} & \quad \\
  & F(u^1, u^2) = (x^1, x^2, x^3 ) \\
  & F(u^1 \dots u^s ) = (x^1 \dots x^m) \text{ s.t. } s\leq m \quad (\text{for this case}) \end{aligned}$

Note
\[
x^i = x^i(u^1 \dots u^s ) \text{ or e.g. } x^2 = x^2(u^1, u^2 )
\]

Recall these facts about pullbacks and pushforwards.

\[
\begin{aligned}
  & F^*: T_{F(p)}M \to T_pS \quad (\text{pullback!}) \\
  & F_*: T_pS \to T_{F(p)}M \quad (\text{push forward; remember we can only pushforward if $F$ diffeomorphism, i.e. $F,F^{-1}$ diff. and $F$ bijective}) \\
  &  F^*: \tau^2(M) \to \tau^2(S) \quad (\text{can always pullback tensors; in this case (rank 2)})
\end{aligned}
\]

Consider charts $(U,u)$, $p\in U\subset S$, $(V,x)$, \, $F(p) \in V \subset M$, $V \subset F(U)$ \\
\quad For $f:M \to \mathbb{R}$, i.e. $f\in \mathcal{C}^{\infty}(M)$ \\
\quad $fF: S \to \mathbb{R}$ i.e. $fF \in \mathcal{C}^{\infty}(S)$
\[
fF = f(x^i)^{-1}x^i F(u^j)^{-1} u^j = (f(x^i)^{-1})(x^i F(u^j)^{-1})u^j = f(x^i(u^j))
\]

Consider $\overline{g}(x_i,x_j)$ \\
\phantom{Consider } $\overline{g} = \delta_{ij} dx^i dx^j$ ($\overline{g}$ as a tensor (rank 2) in its local coordinate form, with coordinates $y^i$.  So $\overline{g}$ is (like, or is) a Euclidean metric)

\[
F_* E_i(f) = E_i(fF) = \omega^k_{(i)} \frac{ \partial }{ \partial x^k}f = \frac{ \partial }{ \partial u^i} f(F(u)) = \frac{ \partial f}{ \partial x^k } \frac{ \partial x^k }{ \partial u^i } \quad \quad \, \omega_{(i)}^k = \frac{ \partial x^k}{ \partial u^i }
\]

By definition, for  \\
\quad $F^*\overline{g}(x^{(i)}, x^{(j)})$ on by (notation) $F^*g(A,B)$, \, $A,B \in T_pS$ \\
\quad $F^*\overline{g}(E_i, E_j) = \overline{g}(F_* E_i, F_* E_j)$

\[
\begin{gathered}
  F^*\overline{g}(E_i,E_j) = \overset{\circ}{g}(E_i, E_j) = \overset{\circ}{g}_{ij} = \overline{g}(F_* E_i, F_* E_j) = \overline{g}{ \left( \frac{ \partial x^k}{ \partial u^i } \frac{ \partial }{ \partial x^k} , \frac{ \partial x^l }{ \partial u^j } \frac{ \partial }{ \partial x^l } \right) } = \\
  = \overline{g}_{kl} \frac{ \partial x^k}{ \partial u^i } \frac{ \partial x^l }{ \partial u^j }
\end{gathered}
\]

Formula for pullback of metric on $M$ to metric on $S$ i.e. formula for metric on $S$
\[
\boxed{ (F^* \overline{g} )_{ij} = \overset{\circ}{g}_{ij} = \overline{g}_{kl} \frac{ \partial x^k}{ \partial u^i } \frac{ \partial x^l }{ \partial u^j } }
\]

For $\overline{g}_{kl} = \delta_{kl}$ (Euclidean metric)

\[
\overset{\circ}{g}_{ij} = \frac{ \partial x^k}{ \partial u^i } \frac{ \partial x^k}{ \partial u^j } = \left( \frac{ \partial x^i }{ \partial u^k } \right)^T \frac{ \partial x^k}{ \partial u^j } = (D_u x)^T (D_u x) \equiv (D_u x)^2
\]

$\overset{\circ}{g}_{ij}$ is just the square of the Jacobian (The square of the Jacobian is the metric in $S^1$).

Then you could get the matrix form of the metric.  \\

Example 13.16

$\overset{ \circ}{g} = \left. \overline{g} \right|_{S^n}$  \quad \, $S^n \hookrightarrow \mathbb{R}^{n+1}$ round metric (or standard metric) on sphere.

It's usually easiest to compute the induced metric on a Riemannian submanifold in terms of local parametrizations (see Chapter 5)

Example 13.17 \textbf{(Induced Metrics in Graph Coordinates.)} \\
Let open $U \subset \mathbb{R}^n$ \\
\phantom{ Let open } $M \subset \mathbb{R}^{n+1}$ graph of smooth $f:U \to \mathbb{R}$ \\

Then $X:U\to \mathbb{R}^{n+1}$ \\
\phantom{ Then }$X(u^1 \dots u^n) = (u^1 \dots u^n, f(u))$ smooth (global) parametrization of $M$

induced metric on $M$,

$\overline{g} = \delta_{ij} dy^i dy^j$ (note $y^i$ local coordinates on $\mathbb{R}^{n+1}$)

Recall Prop.11.9. $F^*(\sigma \otimes \tau) = F^*\sigma \otimes F^*\tau$ \\
Corollary 11.10.  $F:M \to N$, \\
$F^*(\sigma_{j_1 \dots j_k} dy^{j_1} \otimes \dots \otimes dy^{j_k} ) = (\sigma_{j_1 \dots j_k} \circ F) d(y^j F) \otimes \dots \otimes d(y^{j_k}F)$

\[
\begin{gathered}
  X^* \overline{g} = (\delta_{ij} \circ X) d(y^i X) d(y^jX) = (du^1)^2 + \dots + (du^n)^2 + (df)^2 \\
  X^*\overline{g}_p(E_i , E_j) = \overline{g}_{X(p)}(X_* E_i, X_* E_j)
\end{gathered}
\]

\subsubsection*{The Normal Bundle}

Suppose $(M,g)$, Riemannian submanifold $S\subset M$ \\
\quad $\forall \, p \in S$, vector $N \in T_pN$ normal to $S$ if $N$ orthogonal to $T_pS$ with respect to $g$ \\
\quad \quad $N_p S\subset T_pM$, $N_pS = $ all vectors normal to $S$ at $p = \lbrace N | \langle N, X \rangle_g = 0, \, \forall \, X \in T_pS \rbrace$ normal space to $S$ at $p$ \\

\subsection*{The Riemannian Distance Function}

\exercisehead{13.23}
\[
L_g(\gamma) = \int_a^b |\gamma'(t)|_g dt = \int_a^c |\gamma'(t)|_g dt  + \int_c^b |\gamma'(t) |_g dt = L_g(\left. \gamma \right|_{ [a,c] } ) + L_g( \left. \gamma \right|_{[c,b]} )
\]

\exercisehead{13.24}

On every coordinate patch, consider on some interval $I \subset \mathbb{R}$ parametrizing curve $\gamma$ on $M$ and $\widetilde{\gamma}$ on $\widetilde{M}$ in the same way, and that $F^* \widetilde{\gamma} = \widetilde{\gamma}$

\[
\begin{gathered}
  L_{\widetilde{g}}(F\circ \gamma) = \int_I |F\gamma |_{\widetilde{g}} ds = \int_I  ( \widetilde{g}( \dot{ F \gamma(t) }, \dot{ F\gamma(t)} )^{1/2} ds = \int_I \left( \widetilde{g} ( \dot{ \gamma}^i \frac{ \partial y^j}{ \partial x^i } \frac{ \partial }{ \partial y^j }, \dot{\gamma}^k \frac{ \partial y^l}{ \partial x^k} \frac{ \partial }{ \partial y^l } ) \right)^{1/2} ds = \int_I (\dot{\gamma}^i \dot{\gamma}^k )^{1/2} \left( \widetilde{g}_{jl} \frac{ \partial y^j}{ \partial x^i } \frac{ \partial y^l}{ \partial x^i} \right)^{1/2} ds = \\
   = \int_I ( F^* \widetilde{g}(\dot{\gamma}(t), \dot{\gamma}(t) ) )^{1/2} dt = \int_I (g ( \dot{\gamma}(t), \dot{\gamma}(t) ))^{1/2} = L_g(\gamma)
\end{gathered}
\]

Rather, think in terms of a coordinate-free manner.

\[
\begin{gathered}
  L_g(\gamma) = \int_a^b |\gamma(t)|_g dt = \int_a^b (g(\dot{\gamma}(t), \dot{\gamma}(t)) )^{1/2} dt = \int_a^b dt ( F^*\widetilde{g}(\dot{\gamma}(t), \dot{\gamma}(t) ) )^{1/2} = \int_a^b dt (\widetilde{g}(F_* \dot{\gamma}(t), F_* \dot{\gamma}(t) ))^{1/2} = \\
  = \int_a^b | \dot{F\gamma}(t) |_{\widetilde{g}} dt = L_{\widetilde{g}}(F\gamma)
\end{gathered}
\]

\begin{proposition}[13.25] \textbf{(Parameter independence of Length)} \\
Let $(M, g)$, $\gamma:[a,b] \to M$ \, piecewise smooth curve segment \\
If $\widetilde{\gamma}$ any reparametrization of $\gamma$, then $L_g(\widetilde{\gamma}) = L_g(\gamma)$
\end{proposition}

\begin{proof}
  Suppose $\gamma$ smooth. \\
\phantom{Suppose} $\varphi : [c,d] \to [a,b]$ diffeomorphism s.t. $\widetilde{\gamma} = \gamma \circ \varphi$ \\
$\varphi$ \emph{diffeomorphism} \emph{implies} $\varphi' >0$ or $\varphi' <0$ everywhere.   \\

(Recall diffeomorphism (cf. wikipedia) \emph{differentiable}, bijective, inverse \emph{differentiable}; so $DF$, Jacobian \emph{matrix}, bijective,
$F$ differentiable, so it can't be $0$ at any pt. (linear algebra, need $\exists \, $ inverse)) \\

Assume $\varphi' >0$
\[
\begin{gathered}
  L_g(\widetilde{\gamma}) = \int_c^d |\widetilde{\gamma}'(t) |_g dt = \int_c^d \left| \frac{d}{dt} (\gamma \circ \varphi ) \right|_g  dt = \int_c^d | \gamma'(\varphi(t)) \dot{\varphi} |_g dt = \int_a^b |\gamma'(\varphi(t)) |_g \dot{\varphi} dt = \int_a^b |\gamma'(s)|_g = \\
  = \int_a^b |\gamma'(s)|_g ds = L_g(\gamma)
\end{gathered}
\]

where second-to-last equality follows from change of variables formula for ordinary integrals.

\end{proof}

If $(M,g)$ connected Riemannian manifold \\
$d_g(p,q)$ (Riemannian) distance between $p,q$ - infinum of $L_g(\gamma)$ over all piecewise smooth curve segments $\gamma$ from $p$ to $q$.   \\

The key is the following technical lemma, which shows that any Riemannian metric is locally comparable to Euclidean metric in coordinates.

\begin{lemma}[13.28] Let $g$ on open $U\subset \mathbb{R}^n$ \\
For compact $K \subset U$, $\exists \, $ constants $c,C$ s.t. $\begin{aligned} & \quad \\
  & \forall \, x \in K \\
  & \forall \, v\in T_x\mathbb{R}^n \end{aligned}$

\[
c|v|_{\overline{g}} \leq |v|_g \leq C |v|_{\overline{g}}
\]

\end{lemma}

\begin{theorem}[13.29] (Riemannian Manifolds as Metric Spaces)

Let connected $(M,g)$ \\
with $d_g(p,q)$; $M$ metric space whose metric topology same as original manifold topology.
\end{theorem}

local orthonormal frame $(E_1 \dots E_n)$ for $M$ on open $U\subset M$ is adapted to $S$ if first $k$ vectors $( \left. E_1 \right|_p \dots \left. E_k \right|_p)$ span $T_pS \quad \, \forall \, p \in S$. \\
\quad follows $( \left. E_{k+1} \right|_p \dots \left. E_n \right|_p )$ span $N_pS$ \\

Prop. 11.24 proved exactly some way as counterpart for submanifolds of $\mathbb{R}^n$ (Prop. 10.17)

\begin{proposition}[11.24] (Existence of Adapted Orthonormal Fames)
Let $S\subset M$ embedded Riemannian submanifold  \\
\quad $\forall \, p \in S$, $\exists \, $ smooth adapted orthonormal frame on neighborhood $U \ni p \subset M$
\end{proposition}

Recall $F:M \to N$ immersion if $DF$ injective everywhere, $F$ embedding if $F$ injective (homeomorphism onto its image) and $F$ immersion.

normal bundle to $S$
\[
NS  = \coprod_{p \in S} N_p S
\]

\subsection*{The Tangent-Cotangent Isomorphism}

EY 20140521, Below, in between the lines, are my notes off the previous edition.  It's frustrating to not be able to obtain instantly the most up-to-date edition automatically, online, available freely for download.  Notation had changed.  It's important to me to keep up-to-date with the latest notation; it's not trivial (cf. Zee, A.; Srednicki's QFT vs. previous QFT notation)

\hrulefill

Given $(M,g)$ define bundle map $\widetilde{g}:TM \to T^*M$ \\
\quad \, $\forall \, p \in M$, $\forall \, X_p \in T_pM$, \, $\widetilde{g}(X_p) \in T_p^*M$ be covector defined $\widetilde{g}(X_p)(Y_p) = g_p(X_p,Y_p)$ \quad $\forall \, Y_p \in T_pM$ \\

To see this is a smooth bundle map, consider its action on smooth vector fields:

\[
\widetilde{g}(X)(Y) = g(X,Y) \quad \, \forall \, X,Y \in \tau(M)
\]

Because $\widetilde{g}(X)(Y)$ linear over $C^{\infty}(M)$ as a function of $Y$, \\
\quad from Prob. 6-8, $\widetilde{g}(X)$ smooth covector field. \\
\quad because $\widetilde{g}(X)$ linear over $C^{\infty}(M)$ as a function of $X$, $\widetilde{g}$ smooth bundle map by def. by Prop. 5.16. \\

Use same symbol: pointwise bundle map $\widetilde{g}:TM \to T^*M$ \\
\phantom{Use same symbol:} linear map on sections $\widetilde{g}: \mathcal{T}(M) \to \mathcal{T}^*(M)$  \\

$\widetilde{g}$ injective: $\widetilde{g}(X_p) = 0$ implies $0 = \widetilde{g}(X_p)(X_p) = \langle X_p, X_p \rangle_g$ so $X_p =0$

By dim., $\widetilde{g}$ bijective, so it's a bundle isomorphism (Prob. 5-9) \\

If $X,Y$ smooth vector fields,
\[
\begin{aligned}
  & \widetilde{g}(X)(Y) = g_{ij} X^i Y^j \\
  &  \widetilde{g}(X) = g_{ij} X^i dy^j
\end{aligned}
\]

customary to denote $X_j = g_{ij} X^i$ so $\widetilde{g}(X) = X_j dy^j$ \\

$\widetilde{g}^{-1}:T_p^*M\to T_pM$ is inverse of $(g_{ij})$ (Because $(g_{ij})$ matrix of the isomorphism $\widetilde{g}$, it is invertible \, $\forall \, p$) \\
\quad let $(g^{ij})$ inverse of $g_{ij}(p)$ so $g^{ij}g_{jk} = g_{kj} g^{ji} = \delta^i_k$

Thus for covector field $\omega \in \mathcal{T}^*M$,
\[
\widetilde{g}^{-1}(\omega) = \omega^i \frac{ \partial}{ \partial x^i},  \quad \, \omega^i = g^{ij} \omega_j
\]

$\omega^i$ is a vector, which we visualize as a (sharp) arrow, while $X_j$ covector, which we visualize by means of its (flat) level sets.  \\

$\forall \, $ smooth $f$ on $(M,g)$, \, $f\in \mathbb{R}$, define vector field \quad \, $\text{grad}{f} =  \widetilde{g}^{-1}(df)$ \\

$\forall \, X \in \mathcal{T}(M)$

\[
\langle \text{grad}{f}, X\rangle_g = \widetilde{g} (\text{grad}{f})(X) = df(X) = Xf
\]

thus $\langle \text{grad}{f}, X\rangle_g = Xf$ \quad \, $\forall \, X \in \mathcal{\chi}(M)$ \\
\phantom{thus } or equivalently $\langle \text{grad}{f}, \cdot \rangle_g = df$

\[
\text{grad}{f} = g^{ij} \frac{ \partial f}{ \partial x^i} \frac{ \partial }{ \partial x^j}
\]
\hrulefill

bundle isomorphism $\widehat{g} : TM \to T^*M$  \\

$\begin{aligned}
  & \quad \\
  & \forall \, p \in M \\
  & \forall \, v \in T_pM \end{aligned}$ \quad \quad \, $\begin{aligned} & \quad \\
  & \widehat{g}(v) \in T_p^*M \text{ defined by } \\
  & \widehat{g}(v)(w) = g_p(v,w) \quad \, \forall \, w \in T_p M \end{aligned}$

\[
\widehat{g}(X)(Y) = g(X,Y) \quad \quad \, \forall \, X,Y \in \mathfrak{X}(M)
\]

$\widehat{g}(X)(Y)$ linear over $C^{\infty}(M)$ as a function of $Y$, Lemma 12.24 $\Longrightarrow \widehat{g}(X)$ smooth covector field

$g=g_{ij}dx^i dx^j$

\[
\widehat{g}(X)(Y) = g_{ij}X^i Y^j \Longrightarrow \widehat{g}(X) = g_{ij}X^i dx^j = X_j dx^j \text{ where } X_j = g_{ij}X^i
\]

$X^{\flat} = \widehat{g}(X)$

Now
\[
\widehat{g}^{-1}:T_p^*M \to T_pM
\]
$\forall \, $ covector field $\omega \in \mathfrak{X}^*(M)$

\[
\widehat{g}^{-1}(\omega) = \omega^i \frac{ \partial x^i}, \quad \, \omega^i = g^{ij}\omega_j
\]

$omega^{\sharp} = \widehat{g}^{-1}(\omega)$

gradient of $f$ by $\text{grad}{f} = (df)^{\sharp} = \widehat{g}^{-1}(df)$

$\forall \, X \in \mathfrak{X}(M)$

\[
\langle \text{grad}f, X\rangle_g = \widehat{g}(\text{grad}f)(X) = df(X) =Xf
\]

or

$\langle \text{grad}f, \cdot \rangle_g = df$

$\text{grad}f = g^{ij} \frac{ \partial f}{ \partial x^i} \frac{ \partial }{ \partial x^j}$ \quad \, so $\text{grad}f$ is smooth

\subsection*{ Problems }

\problemhead{11-1} Recall $\forall $ bilinear $A : V\times W \to Y$, $\exists \, !$ \, linear $\widetilde{A} : Z \to Y$ s.t.

\begin{tikzpicture}
  \matrix (m) [matrix of math nodes, row sep=2em, column sep=3em, minimum width=1em]
  {
    V\times W  & Z  \\
    V\otimes W  &   \\ };
  \path[-stealth]
  (m-1-1) edge node [right] {$\widetilde{\pi}$} (m-1-2)
  edge node [left] { $\otimes$} (m-2-1)
  (m-2-1) edge node [below] {$\exists \, ! \, \pi$} (m-1-2);
\end{tikzpicture}

is the universal property s.t. $\pi \otimes = \widetilde{\pi}$

Suppose bilinear $\widetilde{\pi} : V\times W \to Z$ s.t., \\
\quad \, $\forall \, $ bilinear $A: V\times W \to Y$, $\exists \, !$ linear $\widetilde{A} : Z \to Y$ s.t.

\begin{tikzpicture}
  \matrix (m) [matrix of math nodes, row sep=2em, column sep=3em, minimum width=1em]
  {
    V\times W  & Y  \\
    Z  &   \\ };
  \path[-stealth]
  (m-1-1) edge node [auto] {$A$} (m-1-2)
  edge node [left] { $\widetilde{Z}$} (m-2-1)
  (m-2-1) edge node [below] {$\widetilde{A}$} (m-1-2);
\end{tikzpicture}

Consider
\begin{tikzpicture}
  \matrix (m) [matrix of math nodes, row sep=2em, column sep=3em, minimum width=1em]
  {
    V\times W  & Z  \\
    V\otimes W  &   \\ };
  \path[->,font=\scriptsize]
  (m-1-1) edge node [auto] {$\widetilde{\pi}$} (m-1-2)
  edge node [left] { $\otimes$} (m-2-1)
  (m-1-2) edge node [above] {$\lambda$} (m-2-1)
  (m-2-1.2) edge node [below] {$\widetilde{\Phi}$} (m-1-2.south east);
\end{tikzpicture}

$\Phi \otimes = \widetilde{\pi}$ (by universal property) \\
\[
\Phi(v\otimes w) = \widetilde{\pi}(v,w)
\]
$\exists \, ! $ linear $\lambda : Z \to V\otimes W$
\[
\begin{aligned}
  & \lambda \circ \widetilde{\pi} = \otimes \\
  & \lambda \otimes \widetilde{\pi}(v,w) = v\otimes w
\end{aligned}
\]

\[
\begin{aligned}
  & \Phi \lambda ( \widetilde{\pi}(v,w) ) = \Phi(v\otimes w) = \widetilde{\pi}(v,w) \\
  & \Phi \lambda = \text{id}_{Z} \\
  & \lambda \Phi(v\otimes w) = \lambda \widetilde{\pi}(v,w) = v\otimes w \\
  & \lambda \Phi = \text{id}_{V\otimes W}
\end{aligned}
\]
So $\Phi$ is an isomorphism between $Z, V\otimes W$.  As $\lambda $ is unique, so is $\Phi$

\problemhead{11-2}

tensor product of $U,V$ is vector space $U\otimes V$ with bilinear map $\begin{aligned} & \quad \\
  \otimes : & U \times V \to U\otimes V \\
  & (u,v) \mapsto u\otimes v \end{aligned}$ \\
with universal property with any vector space $W$.

$K \cong k 1$

By bilinearity,

\begin{tikzpicture}
  \matrix (m) [matrix of math nodes, row sep=2em, column sep=3em]
  {
    U \otimes K  & U\otimes 1 & U  \\
    u\otimes k  & ku \otimes 1 & ku   \\ };
  \path[->]
  (m-1-1) edge node [auto] {$$} (m-1-2)
  (m-1-2) edge node [left] { $$} (m-1-3);
  \path[|->]
  (m-2-1) edge node [auto] {$$} (m-2-2)
  (m-2-2) edge node [above] {$$} (m-2-3);
  \path[|->]
  (m-2-3) edge node [bend right] {$q$} (m-2-2);
\end{tikzpicture}

\begin{tikzpicture}
  \matrix (m) [matrix of math nodes, row sep=2em, column sep=3em]
  {
    u\otimes k  & ku \otimes 1 & ku   \\ };
%  \path[->]
%  (m-1-1) edge node [auto] {$$} (m-1-2)
%  (m-1-2) edge node [left] { $$} (m-1-3)
  \path[|->]
  (m-1-1) edge  (m-1-2)
  (m-1-2) edge  (m-1-3)
%  \path[|->]
  (m-1-3) edge node [bend left] {$q$} (m-1-2);
\end{tikzpicture}

$q: U \to U\otimes 1$ \\
$u \mapsto u\otimes 1$

then $U\otimes K \simeq U$

\problemhead{11-3} $\begin{aligned} & \quad \\
  & U^* \times V \to \text{Hom}{(U,V)} \\
  & (u^*, v) \to ( u \to u^*(u), v) \end{aligned}$ induces a natural homomorphism (injective), $U^* \otimes V \to \text{Hom}{(U,V)}$
\begin{tikzpicture}
  \matrix (m) [matrix of math nodes, row sep=2em, column sep=3em]
  {
    U^* \otimes V  & \text{Hom}{(U,V)}    \\ };
%  \path[->]
%  (m-1-1) edge node [auto] {$$} (m-1-2)
%  (m-1-2) edge node [left] { $$} (m-1-3)
  \path[->]
  (m-1-1) edge  (m-1-2)
    edge node [auto] {$\otimes$} (m-2-1);
%  \path[|->]
    \path[dotted,->]
  (m-2-1) edge  (m-1-2);
\end{tikzpicture}

If $\text{dim}{U}, \, \text{dim}{V} < \infty$,

for arbitrary $v_i \in V$, \, $\begin{aligned} & \quad \\
  & \sum_i e_i^* \otimes v_i \in U^* \otimes V \\
  & e_j \to e_i^*(e_j)v_i = v_j \end{aligned}$

$\sum_i e_i^* \otimes v_i$ corresponds to homomorphism $U\to V$ mapping $e_i \to v_i$

$U^* \otimes V \to \text{Hom}{(U,V)}$ surjective.

$\text{dim}{U^* \otimes V} = \text{dim}{U^*} \text{dim}{V}$

isomorphism by dim. reason.


\subsection{Randomly Created Point Cloud}
\subsubsection{Description of the Algorithm}
The algorithm creates a point cloud where the x and y values for every point
where calculated by a random function.

\subsubsection{Implementation description}
The implementation uses the std::uniform\_real\_distribution function from the
c++ standard. It creates values from 0 to width and 0 to height.

\subsubsection{Complexity}
The complexity is $\bigO(n)$ where $n$ is the number of point count.

\subsubsection{Parameters}
\begin{description}
  \item [--nodes] how many nodes the polygon has to have. [default: 100]
  \item [--sampling-grid] the area within the polygon could grow. [default: 1500x800]
\end{description}

\subsubsection{Examples}
\begin{figure}[ht]
  \centering

  \begin{minipage}[t]{0.4\textwidth}
    \begin{tikzpicture}[yscale=0.05,xscale=0.05]

      \setcounter{i}{1}

      \draw[->] (0,0) -- (80,0) node[below] {$x$};
      \draw[->] (0,0) -- (0,70) node[left] {$y$};

      \foreach \p in {(18, 7),(1, 39),(77, 48),(56, 13),(77, 51),(56, 27),(61, 9),(56, 12),(69, 63),(45, 53)} {
        \node[point] (\arabic{i}) at \p {};
        \stepcounter{i}
      }

      \draw (1) -- (2) -- (3) -- (4) -- (5) -- (6) -- (7) -- (8) -- (9) -- (10)
      -- (1);
    \end{tikzpicture}
    \caption{Example point cloud used as a polygon with 10 points}
    \label{fig:rcpc:points-10}
  \end{minipage}\hfill
  \begin{minipage}[t]{0.4\textwidth}
    \begin{tikzpicture}[yscale=0.05,xscale=0.05]

      \setcounter{i}{1}

      \draw[->] (0,0) -- (80,0) node[below] {$x$};
      \draw[->] (0,0) -- (0,70) node[left] {$y$};

      \foreach \p in {(70,60), (33,70), (33,10), (70, 20), (0,40)} {
        \node[point] (\arabic{i}) at \p {};
        \stepcounter{i}
      }

      \draw (1) -- (2) -- (3) -- (4) -- (5) -- (1);
    \end{tikzpicture}
    \caption{Example point cloud used as a polygon with 5 points}
    \label{fig:rcpc:points-2}
  \end{minipage}
\end{figure}

\FloatBarrier


\documentclass[12pt,twoside]{article}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage{hyperref}
\usepackage{fontspec}
\usepackage{tikz}

\title{The Most Beautiful Math Equations}
\author{KaiserKatze}

\begin{document}

\maketitle

\section{Euler's identity}

$$ e^{i \pi} + 1 = 0 $$

\section{Pythagorean theorem}

$$ a^2 + b^2 = c^2 $$

\section{Quaternion}

$$ i^2 = j^2 = k^2 = ijk = -1 $$

\section{Euler characteristic}

$$ V - E + F = 2 $$

\section{Multinomial theorem}

$$ (x_1+x_2+\cdots+x_t)^n=\sum\frac{n!}{n_1!n_2!\cdots n_t!}x_1^{n_1}x_2^{n_2}\cdots x_t^{n_t} $$

\section{Bayes' theorem}

$$ P\left(A|B\right) = \frac{P\left(A\right)P\left(B|A\right)}{P\left(B\right)} $$

Fin.

\end{document}

\begin{tikzpicture}[remember picture,overlay]
   \node[xshift=1mm,yshift=1mm,anchor=north west] at (current page.north west){%
   \includegraphics[width=50mm]{FreeCulturalWorks_seal_x2.jpg}};
\end{tikzpicture}


\title{Automated Transformations}

\subsection{Automated Transformations}

Automated transformations provide convenient handling of constrained
continuous variables during inference by transforming them to an
unconstrained space. Automated transformations are crucial for
expanding the scope of algorithm classes such as gradient-based Monte
Carlo and variational inference with reparameterization gradients.

A Jupyter notebook version of this tutorial is available
\href{http://nbviewer.jupyter.org/github/blei-lab/edward/blob/master/notebooks/automated_transformations.ipynb}{here}.

\subsubsection{The Transform Primitive}

Automated transformations in Edward are enabled through the key
primitive
\href{/api/ed/transform}{\texttt{ed.transform}}.
It takes as input a (possibly constrained) continuous random variable
$\mathbf{x}$, defaults to a choice of transformation $T$, and returns a
\href{/api/ed/models/TransformedDistribution}
{\texttt{TransformedDistribution}}
$\mathbf{y}=T(\mathbf{x})$ with unconstrained support.
An optional argument allows you to manually specify the transformation.

The returned random variable $\mathbf{y}$'s density is the original
random variable $\mathbf{x}$'s density adjusted by the determinant of
the Jacobian of the inverse transformation \citep{casella2002statistical},

$$p(\mathbf{y}) = p(\mathbf{x})~|\mathrm{det}~J_{T^{-1}}(\mathbf{y}) |.$$

Intuitively, the Jacobian describes how a transformation warps unit
volumes across spaces. This matters for transformations of random
variables, since probability density functions must always integrate
to one.

\subsubsection{Automated Transformations in Inference}

To use automated transformations during inference, set the flag
argument \texttt{auto\_transform=True} in \texttt{inference.initialize}
(or the all-encompassing method \texttt{inference.run}):

\begin{lstlisting}[language=Python]
inference.initialize(auto_transform=True)
\end{lstlisting}

By default, the flag is already set to \texttt{True}.
With this flag, any key-value pair passed into inference's
\texttt{latent\_vars} with unequal support is transformed to the
unconstrained space; no transformation is applied if already
unconstrained. The algorithm is then run under
\texttt{inference.latent\_vars}, which explicitly stores the
transformed latent variables and forgets the constrained ones.

We illustrate automated transformations in a few inference examples.
Imagine that the target distribution is a Gamma distribution.

\begin{lstlisting}[language=Python]
from edward.models import Gamma

x = Gamma(1.0, 2.0)
\end{lstlisting}

This example is only used for illustration, but note this context of
inference with latent variables of non-negative support occur
frequently: for example, this appears when applying topic models with a deep exponential
family where we might use a normal variational
approximation to implicitly approximate latent variables with Gamma
priors (in
\href{https://github.com/blei-lab/edward/blob/master/examples/deep_exponential_family.py}
{\texttt{examples/deep\_exponential\_family.py}},
we explicitly define a non-negative variational approximation).

\textbf{Variational inference.}
Consider a Normal variational approximation
and use the algorithm \href{/api/ed/KLqp}{\texttt{ed.KLqp}}.

\begin{lstlisting}[language=Python]
from edward.models import Normal

qx = Normal(loc=tf.get_variable("qx/loc", []),
            scale=tf.nn.softplus(tf.get_variable("qx/scale", [])))

inference = ed.KLqp({x: qx})
inference.run()
\end{lstlisting}

The Gamma and Normal distribution have unequal support, so inference
transforms both to the unconstrained space; normal is already
unconstrained so only Gamma is transformed. \texttt{ed.KLqp} then
optimizes with
\href{/api/klqp}{reparameterization gradients}.
This means the Normal distribution's parameters are optimized to match
the transformed (unconstrained) Gamma distribution.

Oftentimes we'd like the approximation on the original (constrained)
space. This was never needed for inference, so we must explicitly
build it by first obtaining the target distribution's transformation
and then inverting the transformation:

\begin{lstlisting}[language=Python]
from tensorflow.contrib.distributions import bijectors

x_unconstrained = inference.transformations[x]  # transformed prior
x_transform = x_unconstrained.bijector  # transformed prior's transformation
qx_constrained = ed.transform(qx, bijectors.Invert(x_transform))
\end{lstlisting}

The set of transformations is given by
\texttt{inference.transformations}, which is a dictionary with keys
given by any constrained latent variables and values given by their
transformed distribution. We use the
\href{https://www.tensorflow.org/versions/master/api_docs/python/tf/distributions/bijectors}{\texttt{bijectors}}
module in \texttt{tf.distributions} in order to handle invertible
transformations.

\texttt{qx\_unconstrained} is a random variable distributed
according to a inverse-transformed (constrained) normal distribution.
For example, if the automated transformation from non-negative to
reals is $\log$, then the constrained approximation is a LogNormal
distribution; here, the default transformation is the inverse of
$\textrm{softplus}$.

We can visualize the densities of the distributions.
The figure below shows that the inverse-transformed normal
distribution has lighter tails than the Gamma but is overall a
good fit.

\begin{lstlisting}[language=Python]
sns.distplot(x.sample(50000).eval(), hist=False, label='x')
sns.distplot(qx_constrained.sample(100000).eval(), hist=False, label='qx')
\end{lstlisting}

\includegraphics[width=600px]{/images/automated-transformations-0.png}

\textbf{Gradient-based Monte Carlo.}
Consider an Empirical approximation with 1000 samples
and use the algorithm \href{/api/ed/HMC}{\texttt{ed.HMC}}.

\begin{lstlisting}[language=Python]
from edward.models import Empirical

qx = Empirical(params=tf.get_variable("qx/params", [1000]))

inference = ed.HMC({x: qx})
inference.run(step_size=0.8)
\end{lstlisting}

Gamma and Empirical have unequal support so Gamma is transformed to
the unconstrained space; by implementation, discrete delta
distributions such as Empirical and PointMass are not transformed.
\texttt{ed.HMC} then simulates Hamiltonian
dynamics and writes the unconstrained samples to the empirical
distribution.

In order to obtain the approximation on the original (constrained)
support, we again take the inverse of the target distribution's
transformation.

\begin{lstlisting}[language=Python]
from tensorflow.contrib.distributions import bijectors

x_unconstrained = inference.transformations[x]  # transformed prior
x_transform = x_unconstrained.bijector  # transformed prior's transformation
qx_constrained = Empirical(params=x_transform.inverse(qx.params))
\end{lstlisting}

Unlike variational inference, we don't use \texttt{ed.transform} to
obtain the constrained approximation, as it only applies to continuous
distributions. Instead, we define a new Empirical distribution whose
parameters (samples) are given by transforming all samples stored in
the unconstrained approximation.

We can visualize the densities of the distributions.
The figure below indicates that the samples accurately fit the Gamma
distribution up to simulation error.

\begin{lstlisting}[language=Python]
sns.distplot(x.sample(50000).eval(), hist=False, label='x')
sns.distplot(qx_constrained.sample(100000).eval(), hist=False, label='qx')
\end{lstlisting}

\includegraphics[width=600px]{/images/automated-transformations-1.png}

\subsubsection{Acknowledgements \& Remarks}

Automated transformations have largely been popularized by Stan
for Hamiltonian Monte Carlo \citep{carpenter2016stan}.
This design is inspired by Stan's. However, a key distinction is that Edward
provides users the ability to wield transformations and more flexibly
manipulate results in both the original (constrained) and inferred
(unconstrained) space.

Automated transformations are also core to the algorithm automatic
differentiation variational inference \citep{kucukelbir2017automatic},
which allows it to select a default variational family of normal
distributions. However, note the automated transformation from
non-negative to reals in Edward is not $\log$, which is used in Stan;
rather, Edward uses $\textrm{softplus}$ which is more numerically
stable (see also \citet[Fig.~9]{kucukelbir2017automatic}).

Finally, note that not all inference algorithms use or even need
automated transformations.
\href{/api/ed/Gibbs}{\texttt{ed.Gibbs}}, moment
matching with EP using Edward's conjugacy, and
\href{/api/ed/KLqp}{\texttt{ed.KLqp}}
with
score function gradients all perform inference on the original latent
variable space.
Point estimation such as \href{/api/ed/MAP}{\texttt{ed.MAP}} also
use the original latent variable space and only requires a
constrained transformation on unconstrained free parameters.
Model parameter estimation such as
\href{/api/ed/GANInference}{\texttt{ed.GANInference}} do not even
perform inference over latent variables.

\subsubsection{References}\label{references}