%% -*- coding:utf-8 -*-
\chapter{Stem field, splitting field, algebraic closure}
We introduce the notion of a stem field and a splitting field (of a
polynomial). Using Zorn's lemma, we construct the algebraic closure of
a field and deduce its unicity (up to an isomorphism) from the theorem
on extension of homomorphisms.

\section{Stem field. Some irreducibility criteria}

\subsection{Stem field}

\begin{definition}[Stem field]
Let $P \in K\left[X\right]$ is an irreducible
\mynameref{def:monicpolynomial}. \mynameref{def:fextension1} $E$ is a stem
field of $P$ if $\exists \alpha \in E$ - the root of polynomial
$P$ and $E = K\left[\alpha\right]$.
\footnote{
  Comment from Marc Emmanuel: The stem field is more widely known as
  simple extensions \cite{wiki:simpleextension}
}
\label{def:stemfield}
\end{definition}

Such things exist, for instance we can take
$K\left[X\right]/\left(P\right)$. It is a field because $P$ is
an \mynameref{def:irreducible} moreover the root of the $P$ is in the
field (see example
\ref{ex:F2overP}).

We also can say that for any stem field $E$:
\[
K\left[X\right]/\left(P\right) \cong E.
\]
We can use the following \mynameref{def:isomorphism}:
$f: \forall \mathcal{P} \in K\left[X\right]/\left(P\right) \rightarrow
\mathcal{P}(\alpha)$, there $\alpha$ is a root of polynomial $P$.
\footnote{
  In the case we have $f(P) = P(\alpha) = 0$ as expected
}

