\documentclass[12pt, letterpaper]{report}
\usepackage[margin=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfig}
\graphicspath{ {./img/} }
\setlength\parindent{0pt}
\renewcommand\thesection{\Roman{section}.}
\renewcommand{\thesubsection}{\alph{subsection}.}

\title{CS1675 - Assignment 1}
\author{Zachary M. Mattis}

\begin{document}

\maketitle

\section{Problem 2 - Data Analysis}

% A
\subsection{Max / Min}

\begin{center}
	\begin{tabular}{ |l|l|l|l|l|l|l|l|l| }
		\hline
		Max & 17 & 199 & 122 & 99 & 846 & 67.1 & 2.42 & 81 \\
		\hline
		Min & 0 & 0 & 0 & 0 & 0 & 0 & 0.078 & 21 \\
		\hline
	\end{tabular}
\end{center}

% B
\subsection{Mean / Variance}

\begin{center}
	\begin{tabular}{ |l|l|l|l|l|l|l|l|l| }
		\hline
		$\mu$ & 3.8451 & 120.8945 & 69.1055 & 20.5365 & 79.7995 & 31.9926 & 0.4719 & 33.2409 \\
		\hline
		$\sigma$ & 11 & 1021 & 374 & 254 & 13264 & 62 & 0 & 138 \\
		\hline
	\end{tabular}
\end{center}

% C
\subsection{Subset}

Class 0

\begin{center}
	\begin{tabular}{ |l|l|l|l|l|l|l|l|l| }
		\hline
		$\mu$ & 3.298 & 109.98 & 68.184 & 19.664 & 68.792 & 30.3042 & 0.4207 & 31.19 \\
		\hline
		$\sigma$ & 3.0172 & 26.1412 & 18.0631 & 14.8889 & 98.8653 & 7.6899 & 0.2991 & 11.6677 \\
		\hline
	\end{tabular}
\end{center}

Class 1

\begin{center}
	\begin{tabular}{ |l|l|l|l|l|l|l|l|l| }
		\hline
		$\mu$ & 4.8657 & 141.2575 & 70.8246 & 22.1642 & 100.3358 & 35.1425 & 0.5505 & 37.0672 \\
		\hline
		$\sigma$ & 3.7412 & 31.9396 & 21.4918 & 17.6797 & 138.6891 & 7.263 & 0.3724 & 10.9683 \\
		\hline
	\end{tabular}
\end{center}

Based on the data from the tables above, attribute 2 appears to show the greatest difference in mean among the differing classes. Attribute 2 corresponds to the plasma glucose concentration after 2 hours in an oral glucose tolerance test. This analysis makes sense considering that the two classes are divided by a diabetes diagnoses, which would have a strong correlation with an attribute associated to glucose levels.

% D
\subsection{Histogram}

\begin{verbatim}
function histogram_analysis( attribute_vector )
    hist(attribute_vector, 20);
end
\end{verbatim}

% E
\subsection{Normal Distribution}

The two attribute values that most closely match a normal distribution are Diastolic Blood Pressure (attr. 3) and Body Mass Index (attr. 6), as shown in the histograms below.

\begin{figure}[H]
	\captionsetup[subfigure]{labelformat=empty}
	\centering
	\subfloat[Figure 1]{{\includegraphics[width=18em]{p2e3.png} }}
	\qquad
	\subfloat[Figure 2]{{\includegraphics[width=18em]{p2e6.png} }}
	\label{fig:example}
\end{figure}

% F
\subsection{Subset Analysis}

Attribute 2 of the dataset, plasma glucose concentration after 2 hours in an oral glucose tolerance test, appears to be the most helpful in discriminating between the two sets. Based on the two histograms below, figure 4 represents a normal distribution for the negative diabetes test. However, as seen in figure 3, the distribution is heavily skewed to the right, indicating a correlation between glucose levels and positive test patients.

\begin{figure}[H]
	\captionsetup[subfigure]{labelformat=empty}
	\centering
	\subfloat[Figure 3]{{\includegraphics[width=18em]{p2f2d1.png} }}
	\qquad
	\subfloat[Figure 4]{{\includegraphics[width=18em]{p2f2d0.png} }}
	\label{fig:example}
\end{figure}

% G
\subsection{Scatter Plots}

\begin{verbatim}
function scatter_plot( vector )
    scatter( vector(:,1), vector(:,2) );
end
\end{verbatim}

Given two random variables that are independent, I would predict to see no correlation between the plotted values, which can be seen in figure 6. However, when these random variables are not quite independent, a correlation among the data points can be observed, as in figure 5. This is quite predictable in this example, as it is expected that those with a higher BMI would also tend toward a higher skin fold thickness due to the overlapping nature of the variables.

\begin{figure}[H]
	\captionsetup[subfigure]{labelformat=empty}
	\centering
	\subfloat[Figure 5]{{\includegraphics[width=18em]{p2g4v6.png} }}
	\qquad
	\subfloat[Figure 6]{{\includegraphics[width=18em]{p2g3v5.png} }}
	\label{fig:example}
\end{figure}

\section{Problem 3 - Data Preprocessing}