To summarize we have the following
\begin{proposition}[About stem field existence]
  The stem field exist and if we have 2 stem fields $E$ and $E'$ which
  correspond 2 roots of $P$: $E = K\left[\alpha\right]$,
  $E' = K\left[\alpha'\right]$ then $\exists! f: E \cong E'$
  (\mynameref{def:isomorphism} of K-algebras) such that $f(\alpha) =
  \alpha'$.
  \begin{proof}
    Existence: $K\left[X\right]/\left(P\right)$ can be took as the
    stem field.

    Uniquest of the \mynameref{def:isomorphism} is easy because it is
    defined by it's value on argument $\alpha$:
    \footnote{
      \label{note:stemfieldisomorphismunique}
      First of all if we have an isomorphism $f$ between two $K$
      algebras $K\left[\alpha \right]$ and $K\left[\alpha'
        \right]$ it should preserve the $K$-algebra structure,
      especially $\forall k \in K: k 1_{K\left[\alpha \right]} \to_f
      k 1_{K\left[\alpha' \right]}$. As soon as \(k \in K\left[
        \alpha \right]\) we can write the following
      \[
      f\left(k
      1_{K\left[\alpha \right]}\right) = f\left(k\right)
      f\left(1_{K\left[\alpha \right]}\right) = f\left(k\right)
      1_{K\left[\alpha' \right]}.
      \]
      But from other side
      \[
      f\left(k
      1_{K\left[\alpha \right]}\right) = k f\left(1_{K\left[\alpha
          \right]}\right) = k 1_{K\left[\alpha' \right]}
      \]
      i.e. \(\forall k \in K: f = id\).

      $\alpha$ forms a basis such that $\forall \beta \in E =
      K\left[\alpha\right]$ we have $\beta = \sum_i k_i \alpha^i$
      where $k_i \in K$. We also have $f\left( \beta \right) =
      \sum_i k_i \left[f \left( \alpha\right)\right]^i = \sum_i k_i
      \left[\alpha'\right]^i$. Thus if $\exists f'$ isomorphism such
      that $f'\left(\alpha \right) = \alpha'$ then $f'\left( \beta
      \right) = \sum_i k_i \left[\alpha'\right]^i =
      f \left( \beta\right)$
      i.e. the isomorphisms are the same.
    }
    \begin{eqnarray}
      \phi: K\left[X\right]/\left(P\right) \cong_{x \to \alpha} E,
      \nonumber \\
      \psi: K\left[X\right]/\left(P\right) \cong_{x \to \alpha'} E',
      \nonumber
    \end{eqnarray}
    thus
    \[
    \psi \circ \phi^{-1} : E \cong_{\alpha \to x \to \alpha'} E'.
    \]
  \end{proof}
  \label{prop:stemfield}
\end{proposition}

\begin{remark}[About stem field]
  \begin{enumerate}
  \item In particular: If a stem field contains 2 roots of $P$ then
    $\exists!$ \mynameref{def:automorphism} taking one root into
    another.
  \item If $E$ stem field then $\left[E:K\right] = \deg P$
  \item If $\left[E:K\right] = deg P$ and $E$ contains a root of $P$
    then $E$ is a stem field
  \item If $E$ is not a stem field but contains root of $P$ then
    $\left[E:K\right] > deg P$
    \footnote{
      Let $E'$ is a stem field of $P$. In the case we have
      $E' \subset E$ as soon as any element of $E'$ is an element of
      $E$ because $E$ contains a root of $P$.
      From other side $E \ne E'$ as soon as $E$ is not a stem field.
      Thus $\deg E > \deg E' = \deg P$.
    }
  \end{enumerate}
  \label{rem:lec2_1}
\end{remark}

\subsection{Some irreducibility criteria}

\begin{corollary}
  $P \in K\left[X\right]$ is irreducible over $K$ if and only if it
  does not have a root in \mynameref{def:fextension1} $L$ of $K$ such that
  $\left[L:K\right] \le \frac{n}{2}$, where $n = deg P$.
  \label{cor:lec2_1}
  \begin{proof}
    $\Rightarrow$: If $P$ is not irreducible then it has a polynomial $Q$ that
    divides $P$ and $deg Q \le \frac{n}{2}$.
    \footnote{
      $P = RQ$ and if
      $deg Q > \frac{n}{2}$ then we can take $R$ as $Q$
    }
    The
    \mynameref{def:stemfield} $L$ for $Q$ exists and it's degree is $deg Q
    \le \frac{n}{2}$. $L$ should have a root of $Q$ (as soon as a root of
    $P$) by definition.

    $\Leftarrow$: If $P$ has a root $\alpha$ in $L$ then $\exists
    P_{min}\left(\alpha, K\right)$ with degree
    $\le \frac{n}{2} < n$
    \footnote{
      because
      $\left[L:K\right] \le \frac{n}{2}$
      (see remark
      \ref{rem:lec2_1})
    }
    that divides $P$ (see lemma \ref{lem:minpolynomial}) i.e. $P$
    become reducible.
  \end{proof}
\end{corollary}

\begin{corollary}
  $P \in K\left[X\right]$ irreducible with $\deg P = n$. Let $L$ be an
  extension of $K$ such that $\left[L:K\right] = m$.
  If $gcd\left(n,m\right) = 1$ then $P$ is irreducible over $L$.
  \label{cor:lec2_2}
  \begin{proof}
    If it is not a case and $\exists Q$ such that $Q \mid P$ in
    $L\left[X\right]$. Let $M$ be a \mynameref{def:stemfield} of $Q$
    over $L$.

    So we have $K \subset L \subset M = L\left(\alpha\right)$. $M$ is
    a stem field of $Q$ therefore $\left[M:L\right] = \deg Q = d < n$. Thus
    \[
    \left[M:K\right] = \left[M:L\right] \left[L:K\right]  =
    m d
    \]
    Lets $K\left(\alpha\right)$ is a stem field of $P$ over $K$ then
    $\left[K\left(\alpha\right):K\right] = \deg P = n$.

    $K\left(\alpha\right) \subseteq M$ and therefore $n \mid md$
    \footnote{
      $K \subset K\left( \alpha \right) \subset M$ and with
      \mynameref{thm:mulformuladegrees} we have
      \[
      md = \left[M : L \right] \left[L : K \right] =
      \left[M : K \right] =
      \left[M : K\left( \alpha \right) \right]
      \left[K\left( \alpha \right) : K \right] =
      \left[M : K\left( \alpha \right) \right] \cdot n
      \]
    }
    thus
    using $gcd(m,n)=1$ one can get that $n \mid d$ but this is
    impossible because $d < n$.
  \end{proof}
\end{corollary}

\section{Splitting field}

\begin{definition}[Splitting field]
  Let $P \in K\left[X\right]$.
  The splitting field of $P$ over $K$ is an extension $L$ where $P$ is
  split (i.e. is a product of linear factors) and roots of $P$
  generate $L$
  \label{def:splittingfield}
\end{definition}

\begin{theorem}[About splitting fields]
  \begin{enumerate}
    \item Splitting field $L$ exists and $\left[L:K\right] \le d!$,
      where $d = deg P$.
    \item If $L$ and $M$ are 2 splitting fields then
      $\exists \phi: L \cong M$ (an \mynameref{def:isomorphism}). But
      the \mynameref{def:isomorphism} is not necessary to be unique.
  \end{enumerate}
  \label{thm:lec2_1}
  \begin{proof}
    Lets prove by induction on $d$. The first case ($d = 1$) is
    trivial the $K$ itself is the splitting field. Now assume $d > 1$
    and that the theorem is valid for any polynomial of degree $< d$
    over any field $K$. Let $Q$ be any irreducible factor of $P$. We
    can create a \mynameref{def:stemfield} $L_1 = K\left(\alpha\right)$
    for $Q$ that will be also a \mynameref{def:stemfield} for $P$.

    Over $L_1$ we have $P = (x - \alpha) R$, where $R$ is a polynomial
    with $deg R = d - 1$. We know (by induction) that
    there exists a \mynameref{def:splittingfield} $L$ for $R$ over $L_1$
    and its degree:
    \(
    \left[L:L_1\right] \le (d-1)!
    \)
    We have $K \subset L_1 \subset L$. The $L$ will be a splitting
    field for original polynomial $P$. Its degree (by
    \mynameref{thm:mulformuladegrees}) is $ \le d \cdot (d-1)! = d!$.

    Uniqueness: Let $L$ and $M$ are 2 splitting fields. Let $\beta$ is
    a root of $Q$ (irreducible factor of $P$) in $M$.
    We have 2 stem fields: $L_1 = K\left(\alpha\right)$ and
    $M_1 = K\left(\beta\right)$. Proposition \ref{prop:stemfield} says
    as that
    \[
    L_1 = K\left(\alpha\right) \cong
    K\left(\beta\right) = M_1,
    \]
    i.e. $\exists \phi$ - isomorphism such that $\phi(\alpha) = \beta$.

    Over $M_1$ we have $P = (x - \beta) S$, where
    $S = \phi\left(R\right)$.
    \footnote{
      We have $\phi: K\left(\alpha\right) \to
      K\left(\beta\right)$. Note \ref{note:stemfieldisomorphismunique}
      states that $\phi\mid_K = id$, where $\phi\mid_K$ is the $\phi$
      restricted to $K$: $\phi\mid_K : K \to K$.
      Therefore
      $\phi\left(P\right) = P$ because $P \in K\left[X\right]$.
      Thus
      \[
      P = (X - \beta) S = \phi\left(P\right) =
      \phi\left((X - \alpha) R\right) =
      (X - \beta) \phi\left(R\right)
      \]
      and $S = \phi\left(R\right)$.
    }
    $M$ is a splitting field for $S$ over $K\left[\beta\right]$
    i.e. it is a $K\left[\beta\right]$-algebra but it's is also
    a $K\left[\alpha\right]$-algebra
    \footnote{
      via
      the existent \mynameref{def:isomorphism}
      between $K\left[\alpha\right]$ and $K\left[\beta\right]$
    }
    and as
    result it's a splitting field for $R$ over $K\left[\alpha\right]$
    and by induction
    \footnote{
      Induction steps are the following: we have a polynomial $P$ with
      $\deg P = n$. For $n=1$ the isomorphism exists by proposition
      \ref{prop:stemfield}.
      We suppose that the isomorphism is proved for
      polynomial with degree $n-1$.
    }
    we have $K\left[\alpha\right]$ isomorphism $L \cong M$ and as
    result $K$ isomorphism $L \cong M$.
    \footnote{
      Lukas Heger comment about the prove:
      We can consider
      another roots: $\alpha_2$ for $R$ and $\beta_2$ for $S$
      and there is an isomorphism between the 2 stem fields
      also. Continue in the way we will get the 2 following chains
      \begin{eqnarray}
        K \subset L_1 \subset L_2 \subset \dots \subset L_n \subset L
        \nonumber \\
        K \subset M_1 \subset M_2 \subset \dots \subset M_n \subset M
        \nonumber
      \end{eqnarray}
      On each step we have an isomorphism between $L_i$ and $M_i$ and as
      result the isomorphism between resulting fields $L$ and $M$ (via
      $\phi$) as $L_n$ algebras and therefore as $K$ algebras.
    }
    %% $M$ is splitting field for $S$ over
    %% $K\left(\beta\right) = M_1$. $M$ is also $L_1$-algebra (via the
    %% \mynameref{def:isomorphism} $\phi$) and as such it's a splitting
    %% field for $R$ over $L_1$. As soon as
    %% $\left[L:L_1\right] = \left[M:M_1\right]$ the $M/L_1 \cong L/L_1$
    %% because the $L_1$-algebras with the same dimension are isomorphic (see lemma
    %% \ref{lem:vsisomorphism}). Therefore we have an
    %% $L_1 = K\left(\alpha\right)$ \mynameref{def:isomorphism} $L \cong M$
    %% and therefore $K$ \mynameref{def:isomorphism} $L \cong M$.
  \end{proof}
\end{theorem}

\begin{remark}
  The \mynameref{def:isomorphism} considered in theorem \ref{thm:lec2_1}
  is not unique. A splitting field  can
  have many \mynameref{def:automorphism} and this is in fact the subject
  of Galois theory.
\end{remark}

\section{An example. Algebraic closure}

\subsection{An example of automorphism}

\begin{example}[$X^3-2$ over $\mathbb{Q}$]
  Let we have the following polynomial $X^3-2$ over $\mathbb{Q}$
  (see also example \ref{ex:lec6_degree3}).
  It
  has the following roots: $\sqrt[3]{2}, j\sqrt[3]{2}$ and
  $j^2\sqrt[3]{2}$, where $j = e^{\frac{2 \pi i}{3}}$. Splitting field
  is the following $L = \mathbb{Q}\left(\sqrt[3]{2}, j\right)$. Lets
  find \mynameref{def:automorphism}s of the field.
  $P_{min}\left(j, \mathbb{Q}\right) = X^2 + X + 1$ thus using remark
  \ref{rem:lec2_1}
  $\left[\mathbb{Q}\left(j\right) : \mathbb{Q}\right] = 2$.
  Using the same arguments one can get that
  $\left[\mathbb{Q}\left(\sqrt[3]{2}\right) : \mathbb{Q}\right] = 3$.
  As result the following picture can be got

  \begin{tikzpicture}[descr/.style={fill=white,inner sep=2.5pt}]
    \matrix (m) [matrix of math nodes, row sep=3em,
      column sep=3em]
            { & \mathbb{Q}\left(j\right) & \\
              \mathbb{Q} & & \mathbb{Q}\left(\sqrt[3]{2}, j\right) = L\\
              & \mathbb{Q}\left(\sqrt[3]{2}\right) & \\ };
            \path[->,font=\scriptsize]
            (m-2-1) edge node[descr] {$ 2 $} (m-1-2)
            (m-1-2) edge node[descr] {$ 3 $} (m-2-3)
            (m-2-1) edge node[descr] {$ 3 $} (m-3-2)
            (m-3-2) edge node[descr] {$ 2 $} (m-2-3);
  \end{tikzpicture}

  As soon as $L$ is a stem field for $\mathbb{Q}\left(j\right)$
  and for $\mathbb{Q}\left(\sqrt[3]{2}\right)$ then 2 types of
  automorphism exist:
  \begin{enumerate}
    \item $\mathbb{Q}\left(\sqrt[3]{2}\right)$
      \mynameref{def:automorphism}. We have
      $X^2+X+1$ as
      $P_{min}\left(j, \mathbb{Q}\left(\sqrt[3]{2}\right)\right)$. The
      polynomial has 2 roots: $j$ and $j^2$ and there is an
      \mynameref{def:automorphism} that exchanges the roots. Lets call it
      $\tau$
      \footnote{
        \label{note:lec2_example_j}
        $j \to j^2$ thus $j^2 \to j^4 = j$. Therefore $j
        \leftrightarrow j^2$
      }
      \item $\mathbb{Q}\left(j\right)$ \mynameref{def:automorphism}. In
        this case the automorphism of exchanging $\sqrt[3]{2}$ and
        $j \sqrt[3]{2}$. \footnote{
          $\sqrt[3]{2} \to j \sqrt[3]{2}$ produces
          $j\sqrt[3]{2} \to j^2 \sqrt[3]{2}$ and
          $j^2 \sqrt[3]{2} \to j^3\sqrt[3]{2} = \sqrt[3]{2}$. This statement
          corresponds the fact that
          the minimal polynomial is $X^3 - 2$ there and thus we
          have 3 roots: $\sqrt[3]{2}$, $j \sqrt[3]{2}$ and $j^2
          \sqrt[3]{2}$
        }. Lets call it $\sigma$
  \end{enumerate}

  The group of automorphism of $L$ $Aut\left(L/K\right)$ is embedded
  into permutation group of 3 elements $S_3$ (see example \ref{ex:s3group}):
  \[
  Aut\left(L/K\right) \hookrightarrow S_3.
  \]
  It's embedded because the automorphism exchanges the roots of
  $X^3-2$. Moreover
  \[
  Aut\left(L/K\right) = S_3,
  \]
  because $\sigma$ and $\tau$ generates $S_3$ because
  \begin{itemize}
  \item $\sigma$: $\sqrt[3]{2} \to j \sqrt[3]{2} \to j^2 \sqrt[3]{2}
    \to \sqrt[3]{2}$. This is a circle.
  \item $\tau$ - it keeps $\sqrt[3]{2}$ and exchanges $j$ and $j^2$:
    $\sqrt[3]{2} j \leftrightarrow \sqrt[3]{2} j^2$ (see note
    \ref{note:lec2_example_j}).  This is a
    transposition.
  \end{itemize}

  %% Lets also look at $\mathbb{Q}\left(\sqrt[3]{2}\right)$. The question
  %% is the following: how many \mynameref{def:homomorphism}s to $L =
  %% \mathbb{Q}\left(\sqrt[3]{2}, j\right)$ do we have. As we know
  %% \[
  %% L = \mathbb{Q}\left(\sqrt[3]{2}, j\right) =
  %% \mathbb{Q}\left(\sqrt[3]{2}, j\sqrt[3]{2}, j^2\sqrt[3]{2}\right),
  %% \]
  %% i.e. $\sqrt[3]{2}$ can be switched with one of the roots:
  %% $\sqrt[3]{2}, j\sqrt[3]{2}, j^2\sqrt[3]{2}$ and each permutation is a
  %% homomorphism. To demonstrate it lets look at the following
  %% permutation $\sqrt[3]{2} \leftrightarrow j\sqrt[3]{2}$. We have a
  %% unique \mynameref{def:isomorphism}
  %% \[
  %% \mathbb{Q}\left(\sqrt[3]{2}\right) \to
  %% \mathbb{Q}\left(j\sqrt[3]{2}\right) \subset L.
  %% \]
  %% i.e. we have a homomorphism $\mathbb{Q}\left(\sqrt[3]{2}\right) \to
  %% L$ associated with the following permutation:
  %% $\sqrt[3]{2} \leftrightarrow j\sqrt[3]{2}$
\end{example}

\subsection{Algebraic closure}

\begin{definition}[Algebraically closed field]
  $K$ is algebraically closed if any non constant polynomial $P \in
  K\left[X\right]$ has a root in $K$ or in other words if any $P \in
  K\left[X\right]$ splits
  \label{def:algebraicallyclosed}
\end{definition}

\begin{example}[$\mathbb{C}$]
  $\mathbb{C}$ is an \mynameref{def:algebraicallyclosed}. This will be
  proved later.
\end{example}

\begin{definition}[Algebraic closure]
  An algebraic closure of $K$ is a field $L$ that is
  \mynameref{def:algebraicallyclosed} and
  \mynameref{def:algebraicextension}
  over $K$.
  \footnote{
    If $L$ is algebraic closure of $K$ then the following conditions
    are valid
    \begin{itemize}
      \item $\forall P \in L\left[ X \right]$ $\exists \alpha \in L$
        such that $P\left(\alpha\right) = 0$ (see definition of
        \mynameref{def:algebraicallyclosed})
      \item $\forall \alpha \in L$ $\exists P \in K\left[ X \right]$
        such that $P\left(\alpha\right) = 0$ (see definition of
        \mynameref{def:algebraicextension})
    \end{itemize}
  }
  \label{def:algebraicclosure}
\end{definition}

\begin{theorem}[About Algebraic closure]
  Any field $K$ has an \mynameref{def:algebraicclosure}
  \begin{proof}
    Lets discuss the strategy of the prove.
    First construct $K_1$ such that $\forall P \in K\left[X\right]$
    has a root in $K_1$. There is not a victory because $K_1$ can
    introduce new coefficients and polynomials that can be irreducible
    over $K_1$. Then construct $K_2$ such that $\forall P \in
    K_1\left[X\right]$ has a root in $K_2$ and so forth. As result we
    will have
    \[
    K \subset K_1 \subset K_2 \subset \dots \subset K_n \subset \dots
    \]
    Take $\bar{K} = \cup_i K_i$ and we claim that $\bar{K}$ is
    algebraically closed. Really
    $\forall P \in \bar{K}\left[X\right]$ $\exists j: P \in
    K_j\left[X\right]$ thus it has a root in $K_{j+1}$ and as result
    in $\bar{K}$.

    Now how can we construct $K_1$. Let $S$ be a set of all
    irreducible $P \in K\left[X\right]$. Let
    $A = K\left[\left(X_P\right)_{P \in S}\right]$ - multi-variable
    (one variable $X_P$ for each $P \in S$) polynomial ring.

    Let $I \subset A$ is an \mynameref{def:idealset} $P\left(X_P\right)$
    $\forall P \in S$.\footnote
    {
      $I = \sum_i \lambda_i P_i\left(X_{P_i}\right)$, where $\lambda_i \in A$
    }
    We claim that $I$ is a \mynameref{def:properideal} i.e. $I \ne
    A$. If not then we can write (see theorem \ref{thm:properideal})
    \begin{equation}
      1_A = \sum_i^n \lambda_i P_i\left(X_{P_i}\right),
      \label{eq:properideal_lec2}
    \end{equation}
    where $\lambda_i \in A$ and the sum is the finite
    (see definition \ref{def:idealset}).
    As soon as the
    sum is finite then I can take the product of the polynomials in
    the sum: $P = \prod_i^n P_i$ and I can create a
    \mynameref{def:splittingfield} $L$ for the polynomial $P$ over $K$
    (see theorem \ref{thm:lec2_1}).

    $A$ is a polynomial ring and it's very easy produce a homomorphism
    between polynomial algebra and any other algebra. Therefore there
    is a homomorphism between rings $A$ and $L$ such that
    $\phi: A \to L$ where $X_{P_i} \to \alpha_i$
    \footnote{$\alpha_i$ is a root of $P_i$}
    if $P =P_i$ and
    $X_{P_i} \to 0$ otherwise. From (\ref{eq:properideal_lec2}) we
    have
    \[
    \phi(1_A) = \sum_i^n \lambda_i
    \phi\left(P_i\left(X_{p_i}\right)\right) =
    \sum_i^n \lambda_i P_i\left(\alpha_i\right) = 0
    \]
    that is impossible.

    Fact: Any \mynameref{def:properideal} $I \subset A$ is contained in
    the \mynameref{def:maxideal} $m$ (see proposition
    \ref{prop:propermaxideal} below) and $A/m$ is a field (see theorem
    \ref{thm:maxideal}).

    Thus I can take $K_1 = A/m$ and continue in the same way to
    construct $K_2, K_3, \dots, K_n, \dots$.
  \end{proof}
  \label{thm:lec2_2}
\end{theorem}

\subsection{Ideals in a ring}
\label{sec:lec2_ideals}
The ring is commutative, associative with unity. Any
\mynameref{def:properideal} is in a \mynameref{def:maxideal}. This is a
consequence of what one calls Zorn's lemma

\begin{definition}[Chain]
  Let $\mathcal{P}$ is a partially ordered set ($\le$ is the order
  relation). $\mathcal{C} \subset \mathcal{P}$ is a chain if
  $\forall \alpha, \beta \in \mathcal{C}$ exists a relation between
  $\alpha$ and $\beta$ i.e. $\alpha \le \beta$ or $\beta \le \alpha$.
  \label{def:chain}
\end{definition}

\begin{lemma}[Zorn]
  If any non-empty \mynameref{def:chain} $\mathcal{C}$ in a non-empty set
  $\mathcal{P}$ has an upper bound (that is $M \in \mathcal{P}$ such
  that $M \ge x, \forall x \in \mathcal{C}$) then $\mathcal{P}$ has a
  maximal element.
  \label{lem:zorn}
\end{lemma}

\begin{proposition}
  Any \mynameref{def:properideal} is in a \mynameref{def:maxideal}
  \begin{proof}
    We can use \mynameref{lem:zorn} to prove that any proper ideal is
    in a \mynameref{def:maxideal}.

    Let $\mathcal{P}$ is the set of proper ideals in $A$ containing
    $I$. The set is not empty because it has at least one element $I$. Any
    \mynameref{def:chain} $\mathcal{C} = \left\{I_\alpha\right\}$
    \footnote{
      The order is the following $I_\alpha \le I_\beta$ if
      $I_\alpha \subset I_\beta$
    }
    has an upper bound: it's $\cup_\alpha I_\alpha$ (exercise that the
    union is an ideal). So $\mathcal{P}$ has a maximal element $m$ and $I
    \subset m$.
  \end{proof}
  \label{prop:propermaxideal}
\end{proposition}

If we take a \mynameref{def:quotientring} by maximal ideal it's always a
field
\footnote{
  We refer to it as a theorem with definition provided in
  \ref{thm:maxideal}. The comments can be considered as a simple prove
  of the fact.
}
otherwise
it will have a proper ideal: $\exists a \in A/m$ such that $(a)$ is a
proper ideal and it pre-image in $\pi: A \to A/m$ should strictly
contain $m$
\footnote{ i.e. $m$ is not a maximal ideal in the case}.

\section{Extension of homomorphisms. Uniqueness of algebraic closure}

Some summary about just proved existence of algebraic closure. There
exists $\bar{K} = \cup_{i=1}^\infty K_i$ - algebraic closure of $K$,
where
\[
K \subset K_1 \subset K_2 \subset \dots \subset K_{i-1} \subset K_i
\subset \dots
\]
$K_i$ is a field where each polynomial $P \in K_{i-1}$ has a root. The
field $K_i$ is \mynameref{def:quotientring} of huge polynomial ring
$K_{i-1}\left[X\right]$ by a suitable \mynameref{def:maxideal} that is
got by means of \mynameref{lem:zorn}.

Another question is the closure unique? The answer is yes. We start
the proof with the following theorem

\begin{theorem}[About extension of homomorphism]
  Let $K \subset L \subset M$ - \mynameref{def:algebraicextension}.
  $K \subset \Omega$, where $\Omega$ - \mynameref{def:algebraicclosure}
  of $K$.
  $\forall \phi: L \to \Omega$ extends to $\widetilde{\phi}: M \to
  \Omega$
  \label{thm:lec2_3}
  \footnote{
    see also example \ref{ex:homomorphismext}.
  }
  \begin{proof}
    Apply \mynameref{lem:zorn} to the following set (of pairs)
    \[
    \mathcal{E} = \left\{
    \left(N, \psi\right): L \subset N \subset M, \psi \mbox{ extends }
    \phi
    \right\}
    \]
    $\mathcal{E}$ is non empty because $\left(L,\phi\right) \in
    \mathcal{E}$.

    The set $\mathcal{E}$ is partially ordered by the following
    relation ($\le$):
    \[
    \left(N, \psi\right) \le \left(N', \psi'\right),
    \]
    if $N \subseteq N'$ and $\psi'/N = \psi$ ($\psi'$ extends $\psi$).
    Any \mynameref{def:chain} $\left(N_\alpha, \psi_\alpha\right)$
    has an upper bound $\left(N, \psi\right)$, where
    \(
    N = \cup_\alpha N_\alpha
    \) - field, sub extension of $M$. $\psi$ defined in the following
    way: for $x \in N_\alpha$ $\psi(x) = \psi_\alpha(x)$.

    Thus $\mathcal{E}$ has a maximal element that we denote by
    $\left(N_0, \psi_0\right)$.

    Lets suppose that $N_0 \ne M$, i.e.
    $N_0 \subsetneq M$. Now it's very easy to get a
    contradiction. Lets take $x \in M \setminus N_0$ and consider
    \mynameref{def:minpolynomial} $P_{min}\left(x, N_0\right)$. It
    should have a root $\alpha \in \Omega$. Now we extend $N_0$ to
    $N_0\left(x\right)$ and define $\psi'$ on
    $N_0\left(x\right)$ as follows: $\forall y \in N_0: \psi'(y)
    = \psi_0(y)$ and $\psi'(x) = \alpha$. Thus we was able to find an
    element of the chain that is greater than maximal. Therefore our
    assumption about $N_0 \ne M$ was incorrect and we can conclude
    than $N_0 = M$ and therefore $\tilde{\phi} = \psi_0$.
  \end{proof}
\end{theorem}

\begin{corollary}[About algebraic closure isomorphism]
  If $\Delta$ and $\Delta'$ are 2 algebraic closures of $K$ then they
  are isomorphic as K-algebras.
  \label{col:algebraic_closure_isomorphism}
  \begin{proof}
    Using theorem \ref{thm:lec2_3} one can assume
    $L = K$, $M = \Delta'$ and $\Omega = \Delta$ i.e. we have
    \[
    K \subset K \subset \Delta'
    \]
    in this case homomorphism $K \to \Delta$ can be extended to
    $\Delta' \to \Delta$ i.e. there exists a homomorphism
    (i.e. \mynameref{def:injection}) from $\Delta'$ to $\Delta$.

    If we assume $M = \Delta$ and $\Omega = \Delta$ then there exists
    a homomorphism (i.e. \mynameref{def:injection}) from $\Delta$ to
    $\Delta'$. The \mynameref{def:injection} is also
    \mynameref{def:surjection} in another direction: $\Delta' \to
    \Delta$ and as result we have \mynameref{def:isomorphism} $\Delta' \to
    \Delta$
  \end{proof}
\end{corollary}


\chapter{Early Models of an Atom}\label{c3}
We will review the models of an atom proposed before the development of quantum
mechanics. The purpose of this chapter is less to give an account of the
historical development and more to illustrate how conceptually simple
experiments and relatively straightforward application of the laws of physics
proved these models to be inadequate.

\section{Thomson's model}\label{c3s1}
Sir J. J. Thomson proposed a model of an atom as a uniformly distributed
positive charge in which negatively charged electrons are studded. The atom as
a whole was thought to be impenetrable. This was very much in line with the
ideas of continuous solids and fluids of the late nineteenth century. The only
way to find out if matter was indeed continuous was to bombard it with high
energy particles and check how many of them make it to the other side. This
is exactly what Geiger and Marsden in a series of experiments between 1908 and
1913. Geiger's first experimenti \cite{geiger1908scattering} consisted of
bombarding alpha particles on a thin gold foil and checking how many of them
reach the detector at the end of a $2$ m long evacuated glass tube. The alpha
particles are collimated before they enter the tube. In the absence of the foil
they create a sharply defined image of the slit. When a little air was admitted
the alpha particles collided with the air molecules and caused the image to
blur. When the tube was evacuated again and a gold foil fitted midway between
the collimating slit and the detector, a blurred image was formed. If the matter
were indeed continuous then no alpha particle should have made it to the other
side. Further, there was no qualitative difference between the image caused by a
few gas particles and a solid foil indicating that the `solid' foil was
probably full of pores. Geiger collaborated with Marsden in his next experiment,
published \cite{gegier1909diffuse} in 1909, to prove that some alpha particles,
roughly $1$ ind $8000$ were scattered by the gold foil by an angle more than
$90^\circ$. This suggested that although the `solid' gold foil was largely
porous, it did have a few very strong scattering centres. Since the alpha
particles are positively charged, the scattering centres too must have a
positive charge. Geiger did another experiment \cite{geiger1910scattering} in
the following year from which he concluded that the most probable angle of
deflection is directly proportional to the foil's thickness, atomic mass of
the foil's metal and with the speed of alpha particles. He also found that the
only a very few particles are scattered by more than $90^\circ$. These
experiments proved that the Thomson's model was not correct and Rutherford
proposed \cite{rutherform1911scattering} the nuclear model of an atom. It
consisted of a tiny, positively charge nucleus and the electrons are in the
rest of region, largely vacuous.

Sir J. J. Thomson, the originator of the eponymous model, was also the
discoverer of electrons, which he called `corpuscules'. He was aware that
they are far lighter than the hydrogen atom. Before we discuss the Rutherford
model in greater details let us analyse Thomson's model to show that it cannot
explain the large scattering observed in Geiger and Marsden's experiments.
Consider the collision between two particles of mass $m_1$ and $m_2$. Let their
initial velocities be $v_1$ and $v_2 = 0$ and their final velocities be
$v_1^\prime$ and $v_2^\prime$. Assume a head-on elastic collision. The
conservation of momentum requires
\begin{equation}\label{c3s1e1}
m_1v_1 + 0 = m_1v_1^\prime + m_2v_2^\prime.
\end{equation}
Conservation of kinetic energy gives
\begin{equation}\label{c3s1e2}
m_1v_1^2 + 0 = m_1{v_1^\prime}^2 + m_2{v_2^\prime}^2.
\end{equation}
In these equations, $v_1$ is known and we want to express the final velocities
in terms of it. From \eqref{c2s1e1},
\begin{equation}\label{c3s1e3}
v_2^\prime = \frac{m_1}{m_2}(v_1 - v_1^\prime).
\end{equation}
Substituting this in \eqref{c3s1e2} we get the quadratic
\begin{equation}\label{c3s1e4}
(m_1 + m_2){v_1^\prime}^2 - 2m_1v_1v_1^\prime + (m_1 - m_2)v_1^2 = 0
\end{equation}
whose solutions are
\begin{equation}\label{c3s1e5}
v_1^\prime = \frac{m_1 \pm m_2}{m_1 + m_2}v_1.
\end{equation}
The solution with the plus sign indicates a situation in which the collision
has not happened for the final velocity is identical with the initial one. That
is not true. Therefore,
\begin{equation}\label{c3s1e6}
v_1^\prime = \frac{m_1 - m_2}{m_1 + m_2}v_1
\end{equation}
and hence
\begin{equation}\label{c3s1e7}
v_2^\prime = \frac{2m_1}{m_1 + m_2}v_1.
\end{equation}
It was known that the alpha particle was far more heavier than the electron.
That is $m_1 \gg m_2$ so that $v_2^\prime \approx 2v_1$. The alpha particle
loses a momentum $\Delta p_1 = 2m_2v_1$. If this loss is accompanied by a
deflection by an angle $\theta$ then
\begin{equation}\label{c3s1e8}
\tan\theta = \frac{\Delta p_1}{p_1} = \frac{2m_2}{m_1}.
\end{equation}
Since $m_2$ is far smaller than $m_1$, $\theta$ is very close to zero. Thus,
a collision with an electron cannot explain the large-angle deflection of an
alpha particle.

If the electrons cannot deflect alpha particles can the uniform positive
charge distribution of the rest of the atom? The electric field of a uniformly
distributed charge distribution is found using Gauss's law,
\begin{equation}\label{c3s1e9}
\oint_S \vec{E}.\hat{n}da = \frac{\epsilon_0}{Q},
\end{equation}
where $Q$ is the charge enclosed by the surface $S$ and $\epsilon_0$ is the
permittivity of free space. Let $R$ be the radius of an atom, assumed spherical.
If $r < R$,
\[
E\cdot 4\pi r^2 = \frac{1}{\epsilon_0} \rho_e \frac{4\pi}{3}r^3
\]
where $\rho_e$ is the charge density so that
\[
E = \frac{1}{3\epsilon_0}\rho_e r.
\]
If there are $Z$ electrons then to keep the atom electrically neutral we need
a charge $Ze$ distributed uniformly in a volume $4\pi R^3/3$ or
\begin{equation}\label{c3s1e10}
\rho_e = \frac{3Ze}{4\pi R^3}
\end{equation}
so that the electric field is
\begin{equation}\label{c3s1e11}
\vec{E} = \frac{Ze}{4\pi\epsilon_0}\frac{r}{R^3}\hat{r},
\end{equation}
$\hat{r}$ being the unit vector in the radial direction. This expression is
true for all points $r \le R$. Clearly, the field is maximum at the surface of
the atom and the maximum force experienced by the alpha particle is when it is
just that the surface. Since the charge on the alpha particle is $2e$, it is
\begin{equation}\label{c3s1e12}
\vec{F} = \frac{2Ze^2}{4\pi\epsilon_0}\frac{1}{R^2}\hat{r}.
\end{equation}
Let us further assume that the force makes is most impact when the alpha
particle is in a segment of length $L = 2R$ of the tangent at the point it
touches the spherical atom. Since the collision is assumed to be elastic, the
magnitude of velocity does not change, only its direction changes. A particle
with initial speed $v_1$ takes a time $\delta t = L/v_1$ to cross the segment of
maximum impact. Therefore, the impulse felt by the alpha particle is $F\delta t$
, which is also the change in its momentum. Thus,
\begin{equation}\label{c3s1e13}
\Delta p =\frac{2Ze^2}{4\pi\epsilon_0}\frac{1}{R^2}\frac{2R}{v_1}
\end{equation}
where we have used the fact that $L = 2R$. The angle of deflection is again
estimated using \eqref{c3s1e8} as
\begin{equation}\label{c3s1e14}
\tan\theta = \frac{Ze^2}{\pi\epsilon_0 R m_1v_1^2}.
\end{equation}
For a gold foil $Z = 79$. If we assume that the speed of the incident alpha
particles if $2 \times 10^7$ ms${}^{-1}$ then once again we get the same result
that $\theta$ is very close to zero.

\section{Rutherford's model}\label{c3e2}
We mentioned about Geiger and Marsden's experiments that gave an experimental
proof against the Thomson's model. The large-angle scattering of a few alpha
particles led Rutherford to conjecture that the positive charge of the atom
is concentrated in a tiny nucleus. We will describe his model first proposed in
1911 \cite{rutherform1911scattering}. The scattering process is depicted in
figure \ref{c3f1} taken from \cite{rutherform1911scattering}. An alpha particle
approaches an atom in the direction $PO$ and is deflected in the direction
$OP^\prime$.
\begin{figure}
\begin{center}
\includegraphics{rutherford-scattering}
\caption{Schematic diagram of Rutherford scattering}\label{c3f1}
\end{center}
\end{figure}
Rutherford assumed that the entire positive charge is concentrated in a point-
like nucleus at point $S$. Since the interaction between the nucleus and the
alpha particle is electrostatic, the trajectory is a hyperbola $PAP^\prime$ with
$S$ as its external focus. The point $O$ is chosen as the origin and the lines
$OP$ and $OP^\prime$ are its asymptotes. The line $SN$ is prependicular to the
asymptote and let its length be $p$. Let us further assume that the length of
the segment $OA$ is $q$. Then the equation of the hyperbola is
\begin{equation}\label{c3s2e1}
\frac{x^2}{q^2} - \frac{y^2}{p^2} = 1.
\end{equation}
This is because of the property of the hyperbola that the perpendicular distance
from a focus to either asymptote is the semi-minor axis $p$. Therefore, the
eccentricity is
\begin{equation}\label{c3s2e2}
\varepsilon = \sec\theta.
\end{equation}
Refer to the figure \ref{c3f2} taken from Wikipedia.
\begin{figure}
\begin{center}
\includegraphics{hyperbola}
\caption{$x^2/a^2 - y^2/b^2 = 1$ from Wikipedia}\label{c3f2}
\end{center}
\end{figure}
Let $\vec{V}$ be the velocity of the alpha particle at $P$ and $\vec{v}$ be the
velocity at point $A$. Since the angular momentum is conserved in an
electrostatic interaction,
\begin{equation}\label{c3s2e3}
pV = rv,
\end{equation}
where $r$ is the length of the segment $SA$. Note that both angular momenta are
taken around the point $S$ and \emph{not} the origin $O$. If the nucleus at $S$
carries a charge $Ze$ then the potential energy of the alpha particle with
charge $2e$ at point $A$ is
\[
\frac{2Ze^2}{r}
\]
so that by energy conservation we have
\begin{equation}\label{c3s2e4}
\frac{1}{2}mV^2 = \frac{1}{2}mv^2 + \frac{2Ze^2}{r}.
\end{equation}
Therefore,
\[
v^2 = V^2 - \frac{4Ze^2}{mr}
\]
or
\begin{equation}\label{c3s2e5}
v^2 = V^2\left(1 - \frac{b}{r}\right),
\end{equation}
where
\begin{equation}\label{c3s2e6}
b = \frac{4Ze^2}{mv^2}.
\end{equation}
$b$ is the closest distance at which an alpha-particle with energy $mV^2/2$
can approach a point nucleus with charge $Ze$. At this distance its entire
kinetic energy is converted to electrostatic potential energy. From figures
\ref{c3f1} and \ref{c3f2} it is clear that the length of the segment $OA$ is
$p\cot\theta$ so that the length of $SA$ is
\begin{equation}\label{c3s2e7}
r = p\csc\theta + p\cot\theta = p\frac{1 + \cos\theta}{\sin\theta} =
p\frac{\cos\theta/2}{\sin\theta/2} = p\cot\frac{\theta}{2}.
\end{equation}
From equation \eqref{c3s2e3}
\[
V = \frac{rv}{p}.
\]
Substitute it in \eqref{c3s2e5} to get
\begin{equation}\label{c3s2e8}
v^2 = \frac{r^2v^2}{p^2}\frac{r - b}{r} \Rightarrow p^2 = r(r - b).
\end{equation}
Use \eqref{c3s2e7} for $r$ to get
\begin{equation}\label{c3s2e9}
p^2 = p\cot\frac{\theta}{2}\left(p\cot\frac{\theta}{2} - b\right)
\end{equation}
from which we get
\[
p^2 = p^2\cot^2\frac{\theta}{2} - bp\cot\frac{\theta}{2} \Rightarrow
bp\cot\frac{\theta}{2} = p^2\frac{cos\theta}{\sin^2(\theta/2)} \Rightarrow
b = 2p\frac{\cos\theta}{\sin\theta}
\]
or
\begin{equation}\label{c3s2e10}
b = 2p\cot\theta.
\end{equation}
The angle of deviation $\phi$ is the angle $POP^\prime$ in figure \ref{c3f1}.
$\angle POA = \angle AOP^\prime = \angle SON = \theta$ so that
\begin{equation}\label{c2s2e11}
\phi = \pi - 2\theta
\end{equation}
so that equation \eqref{c3s2e10} can be written as
\begin{equation}\label{c3s2e12}
\cot\left(\frac{\phi}{2}\right) = \frac{2p}{b}.
\end{equation}
Consider a pencil of alpha particles falling normally on the metal foil of
thickness $t$. Let $n$ be the number of atoms per unit volume of the material.
If the radius of an atom is $R$ then `cross sectional area' of the atom is
$\pi R^2$. A cylinder of this `base area' and height $h$ will have $nt\pi R^2$
number of sites where collisions can happen. The probability $P$ of an alpha
particle entering an atom within distance $p$ of its centre is
\begin{equation}\label{c3s2e13}
P = nt \pi p^2
\end{equation}
and the probability that it enters in an annulus of radii $p$ and $p + dp$ is
\begin{equation}\label{c3s2e14}
dP = 2nt\pi pdp.
\end{equation}
From equation \eqref{c3s2e12}
\begin{equation}\label{c3s2e15}
dp=-\frac{b}{4}\csc^2\left(\frac{\phi}{2}\right).
\end{equation}
Substituting \eqref{c3s2e12} and \eqref{c3s2e15} in \eqref{c3s2e14}, we get
\begin{equation}\label{c3s2e16}
dP = -nt\pi \frac{b^2}{4}\csc^2\left(\frac{\phi}{2}\right)
\cot\left(\frac{\phi}{2}\right).
\end{equation}
The probability of finding an alpha particle deflected between angles $\phi_1$
and $\phi_2$ is
\begin{equation}\label{c3s2e17}
P(\phi_1, \phi_2) = \int_{\phi_1}^{\phi_2}dP = \frac{\pi}{4}ntb^2\left(
\cot^2\left(\frac{\phi_1}{2}\right) - \cot^2\left(\frac{\phi_2}{2}\right)\right)
\end{equation}
If $F$ is the incident flux of the alpha particles then the number of particles
deflected between $\phi$ and $\phi + d\phi$ are $|FdP|$, where $dP$ is given
by \eqref{c3s2e16} and we have used the modulus to ensure that the number of
particles is always a positive quantity. These particles land on the detector in
an annular region. The inner radius of this region is $s\sin\phi$ where $s$ is
the distance of any point on it from the centre of the incident pencil. The
circumference of the annulus is $2\pi r\sin\phi$ and the area of the annular
ring is $2\pi r\sin\phi d\phi$. Therefore, the number of particles deflected
between angles $\phi$ and $\phi + d\phi$ and and landing \emph{per unit area of
the detector} is
\begin{equation}\label{c3s2e18}
N(\phi) = \Big|\frac{FdP}{2\pi s^2\sin\phi d\phi}\Big| =
\frac{Fnt b^2\csc^2(\phi/2)\cot(\phi/2)}{8s^2\sin\phi}.
\end{equation}
Writing the denominator in terms of half angles we get
\begin{equation}\label{c3s2e19}
N(\phi) = \frac{Fntb^2}{16s^2}\csc^4\left(\frac{\phi}{2}\right).
\end{equation}
From equation \eqref{c3s2e6} we have
\begin{equation}\label{c3s2e20}
N(\phi) = \frac{FntZ^2e^4}{m^2v^4s^2}\csc^4\left(\frac{\phi}{2}\right).
\end{equation}
Thus, $N(\phi)$ is
\begin{enumerate}
\item directly proportional to $\csc^4(\phi/2)$;
\item directly proportional to the thickness $t$ of the foil;
\item directly proportional to the square of the atomic number $Z$ of the
scatterer;
\item inversely proportional to the square of the kinetic energy of the incident
alpha particles.
\end{enumerate}
Geiger and Marsden's experiments \cite{geiger1913lxi} showed that these
predictions are correct thereby putting the nuclear model of an atom on a firm
footing.

Rutherford's model and Geiger-Marsden's experiments showed that the atoms have
a very small nucleus where all the positive charge resides. It did not tell
anything about the electrons. Either the electrons are smeared as a continuous
distrubution throughout the atom or that the electrons move around the nucleus
like planets around the sun. The former was ruled out because the even the
Thomson model had them as `corpuscules'. Since the entire positive charge is
concentrated in the nucleus, it is impossible for the electrons to remain
stationary as in Thomson's model. Therefore, the only option left was to assume
them to go aroud the nucleus. However, a charge going around a nucleus undergoes
an accelerated motion and radiates energy at the rate \cite[equation (20-44)]{
reitz2009foundations}
\begin{equation}\label{c3s2e21}
P_r = \frac{2}{3}\frac{e^2}{4\pi\epsilon_0}\frac{a^2}{c^3},
\end{equation}
where $a$ is its acceleration and $c$ is the velocity of light. This continuous
loss of energy will force the electron to spiral down and fall into the nucleus.
Thus, although Rutherford's model conclusively showed the existence of a nucleus
it could not account for the motion of electrons.

\section{Bohr's model}\label{c3s3}
The greatest deficiency in Rutherford's model was the radiative loss of
accelerating electrons. Even if, for some reason, the radiative loss was
suspended, the model could not account for the spectra of elements. Before we
get to the details of the Bohr model, let us digress to understand emission
and absorption spectra.

\subsection{Absorption and Emission spectra}
The simplest spectrum that we have seen is that produced by a prism. When white
light is shone on a prism, it is split into seven colours. In a laboratory, the
white light is let from a narrow slit and one can observe seven slits, each one
of a different colour, from the other side. This is called a spectrum of white
lights. It consists of brightly coloured lines on a dark background and is
called an emission spectrum.

Now place a beaker of water on the side from which we are seeing the spectrum.
The spectrum will be undisturbed, all seven colours will be seen. However, when
you add potassium permanganate to the beaker, the water turns purple and
simultanuously the green line disappears. The `green' light is absorbed and that
is why the water appears purple. This is an absorption spectrum.

Spectra of both kinds are signatures of the atoms or molecules that cause them.
In fact, the element Helium was first observed in the solar spectrum and then
discovered on the earth.

The spectrum of Hydrogen atom is in the form of sharp lines and the greatest
triumph of Bohr model was in explaining why it is so.

\subsection{Bohr's postulates}
Bohr postulated \cite{bohr1913constitution} that the electron in a Hydrogen
atom  revolves around its nucleus in a circular orbit under the influence of
the electrostatic attraction between the two. He further, postulated that if the
angular momentum of the electron is an integral multiple of $h/(2\pi)$ then
the electron does not radiates. This assumption has no basis in classical
electrodynamics and it is the first indication of things being different in the
microscopic world of atoms. At this stage, we will not ask why this assumption
is sensible. We will just use it.

Since the electron is known to be much lighter than the nucleus, let us assume
that the latter is stationary. Newton's second law applied to the circular
motion of the electron gives
\begin{equation}\label{c3s3e1}
\frac{mv^2}{r} = \frac{1}{4\pi\epsilon_0}\frac{e^2}{r^2},
\end{equation}
where $e$ is the charge on the electron, $m$ is its mass, $v$ its velocity, $r$
the radius of the orbit and $\epsilon_0$ the permittivity of free space. Bohr's
second condition restricts the values of the electron's angular momentum. It is
\begin{equation}\label{c3s3e2}
mvr = n\frac{h}{2\pi},
\end{equation}
where $m, v, r$ mean the same things as in equation \eqref{c3s3e1} and $n$ is a
positive integer. The quantity $h/(2\pi)$ occurs so frequently in quantum physics
that many people call it as `the Planck constant'. It is denoted by the symbol
$\hslash$. We will use both the quantities, depending on which one makes the
equations look neater. Thus, Bohr's quantisation condition
is
\begin{equation}\label{c3s3e3}
mvr = n\hslash.
\end{equation}
From equations \eqref{c3s3e2} and \eqref{c3s3e1} we get
\begin{equation}\label{c3s3e4}
r = \frac{n^2 h^2 \epsilon_0}{\pi me^2}.
\end{equation}
Thus, the radius of the electron takes only discrete values for each one of $n =
1, 2, \ldots$. This is yet another signature of quantisation. Not only is energy
exchanged in discrete chunks even the radius and the angular momentum take only
a discrete set of values.

From equation \eqref{c3s3e1} we get an expression for the electron's kinetic
energy
\begin{equation}\label{c3s3e5}
T = \frac{1}{2}mv^2 = \frac{1}{2}\frac{1}{4\pi\epsilon_0}\frac{e^2}{r}.
\end{equation}
We know that its potential energy is
\begin{equation}\label{c3s3e6}
V = -\frac{1}{4\pi\epsilon_0}\frac{e^2}{r}
\end{equation}
so that is total energy is
\begin{equation}\label{c3s3e7}
E = T + V = -\frac{1}{2}\frac{1}{4\pi\epsilon_0}\frac{e^2}{r}.
\end{equation}
Using the expression for $r$ obtained in equation \eqref{c3s3e4} we get
\begin{equation}\label{c3s3e8}
E = -\frac{me^4}{8\pi\epsilon_0^2 n^2h^2}.
\end{equation}
Even energy of the electron takes only certain discrete values. It is quantised.
In order to make the dependence of $r$ and $E$ on $n$ explicity, it is common to
write them as
\begin{eqnarray}
r_n &=& \frac{n^2 h^2 \epsilon_0}{\pi me^2} \label{c3s3e9} \\
E_n &=& -\frac{me^4}{8 n^2h^2\epsilon_0^2}. \label{c3s3e10}
\end{eqnarray}
A few observations:
\begin{enumerate}
\item As $n$ increases, so does $r_n$. We can call $n = 1$ the first orbit,
$n = 2$ the second orbit and so on.
\item The energy is always negative. Therefore, we have to supply energy to the
electron in order to eject it out of the atom.
\item As $n$ increases, $E_n$ decreases. Electrons are loosely held in higher
orbits than they are in the lower ones.
\end{enumerate}
Bohr's third postulate is that when an electron makes a transition from an orbit
$n_1$ to an orbit $n_2 < n_1$, it emits a photon of frequency $E_{n_1}-E_{n_2}$.
Likewise, when an electron makes a transition in the opposite direction, it
absorbs a photon of the same energy. Thus, the energy exchange between the atom
and the rest of the world happens in discrete units. When the initial orbit is
$n > 1$ and the final orbit is $1$ then the only possible values of energy are
\begin{equation}\label{c3s3e11}
\Delta E_n=h\nu_n =\frac{me^4}{8\epsilon_0^2h^2}\left(1 - \frac{1}{n^2}\right).
\end{equation}
The set of all frequencies defined by \eqref{c3s3e11} form the `Lyman series' of
lines in the Hydrogen spectrum. When the final orbit is the second one, the
energies of the emitted photon are
\begin{equation}\label{c3s3e12}
\Delta E_n = h\nu_n =
\frac{me^4}{8\epsilon_0^2h^2}\left(\frac{1}{2^2} - \frac{1}{n^2}\right).
\end{equation}
The are the frequencies of the `Balmer series'. Likewise when the final orbits
are $3, 4, 5$ and $6$ we get the lines of the Paschen, Brackett, Pfund and
Humphreys series.

\subsection{Problem set 1}
\begin{enumerate}
\item The electron volt, abbreviated as eV, is a convenient unit if energy in
atomic physics. One electron volt is the energy needed to bring a charge $e =
1.6 \times 10^{-19}$ C up a potential of $1$ V. Thus $1 eV=1.6\times 10^{-19}$
J. Find the energy of an electron in the first Bohr orbit and convert it into
$eV$.

An amount of this energy is also called one rydberg.

\item The energy $E_1$ of an electron in the first orbit is also the energy that
must be supplied to the electron to allow it to escape from the influence of the
nucleus. Equivalently, when an electron from afar is brought close to the
nucleus and made to occupy the first orbit it emits a photon of energy $E_1$.
Show that frequency of this photon is twice that of the frequency of rotation of
the electron in the first orbit. Bohr had used this as a postulate in this paper
\cite{bohr1913constitution} and shown it to be equivalent to the angular
momentum quantisation of equation \eqref{c3s3e2}.

\item Modify the formulae in equations \eqref{c3s3e9} and \eqref{c3s3e10} for
singly ionised He atom and double ionised Lithum atom. Before you derive the
formulae can you predict if $E_n$ and $r_n$ are going to more or less than that
for hydrogen atom.

\item Strictly speaking, we cannot assume the nucleus to be at rest. Let $m_n$
be its mass and $\vec{r}_n$ be its position vector. Let $m_e$ and $\vec{r}_e$ be
the corresponding quantities for the electron. If $\vec{F}_e$ is the force on
the electron and $\vec{F}_n$ is that on the nucleus then the Newton's second
law for each on of them is
\begin{eqnarray}
m_e\frac{d^2\vec{r}_e}{dt^2} &=& \vec{F}_e \label{c3s3e13} \\
m_n\frac{d^2\vec{r}_n}{dt^2} &=& \vec{F}_n \label{c3s3e14}
\end{eqnarray}
The forces $\vec{F}_n$ and $\vec{F}_e$ for an action reaction pair. Therefore
show that
\begin{equation}\label{c3s3e15}
m_e\frac{d^2\vec{r}_e}{dt^2} + m_n\frac{d^2\vec{r}_n}{dt^2} = 0.
\end{equation}
Define the vector
\begin{equation}\label{c3s3e16}
\vec{R} = \frac{m_e\vec{r}_e + m_n\vec{r}_n}{m + m_n}.
\end{equation}
It is the position vector of the centre of mass of the system. Show that
\begin{equation}\label{c3s3e17}
\frac{d^2\vec{R}}{dt^2} = 0.
\end{equation}
The vector $\vec{r} = \vec{r}_e - \vec{r}_n$ is the relative position of
the electron with respect to the nucleus. From equations \eqref{c3s3e13}
and \eqref{c3s3e14} show that
\begin{equation}\label{c3s3e18}
\frac{d^2\vec{r}}{dt^2} = \left(\frac{1}{m_e} + \frac{1}{m_n}\right)\vec{F}_e.
\end{equation}
Define,
\begin{equation}\label{c3s3e19}
\frac{1}{\mu} = \left(\frac{1}{m_e} + \frac{1}{m_n}\right)
\end{equation}
so that we can write \eqref{c2s3e18} as
\begin{equation}\label{c3s3e20}
\mu\frac{d^2\vec{r}}{dt^2} = \vec{F}_e.
\end{equation}
Thus, we have shown that the motion of two bodies can be simplified to the
uniform motion of the centre of mass and an equivalent single body problem
of a body of `reduced mass' $\mu$. Thus, all formulae in section \ref{c3s3}
must be altered to replace $m$ with $\mu$. Does it make a great difference?

\item If we were to extend Bohr's model to atoms with multiple electrons, we
can imagine all of them moving in a single orbit but equally apart from each
other. If there are $N$ electrons then the angular separation between them is
$2\pi/N$. Each electron will experience and attractive force of the nucleus and
the repulsive force of the other electrons. Show that the potential energy of
the electrons alone is
\begin{equation}\label{c3s3e21}
V_e = \frac{Ne^2}{16\pi\epsilon_0 r}
      \sum_{k=1}^{N-1}\csc\left(\frac{k\pi}{N}\right)
\end{equation}
The proof is quite straightforward in spite of the rather formidable appearance
of the expression. Calculate the repulsive force using
\begin{equation}\label{c3s3e22}
F_r = -\frac{dV_e}{dr}.
\end{equation}
Bohr used these expressions in his treatment of multi-electron atoms
\cite{bohr1913constitution}.
\end{enumerate}


\chapter*{Introduction and objectives}
\addcontentsline{toc}{chapter}{Introduction and objectives}

Nowadays, the term \emph{quantum computing} sounds familiar not only to experts but also to the general public. Quantum computing theory began in 1980 when the physicist Paul Benioff proposed a quantum mechanical model of a Turing machine \cite{Benioff1980}. With Peter Shor's development of his integer factoring algorithm in 1994 \cite{Shor1999}, along with the work of several other researchers such as Richard Feynman and Yuri Manin\cite{Feynman1982} \cite{Manin1980}, it was clear that quantum computers had the potential to compute things that a classical computer could not feasible do.

However, it was not until 1995 with Cirac and Zoller's experiments of cold trapped ions that physical implementations of quantum machines were believed by most of the scientific world \cite{Cirac1995}. In recent years, public and private funding to quantum computing research has risen by $400\%$ \cite{Gibney2019}, and in October 2019, Google AI in a partnership with NASA claimed to have performed "quantum computations infeasible on any classical computer" \cite{Pednault2019}. As quantum computing becomes a day-to-day reality, mathematicians, computer scientists, and physicians developt and explore this growing field.

In particular, quantum annealers are a type of quantum computer focussed on optimization. D-Wave Systems is a private commercial quantum company that provides a series of quantum annealers for commercial and educational use. These quantum annealers have proven to be empirically useful for several real-world applications such as control of automated guided vehicles, traffic flow optimization or optimized planning scheduling \cite{Neukart2017} \cite{Ohzeki2019} \cite{Desimone2019}.

On the other hand, knowing an organism genome is key in multiple fields, including microbiology, biotechnology, and personalized medicine \cite{Costessi2018} \cite{Ginsburg2009} \cite{Abdallah2015}. Its applications range from the production of improved crops, biofuels, and pharmaceutical products to more precise complex disease detection and analysis. \emph{Genome assembly} refers to the process of, given a set of short genome reads, reconstruct the whole genome. This proceeding is a key component of the mentioned applications and as an NP-hard problem supposes a huge bottleneck for those developments.

For the reasons explained above and inspired by the works \cite{Sohn2018} and \cite{Sarkar2020}  we set out to first gain a deep understanding of quantum computing and quantum annealers and then tackle the de novo genome assembly problem using D-Wave's quantum annealers. The objectives of this work are:

\begin{enumerate}
	\item To define and understand the theory behind quantum computing: quantum mechanics models. This shall be approached from a mathematic perspective and maintaining perspective of our subsequent application on quantum computing.

	\item To deeply understand how quantum annealers work, and how to use them to solve problems. This includes understanding quadratic unconstrained binary optimization (QUBO) problems, and how to transform NP-hard problems into such models.

	\item To theoretically and empirically tackle the de novo genome assembly problem, performing a comparative study between simulated annealing and quantum annealing using D-Wave's annealers.
\end{enumerate}


\documentclass[11pt]{article}
\usepackage{amsmath,textcomp,amssymb,geometry,graphicx,enumerate}
\usepackage{algorithm} % Boxes/formatting around algorithms
\usepackage[noend]{algpseudocode} % Algorithms
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,
    urlcolor=blue,
}

\def\Name{Neeraj Pandey}  % Your name
%\def\SID{PUT SOMETHING HERE}  % Your student ID number
%\def\Login{PUT SOMETHING HERE} % Your login (your class account, cs170-xy)
\def\Homework{2} % Number of Homework
\def\Session{Monsoon 2018}

\title{CS103 -- Monsoon 2018 --- Homework \Homework}
\author{\Name
%SID \SID,
%\texttt{\Login}
}
\markboth{CS103\Session\  Homework \Homework\ \Name}{CS103--\Session\ Homework \Homework\ \Name, %\texttt{\Login}
}
\pagestyle{myheadings}
\date{}

\newenvironment{qparts}{\begin{enumerate}[{(}a{)}]}{\end{enumerate}}
\def\endproofmark{$\Box$}
\newenvironment{proof}{\par{\bf Proof}:}{\endproofmark\smallskip}

\textheight=9in
\textwidth=6.5in
\topmargin=-.75in
\oddsidemargin=0.25in
\evensidemargin=0.25in

\begin{document}
\maketitle

Collaborators: NONE

\section*{1. Express the following hexadecimal number in decimal and binary forms: 0xd3fa986.}
\begin{qparts}

\textbf{Solution: } Given hexadecimal code is: d3fa986 (neglecting the hex notation 0x)
We know the decimal value of the hexadeimal characters; d,f,a:
\[d=13, f=15, a=10\]
The decimal value for the hexadecimal \textbf{d3fa986}: \[\small( 6*16^0\small) + \small( 68*16^1\small) + \small( 9*16^2\small) + \small( 10*16^3\small) + \small( 15*16^4\small) + \small( 3*16^5\small) + \small( 13*16^6\small)\]
\[\implies 222275974\]
\newline
Now, we have to convert decimal into binary
(`r is the remainder here`):
\[= 222275974_{10} / 2 - r_0\]
\[= 111137987_{10} / 2 - r_1\]
\[= 55568993_{10} / 2 - r_1\]
\[= 27784496_{10} / 2 - r_0\]
\[...\]
\[...\]
\newline
Continuing the process until we have reached 0.
\[\implies 1101001111111010100110000110_{2}\]

\end{qparts}

\section*{2. Annotate the following MIPS instructions to indicate source and destination registers. Also, describe in words (one sentence or less) what the instruction is trying to do. }

\begin{qparts}
\item addi \$t1, \$zero, 8

\textbf{Solution:} Destination: \$t1 \newline
Source: \$zero
\newline
Instruction: To get the value of \$t1 by performing the calculation of 0+8

\item lw \$s3, 4(\$gp)
\textbf{Solution:}Destination: \$s3
\newline
Source: \$gp
\newline
Instruction: To get the value of \s3 from the base address of 4.

\item sw \$s4, 10(\$s5)
\textbf{Solution:}Destination: \$s5
\newline
Source: \$s4
\newline
Instruction: Store the value of \$s4 in a specified address.

\end{qparts}
\end{document}


\RequirePackage[l2tabu, orthodox]{nag} % Complaints if syntax isn't right.
\documentclass[10pt]{extarticle}

\usepackage[utf8]{inputenc}
\usepackage{extsizes} % Allow for more sizes such as 14pt or 17pt on document class.
\usepackage{mathtools} % Allows conditional math expressions, etc.
\usepackage{amsfonts} % Allows \mathbb{R}, which is the real numbers symbol.
\usepackage[export]{adjustbox} % Wrapd \includegraphics with more keys (options).

% For writing pseudocode snippets: http://ctan.mackichan.com/macros/latex/contrib/algorithmicx/algorithmicx.pdf
\usepackage{algorithm}
\usepackage{algpseudocode}

% Layout the document: http://texdoc.net/texmf-dist/doc/latex/geometry/geometry.pdf
\usepackage[top=3.5cm, bottom=3.5cm, left=3.5cm, right=3.5cm]{geometry}

\usepackage{microtype} % Makes document more readable by optimizing space between letters.

\usepackage{units} % Adds \nicefrac{1}{2}: (½), \unit[5]{m}{s}: 5 m/s.

\usepackage[colorlinks=false, pdfborder={0 0 0}]{hyperref} % Allow clicking references and the table of contents in pdfs.
\usepackage{cleveref} % Adds fig/formula etc. before references (use \cref).

%%% New commands.

% Don't output references in case they're empty - http://tex.stackexchange.com/questions/74476/how-to-avoid-empty-thebibliography-environment-bibtex-if-there-are-no-refere

\let\myBib\thebibliography
\let\endmyBib\endthebibliography

\renewcommand\thebibliography[1]{\ifx\relax#1\relax\else\myBib{#1}\fi}

% Norm -> ||something||
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}

% Stdfig -> Used as \stdfig{label_name}{caption}
% Requires: image called 'caption' in img folder.
% Output: A figure with horizontal size the same as the document,
%         labeled as 'fig:label_name'

\newcommand{\stdfig}[2]{
    \begin{figure}
    \centering
    \includegraphics[max size={\textwidth}{\textheight}]{img/#1.eps}
    \caption{#2}
    \label{fig:#1}
    \end{figure}
}

\begin{document}

%% Front page.
\title{Dimensionality Reduction}

    \date{}

    \maketitle

\newpage
%% Abstract page.

%% Table of contents page.

%% Body start.
\section{Motivation I: Data
Compression}\label{motivation-i-data-compression}

Dimensionality reduction means transforming from a given amount of
features to a smaller amount of them (for example: 2D -\textgreater{}
1D). This is useful when we have redunant features (such as inches and
cm) that we can delete and have the same performance but being faster.

\section{Motivation II: Data
Visualization}\label{motivation-ii-data-visualization}

As we can only visualize data that has three or less dimensions, we can
use dimensionality reduction in order to visualize datasets that have
\textgreater{}3 dimensions. The hard part is how to select which
features represent the data better.

\section{Principal Component Analysis Problem
Formulation}\label{principal-component-analysis-problem-formulation}

\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
  Needs feature scaling before being applied.
\item
  PCA tries to minimize the projection error.
\end{itemize}

Problem: Reduce from 2D to 1D: Find a direction onto which to project
the data so as to minimize the projection error. \smallskip

If we have more dimensions than that, we will find n vectors (where n is
the amount of dimensions we want to end with) indicating the directions
into which to project the data, minimizing the projection error.
\smallskip

Basically, PCA is trying to find a lower dimensional surface onto which
to project the data so as to minimize the squared projection error
(squared distance between each point and the location in which it gets
projected).

\subsection{PCA is not lineal
regression}\label{pca-is-not-lineal-regression}

Linear regression fits a line according to the predictions of the
hypothesis (minimizes mse between data and the hyphotesis), whereas PCA
minimizes the squared error directly onto the projection vector.

\section{PCA Algorithm}\label{pca-algorithm}

Remember to preprocess the data normalizing it before applying PCA!
\smallskip

En example of PCA from 2D to 1D can be seen in \cref{fig:pca_2d_to_1d}.
We need to know how to calculate the vector $u^{(1)}$ and all $z^{(i)}$.
\smallskip

\stdfig{pca_2d_to_1d}{Example of PCA from 2D to 1D}

The algorithm for finding out principal components can be found in
\cref{alg:pca}.

\begin{algorithm}
\caption{PCA algorithm}\label{alg:pca}
\begin{algorithmic}[1]
\Function{PCA}{$x, k$} \Comment{x = unlabeled dataset}
    \State Reduces data from $n$-dimensions to $k$-dimensions.
    \State Compute covariance matrix:
        \State \indent $\Sigma = \frac{1}{m} \sum_{(i=1)}^n (x^{(i)})(x^{(i)})^T$
    \State Compute "eigenvectors" of matrix $\Sigma$:
        \State \indent [$U, S, V$] = svd(Sigma);  \Comment{Singular Value Decomposition}
        \State \indent We only need $U$. $k$-first $U$ vectors are the ones that we will use to describe the data.
        \State \indent $U_{\text{reduce}} \gets \text{First} \, k \, \text{vectors from} \, U \, \text{(in columns)}$
    \State $z \gets U_{\text{reduce}}^T x$
    \State \Return $z$
\EndFunction
\end{algorithmic}
\end{algorithm}

\section{Choosing the number of principal
components}\label{choosing-the-number-of-principal-components}

Typically, we choose $k$ to be the smallest value that still retains the
99\% of the variance. That is the same as: \[
\frac{\text{average squared projection error}}{\text{total variation in the data}} = \frac{\frac{1}{m} \sum_{i=1}^m \norm{x^{(i)} - x_\text{approx}^{(i)}}^2}{\frac{1}{m} \sum_{i=1}^m \norm{x^{(i)}}^2} \leq 0.01 \, (1\%)
\]

Then, we can select $k$ iteratively, starting from one and trying every
single value until we retain 99\% of the variance, at which point we can
select the $k$ that satisfies that restriction. \smallskip

Above solution is very slow though. We can take advantage that we are
computing the ``svd''. We can use the $S$ matrix returned by it to
calculate the retained variance in a much more easy way:

\[
\text{For a given} \, k:
\frac{\text{average squared projection error}}{\text{total variation in the data}} = 1 - \frac{\sum_{(i=1)}^k Sii}{\sum_{(i=1)}^n Sii}
\]

Using above formula, we can simply calculate the svd once and iterate
with the $S$ matrix until we find the correct $k$.

\section{Deconstruction from Compressed
Representation}\label{deconstruction-from-compressed-representation}

We're going to see how to reconstruct the data after having applied PCA
to it. It's a lossy method, so we're not going to get the same exact
data, just an approximation of it.

\[
X_\text{approx} = U_\text{reduce} z
\]

\section{Advice for Appylying PCA}\label{advice-for-appylying-pca}

We can use PCA in a supervised machine learning problem (using only $X$)
to speed up the algorithm. Just remember to also use the PCA with the
predict data! \smallskip

The PCA mapping should be defined using only the training set, as we
could bias it running it with the cv/test dataset as well.

%% Body end.

%% Bibliography.

    \nocite{*}

\bibliographystyle{plain}
\bibliography{references}

\end{document}

theory/08.02 - Dimensionality Reduction/08.02 - Dimensionality Reduction.tex


% declare document class and geometry
\documentclass[12pt]{article} % use larger type; default would be 10pt
\usepackage[margin=1in]{geometry} % handle page geometry

% import packages and commands
\input{../header2.tex}

\title{Phys 221A -- Quantum Mechanics -- HW01}
\author{UCLA, Fall 2014}
\date{\formatdate{22}{10}{2014}} % Activate to display a given date or no date (if empty),
         % otherwise the current date is printed

\begin{document}
\maketitle

\textit{
Problems 1.12 (p. 60), 1.15 (p. 61), 1.18 (p. 62), 1.23 (p. 63), 1.29 (p. 64) from the textbook (Sakurai and Napolitano, Modern Quantum Mechanics, 2nd edition).
}

\section*{Problem 1.12}
\textit{
A spin $1/2$ system is known to be in an eigenstate of $\v{S} \cdot \uv{n}$ with eigenvalue $\hbar / 2$, where $\uv{n}$ is a unit vector lying in the $xz$-plane that makes an angle $\gamma$ with the positive $z$-axis.
}

\begin{enumproblem}

% part A
\item \textit{
Suppose $S_x$ is measured. What is the probability of getting $+\hbar / 2$?
}

% part B
\item \textit{
Evaluate the dispersion in $S_x$---that is,
\begin{eqn}
\avg{(S_x - \avg{S_x})^2}.
\end{eqn}
(For your own peace of mind, check your answers for the special cases $\gamma = 0$, $\pi/2$, and $\pi$.)
}

\end{enumproblem}

\section*{Problem 1.15}
\textit{
Let $A$ and $B$ be observables. Suppose the simultaneous eigenkets $\set{\ket{a',b'}}$ of $A$ and $B$ form a \textbf{complete} orthonormal set of base kets. Can we always conclude that
\begin{eqn}
[A,B] = 0?
\end{eqn}
If your answer is yes, prove the assertion. If your answer is no, give a counterexample.
}

\section*{Problem 1.18}

\begin{enumproblem}

% part A
\item \textit{
The simplest way to derive the Schwarz inequality goes as follows. First, observe
\begin{eqn}
(\bra{\alpha} + \lambda^* \bra{\beta}) \cdot (\ket{\alpha} + \lambda \ket{\beta}) \geq 0
\end{eqn}
for any complex number $\lambda$; then choose $\lambda$ in such a way that the preceding inequality reduces to the Schwarz inequality.
}

% part B
\item \textit{
Show that the equality sign in the generalized uncertainty relation holds if the state in question satisfies
\begin{eqn}
\Delta A \ket{\alpha} = \lambda \Delta B \ket{\alpha}
\end{eqn}
with $\lambda$ purely \textbf{imaginary}.
}

% part C
\item \textit{
Explicit calculations using the usual rules of wave mechanics show that the wave function for a Gaussian wave packet given by
\begin{eqn}
\braket{x'}{\alpha} = (2 \pi d^2)^{-1/4} \exp \left[ \frac{i \avg{p} x'}{\hbar} - \frac{(x' - \avg{x})^2}{4d^2} \right]
\end{eqn}
satisfies the minimum uncertainty relation
\begin{eqn}
\sqrt{\abs{(\Delta x)^2}} \sqrt{\abs{(\Delta p)^2}} = \hbar / 2.
\end{eqn}
Prove that the requirement
\begin{eqn}
\matrixel{x'}{\Delta x}{\alpha} = (\text{imaginary number}) \matrixel{x'}{\Delta p}{\alpha}
\end{eqn}
is indeed satisfied for such a Gaussian wave packet, in agreement with (b).
}

\end{enumproblem}

\section*{Problem 1.23}
\textit{
Consider a three-dimensional ket space. If a certain set of orthonormal kets---say, $\ket{1}$, $\ket{2}$, and $\ket{3}$---are used as the base kets, the operators $A$ and $B$ are represented by
\begin{eqn}
A = \pmat{a & 0 & 0 \\ 0 & -a & 0 \\ 0 & 0 & -a}, \qquad B = \pmat{b & 0 & 0 \\ 0 & 0 & -ib \\ 0 & ib & 0}
\end{eqn}
with $a$ and $b$ both real.
}

\begin{enumproblem}

% part A
\item \textit{
Obviously $A$ exhibits a degenerate spectrum. Does $B$ also exhibit a degenerate spectrum?
}

% part B
\item \textit{
Show that $A$ and $B$ commute.
}

% part C
\item \textit{
Find a new set of orthonormal kets that are simultaneous eigenkets of both $A$ and $B$. Specify the eigenvalues of $A$ and $B$ for each of the three eigenkets. Does your specification of eigenvalues completely characterize each eigenket?
}

\end{enumproblem}

\section*{Problem 1.29}

\begin{enumproblem}

% part A
\item \textit{
On page 247, Gottfried (1966) states that
\begin{eqn}
[x_i, G(\v{p})] = i \hbar \pd{G}{p_i}, \qquad [p_i, F(\v{x})] = -i \hbar \pd{F}{x_i}
\end{eqn}
can be ``easily derived'' from the the fundamental commutation relations for all functions of $F$ and $G$ that can be expressed as power series in their arguments. Verify this statement.
}

% part B
\item \textit{
Evaluate $[x^2, p^2]$. Compare your result with the classical Poisson bracket $[x^2, p^2]_\text{classical}$.
}

\end{enumproblem}

\end{document}


\documentclass[./CGMPortfolio.tex]{subfiles}\input{./econtexRoot}
% Different execution depending on whether compiling main file or as standalone subfile
\onlyinsubfile{\externaldocument{CGMPortfolio}} % Get xrefs -- esp to appendix
%-- from main file; only works properly if main file has already been compiled;
%order: Compile this file, then main, then this one again
\begin{document}

\hfill{\tiny \texname.tex, \today}

\begin{verbatimwrite}{CGMPortfolio.title}  % Write title to .title file
Cocco, Gomes, and Maenhout (2005) REMARK
\end{verbatimwrite}

\title{Cocco, Gomes, and Maenhout (2005) \\ REMARK}

\author{Mateo Vel\'asquez-Giraldo \and Matthew V. Zahn}

\keywords{Lifecycle, Portfolio Choice, Replication}

\maketitle

\hypertarget{abstract}{}
\begin{abstract}
This paper contains the highlights from the REMARK file in Code>Python folder.
\end{abstract}

% Various resources
\hypertarget{links}{}
\begin{small}
\parbox{\textwidth}{
\begin{center}
\begin{tabbing}
\texttt{~Archive:~} \= \= \url{http://econ.jhu.edu/people/ccarroll/BufferStockTheory.zip} \kill \\  %
\texttt{~~GitHub:~} \> \>
\url{http://github.com/econ-ark/REMARK/REMARKS/CGMPortfolio} \\
\texttt{~~~~~~~~~~} \> \> \textit{(In GitHub repo, see \texttt{/Code} for tools for solving and simulating the model)} \\
\end{tabbing}
\end{center}

\href{https://mybinder.org/v2/gh/matthew-zahn/CGMPort/develop?filepath=REMARK\%2FCGM_REMARK.ipynb}{CLICK HERE} for an interactive \href{https://en.wikipedia.org/wiki/Project\_Jupyter\#Jupyter_Notebook}{Jupyter Notebook} that uses the \href{https://econ-ark/HARK}{Econ-ARK/HARK} toolkit to produce our figures (warning: it may take several minutes to launch).  Information about citing the toolkit can be found at \href{https://econ-ark.org/acknowledging/}{Acknowleding Econ-ARK}.
} % end parbox{\textwidth}
\end{small}

\begin{authorsinfo}
\name{Contact: \href{mailto:mvelasq2@jhu.edu}{\texttt{mvelasq2@jhu.edu}}, \href{mailto:matthew.zahn@jhu.edu}{\texttt{matthew.zahn@jhu.edu}}, Department of Economics, 590 Wyman Hall, Johns Hopkins University, Baltimore, MD 21218, \url{https://t.co/uaflostQyF?amp=1}, \url{http://matthewvzahn.com}.}
\end{authorsinfo}

\thanks{All numerical results herein were produced using the \href{https://econ-ark/HARK}{Econ-ARK/HARK} toolkit; for further reference options see \href{https://econ-ark.org/acknowledging/}{Acknowleding Econ-ARK}.  Thanks to Chris Carroll and Sylvain Catherine for comments and guidance.}

\titlepagefinish

\newtheorem{defn}{Definition}
\newtheorem{theorem}{Theorem}

\hypertarget{Introduction}{}
\section{Introduction}

This exercise uses the \href{https://github.com/econ-ark/hark}{Econ-ARK/HARK}
toolkit to attempt a replication of \cite{cgm2015}'s main results. The main
HARK tool used
here is the $\texttt{PortfolioConsumerType}$
class. For an introduction to this module, see the
\href{https://hark.readthedocs.io/en/latest/}{HARK's
	Documentation}.

Our results using the HARK toolkit resemble those of the original paper, but we
have not been able to replicate its results exactly for reasons that we have
not been able to track down. We suspect there might be subtleties in the
normalization or calibration that we have missed and that could be causing the
discrepancies. We would be thankful if a reader (or the original authors) were
able to discover the reason for the discrepancies, and could issue a pull
request for a revision that reconciles them.

We thank Chris Carroll and Sylvain Catherine for comments and guidance.

\hypertarget{The-base-model}{}
\section{The base model}

\cite{cgm2015}' aim is to represent the life cycle of a consumer that is
exposed to uninsurable labor income risk and how he chooses to allocate his
savings between a risky and a safe asset, without the possibility to borrow or
short-sell.

\subsection{Dynamic problem}

The problem of an agent $i$ of age $t$ in the base model is recursively represented as

\begin{verbatimwrite}{\EqDir/DynProb.tex}
	\begin{align}
		V_{i,t} =& \max_{0\leq C_{i,t} \leq X_{i,t}, \alpha_{i,t}\in[0,1]} U(C_{i,t}) + \delta p_t E_t\{ V_{i,t+1} (X_{i,t+1}) \}\\
		&\text{s.t} \nonumber \\
		&X_{i,t+1} = Y_{i,t+1} + (X_{i,t} - C_{i,t})(\alpha_{i,t} R_{t+1} + (1-\alpha_{i,t})\bar{R}_f)
	\end{align}
\end{verbatimwrite}
\input{\EqDir/DynProb.tex}
where $C_{i,t}$ is consumption, $\alpha_{i,t}$ is the share of savings
allocated to the risky asset, $Y_{i,t}$ is labor income, and $X_{i,t}$
represents wealth. The utility function $U(\cdot)$ is assumed to be CRRA in the
base model. Extensions beyond the baseline model include an additively
separable bequest motive in the utility function. The discount factor is
$\delta$ and $p_t$ is the probability of survival from $t$ to $t+1$. Death is
certain at a maximum period $T$.

Note that the consumer cannot borrow or short-sell.

The control variables in the problem are $\{C_{it}, \alpha_{it}\}^T_{t=1}$ and the state variables are $\{t, X_{it}, v_{it} \}^T_{t=1}$. The agent solves for  policy rules as a function of the state variables\textemdash $C_{it}(X_{it}, v_{it})$ and $\alpha_{it}(X_{it}, v_{it})$.

\subsection{Labor income}

An important driver of the paper's results is the labor income process. It is
specified as follows:
\begin{equation}
\log Y_{i,t} = f(t,Z_{i,t}) + v_{i,t} + \epsilon_{i,t}, \quad \text{for } t\leq K.
\end{equation}
where $K$ is the (exogenous) age of retirement, $Z_{i,t}$ are demographic
characteristics, $\epsilon_{i,t}\sim \mathcal{N}(0,\sigma^2_\epsilon)$ is a
transitory shock, and  $v_{i,t}$ is a permanent component following a random
walk
\begin{equation}
v_{i,t} = v_{i,t-1} + u_{i,t} = v_{i,t-1} + \xi_t + \omega_{i,t}
\end{equation}
in which the innovation is decomposed into an aggregate ($\xi_t$) and an
idiosyncratic component ($\omega_{i,t}$), both following mean-0 normal
distributions.

Post-retirement income is a constant fraction $\lambda$ of permanent income in the last working year $K$.

A crucial aspect of the labor income process is that $f(\cdot,\cdot)$ is calibrated to match income profiles in the PSID, capturing the usual humped shape of income across lifetime.

\subsection{Matching labor income in HARK}

In HARK's consumption-saving models, the income process takes the form
\begin{equation}
\ln Y_t = \ln P_t + \ln \theta_t
\end{equation}
where $P_t$ represents permanent income and $\ln \theta_t \sim N(0,\sigma_\theta)$ transitory shocks to income. Permanent income evolves according to
\begin{equation}
\ln P_{t+1} = \ln \Gamma_{t+1} +  \ln \psi_{t+1} + \ln P_t
\end{equation}
where $\Gamma_{t+1}$ is a deterministic growth factor, and $\ln \psi_{t+1} \sim N(0,\sigma_\psi)$ a permanent income shock.

To represent the author's assumptions in HARK, we express both income processes as sums of deterministic components and i.i.d shocks
\begin{align}
\text{Cocco et. al} &\quad& \ln Y_{i,t} &=& f(t,Z_{i,t}) + v_{i,0} &+&\sum_{k=1}^t u_{i,k} &+&\qquad \varepsilon_{i,t} \\
\text{HARK}        &\quad& \ln Y_{i,t} &=& \ln P_{i,0} + \sum_{k=1}^t \ln \Gamma_k &+&\sum_{k=1}^t \ln \psi_{i,k} &+& \qquad \ln \theta_{i,t}.
\end{align}

These representations make evident the mapping that we use
\input{\econtexRoot/\TableDir/Mapping.tex}
and to achieve a retirement income that is equal to a fraction $\lambda$ of
permanent income in the last working period $K$, we simply make $\Gamma_{K+1} =
\lambda$ and $\Gamma_{t} = 1$ $\forall t>K+1$.

\subsection{Assets and their returns}

There are two assets available for consumers to allocate their savings.
\begin{itemize}
	\item Bonds: paying a risk-free return $\bar{R}_f$.

	\item Stocks: paying a stochastic return $R_t = \bar{R}_f + \mu + \eta_t$, where the stochastic component $\eta_t \sim \mathcal{N}(0, \sigma^2_\eta)$ is allowed to be correlated with the aggregate labor income innovation $\xi_t$.

\end{itemize}

The borrowing and short-selling constraints ensure that agents cannot allocate negative dollars to either of these assets or borrow against future labor income or retirement wealth. Recall $\alpha_{i,t}$ is the proportion of the investor's savings that are invested in the risky asset. The model's constraints imply that $\alpha_{i,t}\in[0,1]$ and wealth is non-negative.

\hypertarget{Calibration}{}
\section{Calibration\textemdash Summary}

The paper defines and calibrates several parameters which are summarized in Table \ref{tab:Calibration}:

\input{\econtexRoot/\TableDir/Calibration.tex}

\hypertarget{Normalization}{}
\section{A note on normalization}

The problem as specified above makes the value function homogeneous with respect to permanent labor income. This is convenient as it allows for a re-statement of the problem in variables that are normalized by permanent income or its random components, eliminating a state variable.

The authors report (page 497) taking the normalization $v_{i,t} = 1$. This amounts to defining normalized variables $\tilde{\cdot}$ as the original variable divided by $e^{v_{i,t}-1}$. For instance:

\begin{equation}
\tilde{Y_{i,t}} = \frac{Y_{i,t}}{\exp(v_{i,t}-1)} = \frac{\exp (f(t,Z_{i,t}) + v_{i,t} + \varepsilon_{i,t})}{\exp(v_{i,t}-1)} = \exp( f(t,Z_{i,t}) + 1 + \varepsilon_{i,t} )
\end{equation}

These normalized variables have the convenient interpretation of the state that things would be in if, it weren't for permanent shocks. The author's depictions of policy functions are presented in terms of these normalized variables.

On the other hand, HARK normalizes the problem by total permanent income $P_t = \exp (f(t,Z_{i,t}) + v_{i,t})$ and its solution objects are therefore in terms of normalized variables $\hat{\cdot}$, defined as
\begin{equation}
\hat{X_{i,t}} = \frac{X_{i,t}}{P_{i,t}} = \frac{X_{i,t}}{\exp (f(t,Z_{i,t}) + v_{i,t})}.
\end{equation}

Therefore, to present our results in a way consistent with that of the original authors, we would use the following relationship
\begin{equation}
\tilde{X_{i,t}} = \hat{X_{i,t}} \times \exp (f(t,Z_{i,t})+1)
\end{equation}

However, our results are much more consistent with those of the original authors when we take the normalization $v_{i,t} = 0$, which also make sense since it makes the random-walk multiplicative part of permanent income $\exp{v_{i,t}}=1$. We therefore assume this is a typo, take $v_{i,t} = 0$, document this issue in Section \ref{sec:Puzzles} below, and use the relationship
\begin{equation}
\tilde{X_{i,t}} = \hat{X_{i,t}} \times \exp (f(t,Z_{i,t})).
\end{equation}

\hypertarget{Key-Results}{}
\section{Key Results}

\subsection{The optimal risky asset share}

Figure \ref{fig:RSharePol} shows the policy function for the risky portfolio share as a function of wealth at different ages.

The optimal risky share is decreasing in wealth. The authors argue this is due to the fact that, at low levels of wealth, relatively safe human wealth represents a higher fraction of the consumer's wealth, so he shifts his tradeable wealth towards riskier alternatives.

Analyzing the policy rule by age also shows that the risky share increases from young to middle age, and decreases from middle to old age. This is consistent with the previous interpretation: shares trace the humped shape of labor earnings.

These estimates are different from what is produced in the original paper, which are also reproduced below. Generally, the policy functions do not share the same curvature, which leads to greater reductions in the optimal portfolio share at lower levels of wealth.

\providecommand{\figName}{Risky-Share-Policy-Function} % Allows generic definition of hypertargets based on title of figure
\providecommand{\figFile}{RShare_Pol} %  and on filename
\hypertarget{\figFile}{}
\hypertarget{\figName}{}
\input{\econtexRoot/\FigsTeX/RShare_Pol} % Read in the tex to generate the figure

\subsection{Consumption behavior}

Figure \ref{fig:cPolFunc} below shows the policy function for consumption as a function of wealth at different ages.

At all age levels consumption increases with wealth. The consumption function also appears to shift upwards as life progresses.

Our consumption policy functions again do not match those of the original paper, which are also reproduced below. Consumption also appears to increase with age in our policy functions that does not come through in the results presented in the paper.

\providecommand{\figName}{Consumption-Policy-Function} % Allows generic definition of hypertargets based on title of figure
\providecommand{\figFile}{Cons_Pol} %  and on filename
\hypertarget{\figFile}{}
\hypertarget{\figName}{}
\input{\econtexRoot/\FigsTeX/Cons_Pol} % Read in the tex to generate the figure

\hypertarget{Simulations}{}
\section{Simulations}

Using the policy functions obtained from solving the model we present a series of simulations to highlight features of the model.

We first run a few simulations to verify the quality of our calibration.

The Figures \ref{fig:YSim} and \ref{fig:RShareSim} below show simulated levels of permanent income and risky portfolio shares for 5 agents over their life spans. We can see the model generates a heterogeneous permanent income distribution. Interestingly, all of these agents tend to follow the same general pattern for investing in the risky asset. Early in life, all of their portfolios are invested in the risky asset. This declines as the agent ages and converges to approximately 35\% once they reach retirement.

\providecommand{\figName}{Income-Simulation} % Allows generic definition of hypertargets based on title of figure
\providecommand{\figFile}{Y_Sim} %  and on filename
\hypertarget{\figFile}{}
\hypertarget{\figName}{}
\input{\econtexRoot/\FigsTeX/Y_Sim} % Read in the tex to generate the figure

\providecommand{\figName}{Risky-Share-Simulation} % Allows generic definition of hypertargets based on title of figure
\providecommand{\figFile}{RShare_Sim} %  and on filename
\hypertarget{\figFile}{}
\hypertarget{\figName}{}
\input{\econtexRoot/\FigsTeX/RShare_Sim} % Read in the tex to generate the figure

\subsection{The average life cycle patterns}

We now increase the number of simulations to examine and compare the behavior of the mean values of variables of interest at different ages, conditional on survival. In each case we present the original plots from the paper for reference.

Figure \ref{fig:YMC} below illustrates the average dynamics of permanent income, consumption, and market resources across all of the simulated agents. The plot follows the general pattern observed in the original paper. However, our results show that the agents are accumulating significantly more market resources. Figure \ref{fig:RShareMean} presents mean portfolio share conditional on survival.

\providecommand{\figName}{Variable-Means-Conditional-on-Survival} % Allows generic definition of hypertargets based on title of figure
\providecommand{\figFile}{YMC_Means} %  and on filename
\hypertarget{\figFile}{}
\hypertarget{\figName}{}
\input{\econtexRoot/\FigsTeX/YMC_Means} % Read in the tex to generate the figure

\providecommand{\figName}{RShare-Means-Conditional-on-Survival} % Allows generic definition of hypertargets based on title of figure
\providecommand{\figFile}{RShare_Means} %  and on filename
\hypertarget{\figFile}{}
\hypertarget{\figName}{}
\input{\econtexRoot/\FigsTeX/RShare_Means} % Read in the tex to generate the figure

\section{Other results in the original paper}

\subsection{The welfare implications of different allocation rules}

The authors next conduct a welfare analysis of different allocation rules, including popular heuristics. The rules are presented in the Figure \ref{fig:AllocRules}.

\providecommand{\figName}{Allocation-Rules} % Allows generic definition of hypertargets based on title of figure
\providecommand{\figFile}{Alloc_rules} %  and on filename
\hypertarget{\figFile}{}
\hypertarget{\figName}{}
\input{\econtexRoot/\FigsTeX/Alloc_rules} % Read in the tex to generate the figure

The utility cost of each policy in terms of constant consumption streams with respect to the authors calculated optimal policy function is reported in the next Figure \ref{fig:UtilityCosts}.

\providecommand{\figName}{Utility-Costs} % Allows generic definition of hypertargets based on title of figure
\providecommand{\figFile}{Util_cost} %  and on filename
\hypertarget{\figFile}{}
\hypertarget{\figName}{}
\input{\econtexRoot/\FigsTeX/Util_cost} % Read in the tex to generate the figure

Interestingly, the "no-income" column corresponds to the usual portfolio choice result of the optimal share being the quotient of excess returns and risk times relative risk aversion, disregarding labor income. The experiment shows this allocation produces substantial welfare losses.

\subsection{Heterogeneity and sensitivity analysis}

The authors also considered a number of extensions to the baseline model. These are summarized below along with their main conclusions.
\begin{itemize}
	\item Labor income risk: Income risk may vary across employment sectors relative to the baseline model. The authors examine extreme cases for industries that have a large standard deviation and temporary income shocks. While some differences appear across sectors, the results are generally in line with the baseline model.
	\item Disastrous labor income shocks: The authors find that even a small probability of zero labor income lowers the optimal portfolio allocation in stocks, while the qualitative features of the baseline model are preserved.
	\item Uncertain retirement income: The authors consider two types of uncertainty for retirement income; it is stochastic and correlated with current stock market performance and allowing for disastrous labor income draws before retirement. The first extension has results essentially the same as the baseline case. The second leads to more conservative portfolio allocations but is broadly consistent with the baseline model.
	\item Endogenous borrowing constraints: The authors add borrowing to their model by building on credit-market imperfections. They find that the average investor borrows about \$5,000 and are in debt for most of their working life. The agents eventually pay off this debt and save for retirement. Relative to the benchmark model, the investor has put less of their money in their portfolio and arrive at retirement with substantially less wealth. These results are particularly pronounced at the lower end of the income distribution relative to the higher end. Additional details are available in the text.
	\item Bequest motive: The authors introduce a bequest motive into the agent's utility function (i.e., $b>0$). Young investors are more impatient and tend to save less for bequests. As the agent ages, savings increases and is strongest once the agent retires. This leads to effects on the agent's portfolio allocation. Taking a step-back however, these effects are not very large unless $b$ is large.
	\item Educational attainment: The authors generally find that savings are consistent across education groups. They note that for a given age, the importance of future income is increasing with education level. This implies that riskless asset holdings are larger for these households.
	\item Risk aversion and intertemporal substitution: Lowering the level of risk aversion in the model leads to changes in the optimal portfolio allocation and wealth accumulation. Less risk-averse investors accumulate less precautionary savings and invest more in risky assets.
\end{itemize}

\hypertarget{Conclusion}{}
\section{Conclusion}

This article provides a dynamic model with accurate lifetime income profiles in which labor income increases risky asset holdings, as it is seen as a closer substitute of risk-free assets. It finds an optimal risky asset share that decreases in wealth and with age, after middle age. The model is also used to show that ignoring labor income for portfolio allocation can generate substantial welfare losses.

\hypertarget{Puzzles-and-Questions}{}
\section{Puzzles and Questions}\label{sec:Puzzles}
\begin{itemize}
	\item Table 4 in the main text says stock returns are $0.06$. They might
	mean that the equity premium $\mu$ is $0.06$.
	\item The authors report taking the normalization $v_{i,t} = 1$. However the ranges of their results seem more consistent with $v_{i,t} = 0$ so that $\exp (v_{i,t}) = 1$, which also makes more sense for interpretation.
\end{itemize}

\hypertarget{Robustness Analyses}{}
\section{Robustness Analyses}

Given the differences between our results and the original paper, we did a number of checks to ensure our model was behaving consistently with well-established theoretical results. Specifically we checked:
\begin{itemize}
	\item For an infinitely lived agent with log normal returns, that their optimal portfolio allocation converges to the Campbell-Viceira (2002) approximation to the optimal portfolio share in Merton-Samuelson (1969) model.
	\item For an infinitely lived agent with no labor income that can only invest in a single risky asset, that their marginal propensity to consumer converges to the theoretical MPC of Merton-Samuelson (1969).
	\item For an agent facing no labor income risk, that their consumption patterns precisely match the results from a perfect foresight solution.
\end{itemize}

In all three cases, we verified that our HARK model holds up to these results. More details and specific results are available upon request.

As the HARK toolkit continues to develop, there are additional sensitivities that we can perform to further check the credibility of our results. Specifically, once human wealth is available in the $\texttt{PortfolioConsumerType}$ class, we can perform the following additional checks, which were kindly suggested by Professor Sylvain Catherine:
\begin{itemize}
	\item Shut down the income risk and remove retirement income. The solution to this new problem are provided by Merton 1971. Basically, you capitalize future earnings as an endowment of risk free asset. Then the equity share should be such that Equity/(Wealth+NPV of Human capital) is the same as the equity share in Merton 1969.
	\item Adding back the permanent income risk and check if the equity share is consistent with Viceira 2001. Viceira tells you something like this: $\pi = \frac{\mu - r}{\gamma \sigma^2_s} + \left(\frac{\mu - r}{\gamma \sigma^2_s} - \beta_{HC} \right) \frac{HC}{W}$, where $\beta_{HC} = \frac{\text{Cov}(r_{HC},r_s)}{\text{Var}(r_s)}$. In the CGM problem it is easy to compute $\beta_{HC}$ because earnings follow a simple random walk. HC is the NPV of human capital, which you can approximate very well by discounting expected earnings by $r+\beta_{HC}*(rm-r)$.
\end{itemize}

\clearpage\vfill\eject

\onlyinsubfile{\bibliography{\econtexRoot/CGMPortfolio-Add}}

\end{document}