% A
\subsection{One's Hot Encoding}

One's hot encoding is a common scheme for encoding information utilizing standard binary values in a vector whereby the index of the '1' indicates the value of the scalar. Each subsequent scalar can be converted into its corresponding one's hot vector given the following encoding:
\begin{verbatim}
{brown, blue, white, red, yellow, orange, green, black}
\end{verbatim}

\begin{center}
	\begin{tabular}{ |l|l| }
		\hline
		red & [0, 0, 0, 1, 0, 0, 0, 0] \\
		\hline
		black & [0, 0, 0, 0, 0, 0, 0, 1] \\
		\hline
		yellow & [0, 0, 0, 0, 1, 0, 0, 0] \\
		\hline
		red & [0, 0, 0, 1, 0, 0, 0, 0] \\
		\hline
		green & [0, 0, 0, 0, 0, 0, 1, 0] \\
		\hline
		blue & [0, 1, 0, 0, 0, 0, 0, 0] \\
		\hline
		blue & [0, 1, 0, 0, 0, 0, 0, 0] \\
		\hline
	\end{tabular}
\end{center}

% B
\subsection{Normalization}

\begin{verbatim}
function [ normalized, mu, sigma ] = normalize( attribute )
    mu = mean(attribute);
    sigma = std(attribute);
    normalized = (attribute - mu)/sigma;
end
\end{verbatim}

First five values of Attribute 3 (Diastolic Blood Pressure) after being normalized.

\begin{center}
	\begin{tabular}{ |l|l|l|l|l|l| }
		\hline
		0.1495 & -0.1604 & -0.2638 & -0.1604 & -1.5037 \\
		\hline
	\end{tabular}
\end{center}

% C
\subsection{Discretization}

\begin{verbatim}
function [ discrete ] = discretize_attribute( attribute, k )
    min_val = min(attribute);
    max_val = max(attribute);
    bin_div = (max_val - min_val)/k;
    discrete = fix((attribute-min_val)/bin_div);
end
\end{verbatim}

First five values of Attribute 3 (Diastolic Blood Pressure) after being discretized.

\begin{center}
	\begin{tabular}{ |l|l|l|l|l|l| }
		\hline
		5 & 5 & 5 & 5 & 3 \\
		\hline
	\end{tabular}
\end{center}

\section{Problem 4 - Data Training}

\begin{verbatim}
function [ training_set, testing_set ] = divideset( dataset, p_train )

    training_count = round(p_train * length(dataset));
    indices = randperm(length(dataset), training_count);
    t = zeros([length(dataset) 1]);
    t(indices) = 1;

    training_set = dataset(t(:) == 1,:);
    testing_set = dataset(t(:) == 0,:);

end
\end{verbatim}

\section{Problem 5 - Matrix Operations}

\subsection{$A^{T}$}
\begin{center}
	\begin{tabular}{ |l|l| }
		\hline
		1 & 3 \\
		\hline
		2 & 4 \\
		\hline
		5 & 6 \\
		\hline
	\end{tabular}
\end{center}

\subsection{$B^{-1}$}
\begin{center}
	\begin{tabular}{ |l|l|l| }
		\hline
		1 & -5.5 & 1.25 \\
		\hline
		0 & -0.5 & 0.25 \\
		\hline
		-0.667 & 4.333 & -1 \\
		\hline
	\end{tabular}
\end{center}

\subsection{$B + C$}
\begin{center}
	\begin{tabular}{ |l|l|l| }
		\hline
		15 & 7 & 14 \\
		\hline
		3 & -1 & 7 \\
		\hline
		3 & 6 & 10 \\
		\hline
	\end{tabular}
\end{center}

\subsection{$B - C$}
\begin{center}
	\begin{tabular}{ |l|l|l| }
		\hline
		-1 & -5 & 4 \\
		\hline
		1 & 5 & -1 \\
		\hline
		5 & 10 & 2 \\
		\hline
	\end{tabular}
\end{center}

\subsection{$A * B$}
\begin{center}
	\begin{tabular}{ |l|l|l| }
		\hline
		31 & 45 & 45 \\
		\hline
		53 & 59 & 75 \\
		\hline
	\end{tabular}
\end{center}

\subsection{$B * C$}
\begin{center}
	\begin{tabular}{ |l|l|l| }
		\hline
		48 & 21 & 75 \\
		\hline
		15 & 0 & 30 \\
		\hline
		34 & -12 & 76 \\
		\hline
	\end{tabular}
\end{center}

\subsection{$B * A$}
Cannot compute matrix operation because inner dimensions do no match.

\end{document}


\chapter{Frobenius Groups}
\section {Sylow analysis}
{\bf Theorem 1:}
If $G$ is a finite group, $P \in S_p(G)$,  with $n_p = |G:N_G(P)| \ne 1 \jmod{p^2}$,
then there are distinct Sylow subgroups $P, R$ of $G$ such that $P \cap R$ is of index $p$
in both $P$ and $R$.
\begin{quote}
\emph{Proof:}
Let $P$ act on $P^G$ yielding several orbits.  The orbit with $P$ has one element.
If $p^2 \mid |P:P \cap R|$ for all $p$-Sylow subgroups $R \ne P$, $p^2$ divides the size of
every orbit not containing $P$.  Thus $n_p = 1 + kp^2$, which is a contradiction.  So there is
some $R$ for which $|P: P \cap R| = p$.
\end{quote}
{\bf Result:} If $p \ne q$ and every subgroup of order $pq$ is cyclic then $p \mid q-1$.  In this
case, $p \mid |N_G(Q)|$ and for som $p$-group, $P$, of order $p$, $P \leq N_G(Q)$ and $PQ \leq N_G(Q)$ is
abelian so $q \mid |N_G(P)|$.
\\
\\
{\bf Application:} No group, $G$, of order $1785 = 3 \cdot 5 \cdot 7 \cdot 17$ is simple.
\begin{quote}
If $G$ is simple,
$n_{17} =35$.  Let $Q \in S_{17}(G)$, $|G:N_G(Q)|=35$ and $|N_G(Q)|= 3 \cdot 17$.  Let $P \in S_3(N_G(Q))$.
$PQ$ is abelian since $3 \nmid (17 - 1)$ so $Q \leq N_G(P)$ and $17 \mid |N_G(P)|$.  The only possibilities for $n_3$ are
$7, 85, 595$ and the last two are eliminated because $17 \mid |N_G(P)|$.  On the other hand, if $|G:N_G(P)| =7$ it
violates the lower bound on the index of a subgroups of $G$ by the permutation bound so we're done.
\end{quote}
{\bf Application:} No group, $G$, of order $3675 = 3 \cdot 5^2 \cdot 7^2$ is simple.
\begin{quote}
If $G$ is simple, $n_7 = 15$, $Q \in S_7(G)$, $|G:N_G(Q)|= 15$ and $|N_G(Q)|= 5 \cdot 7^2$.  Put $N = N_G(Q)$ and
let $P \in S_5(N)$.  $P \lhd N$ and $P$ is contained in a Sylow $p$ group $P^*$. $P^* \leq N_G(P)$ and
$\langle N, P^* \rangle= N_G(P)$.  $3^2 \cdot 7^2 \mid |N_G(P)|$ and $n_p = 3$ but this violates
the permutation bound on the index of subgroups in $G$.
\end{quote}
{\bf Application:} No gorup, $G$, of order $3159= 3^4 \cdot 13$ is simple.
\begin{quote}
$13 \ne 1 \jmod{3^2}$ so $\exists P, R \in S_3(G)$: $|P:P \cap R| = 3$.  Put $N= N_G(P \cap R)$, $P, R \leq N$,
so $3^4 \mid |N|$ since $|N| > 3^4$, $G = N$ and $P \cap R \lhd G$.
\end{quote}
\section {Frobenius groups}
{\bf Definition:}
$G$ is ${\frac 3 2}$ transitive on $A$ if $G$ is transitive on $A$ and $G_a$ has orbits of
the same size on $A \setminus \{a\}$.
If further, $G_a = 1$, $G$ is called \emph{semiregular} and if, further, $G_a$ is transitive on $A \setminus \{a\}$,
then $G$ is called \emph{regular}.  If $G$ is ${\frac 3 2}$ transitive on $A$, $G_a \ne 1$ and $G_a$ is
semiregular on $A \setminus \{a\}$ then $G$ is called a \emph{Frobenius group}.  So $G$ is Frobenius iff
$G_a \ne 1$ and $G_{a,b} = 1$.
\\
\\
{\bf Example:} $A_4$ is a Frobenius group with kernel $V_4$. $AL(q)$ is Frobenius:
$g =
\left(
\begin{array}{cc}
a &  b \\
0 &  1 \\
\end{array}
\right)$.
$D_{2n}$ is Frobenius with complement of order $2$.
\\
\\
{\bf Theorem 2:} \\
(1) $\sum_{g \in G} |A_g| = t |G|$, where $t$  is the number of orbits of $G$ on $A$.
\\
(2) If $H$ is a transitive abelian group then $H$ is regular.
\\
(3) If $G$ is transitive of prime degree, $G$ is primitive.
\\
(4) If $G$ is transitive, $G$ is primitive iff $G_a$ is maximal.
\begin{quote}
\emph{Proof:}
(1) is just Burnside's theorem. (4) is Theorem 3 in the permutation chapter.
For (2), if $a \ne b$, since $H$ is transitive, $\exists h: h(a) = b$.
$H_b = H_{h(a)} = (H_a)^h$ so $H_b$ also fixes $a$.  Letting $b$ vary, we get $H_a$ fixes all points so
$H_a = 1$.  For (3), if $B_1, \ldots, B_k$ is a system of imprimitivity, $|B_i| \mid |A|$ which is impossible if
$|A|$ is a prime.
\end{quote}
{\bf Theorem 3:} If $G$ is ${\frac 3 2}$ transitive then $G$ is either primitive or Frobenius.
\begin{quote}
\emph{Proof:}
Put $G_C = \{ g \in G: g(c)=c, \forall c \in C \}$ and $G_{\langle C \rangle}$ be the elements that fix $C$ setwise.
Suppose $G$ has a system of imprimitivity, $B_1, \ldots, B_r$ with $|B_i|=k$.  The orbits of $G_{\alpha}$ all have the same size
($m$) except the orbit consisting of just $\alpha$, so $k = 1 \jmod{m}$ so $(k,m)=1$.  If $\alpha \notin B_i$,
$m \mid |B_i^{G_{\alpha}}|$ and $k \mid |B_i^{G_{\alpha}}|$ so $km \mid |B_i^{G_{\alpha}}|$ and $|G_{\alpha} : G_{\alpha, \beta}| = m$
but then $G_{B_i} = G_{\alpha_i, \alpha_j} = G_{\alpha_j, \alpha_i} = G_{B_j}$.  Fixing $i$ and letting $j$ vary, $G_{B_i}= G_A = 1$
for $a \ne b$.  $G_{a,b} = G_{a_i, a_j} = 1$ and $G$ is Frobenius.
\end{quote}
{\bf Theorem 4:} $G$ has a faithful permutation representation in which it is Frobenius iff it has a proper
subgroup, $H$ which is a ``TI'' set with $N_G(H)=H$.
\begin{quote}
\emph{Proof:}
Suppose $G$ is Frobenius and put $H=G_a$. $1 < H < G$.   If $g \in G-H$ then
$H^g= G_a^g= G_{a^g}= G_b$ where $b= a^g \ne a$.   Thus $H^g \cap H = G_a \cap G_b= G_{a,b}=1$.
Hence $H$ is a TI set and $N(H)=H$.  Conversely,
given $G, H$ then $G$ permutes the right cosets of $H$ transitively by right multiplication.
Suppose $\langle x_1, x_2, \ldots , x_n \rangle$ is a set of coset representatives of $H$ then
we have a homomorphism $\varphi: G \rightarrow Sym(\langle Hx_i \rangle)$.  Let
$a- H x_i$, $b= Hx_j$ with $i \ne j$.  $G_{a,b}= H^{x_i} \cap H^{x_j}$ and
$x_j x_i^{-1} \notin H=N(H)$ and so $H^{x_i} \ne H^{x_j}$.   Since $H$ is a TI set,
$G_{a,b} = 1$.  Thus the representation is faithful and $G$ is a Frobenius group.
\end{quote}
{\bf Theorem 5:} If $G$ is Frobenius, it contains a regular normal subgroup, $N$ called a Frobenius kernel.
\begin{quote}
\emph{Proof:}
Put $N = \{ g \in G: g= 1 {\thinspace {\textnormal {or}} \thinspace} |A_g|=0 \}$ and $H=G_{\alpha}$. $H$ is a TI set, $N_G(H)=H$.
Finally, put $\alpha^*(g) = (ind_H)^G(g)$.  $(\alpha^*, \beta^*)_G = (\alpha, \beta)_H$.  Let $\phi_0, \phi_1, \ldots, \phi_k$ be
the irreducible characters of $H$ with $\phi_0 = 1_H$.  For $i \ne 0$, put $\alpha_i = f_i 1_G - \phi_i$, where $f_i = deg(\phi_i)$.
$(\alpha_i, \alpha_i) = {f_i}^2 + 1$, but $({\alpha_i}^*, 1_G)_G = (\alpha_i, 1_H)_H = f_i$.  So, ${\alpha_i}^* = f_i + \chi_i$, where
$\chi_i$ is a generalized character of $G$.  Since $||{\alpha_i}^*|| = {f_i}^2 +1$, ${\alpha_i}^* = f_i 1_H + \chi_i$ where $\chi_i$
is an \emph{irreducible} character of $G$.  Further, $(\chi_i)_H = \phi_i$.  Put $K= \cap_i ker(\chi_i)$ so $K \lhd G$ and $|K| \leq |G:H|$.
If $g \in N$, since no conjugate of an element of $H^{\#}$ lies in $H$, ${\alpha_i}^*(g) = 0$.  Thus, for $g \in N$,
 $\chi_i(g) = f_i = \phi_i(1)$ so $g  \in ker(\chi_i)$ and $g \in K$. $|N|=|G:H| \geq |K|$ and $N=K$.  $N$ is normal and regular.
\end{quote}
{\bf Theorem 6:}
Let $G$ be a Frobenius group with $|G_a|$, even.  Then $G$ has an abelian regular normal subgroup.
\begin{quote}
\end{quote}
{\bf Theorem 7:}
Let $G$ be a Frobenius group of degree $n$ of maximal order [$n(n-1)$].  The $n = p^k$ and $G$ has a regular normal
abelian subgroup.
\begin{quote}
\emph{Proof:} Let $p \mid |N|$, where $N$ is the Frobenius kernel of $G$. $|N|= n$.  Since $|G_a| = n-1$, $p \nmid |G_a|$ for any $a$
and $x \in N$.  Since $G$ is Frobenius, $C_G(x) \leq N$ and $|G| = |G_a| \cdot |N| geq |C_G(x)| \cdot |G_a| = n (n-1)$ and
$|C_g(x)| \leq |N|$ and thus ${\frac {|G|} {C_G(x)}} \geq |G_a| = n-1$.  As a result, $|G:C_G(x)| \geq n-1$ and hence the conjugacy class
containing $x$ in $G$ which is inside $N$ has at least $n-1$ elements and must be all of $N$ except for $1$.  Thus all non-identity
elements of $N$ have order $p$ and $|N|=p^k$.  $N$ is a regular normal subgroup that acts on $ccl_G(x)$ and so it is transitive.
So all non-identity elements of $N$ are conjugate and have common order, $p$, so $N$ is an elementary abelian subgroup.
\end{quote}
{\bf Note:} Frobenius groups are semi-direct products.  $N = Fit(G)$.
\\
\\
{\bf Theorem 8:}
Let $G$ be a group.  The following are equivalent:\\
(a) $G$ is Frobenius with kernel $N$ of order $n$ and complement $H$ of order $m$.
\\
(b) $G$ has a normal subgroup $N$ with $1 < N < G$.  If $C_G(g) \leq N$, $|N|=n$ and $|G| = mn$.
\\
(c) $|G|=mn$, $(m, n) = 1$.  If either $g \in G$ then either $g^m = 1$ or $g^n = 1$.  If $N = \{g \in G, g^n = 1 \}$,
then $N \lhd G$ with $1 < N < G$.
\begin{quote}
\emph{Proof:}
\\
(a) $\rightarrow$ (b):
$1 < N < G$.  Suppose, by way of contradiction, $g \in N^{\#}, C_G(g) \nsubseteq N$.
$G = N \cup \bigcup_{x \in G} (H^{\#})^x$.  Taking conjugates, we can assume $h \in H^{\#}$
and $h \in C_G(g)$ then $h \in H \cap H^g$ so $H \cap h^g \ne 1$, a contradiction.
\\
\\
(b) $\rightarrow$ (c):
First, we show $N$ is a Hall subgroup.  Let $P \in S_p(N)$ extend $P$ to a sylow subgroup $P^*$ of $G$.
$ {\mathbb Z}(P^*) \subseteq C_G(P^{\#})$ and ${\mathbb Z}(P^*) \subseteq N$ also $P^* \subseteq C_G({\mathbb Z}(P^*)i^{\#})$.
So, $P^* \subseteq N$, $P = P^*$ and $N$ is a Hall subgroup.
$|N|=mn$, $(m, n) =1$ and $N \lhd G$ with $N = \{g: g^n = 1 \}$.  Let $g \in G$ and suppose $g^m \ne 1$.  Then
$g^m \in N^{\#}$. By (b) $G \in C_G(g^m) \subseteq N$ and $g^n = 1$.
\\
\\
(c) $\rightarrow$ (a):
Since $N \lhd G$ is a Hall subgroup, by Schur-Zassenhaus, $\exists H, |H|=m$ with $G = HN, H \cap N = 1$.
As $G=HN$ we can assume $g \in N$. If $1 \ne h \in H \cap H^g$, $ghg^{-1} \in H$ and so $[g, h] \in H$ but
$[g, h] \in N$ and $[g, h] \in H \cap N = 1$, so $hg = gh$.  If $|g|= n_1$ and $|h|=m_1$ and $|hg|=m_1 n_1$.
By (c), $m_1 \ne 1$, $n_1 =1$ and $g=1$.  So $H$ is a TU set with $N_G(H)=H$.
\end{quote}
{\bf Theorem 9:}
Let $G$ be a Frobenius group with kernel $N$, $K <G$ if $K \nleq N$ and $K \cap N \ne 1$ then $K$ is
Frobenius with Frobenius kernel
$K \cap N$. If $a < K <N$ and $K \lhd G$ then $G/K$
\begin{quote}
\emph{Proof:}
$K > K \cap N > 1$  and $K \cap N \lhd K$.  If $g \in (K \cap N)^{\#}$, by (b) above, $C_K(g) = K \cap C_G(g) \subseteq K \cap N$
so $K$ is Frobenius and the result follows from (c).
\end{quote}
{\bf Theorem 10:}
Thompson: Frobenius kernels are nilpotent.
\begin{quote}
\emph{Proof:}
Let $G$ be a Frobenius group with kernel $N$.  We show $N$ is nilpotent by induction on $|G|$.  By
Previous result, we can assume $|G:N|=p$ and $|H|=p$.\\
\\
Suppose first that ${\mathbb Z}(N) \ne 1$.  If ${\mathbb Z}(N) = N$, $N$ is nilpotent.  If  ${\mathbb Z}(N) < N$, $N/{\mathbb Z}(N)$ is
nilpotent by induction and thre result follows.\\
\\
Now suppose ${\mathbb Z}(N) = 1$. For some $p \ne q$, $N$ does not have a normal $q$ complement for some $q$.  First
lets assume $q$ is odd. If $q \ne 2$ and $p \nmid |N|$ and $H$ permutes sylow $q$-subgroups of $N$.   Since
$(q, p) =1, \exists Q \in S_q(N), H \subseteq N(Q)$.  If $Q_0 = {\mathbb Z}(Q)$ or $Q_0 = {\cal T}(Q)$, in either case
$Q_0 \thinspace char \thinspace Q$ and $Q_0 \lhd Q$ and $H \subseteq N_N(Q_0)$ and by the previous result,
$K= H N_N(Q_0)$ is Frobenius with kernel $N_N(Q_0)$.  If $N_N(Q_0) \ne N$, $N_N(Q_0)$ is nilpotent and has a normal $q$
complement.  By Thompson's normal $p$-complement theorem, this can't be the case for both ${\mathbb Z}(Q)$ and ${\cal T}(Q)$.
Since $G = HN$, $Q_0 \lhd G$.  By induction, $N/Q_0$ is nilpotent and $Q/Q_0 \lhd N/Q_0$ so $Q \lhd N$.  On the other
hand, if $N$ has a normal $q$ complement for all $q$ odd dividing $|N|$, then $2 \mid |N|$ and $N$ has a normal
Sylow-$2$ subgroup.\\
In any case, we have, for some $q$ and $Q \in S_q(G)$, $Q \lhd N$ and ${\mathbb Z}(Q), C_G({\mathbb Z}(Q)) \lhd G$.
Put ${\overline G} = G/C_G({\mathbb Z}(Q))$.  By a previous result,
${\overline G} = {\overline N} \bigcup_{{\overline g} \in {\overline G}} {\overline H}^{\overline g}$ which is a disjoint
(except for $1$) union of $|{\overline N}|+1$ subgroups.
$G$ acts on ${\mathbb Z}(Q)$ with kernel $C_G({\mathbb Z}(Q))$, so ${\overline G}$ acts faithfully on ${\mathbb Z}(Q)$.
Since $Q \subseteq C_G({\mathbb Z}(Q))$, $(t, q) =1$.
By a result in the coprime action section, $\exists v \in {\mathbb Z}(Q)^{\#}$ which is centralized by either ${\overline N}$
or ${\overline H}^{\overline g}$.  Since ${\mathbb Z}(N) = 1$, $[v, {\overline N}] \ne 1$ and by a previous result,
$v$ cannot be centralized by any non identity element of ${\overline H}^{\overline g}$.  This contradiction establishes the result.
\end{quote}
{\bf Additional fact:} Frobenius groups with non abelian kernels exist.
\\
\\
{\bf Theorem 11:}
Let $G$ be a ${\frac 3 2}$ transitive group with a regular normal subgroup, $N$.  If $G$ is not Frobenius then $N$ is an
elementary abelian $p$-subgroup and $N$ is the unique minimal normal subgroup of $G$.
\begin{quote}
\emph{Proof:} $N$ is transitive and $N$ and $N'= 1$.  $N_a= 1$ and any characteristic subgroup, $T$, of $N$ is normal in $G$ and transitive
which is impossible.
\end{quote}
{\bf Theorem 12:}
If $G$ is Frobenius with non-solvable complement $H$, $H$ has a normal subgroup of index $2$ that is isomorphic to
$M \times SL_2(5)$ where $M$ is metacyclic and $(|M|, 30) = 1$.
\begin{quote}
\end{quote}
\section {Character theory of Frobenius groups}
{\bf Theorem 13:}
Let $G$ be a Frobenius group of order $q^ap$ with elementary abelian Frobenius kernel $Q$ and a cyclic
group of $G/Q$ acts irreducibly by conjugation on $Q$, then
\\
(1) $G=QP$, $P \in S_p(G)$.  Every non-identity element of $G$ has order $p$ or $q$.  Every element of $P$ is conjugate to one in
$P$ and every element of order $q$ in in $Q$.  There are $p-1$ conjugacy classes of order $p$ of size $q^a$.
There are ${\frac {q^a-1} p}$ conjugacy classes of order $q$ of size $p$.
\\
(2) $G' = Q$ so the number of characters of degree 1 of $G$ is $p$ contains $Q$ in its kernel.
\\
(3) If $\phi$ is a non-principal irreducible character of $Q$, then ${ind_Q}^G(\phi)$ is an irredicible character of
$G$.  Every irreducible character of of $G$ degree $>1$ is equal to  ${ind_Q}^G(\phi)$ for some non-principal
irreducible character of $G$ has either degree $1$ or $p$ and the number of irreducible characters of
degree $p$ is ${\frac {q^a - 1} p}$.
\begin{quote}
\emph{Proof:}
$G=QP$ and $C_G(h)= Q$ if $1 \ne h \in Q$.  If $|x|=pq$, $x^p$ has oorder $q$, so $x^p \in Q$ but then $[x, x^p]=1$ and
$x \in C_G(x^p)= Q$, which is a contradiction. Put ${\overline G} = G/Q$ and ${\overline G}$ is abelian.
${\overline {g^{-1}xg}} = {\overline y}$. So ${\overline x} = {\overline y}$ since $P \cong {\overline P}$.
There are $p-1$ conjugacy classes of elements of order $p$.  If $1 \ne x \in P$, $C_G(x)=Q$ and $|G:P| = q^a$.
If $1 \ne h \in Q:$ $C_G(h)=Q$, $ccl(h) = \langle h, h^x, \ldots , h^{x^{p-1}} \rangle$.  $P = \langle x \rangle$.
This proves (1).
\\
\\
$G/Q$ is abelian so $Q \subseteq G'$ but $Q$ is a minimal normal subgroup so $Q=G'$.  Let $\psi$ be a non-principal irreducible
character of $Q$ and $\phi = {ind_Q}^*(\psi)$.  Let $1, x, \ldots, x^{p-1}$ be coset representatives for $G/Q$.
$||\phi||^2 = {\frac 1 {|G|}} \sum_{h \in Q} \phi(h) {\overline {\phi(h)}}=$
${\frac 1 {|G|}} \sum_{h \in Q} \sum_{i=0}^{p-1} $ $\phi(x^i h x^{-i}) {\overline {\phi(x^i h x^{-i}})} =$
${\frac p {|G|}} \sum_{h \in Q} \phi(h) {\overline {\phi(h)}}= {\frac {p|Q|} {|G|}} = 1$ so $\phi$ is irreducible.
\\
\\
$P$ acts on irreducible characters of degree $>1$, ${\cal C}$ as follows.  For $\psi \in {\cal C}$,
$\psi^x(h) = \psi(xhx^{-1}), h \in Q$.  Let $P= \langle x \rangle$ so ${ind_Q}^G(\psi)(h) = \psi(h) + \psi^x(h) + \ldots + \psi^{x^{p-1}}(h)$.
If $\psi_1$ and $\psi_2$ are in two different orbits, ${ind_H}^G(\psi_1)$ and ${ind_H}^G(\psi_2)$ restrict to different $Q$-classes.
$Q$ has $q^a-1$ irreducible, non-principal characters and so ${\cal C}|= q^a-1$, $|P|=p$ and there are ${\frac {q^q-1} p}$ $P$-orbits.
This accounts for all non-principal irreducible characters so they all have degree $p$.
\end{quote}
{\bf Application:} You can use this to calculate the characters of $D_{10}$, a non-abelian group of order $57$, a non-abelian
group of order $56$ with a normal elementary abelian Sylow $2$ subgroup.
\\
\\
{\bf Lemma 13.1:} Let $1 \ne Z \subseteq {\mathbb Z}(G)$ with $|G:Z|=m$ and $\psi$ a character of $Z$, then
${ind_Z}^G(\psi)(g) = m \psi(g), g \in Z, 0 \textnormal{ otherwise}$.
\section {Frobenius groups in CN classification}
The main result is that there is no simple group of order $3^3 \cdot 7 \cdot 13 \cdot 409$ using a method similar to
the method of Feit, Hall, Thompson to show CN groups of odd order are solvable.
\begin{quote}
\end{quote}
{\bf Lemma 13.2:} Let $G$ be a Frobenius group of with kernel $Q$ and suppose $Q$ and $G/Q$ are abelian but $G$ is not abalian.
Let $|Q|=n, |G:Q|=m$.  Then
\begin{itemize}
\item[(1)] $G/Q$ is cyclic and $G= QC$ for some cyclic groups $C$, $C \cap Q = 1$.
\item[(2)] $(m, n) =1$.
\item[(3)] $G$ has no elements of order $pq$, $q \mid n$, $p \mid m$,
\item[(4)] The number of non-identity conjugacy classes of $G$ in $Q$ is ${\frac {n-1} m}$ and each has size $m$.
\item[(5)] No two distinct elements of $C$ are $G$-conjugate.  So there are $m-1$ representatives of distinct conjugacy classes in $C$,
each of size $n$.  Every element of $G \setminus Q$ is conjugate to some element of $C$.  $G$ has $m + {\frac {n-1} m}$ conjugacy classes.
\item[(6)] $G' = Q$ and $G$ has $m$ distinct linear characters.
\item[(7)] If $\psi$ is a non-principal irreducible character of $Q$, ${ind_Q}^G(\psi)$ is an irreducible character of $G$.
Every irreducible character of degree $>1$ is ${ind_Q}^G(\psi)$ for some non-principal character of $Q$.  Every irreducible character has
degree $1$ or $m$ and the number of degree $m$ is ${\frac {n-1} m}$.
\end{itemize}
\begin{quote}
\emph{Proof:}
\\
\\
(1) Let $q \mid n$ and let $G/Q$ act by conjugation on the elementary abelian subgroup $\Omega_1(Q)$.  If $\phi$ is a faithful
irreducible character then the center is cyclic
\\
\\
(2) If
$p \mid |Q|$ and $p \mid |G:Q|$.  Let $P \in S_p(G)$, then $P \cap Q \lhd P$ and $P \cap Q$ is a Sylow subgroup of $Q$.
$C_G({\mathbb Z}(P) \cap Q)$
\\
\\
(3) and (4) Argue as in theorem 13.
\\
\\
(5) If $g_1^x=g_2$; $g_1, g_2 \in C$ and we cam pick $x \in Q$.  $[g_2,x] \in C \cap C^x \cap Q = 1$.  So $g_2 \in C(x), x \in Q$ which contradicts the
fact that $G$ is Frobenius.
\\
\\
(6) $Q \leq G'$ since $G/Q$ is abelian.  Let $C = \langle x \rangle$.  $h \mapsto [x, h]$ is a homomorphism with trivial kernel.
\\
\\
(7) Argue as in theorem 13.
\end{quote}
\section {Frobenius groups in CN classification}
The main result is that there is no simple group of order $3^3 \cdot 7 \cdot 13 \cdot 409$ using a method similar to
the method of Feit, Hall, Thompson to show CN groups of odd order are solvable.
\\
\\
{\bf Theorem 14:}
Let $G$ be a simple group of order $3^3 \cdot 7 \cdot 13 \cdot 409$.
\begin{itemize}
\item[(1)] $q_1 =3$: $Q_1 \in S_3(G)$, $N_1 = N_G(Q_1)$.  $Q_1$ is elementary abelian. $|N_1|= 3^3 \cdot 13$ and $N_1$ is Frobenius.
\item[(2)] $q_2 =7$: $Q_2 \in S_7(G)$, $N_2 = N_G(Q_2)$.  $Q_2$ is cyclic. $|N_2|= 3 \cdot 7$ and $N_2$ is Frobenius.
\item[(3)] $q_3 = 13$: $Q_{3} \in S_{13}(G)$, $N_3 = N_G(Q_3)$.  $Q_3$ is cyclic. $|N_3|= 3 \cdot 13$ and $N_3$ is Frobenius.
\item[(4)] $q_4 = 409$: $Q_4 \in S_{409}(G)$, $N_4 = N_G(Q_4)$.  $Q_4$ is cyclic. $|N_4|= 3 \cdot 409$  and $N_4$ is non-abelian.
\item[(5)] Every non-identity element of $G$ has prime order and $Q_i \cap {Q_i}^g = 1, g \in G \setminus Q_i$.  Further, for
$1 \leq i \leq 4$: $Q_i \cap {Q_i}^g = 1$, if $g \in G \setminus N_i$.
\end{itemize}
The non-identity conjugacy classes of $G$ are:
\begin{itemize}
\item[(a)] $2$ classes of elements of order $3$, each of size $7 \cdot 13 \cdot 409$.
\item[(b)] $2$ classes of elements of order $7$, each of size $3^3 \cdot 13 \cdot 409$.
\item[(c)] $4$ classes of elements of order $13$, each of size $3^3 \cdot 7 \cdot 409$.
\item[(d)] $136$ classes of elements of order $409$, each of size $3^3 \cdot 7 \cdot 13$.
\end{itemize}
From here on, for any subgroup $H < G$ with generalized character $\mu$ of $H$, put
$\mu^* = (ind_H)^G(\mu)$.
Thus,
\begin{itemize}
\item[(i)] $N_1$ has $2$ irreducible characters of degree $13$.
\item[(ii)] $N_2$ has $2$ irreducible characters of degree $3$.
\item[(iii)] $N_3$ has $4$ irreducible characters of degree $3$.
\item[(iv)] $N_4$ has $136$ irreducible characters of degree $3$.
\end{itemize}
\begin{quote}
\emph{Proof:}
Note that by theorem 8, $G$ is Frobenius with kernel $Q$, if $Q\lhd G$ and $C_G(x) \leq Q, 1 \ne x \in Q$.
\\
\\
Let $n_i$ be the size of $S_{q_i}(G)$.
\\
\\
Besides $1$ (which is impossible since $G$ is simple), $n_4 \mid 3^3 \cdot 7 \cdot 13$ and $n_4 = 1 \jmod{409}$
leaves only $n_4 = 819$ and $|N_4| = 3 \cdot 409$.  $Q_4 \lhd N_4$ and $N_4$ is a semidirect product of $Q_4$ and a cyclic group of order $3$.
\\
\\
No element of order $409$ divides $|N_3|$, so $n_3 \mid 3^3 \cdot 7 \cdot 13$ and $n_3 = 1 \jmod{13}$.  The only possibilities are
$n_3 =27$ or
$n_3 = 9 \cdot 7 \cdot 409$. So $n_3 = 9 \cdot 7 \cdot 409$, $|N_3|= 3 \cdot 13$.
\\
\\
No element of order $13$ or $409$ can divide $|N_2|$, so $n_2 \mid 3^3 \cdot 13 \cdot 409$.
$n_2 = 3^2 \cdot 13 \cdot 409$ and $|N_2|= 3 \cdot 7$.
\\
\\
Based on what we know so far, there are $s_{409}= 408 \cdot 9 \cdot 7 \cdot 13 = 334,152$ elements of order $409$ in $G$,
$s_{13} = 12 \cdot 9 \cdot 7 \cdot 409= 309,204$ elements of order $13$, $s_{7}=  6 \cdot 9 \cdot 7 \cdot 409 = 287,118$
elements of order $7$ and $s_{1}= 1$ element of order $1$.  $|G|= 3^3 \cdot 7 \cdot 13 \cdot 409= 1,004,913$; there are
$r= |G| - s_{1} - s_{7} -s_{13} - s_{409}= 74,438$ remaining elements.
Neither $N_4$, $N_3$ nor $N_2$ can be abelian otherwise a Sylow subgroup would lie in the center of its normalizer and $G$
would have a normal $p$ complement by Burnside.  Let $x$ be an element of order $3$ that lies in
the center of $Q_1$.
$|C_G(x)|$ cannot contain a element of order $409$, $13$ or $7$ because of the structure of the normalizers of their Sylow subgroups.
$Q_1 \subseteq C_G(x)$ so $|G:C_G(x)| = 7 \cdot 13 \cdot 409= 37,219$,
there are also $37,219$ conjugates of $x^2$ which also has order $3$ and thus $74,438$ elements of order $3$, this
accounts for all the remaining elements
of $G$.  As a result, every element of $Q_1$ has order $3$ and $Q_1$ is an elementary abelian group of order $3^3$.
$|Aut(Q_1)|= (3^3-1)(3^3 - 3)(3^3 - 3^2)= 26 \cdot 24 \cdot 18 = 2^5 \cdot 3^3 \cdot 13$.
$|N_G(Q_1)/C_G(Q_1)|$ must be either $1$ or $13$.
Again, Burnside rules out $1$ so $|N_G(Q_1)|= 3^3 \cdot 13$ and $N_1=N_G(Q_1)$ is nonabelian.
For each $Q= Q_i, i = 1,2,3,4$, $x \in Q$ implies
$C_G(x) \leq Q$ so $N_1$, $N_2$, $N_3$ and $N_4$ are all Frobenius.
$n_1 = {\frac {|G|} {|N_1|}}= 7 \cdot 13 \cdot 409$.
\\
\\
The character results follow from theorem 13, completing the proof.
\end{quote}
{\bf Lemma 14.1:}  For $1 \leq j \leq 4$, $q= q_i$, $Q = Q_i$, $N=N_i$, $p=|N:Q|$.
Let $\phi_1 , \ldots , \phi_k$ be any exceptional characters of $N$ of degree $p$.
Put $\alpha = \phi_1 - \phi_2$,
$\beta = \phi_3 - \phi_4$, then $\alpha, \beta$ are generalized characters of $N$ with
$\alpha(g)=0=\beta(g)$, if $g \in N, |g| \ne q$. $\alpha^*, \beta^*$ are generalized characters of $G$
with the same property. $(\alpha^*, \beta^*)_G = (\alpha, \beta)_N$.
\begin{quote}
\emph{Proof:}
$\exists \lambda_1, \ldots. \lambda_4$ irreducible, linear cahracters of $Q$, $\psi_j= {ind_Q}^G(\lambda_j)$.
$\psi_j(x) = 0$ if $x \in N \setminus Q$ since $Q \lhd N$ and so do $\alpha$ and $\beta$.
$\psi_j^*(1)= p$ and $\alpha(1)=\beta(1) = 0$.  ${\psi_j}^* = {ind_N}^G(\lambda_j) = {ind_Q}^N(\lambda_j)$.
$\psi_j^*$ vanishes on all elements not conjugate to an element of $Q$ and so do $\alpha^*$ and $\beta^*$.
$deg(\psi_j^*)= |G:Q|$. $\alpha^*(x) = \beta^*(x) = 0$  if $|x| \ne q$.   Let $\langle g_1, g_2, \ldots , g_k \rangle$
be coset representatives for $G/N$.  $Q \cap Q^x =1, k > 1$.
$(\alpha^*, \beta^*)_G = {\frac 1 {|G|}} \sum_{x \in G} \alpha^*(x) {\overline {\beta^*(x)}} =$
${\frac 1 {|G|}} \sum_{x \in G, |x| = q} \alpha^*(x) {\overline {\beta^*(x)}} = $
${\frac 1 {|G|}} \sum_{x \in N, |x| = q} |G:N| \alpha^*(x) {\overline {\beta^*(x)}} = $
${\frac 1 {|N|}} \sum_{x \in N} \alpha(x) {\overline {\beta(x)}} = (\alpha, \beta)_N$.
\end{quote}
{\bf Lemma 14.2:} Under the same assumptions as Lemma 14.1, let $\psi_1, \ldots, \psi_k$ be dictinct irreducible
characters of $N$ of degree $p$.  $\exists \chi_1, \chi_2, \ldots , \chi_k$ which are irreducible characters of
$G$ of the same degree $\phi_1^*=\phi_j^* = \epsilon_j (\chi_1 - \chi_j)$, $\epsilon_j = \pm 1$, $2 \leq j \leq k$.
These $\psi_j^*$ are called the exceptional representations associated with $Q_j$.
\begin{quote}
\emph{Proof:}
Let $q=q_i$, $N=N_i$, $p=|N:Q|$.  Let $\psi_1, \ldots , \psi_k$ be irreducible representations of $Q$.
Put $\alpha_j = \psi_1 - \psi_j, j = 2,\ldots,k$.  $2=||\alpha_j||^2 = (\alpha_i, \alpha_j)_N=||\alpha_j^*||^2$.
So $\alpha_j^*$ has two irreducible characters of $G$ as constituents; since $\alpha_j^*(1)=0$, these must be characters
of the same degree.  The lemma holds for $k= 1, 2$ so assume $k>2$.
$\alpha_2^* = \psi_1^* -\psi_2^*= \epsilon (\chi - \chi')$ and
$\alpha_3^* = \psi_1^* -\psi_3^*= \epsilon (\theta - \theta')$ and $\theta, \theta', \chi, \chi' \in Irred(G)$.
$\chi \ne \chi'$ and $\theta \ne \theta'$.
$\alpha_3^* - \alpha_2^* = \psi_2^* - \psi_3^* = \epsilon (\theta - \theta' +\chi' - \chi)$.  By 14.1,
$\psi_2^* - \psi_3^* = (\psi_2 - \psi_3)^*$ has two constituents and $\theta=\chi$ or $\theta'= \chi'$.
$\alpha_2^* = (\chi - \chi')$ and
$\alpha_3^* = (\chi - \theta')$; put $\chi_1 = \chi, \chi_2 = \chi', \chi_3 = \theta$.
$\exists \chi_j: \alpha_j^* = \psi_1^* - \psi_j^* = \epsilon (\chi_1 - \chi_j)$.  $\chi_1, \ldots, \chi_k$ are all
distinct, proving the lemma.
\end{quote}
{\bf Lemma 14.3:} The exceptional characters associated with $Q_i$ are distinct from the exceptional characters
associated with $Q_j$.
\begin{quote}
\emph{Proof:}
Let $\chi$ be an exceptional character associated with $Q_i$ and
Let $\theta$ be an exceptional character associated with $Q_j$.
There are distinct, irreducible characters of $Q_i$ with $\psi^* - \psi'^* = \chi - \chi'$
and distinct, irreducible characters of $Q_j$ with $\lambda^* - \lambda'^* = \theta - \theta'$.
Put $\alpha = \psi - \psi'$ and $\beta = \lambda - \lambda'$.
$\alpha^*$ is $0$ on all elements with order different from $q_i$ and
$\beta^*$ is $0$ on all elements with order different from $q_j$.  So $(\alpha^*, \beta^*)_G = 0$ and the pairwise
constituents are pairwise orthogonal.
\end{quote}
{\bf Lemma 14.4:} The permutation character of the group $G$ in theorem 14 of degree $819$ with $G$ actinng on left cosets of
$N_4$ decomposes as $\chi_0 + \gamma + \gamma'$ where $\chi_0$ is the principal character, and $\gamma, \gamma'$ are irreducible characters
of degree 409.
\begin{quote}
\end{quote}
{\bf Theorem 15:}
Let $G$ be a group of order $3^3 \cdot 7 \cdot 13 \cdot 409$, then $G$ is not simple.
\begin{quote}
\emph{Proof:}
Let $d_i$ be the common degree of the characters associated with $Q_i$.  These characters represent
irreducible, non-principal characters of $G$; together with the principal character.  These form all
the irreducible characters of $G$.  $1 + 2d_1^2 + 2d_2^2 + 4 d_3^2 + 136 d_4^2 = 1004913$.
$d_1^2 + d_2^2 + 2 d_3^2 + 68 d_4^2 = 502456$ (Equation *). All of these are irredicible and faithful and the smallest
degree is $13$, so $d_i \geq 13$ and $d_4 \leq {\sqrt {50245668}} < 86, d_4 \mid |G|$, so
$d_4 = \langle 13, 21, 27, 39, 63 \rangle$. As a result equation * has no solution.
\end{quote}


\documentclass[main.tex]{subfiles}

\begin{document}
\subsection{Define the notion of time complexity \text{TIME}(f (n)). Explain why we can say that this is a worst-case measure of complexity ? Why do we use big $O$ notation when we reason on the time complexity of a Turing machine}

\subsection{Define the big $O$ notation and the small $o$ notation. Give examples and explain the relation that exists between those two notions}

\subsection{Why are deterministic polynomial time Turing machines suitable to study the class $P$}

\subsection{Define the running time of a Turing machine that is a decider. If $M$ is a nondeterministic machine that decides the language $L$ in $O(t(n))$, how can we bound the running time of a deterministic Turing machine that decides $L$}

\subsection{Define the class $P$ and explain why it is an important complexity class}

\subsection{Given two examples of problems and their natural encodings. Suggest other encodings that are not reasonable and explain why}

\subsection{Give an example of a problem which is in NP and prove its membership NP using the notion of certificate}

\subsection{We have given two definitions of the class NP. One uses ”certificates” and one uses nondeterministic Turing machines. Recall the two definitions and prove that they are equivalent}

\subsection{Explain why NP $\subseteq$ ExpTime}

\subsection{Define the notion of NP complete problem and explain why this notion is important}

\subsection{Define the notion of "polynomial time mapping reducible". Show that if $A$ is polynomial time reducible to $B$ and $B \in P$ then $A \in P$}

\subsection{Prove that 3SAT is polynomial time reducible to CLIQUE}

\subsection{Prove the following two statements: ($i$) if $B \in$ NP-Complete and $B \in$ P, then P = NP, ($ii$) if $B \in$ NP-Complete and $B \leq_{P} C$, and $C \in$ NP then C is NP-Complete}

\subsection{Give the main constructions and arguments underlying the proof of the Cook-Levin Theorem that establishes that SAT is NP-Complete}

\subsection{Prove that 3SAT $\leq_P$ VERTEX-COVER}

\subsection{Define the HAMILTONIAN-PATH problem and prove it is NP-complete}

\subsection{Give a dynamic programming algorithm for the PARTITION problem and explain why it does not imply P = NP}

\subsection{Give a dynamic programming algorithm for the SUBSET-SUM problem and explain why it does not imply P = NP}

\end{document}


\section{Background} \label{sec:background}

\subsection{Scattering Matrix Calculus} \label{sec:s_mats}
\input{\here/s_mats.tex}
\clearpage

\subsection{SASA}\label{sec:SASA}
\input{\here/sasa.tex}
\clearpage

\subsection{Plasmonic Metasurfaces}\label{sec:plasmonic}
\input{\here/plasmonic.tex}
\clearpage

\subsection{Neural Networks} \label{sec:NN_bg}
\input{\here/neural_networks_background.tex}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%2345678901234567890123456789012345678901234567890123456789012345678901234567890
%        1         2         3         4         5         6         7         8

\documentclass[letterpaper, 10 pt, conference]{ieeeconf}  % Comment this line out
                                                          % if you need a4paper
%\documentclass[a4paper, 10pt, conference]{ieeeconf}      % Use this line for a4
                                                          % paper

\IEEEoverridecommandlockouts                              % This command is only
                                                          % needed if you want to
                                                          % use the \thanks command
\overrideIEEEmargins
% See the \addtolength command later in the file to balance the column lengths
% on the last page of the document

% The following packages can be found on http:\\www.ctan.org
%\usepackage{graphics} % for pdf, bitmapped graphics files
%\usepackage{epsfig} % for postscript graphics files
%\usepackage{mathptmx} % assumes new font selection scheme installed
%\usepackage{times} % assumes new font selection scheme installed
\usepackage{amsmath} % assumes amsmath package installed
\usepackage{amssymb}  % assumes amsmath package installed
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{array}
\usepackage{framed}

\title{\LARGE \bf
Radial-Basis Functions and Self Organization}

%\author{ \parbox{3 in}{\centering Huibert Kwakernaak*
%         \thanks{*Use the $\backslash$thanks command to put information here}\\
%         Faculty of Electrical Engineering, Mathematics and Computer Science\\
%         University of Twente\\
%         7500 AE Enschede, The Netherlands\\
%         {\tt\small h.kwakernaak@autsubmit.com}}
%         \hspace*{ 0.5 in}
%         \parbox{3 in}{ \centering Pradeep Misra**
%         \thanks{**The footnote marks may be inserted manually}\\
%        Department of Electrical Engineering \\
%         Wright State University\\
%         Dayton, OH 45435, USA\\
%         {\tt\small pmisra@cs.wright.edu}}
%}

\author{ Federico Baldassarre, Diego Gonz\'alez Mor\'in, Lucas Rod\'es Guirao \\
KTH Royal Institute of Technology
}

\begin{document}

\maketitle
\thispagestyle{empty}
\pagestyle{empty}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{abstract}

%\end{abstract}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
In this lab we use Radial Basis Functions (RBF) to approximate some simple functions of one variable. Suppose we have the function $f: \mathbb{R} \to \mathbb{R}$. RBF introduces a hidden layer such that $\hat{f}: \mathbb{R} \to \mathbb{R}^n \to \mathbb{R}$, where $n$ is the number of neurons in the hidden layer. The trick basically consists on mapping an input $x \in \mathbb{R}$ to a new space $\mathbb{R}^n$ using a set of functions $\{\phi_i\}_{i=1}^n$ and then back to $\mathbb{R}$.

The functions used are Gaussians with different means and, possibly, also different variances

$$
\phi_i(x) = \frac{\exp \Big(-\frac{(x-\mu_i)^2}{2\sigma_i}\Big)}{\sum_i \exp \Big(-\frac{(x-\mu_i)^2}{2\sigma_i}\Big)}.
$$

\emph{Radial} comes from the fact that the functions $\{\phi_i\}_{i=1}^n$ operate on distances rather than on the input points themselves. In this regard, the selection of $\{\mu_i\}_{i=1}^n$ is essential and is typically done using K-means or by simply selecting some points from the training set.

Given an input $x$ the output of the network is

$$
\hat{f}(x) = \sum_{i=1}^n w_i \phi_i(x).
$$

Thus we can say that the units in the hidden layer work as \emph{basis} in which the function $\hat{f}$ can be expressed. \\

The motivation behind this technique is the fact that in higher dimensional spaces, data is usually linearly separable. \\

Suppose we have a set of patterns $\{x_1, \dots, x_N\}$ and their corresponding real function values $\{f_1, \dots, f_N\}$. While training, the neural network minimizes the error measure

$$
total~error = \sum_{k=1}^N (\hat{f}_k-f_k)^2.
$$

\subsection{Computing the weight matrix}

The weights of the network are found by solving the system in (\ref{eq:1}).

\begin{equation}
\begin{split}
\phi_1(x_1)w_1 + \phi_2(x_1)w_2 + \dots + \phi_n(x_1)w_n &= f_1 \\
\phi_1(x_2)w_1 + \phi_2(x_2)w_2 + \dots + \phi_n(x_2)w_n &= f_2 \\
&\vdots \\
\phi_1(x_k)w_1 + \phi_2(x_k)w_2 + \dots + \phi_n(x_k)w_n &= f_k \\
&\vdots \\
\phi_1(x_N)w_1 + \phi_2(x_N)w_2 + \dots + \phi_n(x_N)w_n &= f_N
\end{split}
\label{eq:1}
\end{equation}

\begin{framed}
\textbf{Questions}
\begin{itemize}
\item \textit{What is the lower bound for the number of training examples, $N$?}

From basic linear algebra, we need at least $n$ equations in a system with $n$ variables. Otherwise, the system is underdefined. Hence, we have that $N\geq n$. If the number of samples is smaller than the number of hidden units, some units will end up doing nothing or doing the same thing as other units (i.e. will activate around the same point in the input space)

\item \textit{What happens with the error if $N=n$? Why?}

If this is the case, and the system is full-rank, we have that we can find a set of weights $\{w_i\}_{i=0}^n$ such that we perfectly reconstruct the target function, i.e. $\hat{f}_k = f_k$ for all the training samples. Thus we can decrease the error to zero.

From the network perspective what will happen is that every RBF unit will "specialize" in one single training point. For this reason, every time we feed an input there will be only one unit active and the others will be off, making it trivial for the following layer to classify the point. However, this is not a desirable behavior, because the network will have overfitted on the training points and will underperform on unseen data.

\item \textit{Under what conditions, if any, does (\ref{eq:1}) have a solution in this case?}

This happens if the rank per columns and the rank per rows is the same.

\item \textit{During training we use an error measure defined over the training examples. Is it good to use this measure when evaluating the performance of the network? Explain!}

Although we can make the error zero on the training set, it does not mean that the network will perform well with unseen data. On the contrary, we risk to overfit the network and reduce its generalization power.

\end{itemize}
\end{framed}

\subsection{Least Squares}

We write (\ref{eq:1}) as

$$
\boldsymbol{\Phi}\textbf{w} = \textbf{f},
$$

where

\begin{equation} \nonumber
\boldsymbol{\Phi} =
\begin{pmatrix}
\phi_1(x_1) & \phi_2(x_1) & \dots & \phi_n(x_1)\\
\phi_1(x_2) & \phi_2(x_2) & \dots & \phi_n(x_2) \\
\vdots & \vdots & \ddots & \vdots \\
\phi_1(x_N) & \phi_2(x_N) & \dots & \phi_n(x_N)
\end{pmatrix}
\end{equation}

and

\begin{equation}
\textbf{w} =
\begin{pmatrix}
w_1 \\
w_2 \\
\vdots \\
w_n
\end{pmatrix}.
\end{equation}

Now our error measure becomes $total~error = || \boldsymbol{\Phi}\textbf{w} - \textbf{f}||^2$, which is minimized by solving $ \boldsymbol{\Phi}^T \boldsymbol{\Phi}\textbf{w} = \boldsymbol{\Phi} \textbf{f}$, i.e.

$$
\textbf{w}_\text{opt} = (\boldsymbol{\Phi}^T \boldsymbol{\Phi})^{-1}\boldsymbol{\Phi}^T \textbf{f}.
$$

\subsection{The Delta Rule}
Sometimes, not all the sample patterns are accessible simultaneously.  If the network operates on a continuous stream of data,  the process of computing the weights changes from the previous case. We now define our error using the expectation

$$
\xi = expected~error= \textbf{E}\Big[ \frac{1}{2} (f(x) - \hat{f}(x))^2\Big].
$$

However, since we cannot find an exact expression for $\xi$ we use the instantaneous error as an estimate of $\xi$, i.e.

$$
\xi \approx \hat{\xi} = \frac{1}{2} (f(x) - \hat{f}(x))^2 = \frac{1}{2} e^2.
$$

Our goal here is to make $\hat{\xi} \to 0$ as fast as possible. To do so, we take a step $\Delta \textbf{w}$ in the opposite direction of the gradent of the error surface, i.e.

\begin{equation} \nonumber
\begin{split}
\Delta \textbf{w} &= -\eta \nabla_\textbf{w} \hat{\xi} \\
&= -\eta \frac{1}{2}\nabla_\textbf{w}(f(x_k)-\boldsymbol{\Phi}(x_k)\textbf{w})^2 \\
&= \eta(f(x_k)-\boldsymbol{\Phi}(x_k)^T\textbf{w})\boldsymbol{\Phi}(x_k) \\
&= \eta e \boldsymbol{\Phi}(x_k)
\end{split}
\end{equation}

where

\begin{equation} \nonumber
\boldsymbol{\Phi}(x_k) =
\begin{pmatrix}
\phi_1(x_k) \\
\phi_2(x_k) \\
\vdots \\
\phi_n(x_k)
\end{pmatrix}.
\end{equation}

$\eta$ is known as the learning rate constant and is essential in order to find a good solution. However its tunining is tricky since depending on its value we might never approach a good solution to the system. In particular, if $\eta$ is too high, noise on the input data might lead to error increase in $\textbf{w}$ instead. However, if $\eta$ is too small we might never achieve the optimum (least squares solution).
\cite{etzioni2011less}

\section{Supervised Learning of Network Weights}

\bibliographystyle{unsrt}
\bibliography{refs}

\end{document}


\subsection{Line integral of scalar fields}


\chapter{TSet}

Implements container for storing ordered set of unique elements.
Takes 2 arguments for specialization, first one is type of elements, second one is comparator class.
Usage example:

\lstinputlisting[language=Pascal]{setexample.pp}

Some methods return type of PNode. It has field Data, which can be used for retrieving data from
that node. This node can be also used for navigation between elements by methods of set class.
(But don't do anything else with it, you can lose data integrity.)

Memory complexity:
Size of stored base + constant overhead for each stored element (3 pointers + one boolean).

Members list:

\begin{longtable}{|m{10cm}|m{5cm}|}
\hline
Method & Complexity guarantees \\ \hline
\multicolumn{2}{|m{15cm}|}{Description} \\ \hline\hline

\verb!Create! & O(1) \\ \hline
\multicolumn{2}{|m{15cm}|}{Constructor. Creates empty set.} \\ \hline\hline

\verb!function Size(): SizeUInt! & O(1) \\ \hline
\multicolumn{2}{|m{15cm}|}{Returns number of elements in set.} \\\hline\hline

\verb!procedure Insert(value: T)! &
O(lg N), N is number of elements in set \\ \hline
\multicolumn{2}{|m{15cm}|}{Inserts element into set.} \\\hline\hline

\verb!procedure Delete(value: T)! &
O(lg N), N is number of elements in set \\ \hline
\multicolumn{2}{|m{15cm}|}{Deletes value from set. If element is not in set, nothing happens.} \\\hline\hline

\verb!function Find(value: T):PNode! & O(lg N) \\\hline
\multicolumn{2}{|m{15cm}|}{Searches for value in set. If value is not there returns nil. Otherwise
returns pointer to tree node (type PNode), which can be used for retrieving data from set.} \\\hline\hline

\verb!function FindLess(value: T):PNode! & O(lg N) \\\hline
\multicolumn{2}{|m{15cm}|}{Searches for greatest element less than value in set. If such element is not there returns nil. Otherwise
returns pointer to tree node (type PNode), which can be used for retrieving data from set.} \\\hline\hline

\verb!function FindLessEqual(value: T):PNode! & O(lg N) \\\hline
\multicolumn{2}{|m{15cm}|}{Searches for greatest element less or equal than value in set. If such element is not there returns nil. Otherwise
returns pointer to tree node (type PNode), which can be used for retrieving data from set.} \\\hline\hline

\verb!function FindGreater(value: T):PNode! & O(lg N) \\\hline
\multicolumn{2}{|m{15cm}|}{Searches for smallest element greater than value in set. If such element is not there returns nil. Otherwise
returns pointer to tree node (type PNode), which can be used for retrieving data from set.} \\\hline\hline

\verb!function FindGreaterEqual(value: T):PNode! & O(lg N) \\\hline
\multicolumn{2}{|m{15cm}|}{Searches for smallest element greater or equal than value in set. If such element is not there returns nil. Otherwise
returns pointer to tree node (type PNode), which can be used for retrieving data from set.} \\\hline\hline

\verb!function Min:PNode! & O(lg N) \\\hline
\multicolumn{2}{|m{15cm}|}{Returns node containing smallest element of set. If set is empty returns
nil.} \\\hline\hline

\verb!function Max:PNode! & O(lg N) \\\hline
\multicolumn{2}{|m{15cm}|}{Returns node containing largest element of set. If set is empty returns
nil.} \\\hline\hline

\verb!function Next(x:PNode):PNode! & O(lg N) worst case, but traversal from smallest element to
largest takes O(N) time \\\hline
\multicolumn{2}{|m{15cm}|}{Returns successor of x. If x is largest element of set, returns nil.} \\\hline\hline

\verb!function Prev(x:PNode):PNode! & O(lg N) worst case, but traversal from largest element to
smallest takes O(N) time \\\hline
\multicolumn{2}{|m{15cm}|}{Returns predecessor of x. If x is smallest element of set, returns nil.} \\\hline\hline

\verb!function IsEmpty(): boolean! & O(1) \\ \hline
\multicolumn{2}{|m{15cm}|}{Returns true when set is empty.} \\\hline

\end{longtable}


\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts,epsfig}
\usepackage[hyphens]{url}
\RequirePackage{color}
\usepackage{microtype}
\usepackage{mathtools}
\usepackage{extarrows}
\usepackage{enumerate}% http://ctan.org/pkg/enumerate
\usepackage{tabularx}
\usepackage{pifont}
 \usepackage{tikz}
\usetikzlibrary{shapes,arrows,chains}
\usetikzlibrary[calc]
\usetikzlibrary{bayesnet}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{hyperref}
\hypersetup{
	colorlinks=true,
	linkcolor=black,
	citecolor=black,
	filecolor=black,
	urlcolor=black,
}

\usepackage{breakurl}
\usepackage{comment}
\graphicspath{{fig/}}
\linespread{1.02}
\usepackage{wrapfig}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\usepackage[linesnumbered,boxed]{algorithm2e}

\usepackage{relsize}
\usepackage{fancyvrb}
\let\oldv\verbatim
\let\oldendv\endverbatim
\def\verbatim{\par\setbox0\vbox\bgroup\oldv}
\def\endverbatim{\oldendv\egroup\fboxsep0pt \noindent\colorbox[gray]{0.96}{\usebox0}\par}

\usepackage{amssymb}
%%% Document layout, margins
\usepackage{geometry}
\geometry{letterpaper, textwidth=6.5in, textheight=9in, marginparsep=1em}
%%% Section headings
\usepackage{sectsty}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{amsmath}
\DeclareMathOperator{\E}{\mathrm{E}}
\DeclareMathOperator{\Exp}{\mathrm{Exp}}
\DeclareMathOperator{\Var}{\mathrm{Var}}
\DeclareMathOperator{\KL}{\mathrm{KL}}
\DeclareMathOperator{\R}{\mathbb{R}}
\DeclareMathOperator{\N}{\mbox{N}}

\usepackage[round]{natbib}

\makeatletter
\def\@maketitle{%
	\begin{center}%
		\let \footnote \thanks
		{\large \@title \par}%
		{\normalsize
			\begin{tabular}[t]{c}%
				\@author
			\end{tabular}\par}%
		{\small \@date}%
	\end{center}%
}
\makeatother

\title{\bf  Use Stacking to Average Models for Time Series and Panel Data Under Continuous Ranked Probability Score }
\author{Yuling Yao}
\date{\today \vspace{-.1in}}
\begin{document}\sloppy
	\maketitle
	\thispagestyle{empty}

\section{Method}
The CRPS  for forecast CDFs with a finite first
moment can be written as
$$crps(F,y)=\E_X|X-y|- \frac{1}{2}\E_{X,X^\prime}|X-X^\prime|.$$

Given $K$ prediction models and observations $y_{tr}$ (number of observed icu needs) at time $t=1, \dots, T$ and region $r=1,\dots, R$, we could generate one-day-ahead prediction in each model, and draw $K$ predictive samples $x_{1ktr}, \dots, x_{Sktr}$ for the $k$-th model on the  day $t$ and region $r$. The prediction uses all information before $t$ to eliminate over-fitting.

Using these predictive draws, we can compute the crps of the k-th model on the $tr$-th observation by

$$ \widehat {crps}_{ktr}= \widehat {crps}_(x_{1ktr}, \dots, x_{sktr},y_{tr})= \frac{1}{S} \sum_{s=1}^S  |x_{sktr}-y_{tr}| -
\frac{1}{2S^2} \sum_{s, j=1}^S |x_{sktr}- x_{jktr}|.$$

Now the goal is to aggregate these $K$ models. It is easy to show that, when prediction is a mixture with weights $w_1, \dots, w_s$, the CRPS can be expressed as

$$ \widehat {crps}_{agg, tr} (w_1, \dots, w_K) = \frac{1}{S} \sum_{k=1}^K w_k  \sum_{s=1}^S |x_{skt}-y_t| -
\frac{1}{2S^2}  (\sum_{k=1}^K   \sum_{k, k'=1 }^K w_k w_{k'}   \sum_{s, j=1}^S |x_{skt}- x_{jk't}| ).$$

This expression is quadratic on $w$. We only need to compute  $\sum_{s=1}^S |x_{skt}-y_{tr}|$, $\sum_{s, j=1}^S |x_{sktr}- x_{jktr}|$, and
$\sum_{s, j=1}^S |x_{sktr}- x_{jk'tr}|$ for all $k, k'$ pairs once and store them for all  weight values in the optimization.

An extra degree of freedom is how we weight the prediction over time and over regions. In the early days we have very few data so all predictions are noisy and we might want to down weight the early phase in the final model evaluation. Mathematically we can pre-fixed introduce a time-varying weight $\lambda_1, \dots, \lambda_T$, say $\lambda_t = 1.5-(1-t/T)^2$, it penalizes early estimates (smaller t).  Likewise  we take into account the association of regions and individual sample size by a region-specific weight $\tau_r$

Finally we solve a quadratic optimization:

\begin{align*}
 &\min_{w_1, \dots, w_K} \sum_{t=1}^T  \sum_{r=1}^R\lambda_t\tau_r  \widehat {crps}_{agg, tr} (w), \\
  &s.t. ~{0\leq w_1, \dots, w_K \leq 1, \sum_{k=1}^K w_k=1}.
\end{align*}

\end{document}


\chapter{Lecture 14 Jun 01st 2018}%
\label{chp:lecture_14_jun_01st_2018}
% chapter lecture_14_jun_01st_2018

\section{Isomorphism Theorems (Continued 2)}%
\label{sec:isomorphism_theorems_continued_2}
% section isomorphism_theorems_continued_2

\subsection{Isomorphism Theorems (Continued)}%
\label{sub:isomorphism_theorems_continued}
% subsection isomorphism_theorems_continued

\begin{note}[Recall]
  In \autoref{thm:first_isomorphism_theorem}, we had that for a group homomorphism $\alpha : G \to H$ where $G$ and $H$ are groups,
  \begin{equation*}
    \faktor{G}{\ker \alpha} \cong \img \alpha
  \end{equation*}

  Now let $\alpha : G \to H$ be a group homomorphism, $K = \ker \alpha$, $\phi : G \to \faktor{G}{K}$ be the coset map, and $\bar{\alpha}$ be as defined in the proof of \autoref{thm:first_isomorphism_theorem}. We then have the following commutative diagram to illustrate the relationship between the three groups.
  \begin{center}
  \begin{tikzcd}
    G \arrow[dd, "\phi"'] \arrow[rrr, "\alpha"] &  &  & H \\
     &  &  &  \\
    G/K \arrow[rrruu, "\bar{\alpha}"'] &  &  &
  \end{tikzcd}
  \end{center}
\end{note}

A natural question to ask after seeing the relationship is: Is $\bar{\alpha} \phi = \alpha$? If it is, is the definition of $\bar{\alpha}$ unique? The answer is: \hlnotec{YES!} on both accounts.

\begin{proof}
  Let $g \in G$. Then
  \begin{equation*}
    \bar{\alpha} \phi (g) = \bar{\alpha} \big( \phi(g) \big) = \bar{\alpha} (Kg) = \alpha(g)
  \end{equation*}

  Suppose $\alpha = \beta \phi$ where $\beta : \faktor{G}{K} \to H$. Then
  \begin{equation*}
    \beta (Kg) \overset{(1)}{=} \beta ( \phi(g) ) = \beta \phi(g) = \alpha(g) = \bar{\alpha} (Kg)
  \end{equation*}
  where $(1)$ is because $\phi$ is surjective by \cref{propo:propo_related_to_quotient_groups}. Therefore, we observe that $\beta = \bar{\alpha}$ for any $Kg \in \faktor{G}{K}$. This proves that $\bar{\alpha}$ is the unique homomorphism such that $\faktor{G}{K} \to H$ satisfying $\alpha = \bar{\alpha} \phi$.\qed
\end{proof}

With that, we have the following proposition.

\begin{propo}\index{factors through}
\label{propo:uniqueness_of_homomorphism_factors}
  Let $\alpha : G \to H$ be a group homomorphism, where $G$ and $H$ are groups. Let $K = \ker \alpha$. Then $\alpha$ factors uniquely as $\alpha = \bar{\alpha} \phi$< where $\phi : G \to \faktor{G}{K}$ is the coset map and $\bar{\alpha} : \faktor{G}{K} \to H$ is defined by
  \begin{equation*}
    \bar{\alpha} (Kg) = \alpha(g).
  \end{equation*}
  Note that $\phi$ is surjective and $\bar{\alpha}$ is injective.

  In such a scenario, we also say that $\alpha$ \hlnoteb{factors through} $\phi$.\sidenote{Reference for the terminology: \url{https://math.stackexchange.com/questions/68941/terminology-a-homomorphism-factors}.}
\end{propo}

\begin{eg}
  Let $G = \lra{g}$ be a cyclic group. Consider $\alpha : \mathbb{Z} \to G$, defined as
  \begin{equation*}
    \forall k \in \mathbb{Z} \quad \alpha(k) = g^k,
  \end{equation*}
  which is a group homomorphism. By definition, $\alpha$ is surjective. Note that
  \begin{equation*}
    \ker \alpha = \{k \in \mathbb{Z} : g^k = 1 \}.
  \end{equation*}
  We have, therefore, two cases to consider.
  \begin{itemize}
    \item \underline{$G$ is an infinite group} \\
      This would imply that $\ker \alpha = \{0\}$ since only $g^0 = 1$. Then by \autoref{thm:first_isomorphism_theorem}, we have that
      \begin{equation*}
        \faktor{\mathbb{Z}}{\ker \alpha} \cong G
      \end{equation*}
      Note that\sidenote{We are assuming that the group $\mathbb{Z}$ here works under the operation of addition, otherwise, if we employ multiplication, then $\mathbb{Z}$ would not be a group and $\alpha$ would not be a group homomorphism.}
      \begin{equation*}
        \faktor{\mathbb{Z}}{\ker \alpha} = \{ ( \ker \alpha ) k : k \in \mathbb{Z} \} = \{ 0 + k : k \in \mathbb{Z} \} = \mathbb{Z}.
      \end{equation*}
      Therefore
      \begin{equation*}
        \mathbb{Z} \cong G
      \end{equation*}

    \item \underline{$G$ is a finite group} \\
      Suppose that $\abs{G} = o(g) = n \in \mathbb{N}$, which is valid by \cref{crly:lagrange_s_theorem_crly1}. Then
      \begin{equation*}
        \ker \alpha = n \mathbb{Z}
      \end{equation*}
      Then by the \autoref{thm:first_isomorphism_theorem}, we have
      \begin{equation*}
        \faktor{\mathbb{Z}}{n \mathbb{Z}} \cong G.
      \end{equation*}
      Observe that
      \begin{equation*}
        \faktor{\mathbb{Z}}{n \mathbb{Z}} = \{ n \mathbb{Z} + k : k \in \mathbb{Z} \} = \mathbb{Z}_n
      \end{equation*}
      since the set in the middle is the definition of the set of integers modulo $n$.\sidenote{This is why we often see texts from various authors using $\faktor{\mathbb{Z}}{n \mathbb{Z}}$ to represent the set of integers modulo $n$.} Therefore,
      \begin{equation*}
        \mathbb{Z}_n \cong G
      \end{equation*}
  \end{itemize}

  Therefore, we have that
  \begin{equation*}
    \mathbb{Z} \cong G \text{ or } \mathbb{Z}_{o(g)} \cong G
  \end{equation*}
\end{eg}

\begin{thm}[Second Isomorphism Theorem]
\index{Second Isomorphism Theorem}
\label{thm:second_isomorphism_theorem}
  Let $H$ and $K$ be the subgroups of a group $G$ with $K \triangleleft G$. Then
  \begin{itemize}
    \item $HK$ is a subgroup of $G$;
    \item $K \triangleleft HK$;
    \item $H \cap K \triangleleft H$; and
    \item $\faktor{HK}{K} \cong \faktor{H}{H \cap K}$.
  \end{itemize}
\end{thm}

\begin{proof}
  Since $K \triangleleft G$, by \cref{lemma:product_of_groups_as_a_subgroup} and \cref{propo:product_of_normal_subgroups_is_normal}, we have that $HK = KH$ is a subgroup of $G$. Consequently, we have $K \triangleleft HK$, since $K$ is clearly a subgroup of $HK$ and $K \triangleleft G$, and so $\forall x \in HK \subseteq G$ we have that $gK = Kg$.

  Consider $\alpha : H \to \faktor{HK}{K}$, defined by\sidenote{Note that $Kh \in \faktor{HK}{K}$ since $h \in H \subseteq HK$.}
  \begin{equation*}
    \alpha(h) = Kh
  \end{equation*}
  Now if $x = kh \in KH = HK$, then
  \begin{equation*}
    Kx = K(kh) = Kh = \alpha(h).
  \end{equation*}
  Therefore, we have that $\alpha$ is surjective. Now by \cref{propo:properties_of_cosets}, observe that
  \begin{equation*}
    \ker \alpha = \{h \in H : Kh = K \} = \{h \in H h \in K \} = H \cap K.
  \end{equation*}
  Then by the \hyperref[thm:first_isomorphism_theorem]{First Isomorphism Theorem}, we have that
  \begin{equation*}
    \faktor{HK}{K} \cong \faktor{H}{H \cap K}.
  \end{equation*}
  Since we have that $\ker \alpha = H \cap K$ and $\ker \alpha \triangleleft H$, we have that $H \cap K \triangleleft H$.\qed
\end{proof}

\begin{thm}[Third Isomorphism Theorem]
\index{Third Isomorphism Theorem}
\label{thm:third_isomorphism_theorem}
  Let $K \subseteq H \subseteq G$ be groups, with $K \triangleleft G$ and $H \triangleleft G$. Then
  \begin{equation*}
    \faktor{H}{K} \, \triangleleft \, \faktor{G}{K} \text{ and } \left( \faktor{G}{K} \right) \Big/ \left( \faktor{H}{K} \right) \cong \faktor{G}{H}
  \end{equation*}
\end{thm}

\begin{proof}
  Define $\alpha : \faktor{G}{K} \to \faktor{G}{H}$ by $\alpha(Kg) = Hg$ for all $g \in G$. Clearly, $\alpha$ is surjective. Now if $Kg = Kg_1$, for any $g, g_1 \in G$, then $gg_1 \in K \subseteq H$. Therefore, $Hg = Hg_1$. Thus $\alpha$ is well-defined. Now
  \begin{equation*}
    \ker \alpha = \{Kg : Hg = H \} = \{ Kg : g \in H \} = \faktor{H}{K}.
  \end{equation*}
  Then
  \begin{equation*}
    \faktor{H}{K} = \ker \alpha \triangleleft \faktor{G}{K}.
  \end{equation*}
  By the \hyperref[thm:first_isomorphism_theorem]{First Isomorphism Theorem}, we have
  \begin{equation*}
    \left( \faktor{G}{K} \right) \Big/ \left( \faktor{H}{K} \right)
  \end{equation*}
  as required. \qed
\end{proof}

% subsection isomorphism_theorems_continued (end)

% section isomorphism_theorems_continued_2 (end)

\newthought{One reason} that we are interested in the symmetric group is that they contain all finite groups.

\begin{thmnonum}[Cayley's Theorem]
  If $G$ is a finite group of order $n$, then $G$ is isomorphic to a subgroup of $S_n$.
\end{thmnonum}

% chapter lecture_14_jun_01st_2018 (end)


\input{settings}

\begin{document}

\lhead{Hyperparameter tuning, Regularization \\ and Optimization}
\rhead{ Deep Learning specialization}
\cfoot{\thepage \ of \pageref{LastPage}}

\section*{Setting up your Machine Learning process}
\subsection*{Train, Dev and Test}

Applied machine learning is a highly iterative process: You start with an idea, you
experiment with it, get back results and based on the outcome you refine your ideas,
change your choices and repeat the process.

To train a neural network, you have several decisions to make:

\begin{itemize}
    \item Number of laters
    \item Number of hidden units
    \item Learning rate
    \item Activation functions
\end{itemize}

One of the things that determine how quickly you can make progress is how efficiently
you can go around this cycle. Making good choices in how you set up your training, development, and test sets can make
a huge difference in helping you quickly find a good high performance neural network.

Usually, the rule of thumb in machine learning is a 60\% train, 20\% dev and 20\% test
partition of the dataset. It's important to consider the size of your dataset, since the
dev and test sets only are to evaluate the performance of a model, it might be
sufficient to have 10,000 observations in each set, for a dataset of a million observations
that split would be 98\% train, 1\% dev and 1\% test.

Another rule of thumb is to make sure that the dev and test sets come from the same
distribution.

It might be okay not to have a test set. The goal of a test set is to give an
unbiased estimate of the error of your algorithm, if you don't need that estimate it's
okay not to have a test set.

\subsection*{Bias and Variance}

\begin{figure}[H]
    \subfloat[High bias]{{\includegraphics[width=4.5cm]{img/under.png} }}%
    \subfloat[Just right]{{\includegraphics[width=4.5cm]{img/right.png} }}%
    \subfloat[High variance]{{\includegraphics[width=4.5cm]{img/over.png} }}%
    \caption{Bias and variance}
    \label{fig:example}
\end{figure}

Since we have several dimensions it's difficult to plot the decision boundary. We can
compare the train and dev errors in order to obtain how is our bias and variance:

\begin{itemize}
    \item If the difference between train and dev errors is small we have low variance
    and if it's big we have high variance.
    \item If the train error is near to the optimal (bayes) error we have low bias
    and in the other case we have high bias.
\end{itemize}

The following curve ilustrates this tradeoff:

\begin{figure}[H]
    \begin{center}
            \includegraphics[width=0.6\textwidth]{img/bias-variance.png}
            \caption{Test and training error as a function of model complexity}
        \end{center}
\end{figure}

\subsection*{Basic Recipe for Machine Learning}

If the model has a high bias (train set performance) you can:
\begin{itemize}
    \item Train a bigger network
    \item Train longer
    \item Try a different Neural Network architecture
\end{itemize}

If the model has a high variance (test set performance) you can:
\begin{itemize}
    \item Get more data (if possible)
    \item Regularization
    \item Try a different Neural Network architecture
\end{itemize}

In "traditional" machine learning we speak of the bias-variance tradeoff because we
could only increase one sacrificing the other. In deep learning is a little bit difference
training a bigger network almost always reduce bias and doesn't increase variance (with
proper regularization) and getting more data almos always reduce variance without
hurting the bias. This is why deep learning has been so successfull with supervised
learning.

\section*{Regularizing your netural network}
\subsection*{Regularization}

If you have a high variance problem (your neural network is overfitting the data) you
should try regularization.

Let's begin explaining how regularization works for the logistic regression, we add
the following term to the loss:
\begin{align*}
    J(w,b) = \frac{1}{m} \sum_{i=1}^m L(\hat{y}^{(i)},y^{(i)}) + \color{blue} \frac{\lambda}{2m} \|w\|_p^2
\end{align*}
Where $\lambda$ is called the \textit{regularization parameter} and $\|\dot\|_p$ is the
$p$ norm, the must common regularizations are:
\begin{itemize}
    \item $p=2$ (L2 regularization)
    \item $p=1$ (L1 regularization)
\end{itemize}
L2 regularization is the most common and L1 regularization is used because it makes
the solution sparse.

For a neural network, the regularization looks as follows:
\begin{align*}
    J(w^{[1]},b^{[1]},..., w^{[L]}, b^{[L]}) = \frac{1}{m} \sum_{i=1}^m L(\hat{y}^{(i)},y^{(i)}) + \color{blue} \frac{\lambda}{2m} \sum_{l=1}^L\|W^{[l]}\|^2
\end{align*}
Where $\|W^{[l]}\|$ is the \textit{Frobenius} norm of $W$.

How do you implement gradient descent with this?
\begin{align*}
    dW^{[l]} &= \text{(from backprop)} + \color{blue} \frac{\lambda}{m}W^{[l]} \\
    W^{[l]} &:= W^{[l]} - \alpha dW^{[l]}  \\
    &= W^{[l]}\left(1 - \frac{\alpha \lambda}{m}\right) - \alpha(\text{from backprop})
\end{align*}
That's why this kind of regularization is also known as \textit{weight decay} because
it's just like the original backpropagation but you are multiplying the weght matrix
$W^{[l]}$  by $\left(1 - \frac{\alpha \lambda}{m}\right)$ a number strictly smaller than
1.

\textbf{Why regularization reduces overfitting?} As lambda gets bigger the penalization
for $W$ being a large matrix get's bigger and so
the error is bigger. Intuitively as we make $\lambda$ bigger we start making the
impact of more and more hidden units negligible and therefore obtaining a more
simple network that is therefore less prone to overfitting.

\subsection*{Dropout regularization}
With droput we go through each layer of the network and set some probability $p$
of eliminating a node in the neural network so you end up with a much smaller,
diminished network.
\begin{figure}[H]
    \begin{center}
            \includegraphics[width=0.9\textwidth]{img/regularization.jpg}
            \caption{Ilustration of regularization}
        \end{center}
\end{figure}

\textbf{Inverted dropout} After removing nodes from the layer $l$ with probability $p$
we have to divide $a$ by that probability so that the expected value remains the same.

Notice that each layer can have different probability $p$, for more dense layers you
might use smaller $p$ (probability to keep a node) and in thinner layers that $p$ can
be bigger or even 1 (no dropout).

Also notice that at test time we shouldn't do any dropout (you would just add noise to your
predictions)

\textbf{Why does dropout work?} The intuition is that a single unit can't rely solely
in any feature because any one feature could be made zero (because of droput) so
it has to spread and give a little bit of weight to each incoming feature. By spreading
weights it has an effect of shrinking the squared norm of the weights, similar to L2
regularization.

\subsection*{Other regularization methods}
\textbf{Data augmentation:} Take the examples of an neural network which purpose is image
classification. Then you can flip, zoom, rotate and perform an slight distortion
to each image. The new dataset is bigger and might help reducing to reduce the variance.

\textbf{Early stopping:} By stopping early you have a mid-size $W$ that hasn't still
learned some really specific configurations of the train dataset and therefore overfitting.

Early stopping has one downside, in general you would like to follow the principle of
orthogonalization, that is, solving different tasks at different times. When training
neural networks we have to worry about optimizing the cost function $J$ and after that
to not overfit. In general we can tackle this two problem in a totally independent way
but early stopping couples this two tasks.

\begin{figure}[H]
    \begin{center}
        \subfloat[Data augmentation]{{\includegraphics[width=6cm]{img/aumentation.png} }}%
        \quad
        \subfloat[Early stopping]{{\includegraphics[width=6cm]{img/early-stopping.png} }}%
        \caption{Other regularization methods}
    \end{center}
\end{figure}

A better alternative to early stopping is just using L2 regularization and training for
as long as possible. The downside of this alternative is that you add another hyperparameter
($\lambda$).

\section*{Setting the optimization problem}
\subsection*{Normalizing inputs}

In general, the cost function of the optimization problem is easier to optimize when
the training dataset is normalized. To normalize it you have to:
\begin{itemize}
    \item Obtain the dataset mean $\mu = \frac{1}{m}\sum_{i=1}^m x^{(i)}$ and substract
    it to every observation $x^{(i)} = x^{(i)} - \mu$
    \item Obtain the dataset variance $\mu = \frac{1}{m}\sum_{i=1}^m x^{(i)2}$ and divide
    each observation $x^{(i)} = \frac{x^{(i)}}{\sigma^2}$
\end{itemize}
Notice that you should store this values of $\mu$ and $\sigma^2$ so you can normalize
your test set with this same $\mu$ and $\sigma^2$ values.
\begin{figure}[H]
    \begin{center}
            \includegraphics[width=0.9\textwidth]{img/normalized.png}
            \caption{Comparison of countours of the normalized an unnormalized cases}
        \end{center}
\end{figure}

\subsection*{Vanishing / Exploding gradients}
One of the problems of training neural network, especially very deep neural networks,
is vanishing and exploding gradients, that is, the derivatives can get either
very big or very small; this makes the training very difficult.

\textbf{Weight Initialization for Deep Networks:} Usually a better or more careful
choice of the random initialization for the neural network can address the problem of
vanishing and exploding gradients.

The recomenended initialization of the weights matrix at the $l$ layer is:
\begin{align*}
    W^{[l]} &\sim N\left(0, \frac{2}{n^{[l-1]}}\right) && \text{for relu activations} \\
    W^{[l]} &\sim N\left(0, \sqrt{\frac{1}{n^{[l-1]}}}\right) && \text{for tanh activations} \\
\end{align*}
In this way each $W$ matrix has a norm near to 1 for each layer $l$ trying to prevent
the gradients to vanish or explode to quickly.

\subsection*{Gradient checking}
When implementing backpropagation there's a test called \textit{gradient checking} that
can help you to make sure that your implementation of backpropagation is correct. In
order to aproach this test we need to introduce first a way tu approach numerically
the gradients.

\textbf{Numerical approximation of gradients:} We can use the forward difference where,
for $\varepsilon > 0$ :
\begin{align*}
    \frac{f(\theta + \varepsilon) - f(\theta)}{\varepsilon} = f'(\theta) + O(\varepsilon)
\end{align*}
A better expression is the central (two sided) difference where:
\begin{align*}
    \frac{f(\theta + \varepsilon) - f(\theta - \varepsilon)}{2 \varepsilon} = f'(\theta) + O(\varepsilon^2)
\end{align*}
Notice that now the error is $O(\epsilon^2)$ instead of $O(\epsilon)$. There are also
Higher-order differences that might give a better approximation but are also more complicated
to calculate.

\textbf{Gradient checking procedure:}

\begin{enumerate}
    \item Reshape $W^{[1]}, b^{[1]}, ..., W^{[L]}, b^{[L]}$ into a single vector $\theta$
    \item Reshape $dW^{[1]}, db^{[1]}, ..., dW^{[L]}, db^{[L]}$ into a single vector $d\theta$
    \item Compute $\hat{d\theta_i} = \dfrac{J(\theta_1, ..., \theta_i+\varepsilon + ...) - J(\theta_1, ..., \theta_i-\varepsilon + ...)}{2 \varepsilon}$
    \item Compute $\delta = \dfrac{ \|\hat{d\theta_i} - d\theta_i\|}{\| \hat{d\theta_i} \| + \| d\theta_i \|}$.
    \item If $\delta$ is smaller than $\varepsilon$ there's no reason to woerry, if it's
    around epsilon its okay but double check your backpropagation algorithm and if it's
    much bigger than epsilon then it might be a bug.
\end{enumerate}

It's important not to use it in training (it's really slow). It should be used just
to debug the implementation.

\end{document}


\section{Design Factor}\label{sec:DF}

The Design Factor (\(N_u\)/\(N_y\)) is used to obtain an ``allowable'' or ``working'' stress for design calculations. The design factor may be based on a number of failure modes, such as \ac{UTS} or endurance limit.

When considering the \ac{UTS}, the Design Factor (\(N_u\)) is:

\begin{equation}
    N_u = a.b.c.d.k
\end{equation}

And the allowable stress is calculated by:

\begin{equation}
    \text{Allowable Stress} = \frac{S_\text{UTS}}{N_u}
\end{equation}

When considering the \acf{YS}, the Design Factor (\(N_y\)) is:

\begin{equation}
    N_y = b.c.d.k
\end{equation}

And the allowable stress is calculated by:

\begin{equation}
    \text{Allowable Stress} = \frac{S_\text{y}}{N_y}
\end{equation}

The five factors \(a\), \(b\), \(c\), \(d\) and \(k\) ensure that we consider the following in our calculations:

\begin{description}
    \item[a] ratio between \ac{UTS} and \ac{YS} for your material
    \item[b] fatigue factor
    \item[c] shock factor
    \item[d] factor of safety (Pugsley's Method)
    \item[k] stress concentration factor
\end{description}

The\marginnote{a: UTS / YS ratio} ratio of the ultimate strength of the material to its yield strength (sometimes the elastic limit). If the yield strength is not known then this factor is used to estimate what it would be:

\begin{description}
    \item[\(a=2\)] for ductile material
    \item[\(a=1.5\)] for heat treated and tempered alloys
\end{description}

For cast iron, which has no real elastic limit, failure occurs suddenly at the ultimate tensile strength, and there is no sense in applying this factor at all.

The\marginnote{b: Fatigue Factor} fatigue factor can be calculated using the Goodman Criterion but in general and for the purpose of this exercise, you should consider two scenarios:

%used to quantify the interaction of mean and alternating stresses on the fatigue life of a material.

%\begin{equation}
%  \sigma_\text{a} = \sigma_\text{fat}\times\left(1-\frac{\sigma_\text{m}}{\sigma_\text{ts}}\right).
%\end{equation}

%\noindent Where $\sigma_\text{a}$ is the alternating stress, $\sigma_\text{m}$ is the mean stress, $\sigma_\text{fat}$ is the fatigue limit for completely reversed loading, and $\sigma_\text{ts}$ is the ultimate tensile strength of the material. But in general and for the purpose of this exercise, you should consider two scenarios:

\begin{description}
    \item[\(b=1\)] for a dead load, or a single-plane load varying between 0 and a maximum.
    \item[\(b=1.5\)] for a load that varies between tension and compression
\end{description}

The\marginnote{c: Shock Factor} dynamic forces imposed by shock loading can be many times the static loads that a shaft is designed towards. If there is potential for a shock load, a safety factor should be included to account. Again, you should consider two cases.

\begin{description}
    \item[\(c=1\)] when loads are gradually applied
    \item[\(c=2\)] when loads are suddenly applied
\end{description}

To investigate the shock loads in detail, analysis of the elongation and energy absorption capability of material and geometry would be required.

The\marginnote{d: ``Factor of Safety''} ``Factor of Safety'' or uncertainty factor can be considered the ``real'' safety factor.

If all the other factors (a,b,c,k) are properly computer and accounted for, and the ``design factor'' made equal to their product, the design will still have nor margin of safety to allow for unexpected variation in load or material quality. It may be on the point of failure and these factors may be indeterminate, or extremely complex, or uncertain.

The factor d provide for these conditions, The value taken for d will be dependent on the judgement of the designer, but will include the consideration of the following:

\begin{enumerate}
    \item Degree of accuracy of stress computations \emph{(I.e.\ the reliance that can be placed on the estimation of and the assumptions made in calculating the stresses.)}
    \item Degree of reliability of the material \emph{I.e.\ the conformance to specification of the material chosen and the property chosen to represent the behaviour of the material under the specified loading.}
    \item Degree of uncertainty of loading \emph{I.e.\ How reliable the load specification is both in terms of magnitude, point of application, distribution of loading and inclusion of other loads such as handling, transportation etc.}
    \item Degree of reliability of specification \emph{I.e.\ How reliable the ``specification'' is in terms of defining the function etc.}
    \item Initial stresses \emph{I.e.\ Presence of residual stresses associated with manufacture, forming or assembly etc.}
    \item Reliability of manufacture \emph{I.e.\ Variability of heat treatments, surface finishes, dimensional tolerances etc.}
    \item Indeterminate or unexpected loads \emph{I.e.\ Errors in handling, changes in loading due to wear of critical parts etc.}
    \item Operating environment \emph{I.e.\ Ambient temperature (high or low), corrosion etc.}
    \item Consequences of failure \emph{I.e.\ Danger to life, ease of repair, cost of failure etc.}
\end{enumerate}

A safety factor may be defined by a Code of Practice, Company Policy, experience of designer. Codes of Practice specifying Safety Factors are often associated with specialised industries for products such as boilers, buildings etc. Companies dealing with specialised products frequently have their own specified factors of safety. Caution should be exercised where the design differs from the ``norm''. Experienced designers will often have developed their own safety factors for application to their design speciality.

In\marginnote{Calculating d using Pugsley's Method} 1966, Pugsley~\cite{howard1967} devised a general methodology for determining the safety factor, which takes the manufacturing, operational characteristics, and seriousness of failure into account\footnote{For more information on Safety Factors please see \cref{appendix-safety}}.

\begin{equation}
    d = X.Y
\end{equation}

\begin{description}
    \item[\(X\)] is chosen based on three factors related to manufacture and operation.
    \item[\(Y\)] is chosen based on seriousness of failure related to personnel and to economic impact.
\end{description}

To calculate the value of \(X\), one has to determine the quality of the component in three areas:

\begin{description}
    \item[A] Materials, workshop, inspection and manufacture
    \item[B] Loading and control over it
    \item[C] Quality of assessment of strength, analysis methods and accuracy
\end{description}

Each are scored as either Very Good (VG), Good (G), Fair (F) or Poor (P). Using these scores, the value for \(X\) can be calculated using \cref{tbl-pugsley-x}.

\begin{table}[h!]
  \caption{Calculating $X$}\label{tbl-pugsley-x}
  \center{}
  \begin{tabular}{l c | c c c c}
    \toprule
    & B = & VG & G & F & P \\
    A = & C = & & & & \\
    \midrule
    VG & VG & 1.1 & 1.3 & 1.5 & 1.7 \\
    VG & G & 1.2 & 1.45 & 1.7 & 1.95 \\
    VG & F & 1.3 & 1.6 & 1.9 & 2.2 \\
    VG & P & 1.4 & 1.75 & 2.1 & 2.45 \\
    \midrule
    G & VG & 1.4 & 1.55 & 1.8 & 2.05 \\
    G & G & 1.45 & 1.75 & 2.05 & 2.35 \\
    G & F & 1.6 & 1.95 & 2.3 & 2.65 \\
    G & P & 1.75 & 2.15 & 2.55 & 2.95 \\
    \midrule
    F & VG & 1.5 & 1.8 & 2.1 & 2.4 \\
    F & G & 1.7 & 2.05 & 2.4 & 2.75 \\
    F & F & 1.9 & 2.3 & 2.7 & 3.1 \\
    F & P & 2.1 & 2.55 & 3.00 & 3.45 \\
    \midrule
    P & VG & 1.7 & 2.15 & 2.4 & 2.75 \\
    P & G & 1.95 & 2.35 & 2.75 & 3.15 \\
    P & F & 2.2 & 2.65 & 3.1 & 3.55 \\
    P & P & 2.45 & 2.95 & 3.45 & 3.95 \\
    \bottomrule
  \end{tabular}
\end{table}

To calculate the value of \(Y\), one has to assess the potential impact of the failing with respect to two areas:

\begin{description}
  \item[D] Seriousness of danger to personnel
  \item[E] Seriousness of economic consequences
\end{description}

These are scores Not Serious, Serious and Very Serious. Table~\ref{tbl-pugsley-y} is then used to look-up the respective \(Y\) value.

\begin{table}
  \caption{Calculating $Y$}\label{tbl-pugsley-y}
  \center{}
  \begin{tabular}{c c c c}
    \toprule
    D = & Not Serious & Serious & Very Serious \\
    E = & & & \\
    \midrule
    Not Serious & 1 & 1.2 & 1.4 \\
    Serious & 1.1 & 1.3 & 1.5 \\
    Very Serious & 1.2 & 1.4 & 1.6 \\
    \bottomrule
  \end{tabular}
\end{table}

This\marginnote{k: Stress Concentration Factor} allows for the fact that there may be sudden changes in the geometry of a part. An example is fillets that provide places where localised stresses are higher than those determined by simple stress analysis. A wealth of empirical and analytical studies have been performed to determine the stress concentration factors for features, such as fillets and circlip grooves (\cref{fig-stress-fillet,fig-stress-circlip}, respectively).

\begin{figure*}[t!]

    \hfill
    \subfloat[Shaft under bending]{
        \includegraphics[width=0.45\textwidth]{05_design_factor/fillet-bending.png}
    }
    \hfill
    \subfloat[Shaft under torsion]{
        \includegraphics[width=0.45\textwidth]{05_design_factor/fillet-torsion.png}
    }
    \hfill

    \vspace{1em}
    \caption{Fillet stress concentration factors for shafts}\label{fig-stress-fillet}
\end{figure*}

\begin{figure*}[t]

    \hfill
    \subfloat[Shaft under bending]{
        \includegraphics[width=0.45\textwidth]{05_design_factor/circlip-groove-bending.png}
    }
    \hfill
    \subfloat[Shaft under torsion]{
        \includegraphics[width=0.45\textwidth]{05_design_factor/circlip-groove-torsion.png}
    }
    \hfill

    \vspace{1em}
    \caption{Circlip stress concentration factors for shafts}\label{fig-stress-circlip}
\end{figure*}