%% -*- coding:utf-8 -*-
\chapter{Tensor product. Structure of finite K-algebras}
This is a digression on commutative algebra. We introduce and study
the notion of tensor product of modules over a ring. We prove a
structure theorem for finite algebras over a field (a version of the
well-known "Chinese remainder theorem").

\section{Definition of tensor product}

\subsection{Summary for previous lectures}
We considered finite \mynameref{def:fextension1} $L$ i.e
$\left[L:K\right] < \infty$. We also saw that if
$L$ is generated by a finite number of \mynameref{def:degsepelem}s
$\alpha_1, \dots, \alpha_r$ then the number of
\mynameref{def:homomorphism}s over $K$ from $L$ to $\bar{K}$ denoted by
$\left|Hom_K\left(L, \bar{K}\right)\right|$ is equal to
$\left[L:K\right]$. In general
\[
\left[L:K\right]_{sep} =
\left|Hom_K\left(L, \bar{K}\right)\right| \le
\left[L:K\right].
\]

For $L = K\left(\alpha\right)$ it is clear because the number of
homomorphisms is equal to the number of roots of the
\mynameref{def:minpolynomial} $P_{min}\left(\alpha, K\right)$. In
general one can use induction and multiplicativity of the degree
$\left[L:K\right]$ and number of homomorphisms (see theorem
\mynameref{thm:lec3_3}). Thus  separable extension was exactly an
extension  which had the right number of homomorphisms into the
algebraic closure.

Our next goal is to characterize the separability in the terms of
tensor product.

\subsection{Tensor product}

\begin{definition}[Tensor product]
  Let $A$ is a ring, $N$, $M$ are $A$-\mynameref{def:module}s. The
  tensor product $M \otimes_A N$
  is another $A$-\mynameref{def:module} together with an
  $A$-bilinear map $\phi: M \times N \to M \otimes_A N$ which has
  ``\mynameref{def:universalproperty}'' defined below
  \label{def:tensorproduct}
\end{definition}

\begin{definition}[Universal property]
  $A$-bilinear map $\phi: M \times N \to M \otimes_A N$ has
  ``universal property'' if
  $\forall P$ - $A$-\mynameref{def:module} and
  for $A$-bilinear $f: M \times N \to P$ (
  i.e.
  \(
  \forall m, f_m:
  N \xrightarrow[n \to f(m,n)]{} P
  \)
  and
  \(
  \forall n, f_n:
  M \xrightarrow[m \to f(m,n)]{} P
  \)
  are \mynameref{def:homomorphism}s of $A$-modules
  ), then
  $\exists! \tilde{f}$ - homomorphism of $A$-modules such that
  $f = \tilde{f} \circ \phi$
  \footnote{
    That means that we have a \mynameref{def:commutativediagram} there
  }

  \begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}]
    \matrix (m) [matrix of math nodes, row sep=3em,
      column sep=2.5em, text height=1.5ex, text depth=0.25ex]
            { M \times N & & P \\
              & M \otimes_A N & \\ };
            %\draw[double,double distance=5pt] (m-1-1) – (m-1-3);
            \path[->]
            (m-1-1) edge node[auto] {$ f $} (m-1-3)
            edge node[auto] {$ \phi $} (m-2-2)
            (m-2-2) edge node[auto] {$ \tilde{f} $} (m-1-3);
  \end{tikzpicture}
  \label{def:universalproperty}
\end{definition}

The property characterize the pair
$\left(\phi, M \otimes N\right)$.
Really if have another pair
$\left(\overline{\phi}, \overline{M \otimes N}\right)$
like this one then by definition we have mutually inverse
homomorphisms of $A$-modules between them

\begin{lemma}[About uniqueness of object defined by universal
    property]
  \footnote{
    It is out of the lecture video and can be considered as an
    explanation for the claim about having mutually inverse
    homomorphisms of $A$-modules. The proof was taken from
    \cite{bib:KeithConradTensorProduct1}.
  }
  If we have two objects $\left(\phi, M \otimes N\right)$
  and $\left(\overline{\phi},\overline{M \otimes N}\right)$
  which both satisfies \mynameref{def:universalproperty} than there is
  an unique \mynameref{def:isomorphism} between them:
  \[
  \left(\phi, M \otimes N\right) \cong \left(\overline{\phi},
  \overline{M \otimes N}\right)
  \]
\begin{proof}
Let $P = \overline{M \otimes N}$ and $f =
\overline{\phi}$. In
the case we can consider the following diagram

\begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}]
  \matrix (m) [matrix of math nodes, row sep=3em,
    column sep=2.5em, text height=1.5ex, text depth=0.25ex]
          { & & M \otimes_A N & \\
            M \times N & & \overline{M \otimes_A N} \\
            & & M \otimes_A N & \\ };
          %\draw[double,double distance=5pt] (m-1-1) – (m-1-3);
          \path[->]
          (m-2-1) edge node[auto] {$ \phi $} (m-1-3)
          (m-1-3) edge node[auto] {$ g = \tilde{\overline{\phi}} $} (m-2-3)
          (m-2-1) edge node[auto] {$ \overline{\phi} $} (m-2-3)
          (m-2-1) edge node[auto] {$ \phi $} (m-3-3)
          (m-2-3) edge node[auto] {$ \bar{g} = \tilde{\phi} $} (m-3-3);
\end{tikzpicture}

As soon as we fixed $\overline{ M \otimes_A N}$
we 2 unique homomorphisms (which are defined by the fixed
$\overline{ M \otimes_A N}$) -
$g :  M \otimes_A N \to \overline{ M \otimes_A N}$
and
$\bar{g} :  \overline{M \otimes_A N} \to M \otimes_A N$.
Both $g$ and $\bar{g}$ are linear and, as mentioned above, the pair is
unique (if we fix $g$ we will have only one $\bar{g}$ that corresponds
to $g$). The composition $g \circ \bar{g}$ maps $M \otimes_A N$ to
itself. I.e. $\forall x \in M \times N$ we have
$\bar{g}\left(g\left(\phi\left(x\right)\right)\right) =
\phi\left(x\right)$. If $y = \phi\left(x\right)$ then
$\bar{g}\left(g\left(y\right)\right) = y$. The last equation holds
$\forall y \in Im\left(\phi\right)$ i.e. $\forall y \in M \otimes_A
N$. Therefore $\bar{g} = g^{-1}$.
\footnote {
  Another explanation is the following: thus if we fix $g$ and choose
  $\bar{g} = g^{-1}$ we will get $g \circ \bar{g} = id_{M \otimes_A
    N}$ that satisfied all requirements. The choice is final because
  we don't have a possibility to choose any other $\bar{g}$ (it should
  be unique).
}

Thus we have an
\mynameref{def:isomorphism} and the isomorphism is unique as soon as the
function $g$ is unique due the \mynameref{def:universalproperty}.

We just prove an isomorphism existence between
$M \otimes N$ and $\overline{M \otimes N}$ but the tensor product is
characterized not only by the module $M \otimes N$
but also a bilinear map $\phi$. Let $P = \overline{M \otimes N}$ thus
we can get that $\bar{\phi} = \tilde{\bar{\phi}} \circ \phi$ is
determined by the unique
relation $\phi \to \bar{\phi}$ as soon as
$\tilde{\bar{\phi}}$ is unique.
Analogues one can get the unique relation
$\bar{\phi} \to \phi$.
\end{proof}
\label{lem:universalpropertyuniqueness}
\end{lemma}

The uniqueness does not mean existence and we should proof that such
object exists.
\begin{lemma}[About tensor product existence]
  Tensor product defined via \mynameref{def:universalproperty} exists
  \begin{proof}
    Lets consider $\mathcal{E}$ the maps (functions) from
    $M \times N$ to $A$ as sets which are $0$ almost everywhere
    (i.e. outside of a finite set). For example we can consider delta
    functions:
    \[
    \delta_{m,n} : M \times N \to A
    \]
    such that
    \begin{eqnarray}
      \delta_{m,n}(m,n) = 1,
      \nonumber \\
      \delta_{m,n}(m',n') = 0 \mbox{ if } (m,n) \ne (m',n')
      \nonumber
    \end{eqnarray}
    Then $\mathcal{E}$ is a A-\mynameref{def:freemodule} with basis
    $\delta_{m,n}$. Thus we have a map of sets $M \times N \to
    \mathcal{E}$ such that $(m,n) \to \delta_{m,n}$ which is not bilinear
    but we can make it bilinear by means of changing $\mathcal{E}$.

    Let $\mathcal{F} \subset \mathcal{E}$ a submodule generated by
    $\delta_{m+m',n} - \delta_{m,n} - \delta_{m',n}$,
    $\delta_{m,n+n'} - \delta_{m,n} - \delta_{m,n'}$,
    $\delta_{am,n} - a\delta_{m,n}$,
    $\delta_{m,an} - a\delta_{m,n}$.
    \footnote{
      The basis is chosen to be a bilinear $\mod \mathcal{F}$, for instance
      $\delta_{m+m',n} = \delta_{m,n} + \delta_{m',n} \mod \mathcal{F}$
    }

    It can be shown that $M \times N \to \mathcal{E}/\mathcal{F}$ is
    bilinear
    \footnote{
      Follows from the basis choice
    }
    and has the desired \mynameref{def:universalproperty}.

    Really lets we have the following bilinear map:
    $f: M \times N \to P$. Then we can consider the following linear
    map (\mynameref{def:homomorphism})
    $f': \mathcal{E} \to P$ that sends $\delta_{m,n}$ to
    $f(n,m)$. Using the fact that $f$ is bilinear we can get
    \begin{eqnarray}
      f'(\delta_{m+m',n}) =
      f(m+m', n) = f(m, n) + f(m', n) =
      \nonumber \\
      =
      f'(\delta_{m,n}) + f'(\delta_{m',n}).
      \nonumber
    \end{eqnarray}
    With the same approach one can get the following relations
    \begin{eqnarray}
      f'(\delta_{m,n+n'}) = f'(\delta_{m,n}) + f'(\delta_{m,n'}),
      \nonumber \\
      f'(\delta_{am,n}) =  a f'(\delta_{m,n}),
      \nonumber \\
      f'(\delta_{m,an}) = a f'(\delta_{m,n})
      \nonumber
    \end{eqnarray}
    with the $f'$ linearity we have
    \begin{eqnarray}
      f'(\delta_{m+m',n}) = f'(\delta_{m,n} + \delta_{m',n}),
      \nonumber \\
      f'(\delta_{m,n+n'}) = f'(\delta_{m,n} + \delta_{m,n'}),
      \nonumber \\
      f'(\delta_{am,n}) =  a f'(\delta_{m,n}),
      \nonumber \\
      f'(\delta_{m,an}) = a f'(\delta_{m,n})
      \nonumber
    \end{eqnarray}

    The kernel $\ker f' = \mathcal{F}$ thus if we want to have a
    homomorphism to $P$ we have to replace $\mathcal{E}$ with
    $\mathcal{E}/\mathcal{F}$ that is also denoted by
    $M \otimes_A N$. In the case we will replace $f'$ with
    $\tilde{f}\left(\delta_{m,n} \mod \mathcal{F}\right) = f(m,n)$. As
    soon as the images for the basis is fixed the mapping is unique.
  \end{proof}
  \label{lem:tensorproductexistence}
\end{lemma}

We will denote $\phi\left(m,n\right) = \delta_{m,n} \mod \mathcal{F}$ as
$m \otimes n$. I.e our tensor product can be considered as the
$\left(\otimes, M \otimes_A N\right)$ pair.

\begin{remark}
  Wrong idea is to define $M \otimes_A N$
  as a set of $m \otimes n$. I.e.
  $M \otimes_A N \neq \{m \otimes n\}$. The $M \otimes_A N$ is
  generated by $m \otimes n$ i.e.
  $\forall x \in M \otimes_A N$ we have
  $x = \sum_{i = 1}^k m_i \otimes n_i$ i.e. each element is a finite
  sum of $m \otimes n$ and I cannot reduce these further
  \footnote{
    i.e. $\exists x \in M \otimes_A N$ such that
    $\exists! m \in M, n \in N: x = m \otimes n$ but
    $\exists m_1, \dots, m_k \in M, n_1, \dots, n_k \in N :
    x = \sum_{i = 1}^k m_i \otimes n_i$
  }.

\end{remark}

\section{Tensor product of modules}

\subsection{Advantages of the universal property}
Now, you can ask  why haven't I just defined the tensor product by
this construction? Why am I talking of this universal property?
And the answer is because it is easier to prove things this way.
So advantages of the universal property is as follows: the proofs
become easy.

\subsection{Several examples of universal property usage}

\begin{example}[Commutativity proof]
  We want to prove that
  \[
  M \otimes_A N \cong N \otimes_A M
  \]

  We have the following bilinear map:
  $M \times N \to N \otimes_A M$ for which the pair
  $(m,n)$ is mapped to $n \otimes m$. Thus from
  \mynameref{def:universalproperty} we have that there is a linear map
  (homomorphism)
  $\alpha: M \otimes_A N \to N \otimes_A M$:

  \begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}]
    \matrix (m) [matrix of math nodes, row sep=3em,
      column sep=2.5em, text height=1.5ex, text depth=0.25ex]
            { M \times N & & N \otimes_A M \\
              & M \otimes_A N & \\ };
            %\draw[double,double distance=5pt] (m-1-1) – (m-1-3);
            \path[->]
            (m-1-1) edge node[auto] {$ (m,n) \to n \otimes m $} (m-1-3)
            (m-1-1) edge node[description] {$ (m,n) \to m \otimes n $} (m-2-2)
            (m-2-2) edge node[description] {$ \alpha $} (m-1-3);
  \end{tikzpicture}

  With the same
  construction we can also get the inverse map $a^{-1}$ that sends
  $N \otimes_A M$ to $M \otimes_A N$:

  \begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}]
    \matrix (m) [matrix of math nodes, row sep=3em,
      column sep=2.5em, text height=1.5ex, text depth=0.25ex]
            { M \times N & & M \otimes_A N \\
              & N \otimes_A M & \\ };
            %\draw[double,double distance=5pt] (m-1-1) – (m-1-3);
            \path[->]
            (m-1-1) edge node[auto] {$ (m,n) \to m \otimes n $} (m-1-3)
            (m-1-1) edge node[description] {$ (m,n) \to n \otimes m $} (m-2-2)
            (m-2-2) edge node[description] {$ \alpha^{-1} $} (m-1-3);
  \end{tikzpicture}

\end{example}

Also
\begin{corollary}
\[
A \otimes_A M \cong M
\]
\begin{proof}
  For the proof
  \footnote{
    The proof is missed in the lectures
  }
  lets look at $A$.
  Really $A$ can be considered as $A$-module because all
  requirements from definition \ref{def:module} are satisfied. The
  following diagrams shows that there exist 2 homomorphisms:
  $\alpha: A \otimes_A M \to M$ and
  $\alpha^{-1}: M \to A \otimes_A M$ as result there is a homomorphism
  $A \otimes_A M \cong M$:

  \begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}]
    \matrix (m) [matrix of math nodes, row sep=3em,
      column sep=2.5em, text height=1.5ex, text depth=0.25ex]
            { A \times M & & M \\
              & A \otimes_A M & \\ };
            %\draw[double,double distance=5pt] (m-1-1) – (m-1-3);
            \path[->]
            (m-1-1) edge node[auto] {$ (a,m) \to a \cdot m $} (m-1-3)
            (m-1-1) edge node[description] {$ (a,m) \to a \otimes_A m $} (m-2-2)
            (m-2-2) edge node[description] {$ \alpha $} (m-1-3);
  \end{tikzpicture}
  \begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}]
    \matrix (m) [matrix of math nodes, row sep=3em,
      column sep=2.5em, text height=1.5ex, text depth=0.25ex]
            { A \times M & & A \otimes_A M \\
              & M & \\ };
            %\draw[double,double distance=5pt] (m-1-1) – (m-1-3);
            \path[->]
            (m-1-1) edge node[auto] {$ (a,m) \to a \otimes_A m $} (m-1-3)
            (m-1-1) edge node[description] {$ (a,m) \to a \cdot m $} (m-2-2)
            (m-2-2) edge node[description] {$ \alpha^{-1} $} (m-1-3);
  \end{tikzpicture}

  In the diagrams $m \in M$, as usual, and $a \in A$.

\end{proof}
\end{corollary}

If we have that $M$ is generated by $e_1, e_2, \dots$ and
$N$ is generated by $\epsilon_1, \epsilon_2, \dots$ than
$M \otimes_A N$ is generated by pairs $e_i \otimes \epsilon_j$. It's
obvious.

More complex fact is the following
\begin{proposition}
  Let $M$ and $N$ are \mynameref{def:freemodule}s
  with corresponding basises $e_1, e_2, \dots, e_n$ and
  $\epsilon_1, \epsilon_2, \dots, \epsilon_m$ than
  $M \otimes_A N$ is also free module with basis $e_i \otimes
  \epsilon_j$ where $1 \le i \le n$ and
  $1 \le j \le m$.
  \begin{proof}
    Lets define
    $f_{i_0,j_0}: M \times N \to A$ as a map that sends
    $\left(\sum a_i e_i, \sum b_j \epsilon_j\right)$ to
    $a_{i_0} b_{j_0}$. It's bilinear
    \footnote{
      for example
      $\left(\sum (a_i + a_i') e_i, \sum b_j \epsilon_j\right)$ is
      sent to  $(a_{j_0} + a_{j_0}') b_{j_0}$.
    }
    so it factors through the tensor product
    $\tilde{f}_{i_0, j_0} : M \otimes_A N \to A$. The map
    $\tilde{f}_{i_0, j_0}$ sends $e_{i_0} \otimes \epsilon_{j_0}$ to 1
    and all others to 0.
    \footnote{
      Because $f_{i_0, j_0} = \tilde{f}_{i_0, j_0} \phi$ i.e.
      \begin{eqnarray}
      a_{i_0} b_{j_0} =
      f_{i_0,j_0}\left(\sum a_i e_i, \sum b_j\epsilon_j\right) =
      \nonumber \\
      =  \tilde{f}_{i_0,j_0}\left(
      \phi\left(\sum a_i e_i, \sum b_j\epsilon_j\right)\right) =
      \nonumber \\
      =
      \tilde{f}_{i_0,j_0}\left(\sum a_i e_i \otimes \sum b_j
      \epsilon_j\right) =
      \sum_{i,j} a_i b_j \tilde{f}_{i_0,j_0}(e_i \otimes \epsilon_j).
      \nonumber
      \end{eqnarray}
    }
    So if
    \[
    \sum \alpha_{ij} e_i \otimes \epsilon_j = 0
    \]
    then applying $\tilde{f}_{i_0, j_0}$ for all indices one can get
    that $\forall i,j: \alpha_{ij} = 0$.
    \footnote{
      because $\tilde{f}$ should be linear.
    }
  \end{proof}
  \label{prop:lec4_1}
\end{proposition}

In particular for the \mynameref{def:vectorspace} the tensor product is
defined in the same way (as just proved in the proposition
\ref{prop:lec4_1}): the tensor product of 2 vector spaces with
basises $e_1, e_2, \dots, e_n$ and
$\epsilon_1, \epsilon_2, \dots, \epsilon_m$ is another vector space
with the following basis $e_i \otimes \epsilon_j$ i.e. the definition
does not take into consideration the \mynameref{def:universalproperty}.

\begin{proposition}[Associative]
  \[
  \left(M_1 \otimes_A M_2\right) \otimes_A M_3
  \cong
  M_1 \otimes_A \left(M_2 \otimes_A M_3\right)
  \]
  \begin{proof}
    There is just a scratch of the proof.
    Introduce
    $M_1 \otimes_A M_2 \otimes_A M_3$
    as a universal object for 3-linear maps and show that 2 considered
    parts are isomorphic each other.
  \end{proof}
  \label{prop:lec4_Associative}
\end{proposition}

\section{Base change}

Let $A$ is a \mynameref{def:ring} and $B$ is $A$-algebra. Let also $M$
is an $A$-\mynameref{def:module} and $N$ is $B$-module.

I can of course make $N$ into $A$-module (just forgetting the
additional $A$-algebra structure). But we can also make $B$-module on
$M$ (that is not a trivial thing) by considering $B \otimes_A M$
\footnote{
  In other words we can make a $B$-module from $A$-module $M$
}
.
We can introduce $B$-module structure on $B \otimes_A M$ by
\footnote{
  I.e. we introduced $B$-algebra operations for objects from
  $B \otimes_A M$. See also definition \ref{def:kalgebra}.
}
\[
b \cdot \left(b' \otimes m \right) = \left( b \cdot b' \right) \otimes m
\]

\begin{example}[The complexification of a real vector space]
  We can ``make'' $\mathbb{R}^{2n}$ from $\mathbb{C}^n$ by forgetting
  the complex structure.
  \footnote{
    In the case we have ring $A = \mathbb{R}$ and $B = \mathbb{C}$ -
    $A$ algebra. $A$ - module is the following vector space
    $M = \mathbb{R}^{n}$ and $B$ - module is $N = \mathbb{C}^n$.
  }
  The $\mathbb{C}^n$ has the following basis $e_1, \dots, e_n$.
  The $\mathbb{R}^{2n}$ has the following one
  $e_1, \dots, e_n, i e_1, \dots, i e_n$. Now we forgot about
  multiplication rules for $i = \sqrt{-1}$ and denote $i e_i$ as
  $v_i$. In the case the basis for $\mathbb{R}^{2n}$ is the following
  one: $e_1, \dots, e_n, v_1, \dots, v_n$.

  But we can also do the following constructions
  \[
  \mathbb{R}^n \rightarrow
  \mathbb{C}^n = \mathbb{C} \otimes \mathbb{R}^n \rightarrow
  \mathbb{R}^{2n}
  \]
  for the $\mathbb{C}^n$ basis we have
  $1_{\mathbb{C}} \otimes e_1, \dots, 1_{\mathbb{C}} \otimes e_n$ and
  for
  $\mathbb{R}^{2n}$ -
  $1 \otimes e_1, \dots, 1 \otimes e_n, i \otimes e_1, \dots, i
  \otimes e_n$.
  \footnote{
    some additional clarification:
    $\forall x \in \mathbb{C} \otimes \mathbb{R}^n$ we have
    \[
    x = \sum_{i=1}^n c_i \otimes r_i e_i =
    \sum_{i=1}^n c_i r_i 1_{\mathbb{C}} \otimes e_i =
    \sum_{i=1}^n c_i' 1_{\mathbb{C}} \otimes e_i,
    \]
    where $c_i,c_i'=c_i r_i \in \mathbb{C}, r_i \in \mathbb{R}$. Thus
    we just got $\mathbb{C}^n$.
    From other side we can write $c_i$
    as follows: $c_i = a_i + i b_i$, where $a_i, b_i \in \mathbb{R}$.
    Therefore
    \[
    x = \sum_{i=1}^n a_i r_i 1 \otimes e_i + \sum_{i=1}^n b_i r_i i \otimes e_i.
    \]
    I.e. $x \in \mathbb{R}^{2n}$ and the basis in $\mathbb{R}^{2n}$ is
    formed by $1 \otimes e_1, \dots, 1 \otimes e_n, i \otimes e_1,
    \dots, i \otimes e_n$.
  }

\end{example}

\begin{proposition}
In general we have the following. If $M$ - free $A$ - module with
basis $e_1, \dots, e_n$ then $B \otimes_A M$ is a free $B$ module with
basis $1_B \otimes e_1, \dots, 1_B \otimes e_n$.
\label{prop:lec4_Addon}
\begin{proof}
  The proof is the same as at proposition \ref{prop:lec4_1}. Again we
  construct certain bilinear maps and say that those factor over the
  tensor product and this implies that certain families are linearly
  independent.

  Really lets define bilinear map $f_{i_0}: B \times M \to A$ such that
  \[
  f_{i_0}\left(b, \sum_{i=1}^n m_i e_i\right) = b m_{i_0} e_{i_0}
  \]
  so there exists a linear map $\tilde{f}_{i_0}$ (homomorphism) such
  that $f_{i_0} = \tilde{f}_{i_0} \phi$ or
  \begin{eqnarray}
    f_{i_0}\left(b, \sum_{i=1}^n m_i e_i\right) =
    \tilde{f}_{i_0} \left(
    \phi\left(b, \sum_{i=1}^n m_i e_i\right)
    \right)
    \nonumber \\
    =
    \tilde{f}_{i_0}\left(b \otimes \sum_{i=1}^n m_i e_i\right) =
    b \tilde{f}_{i_0}\left(1_B \otimes \sum_{i=1}^n m_i e_i \right) =
    b m_{i_0}
    \nonumber
  \end{eqnarray}
  i.e. it sends $1_B \otimes e_{i_0}$ to 1 and all others $1_B \otimes
  e_i$ to 0.
  Thus the following sum $\sum \alpha_i 1_B \otimes e_i$ is equal to 0
  if and only if $\alpha_i = 0$ i.e. $\alpha_i 1_B \otimes e_i$ forms a basis.
\end{proof}
\end{proposition}

\begin{remark}
We have the following maps.
\begin{itemize}
  \label{item:lec4_maps}
\item For A - modules:
  $\alpha: M \xrightarrow[m  \to 1_B \otimes_A m]{} B \otimes_A M$
  which makes a $B$-module from an $A$-module.
\item For B - modules:
  $\mu: B \otimes_A N \xrightarrow[b \otimes n \to b n]{} N$.
\end{itemize}
\label{rem:lec4_maps}
\end{remark}

\begin{theorem}[Base-change]
  Let $A$ is a \mynameref{def:ring} and $B$ is $A$-algebra. Let also $M$
  is an $A$-\mynameref{def:module} and $N$ is $B$-module.
  \[
  Hom_A\left(M, N\right)
  \leftrightarrow
  Hom_B\left(B \otimes_A M, N\right)
  \]
  I.e. the homomorphisms
  \footnote{
    $A$-homomorphisms between $A$ modules $Hom_A\left(M, N\right)$ are the
    same as $B$-homomorphisms between $B$ modules
    $Hom_B\left(B \otimes_A M, N\right)$.
  }
  are the same or in other words the
  corresponding groups of homomorphisms are isomorphic:
  \[
  Hom_A\left(M, N\right)
  \cong
  Hom_B\left(B \otimes_A M, N\right)
  \]
  \label{thm:basechange}

  \begin{proof}
    First of all we have
    \footnote{
      One homomorphism from  $Hom_B\left(B \otimes_A M, N\right)$
    }
    \mynameref{def:homomorphism} $f: B \otimes_A M \to N$. We also have
    the following map (see remark \ref{rem:lec4_maps}):
    $\alpha: M \to B \otimes_A M$.
    Thus $f \cdot \alpha: M \to N$ i.e.
    we can set the following relation
    \[
    \hat{f} : Hom_B\left(B \otimes_A M, N\right)
    \to Hom_A\left(M, N\right)
    \]
    such that $\hat{f}\left(f\right) = f \alpha$.

    In other direction we have $g: M \to N$ thus
    $id_B \otimes g: B \otimes_A M \to B \otimes_A N$ but
    ( see remark \ref{rem:lec4_maps}) we have
    $\mu: B \otimes_A N \to N$ i.e. we have the following relation
    \[
    \hat{g} : Hom_A\left(M, N\right) \to
    Hom_B\left(B \otimes_A M, N\right)
    \]
    such that
    \[
    \hat g(g) = \mu \cdot (id_B \otimes g).
    \]
    And we can check that those maps ($\hat{f}$ and $\hat{g}$) are
    mutually inverse. For the proof
    \footnote{
      It's missed in the lectures
    }
    the fact consider the following diagram

    \begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}]
      \matrix (m) [matrix of math nodes, row sep=3em,
        column sep=2.5em, text height=1.5ex, text depth=0.25ex]
              { M  & &  N \\
                & B \otimes_A M & & B \otimes_A N \\ };
              %\draw[double,double distance=5pt] (m-1-1) – (m-1-3);
              \path[->]
              ([yshift=1ex]m-1-1.east) edge node[description] {$ f \alpha $}
              ([yshift=1ex]m-1-3.west);
              \path[->]
              ([yshift=-1ex]m-1-1.east) edge node[description] {$ g $}
              ([yshift=-1ex]m-1-3.west);
              \path[->]
              (m-1-1) edge node[description] {$ \alpha $} (m-2-2)
              (m-2-2) edge node[description] {$ f $} (m-1-3)
              (m-2-2) edge node[description] {$ id_B \otimes g $}
              (m-2-4)
              (m-2-4) edge node[description] {$ \mu $} (m-1-3)
              ;
    \end{tikzpicture}

    One can conclude, as soon as the diagram commutes

        \begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}]
      \matrix (m) [matrix of math nodes, row sep=3em,
        column sep=2.5em, text height=1.5ex, text depth=0.25ex]
              { M  & &  N \\
                & B \otimes_A M & & B \otimes_A N \\ };
              %\draw[double,double distance=5pt] (m-1-1) – (m-1-3);
              \path[->]
              ([yshift=-1ex]m-1-1.east) edge node[description] {$ g $}
              ([yshift=-1ex]m-1-3.west);
              \path[->]
              (m-1-1) edge node[description] {$ \alpha $} (m-2-2)
              (m-2-2) edge node[description] {$ id_B \otimes g $}
              (m-2-4)
              (m-2-4) edge node[description] {$ \mu $} (m-1-3)
              ;
    \end{tikzpicture}

    \[
    \hat{f}\left(\hat{g}\left(g\right)\right) =
    \mu \cdot (id_B \otimes g) \cdot \alpha = g.
    \]
    I. e. $\hat{f}\circ\hat{g} = id$
    \footnote {
      Operation $\circ$ is defined as follows $(\hat{a} \circ \hat{b})(x) =
      \hat{a}(\hat{b}(x))$ where $\hat{a}, \hat{b}$ are 2 maps acting
      on a set $X$ and $x \in X$.
    }
    or in other words $\hat{f}$ and
    $\hat{g}$ are mutually inverse.
  \end{proof}
\end{theorem}

\section{Examples. Tensor product of algebras}

\begin{proposition}
  If $I \subset A$ - is an \mynameref{def:ideal} so my $B$ - $A$ algebra
  will be $B = A/I$ then
  \[
  A/I \otimes_A M \cong M/IM
  \]
  where $IM$ is a sub-module of $M$.
  \label{prop:lec4_prop2}
  \begin{proof}
    We have map $\alpha: M \to B \otimes_A M = A/I \otimes_A M$
    (see remark \ref{rem:lec4_maps})
    which sends $m$ to $\bar{1} \otimes m$.
    \footnote{
      $\bar{1} = 1_A + I$
    }
    The map sends $IM$ to $0$
    because
    $\forall i \in I, m \in M : im \to \bar{1} \otimes im = \bar{i} \otimes m$
    because the tensor product is over $A$ and everything is $A$
    linear and as result $\bar{1} \otimes im = \bar{i} \otimes m$,
    but $\bar{i} \otimes m = \bar{0} \otimes m = 0$.
    \footnote{
      because
      $\bar{i} = 0 \mod I$
    }
    Thus $\alpha$ sends $IM$ to 0. So $\alpha$ induces
    $\bar{\alpha}: M/IM \to A/I \otimes_A M$ such that
    $\bar{\alpha}\left(\bar{m}\right) = \bar{1} \otimes m$.

    For other direction we apply \mynameref{thm:basechange}. The
    following map (projection) of $A$-modules
    \[
    M \xrightarrow{m \to \bar{m}} M/IM
    \]
    gives us the following map of $B$-modules
    \footnote{
      the \mynameref{thm:basechange} says that homomorphism of
      $A$-modules $M \to N$ is isomorphic to homomorphism of $B$
      modules $B\otimes_A M \to N$. Using $N = M/IM$ we can get that
      $B\otimes_A M \to M/IM$ is isomorphic (i.e. the same) to
      $M \to M/IM$. We also can get the same result just ignore $B$:
      $B \otimes_A M \to M \to M/IM$.
    }
    \[
    \bar{\beta}: B \otimes_A M \to M/IM
    \]
    i.e.
    \[
    \bar{\beta}: A/I \otimes_A M \to M/IM
    \]
    that sends $\bar{a} \otimes m$ to $\bar{am}$
    Ones check again that this inverse to $\bar{\alpha}$.
    \footnote{
      For example
      \(
      \bar{\beta}\left(\bar{\alpha}\left(\bar{m}\right)\right) =
      \bar{\beta}\left(\bar{1} \otimes m\right) = \overline{1 \cdot m} = \bar{m}
      \)
    }
  \end{proof}
\end{proposition}

Several examples:
\begin{example}
  Let $\mathbb{Z}/2\mathbb{Z} \otimes_\mathbb{Z}
  \mathbb{Z}/3\mathbb{Z}$ what will we obtain?
  \[
  \mathbb{Z}/2\mathbb{Z} \otimes_\mathbb{Z} \cong
  ^{\mathbb{Z}/3\mathbb{Z}}/_{(2) \cdot \mathbb{Z}/3\mathbb{Z}}
  \]
  but 2 is invertible: $2^{-1} = -1 \mod 3$
  \footnote{
    I.e. there exist an invertible element $2^{-1} \in
    \mathbb{Z}/3\mathbb{Z} = \mathbb{F}_3$ therefore
    $1_{\mathbb{F}_3} \in 2 \cdot \mathbb{F}_3$ or
    $2 \cdot \mathbb{F}_3 = \mathbb{F}_3$ and as result
    $(2) \cdot \mathbb{F}_3 = \mathbb{F}_3$. I.e. $(2)$ is not a
    \mynameref{def:properideal} in $\mathbb{F}_3$ because it is equal
    to $\mathbb{F}_3$.
  }
  thus
  $(2)\mathbb{Z}/3\mathbb{Z} =\mathbb{Z}/3\mathbb{Z}$ and as result
   \[
  \mathbb{Z}/2\mathbb{Z} \otimes_\mathbb{Z} \cong
  ^{\mathbb{Z}/3\mathbb{Z}}/_{ \mathbb{Z}/3\mathbb{Z}} = 0
  \]
\end{example}

\begin{example}
  Another obvious example
  \footnote {
    $B \otimes_A A\left[X\right]$ has the following $B$-basis:
    $\{1_B \otimes X^i\}$ thus
    $\forall b \in B \otimes_A A\left[X\right]$ we can get
    \[
    b = \sum b_i \cdot 1_B \otimes X^i
    \]
    and there is an obvious isomorphism
    \[
    f: B \otimes_A A\left[X\right]
    \xrightarrow[b \to \sum b_i X^i]{}
    B\left[X\right]
    \]
  }
  \[
  B \otimes_A A\left[X\right] \cong B\left[X\right]
  \]
  and more interesting one
  \[
  B \otimes_A A\left[X\right]/(P) \cong B\left[X\right]/(P),
  \]
  there $(P)$ becomes an ideal generated by $P$ in
  $B\left[X\right]$.
  \label{ex:lec4_1}
\end{example}

\subsection{Tensor product of A-algebras}

Let $B, C$ are $A$-algebras. The following maps form an algebra
structure on $A$:
\[
\alpha: A \to B
\]
\[
\beta: A \to C
\]
New $A$-algebra $B \otimes_A C$: is a ring with respect to the
following operation
\footnote{
  that makes it $A$-algebra (see \mynameref{def:kalgebra})
}
\begin{equation}
\left(b \otimes c \right) \cdot \left(b' \otimes c'\right) =
\left(b \cdot b'\right) \otimes \left(c \cdot c'\right)
\label{eq:lec4_algebra_tensor_product}
\end{equation}

The tensor product has the following
\begin{definition}[Universal property]
  Let we have the following maps
  \begin{eqnarray}
    \alpha: A \to B,
    \nonumber \\
    \beta: A \to C,
    \nonumber \\
    \phi: B \xrightarrow[b \to b \otimes 1_C ]{} B \otimes_A C,
    \nonumber \\
    \psi: C \xrightarrow[c \to 1_B \otimes c ]{} B \otimes_A C
    \nonumber
  \end{eqnarray}

  Then for any $A$-algebra $D$ one has
  \[
  Hom_A\left(B \otimes_A C, D\right)
  \leftrightarrow
  Hom_A\left(B, D\right) \times
  Hom_A\left(C, D\right)
  \]
  i.e. if I have some \mynameref{def:homomorphism}
  $h \in Hom_A\left(B \otimes_A C, D\right)$ this is the same as
  giving 2 homomorphisms
  $f \in Hom_A\left(B, D\right)$ and
  $g \in Hom_A\left(C, D\right)$ such that all maps in the following
  diagram commute (see \mynameref{def:commutativediagram}).

  \begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}]
    \matrix (m) [matrix of math nodes, row sep=3em,
      column sep=2.5em, text height=1.5ex, text depth=0.25ex]
            { D & & B \otimes C & \\
              & B & & C & \\
              & & A & & \\
            };
            %\draw[double,double distance=5pt] (m-1-1) – (m-1-3);
            \path[->]
            (m-2-2) edge node[description] {$ \phi $} (m-1-3)
            (m-2-4) edge node[description] {$ \psi $} (m-1-3)
            (m-3-3) edge node[description] {$ \alpha $} (m-2-2)
            (m-3-3) edge node[description] {$ \beta $} (m-2-4)
            (m-1-3) edge [bend right=15] node[description]  {$ h $}
            (m-1-1);
            \path[->, dashed]
            (m-2-2) edge [bend left=15] node[description] {$ f $} (m-1-1)
            (m-2-4) edge [bend left=15] node[description] {$ g $} (m-1-1)
            ;
  \end{tikzpicture}

  Thus if we have $h$ then we can define
  $f = h \cdot \phi$ and $g = h \cdot \psi$. And conversely if I have
  $f$ and $g$ then I can define $h$ by the following rule:
  \[
  h\left(b \otimes c\right) = f(b) \cdot g(c)
  \]
\end{definition}
The main point for us is that the tensor product of the $A$-algebras is
itself an $A$-algebra by this very simple rule, component-wise
multiplication (see (\ref{eq:lec4_algebra_tensor_product})).

Let consider next example.
We will start with the following
\[
\mathbb{C} \cong {\mathbb{R}\left[X\right]}/{\left(X^2 + 1\right)}
\]
therefore with result from example \ref{ex:lec4_1} one can get
\[
\mathbb{C} \otimes_\mathbb{R} \mathbb{C}
\cong
\mathbb{C} \otimes_\mathbb{R}
{\mathbb{R}\left[X\right]}/{\left(X^2 + 1\right)}
\cong
^{\mathbb{C}\left[X\right]}/_{\left(X^2 + 1\right)}
\]
but by \mynameref{thm:chineseremainder}
\[
^{\mathbb{C}\left[X\right]}/_{\left(X^2 + 1\right)}
\cong
^{\mathbb{C}\left[X\right]}/_{\left(X + i\right)}
\times
^{\mathbb{C}\left[X\right]}/_{\left(X - i\right)}
\cong
\mathbb{C} \times \mathbb{C}
\]
As result we have that
$\mathbb{C} \otimes_\mathbb{R} \mathbb{C}$ is not a field
because it
has zero divisors. How we can get the zero divisors?
The element $\overline{X + i}$ is a zero divisor
in
\(
^{\mathbb{C}\left[X\right]}/_{\left(X^2 + 1\right)}
\)
because
\[
\left(X + i\right) \left(X - i\right) \equiv 0 \mod {\left(X^2 + 1\right)}
\].

Another proof (not a part of the lecture) of the fact that $\mathbb{C}
\otimes_\mathbb{R} \mathbb{C}$ is not a field consider the following
one
\[
\mathbb{C}
\otimes_\mathbb{R} \mathbb{C}
\cong
^{\mathbb{C}\left[X\right]}/_{\left(X^2 + 1\right)}
\]
but the polynomial $X^2 + 1 = \left(X + i\right)\left(X - i \right)$
is reducible in $\mathbb{C}\left[X\right]$ i.e. is not a
\mynameref{def:maxideal} (see theorem \ref{thm:irreducibleideal}) and
with the theorem \ref{thm:maxideal} the quotient by the polynomial is
not a field (see also claim \ref{claim:lec1_sec14}).

\section{Relatively prime ideals. Chinese remainder theorem}

\begin{definition}[Relatively prime ideals]
  Let $A$ - \mynameref{def:ring} and $I,J$ are \mynameref{def:ideal}s.
  $I$ and $J$ are relatively prime if $I + J = A$.
  \label{def:relprimeideals}
\end{definition}

\begin{lemma}
  \begin{enumerate}
  \item If $I,J$ are relatively prime then $IJ = I \cap J$
  \item If $I_1, \dots, I_k$ relatively prime with $J$ then
    $\prod_{i =1}^k I_i = I_1 \dots I_k$ is also
    relatively prime with $J$.
  \item If $I, J$ relatively prime then $I^k$ and $J^l$ are also
    relatively prime for any $l$ and $k$.
  \end{enumerate}
  \begin{proof}
    \begin{enumerate}
    \item
      The following one  $IJ \subset I \cap J$ is clear
      \footnote {
        Assuming that $I$ and $J$ commute we have if
        $x \in IJ$ then $x \in I$ and if
        $x \in JI$ then $x \in J$ i.e. $x \in I \cap J$.
      }
      If $I$ and $J$ are relatively prime then $1_A = i + j$ for some
      $i \in I$ and $j \in J$. Thus $\forall x \in I \cap J$ we have the
      following ones:
      $x i \in IJ$ and $x j \in IJ$ and as result
      \[
      x = x i + x j \in IJ
      \]
      i.e. $I \cap J \subset IJ$.
    \item Suppose for simplicity that $k = 2$. In the case we have
      $1_A = i_1 + j_1 = i_2 + j_2$ where $i_1 \in I_1, i_2 \in I_2$ and
      $j_1, j_2 \in J$.
      we also have
      \[
      1_A = \left(i_1 + j_1\right) \left(i_2 + j_2\right) =
      i_1 i_2 + \left(j_1 i_2 + j_2 i_1 + j_1 j_2\right)
      \in I_1 I_2 + J
      \]
      thus $\forall x \in A$ we have
      \[
      x = 1_A x =
      i_1 i_2 x + \left(j_1 i_2 + j_2 i_1 + j_1 j_2\right) x
      \in I_1 I_2 + J,
      \]
      i.e. $I_1 I_2 + J = A$ therefore $I_1 I_2$ and $J$ are
      relatively prime.
    \item is obvious
      \footnote{
        It follows from the 2 because we can assume $I_i = I$ and will
        get that $\forall k, I^k$ is relatively prime with $J$. From
        other side we can assume $I_i = J$ and $J = I^k$ and conclude
        that $J^l$ is relatively prime with $I^k$.
      }
    \end{enumerate}
  \end{proof}
  \label{lem:aboutrelprimeideals}
\end{lemma}

\begin{theorem}[Chinese remainder]
  \label{thm:chineseremainder}

  Let $I_1, \dots, I_n$ - ideals and map
  $\pi: A \to A/I_1 \times \dots \times A/I_n$ defined as follows
  \begin{equation}
    \pi(a) = \left(a \mod I_1, \dots, a \mod I_n\right)
    \label{eq:lec4_crt_map}
  \end{equation}
  The kernel $\ker \pi = I_1 \cap \dots \cap I_n$.

  The $\pi$ is \mynameref{def:surjection} if and only if $I_1, \dots,
  I_n$ are pairwise relatively prime.

  In that case
  \[
  A/\cap I_k
  \cong
  A/\prod I_k
  \cong
  \prod \left(A/I_k\right)
  \]
  \footnote{
    See \mynameref{thm:firstisomorphism} where
    $G = A$,
    $H = A/I_1 \times \dots \times A/I_n$, $\phi = \pi$ and  with
    lemma \ref{lem:aboutrelprimeideals} (as soon as $I_k$ pairwise
    relatively prime)
    \[
    \ker \phi = \ker \pi = I_1 \cap \dots \cap I_n = I_1 \dots I_n.
    \]
  }
  \begin{proof}
    Let $\pi$ is \mynameref{def:surjection}. In the case
    $\exists a_i \in A$ such that
    \[
    \pi(a_i) = \left(0, \dots, 1 (\mbox{ in }i\mbox{-th place }),
    0, \dots, 0\right)
    \]
    i.e.
    $a_i \mod I_j = 0$ or $a_i \in I_j$ for $i \ne j$. We also have
    $a_i \mod I_i = 1$ thus $1 - a_i = k I_i$ i.e. $1 - a_i \in I_i$.
    Thus $\forall j, \exists a_i \in I_j, a_k \in I_i$ such that
    $1 = a_i + a_k$ thus $A = I_j + I_i$ i.e. $I_i$ relatively prime
    with any $I_j$.

    Conversely if $I_i$ is relatively prime with any $I_j$ where $j
    \ne i$ then it also relatively prime with the product (see lemma
    \ref{lem:aboutrelprimeideals}) $\prod_{j \ne i} I_j$. In the case
    $\exists x_i \in I_i, y_i \in \prod_{j \ne i} I_j$ such that
    $1 = x_i + y_i$ in the case
    \[
    \pi(y_i) = \left(0, \dots, 1 (\mbox{ in }i\mbox{-th place }),
    0, \dots, 0\right)
    \]
    and $\forall b_i \in A/I_i$
    \[
    \pi \left(\sum_{i = 1}^n b_i y_i\right) =
    \left(b_1, \dots, b_n\right)
    \]
    i.e. $\pi$ is surjective.
  \end{proof}
\end{theorem}

Let $K$ is a field and $A$ is a finite (finite dimensional vector
space) $K$-algebra.

\begin{proposition}
  \begin{enumerate}
    \item If $A$ is an \mynameref{def:integraldomain} then $A$ is a
      field.
    \item (replacing the first one) Any
      \mynameref{def:primeideal} of $A$ is a \mynameref{def:maxideal}
  \end{enumerate}
  \begin{proof}
     Well, I shall prove only the first part, the second part is just
     a consequence of definitions. In fact, a factor over a prime
     ideal, a quotient over a prime ideal is an integral domain, and a
     quotient over a maximal ideal is a field.
     \footnote{
       i.e. prime ideal is a maximal ideal
     }
     If you don't know this,
     please look it up in any book.

     Lets prove the first part. \mynameref{def:integraldomain} means
     that there is no zero divisors i.e. $\forall a \in A$
     \footnote{
       $a \ne 0_A$
     }
     multiplication by $a$ is \mynameref{def:injection}. $A$ is finite
     dimensional \mynameref{def:vectorspace} (see above) that implies
     that $\times a$ is an
     \mynameref{def:isomorphism},
     \footnote{
       $\times a$ sends a vector space  into another vector space with
       the same dimension. But with \mynameref{lem:vsisomorphism} one
       can get that the spaces are isomorphic each others and as
       result the operation $\times a$ is an \mynameref{def:isomorphism}.
     }
     in particular \mynameref{def:surjection} i.e. $\exists b \in A$
     such that $b \times a = 1$ i.e. $a$ is invertible therefore
     $A$ is field.
  \end{proof}
  \label{prop:lec4_ideals}
\end{proposition}

\section{Structure of finite algebras over a field. Examples}

\begin{myremark}
  Let $A$ is a $K$-algebra and $m$ is a maximal ideal of $A$. Then
  $A/m$ is also $K$-algebra.
  \label{rem:lec5_quotientkalgebra}
  \begin{proof}
    Lemma \ref{lem:lec1_homkalgebra} says that there is a ring homomorphism
    between $K$ and $A$: $f_K: K \to A$. There is also a canonical
    homomorphism $f_A: A \xrightarrow[a \to \bar{a}]{} A/m$. Therefore
    we can define $f = f_A f_K: K \to A/m$ and therefore with
    lemma about \mynameref{lem:lec1_homkalgebra} can conclude that $A/m$ is a
    $K$-algebra.
    \footnote{
      Thanks Zonglin Jiang for the proof.
    }

    Note that if $A$ is a field then $f_A$ is injection, $m=\{0_K\}$
    and $A = A/m$.
  \end{proof}
\end{myremark}

\begin{theorem}[Structure of finite $K$-algebra]
  Let $A$ be a finite $K$-algebra i.e.
  $\dim_K A < \infty$. Then
  \begin{enumerate}
  \item There are only finitely many \mynameref{def:maxideal}s
    $m_1, \dots, m_r$ in $A$
  \item Let $J = m_1 \cap \dots \cap m_r = m_1 \dots m_r$.
    \footnote{
      Since the ideals are relatively prime the intersection is the
      same as the product of the ideals
    }
    Then
    $J^n = 0$ for some $n$
  \item
    $A \cong A/{m_1^{n_1}} \times \dots \times A/{m_r^{n_r}}$ for
    some $n_1, \dots, n_r$.
  \end{enumerate}
  \label{thm:structurefinitekalgebra}
  \begin{proof}
    \begin{enumerate}
    \item
      Let $m_1, \dots, m_i$ are maximal ideals. By
      \mynameref{thm:chineseremainder} we have
      \footnote{
        Maximal ideals are relatively prime because
        in a commutative ring with unity, every
        \mynameref{def:maxideal} is a
        \mynameref{def:primeideal} see also proposition
        \ref{prop:lec4_ideals}.
      }
      \[
      A/m_1 \dots m_i \cong
      A/m_1 \times \dots \times A/m_i.
      \]
      We know that $A$ as well as $A/m_1 \dots m_i$ and $A/m_k$ are
      finite dimensional $K$-\mynameref{def:vectorspace}
      \footnote {
        See remark \ref{rem:lec5_quotientkalgebra} and take into
        consideration
        the theorem statement (see above) that says
        $\dim_K A < \infty$. $A/m_1$ is a projection i.e.
        $\dim_K A/m_1 < \dim_K A < \infty$.
      }
      thus we have the
      following relations
      \[
      \dim_K A \ge \dim_K  A/m_1 \dots m_i  =
      \sum_{j=1}^i dim_K A/m_j \ge i.
      \]
      Therefore if $N$ the number of maximal ideals then
      $\dim_K A \ge N$ i.e. the number of maximal ideal is limited by
      the vector space dimension.
    \item
      $J = m_1 \cap \dots \cap m_r = m_1 \dots m_r$ is finite
      dimensional vector space over $K$
      \footnote{
        We have $m_i \subset A$ i.e. $\dim_K m_i \le \dim_K A <
        \infty$. From other side $J = m_1 \dots m_r = (m_1 \cap \dots \cap
        m_r) \subset m_i, \forall i \in \{1, \dots, r\}$.
        Thus $\dim_K J \le \dim_K m_i \le \dim_K A <
        \infty\le $
      }
      as well as its powers
      $J^k$.
      We have the following sequence
      \footnote {
        Let $j \in J \subset A$ and $x \in JJ$.
        Then $\exists j \in J$ such that $x = j j$
        but $j j \in J$ because $\forall y \in J: j y \in J$.
        As result $J^2 \subseteq J$.
      }
      \[
      \dots \subseteq J^k \subseteq \dots \subseteq
      J^2 \subseteq J.
      \]
      and the sequence should stop somewhere
      \footnote {
        On each step we should decrease the dimension if we don't
        stop. The dimension is limited and as result the sequence
        should stop.
      }
      i.e.
      $\exists n$ such that $J^n = J^{n+1}$. We claim that $J^n = 0$
      in the case. Indeed if not we have the following basis of $J^n$:
      $e_1, \dots, e_s$. And as soon as $J^n = J J^n$ we can write a
      vector $e_i \in J^n$ as a vector from $J^n$ multiplied on an
      object from $J$ i.e.
      \[
      e_i = \sum \lambda_{ij} e_j,
      \]
      there $e_j \in J^n, \lambda_{ij} \in J$. Thus if
      $M = id - \lambda_{ij}$
      \[
      M \cdot \left(
      \begin{array}{c}
        e_1 \\
        \vdots \\
        e_s
      \end{array}
      \right) = 0.
      \]
      It's possible over ring
      to find a matrix $\tilde{M}$ such that
      \(
      \tilde{M} M = \det M \cdot id,
      \)
      \footnote{
        If $M$ is a matrix over a field we can consider the following
        2 cases:
        \begin{enumerate}
        \item $\det M = 0$: we can assume that $\tilde{M} = 0$
        \item $\det M \ne 0$: at the case $\exists M^{-1}$ and
          therefore $\tilde{M} =
          \det M \cdot M^{-1}$ will work.
        \end{enumerate}
        For more common case we have to look at Adjugate matrix
        \cite{wiki:adjugatematrix}
      }
      i.e.
      \begin{equation}
      \det M \cdot \left(
      \begin{array}{c}
        e_1 \\
        \vdots \\
        e_s
      \end{array}
      \right) = 0.
      \label{eq:lec4_det}
      \end{equation}
      But $\det M = 1 + \lambda$ where $\lambda \in J$.
      \footnote{
        Because the $\det$ consists of the following
        items $\prod (1-\lambda_{ii}) = 1 + (-1)^s\prod \lambda_{ii}$
        and $\prod \lambda_{ij}$. The sum of the items ($\det$)
        consists of $1$ and another sum in which all items are from
        $J$. Thus the second sum is an element of $J$ i.e.
        $\det M = 1 + \sum \prod \lambda_{ij} = 1 + \lambda$.
      }
      Since  $J = m_1 \cap \dots \cap m_r$ then
      $\forall i: \lambda \in m_i$
      so $\nexists i$ such that $1 + \lambda \in m_i$
      \footnote{
        We have that $m_i$ is a \mynameref{def:maxideal} and therefore (by
        its definition) it is a \mynameref{def:properideal} i.e.
        $1 \notin m_i$. From other side if $1 + \lambda \in m_i$ then
        $1 + \lambda - \lambda \in m_i$ as soon as $\lambda \in
        m_i$. I.e. we have a contradiction.
      }
      thus $1 + \lambda$ is invertable
      \footnote {
        $0 \in m_i$ thus if $1 + \lambda \notin m_i$ then
        $1 + \lambda \ne 0$.
      }
      therefore $e_1 = \dots = e_s = 0$
      \footnote{
        Because $\det M = 1 + \lambda \ne 0$
      }
    \item Using part 2
      $\exists n_1, \dots, n_r$ such that
      $m_1^{n_1} \dots m_r^{n_r} = 0$ (for example we can assume
      $n_i = n$). Then by \mynameref{thm:chineseremainder}
      \[
      A \cong
      A/{m_1^{n_1}} \times \dots \times A/{m_r^{n_r}}.
      \]
      We used the following facts:
      \begin{itemize}
      \item $A = A /m_1^{n_1} \dots m_r^{n_r}$
        \footnote{
          Because $A = A/\{0\}$. For example if $I = \{0\}$ and
          $x \in A$ then $\bar{x} \in A/I$ if $\bar{x} = x + I$. In
          our case $\bar{x} = x + \{0\} = x$ i.e. $\forall x \in A$ we
          have $x \in A/\{0\}$.
          (See also \mynameref{def:quotientring})
        }
      \item $m_i^{n_i}$ are pairwise relatively prime
        \footnote{
          As soon as $\{m_i\}$ - \mynameref{def:maxideal}s and as result
          \mynameref{def:primeideal}s then with lemma
          \ref{lem:aboutrelprimeideals} one can get that
          $\forall i \ne j$ $m_i^{n_i}$ is relatively prime with
          $m_j^{n_j}$.
        }
      \end{itemize}
    \end{enumerate}
  \end{proof}
\end{theorem}

\begin{remark}
  The $n_i$s are not uniquely defined. For example (see also example
  \ref{ex:lec5_1})
  \[
  A = ^{K\left[X\right]}/_{\left(X^2 \left(X+1\right)^3\right)}.
  \]
  We have 2 ideals there:
  $m_1 = (X)$ and $m_2 = (X+1)$.
  We of course have
  \[
  A \cong A/m_1^2 \times A/m_2^3
  \]
  but also we have
  \[
  A \cong A/m_1^3 \times A/m_2^3
  \]
  as soon as $m_1^2 = m_1^3$ in $A$:
  $(X)^2 \subset (X)^3$ but also
  $(X)^3 \subset (X)^2$
  \footnote{
    $(X)^3 \subset (X)^2$ - this is true for any polynomial
    $P\left(X\right)$ because if
    $P\left(X\right) \in (X)^3$ then
    $P\left(X\right) = X^3 P'\left(X\right) =
    X^2 \bar{P}\left(X\right) \in (X)^2$ where
    $\bar{P}\left(X\right) = X P'\left(X\right)$

    $(X)^2 \subset (X)^3$ is the more complex one and it does not true
    for any polynomial ring but this is true for our $A$.
    Let $P\left(X\right) \in \left(X\right)^2 \subset
    K\left[X\right]$ then
    $P\left(X\right) = X^2 P'\left(X\right)$ but
    $X^2 P'\left(X\right) \equiv 0 \mod X^2$.
    From other side
    $X^4 P'\left(X\right) \equiv 0 \mod X^2$
    therefore
    \[
    P\left(X\right) \equiv X^3 X P'\left(X\right) \mod X^2
    \]
    i.e. $P\left(X\right) \in (X)^3$.
  }
  \label{rem:lec5_4}
\end{remark}

Several examples:
\[
\mathbb{C} \otimes_\mathbb{R} \mathbb{C} =
\mathbb{C} \times \mathbb{C}.
\]

Another example
\[
\mathbb{Q}\left(\sqrt{2}\right)
\otimes_{\mathbb{Q}}
\mathbb{Q}\left(\sqrt{3}\right) =
\mathbb{Q}\left(\sqrt{2}, \sqrt{3}\right)
\]
And you see that those algebras are Cartesian products of fields.
So all $n_i$'s may be taken equal to 1
\footnote{
  Because $A/m^n$ (where $m$ is a maximal ideal) is a field if $n=1$
}.
In other words, we don't have
\mynameref{def:nilpotent}s in our algebra
\footnote{
  Cartesian products of fields has no nilpotent elements except 0
  \cite{ribenboim2001classical}.
}. So, it is a reduced
algebras. Reduced, by definition, is without nilpotents.
It's general phenomena because the presence of nilpotents is due to the
inseparability of extensions come from inseparable extensions.


% LaTeX file for a 1 page document
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{physymb}
\usepackage{braket}
\usepackage{array}
\title{EP 307 Assignment 4}

\author{Manish Goregaokar\\120260006}

\begin{document}
\maketitle

\section*{Problem 1}
$$\prod_{i\neq s}\frac{\hat A-a_i}{a_s-a_i}$$

If $\Ket{a}=\sum c_i\Ket{a_i}$, applying this operator we have \begin{align*}
\prod_{i\neq s}\frac{\hat A-a_i}{a_s-a_i}\left(\sum c_i\Ket{a_i}\right)&=\sum_j\left(\prod_{i\neq s}\frac{\hat A-a_i}{a_s-a_i}\right)c_j\Ket{a_j}\\
&=\left(\prod_{i\neq s}\frac{\hat A-a_i}{a_s-a_i}\right)c_s\Ket{a_s}\\&\qquad\text{Since the other terms have numerator cancelling out for $i=j$}\\
&=\left(\prod_{i\neq s}\frac{a_s-a_i}{a_s-a_i}\right)c_s\Ket{a_s}\\
&=c_s\Ket{a_s}
\end{align*}
Thus the operator is $\frac{\Ket{a_s}\Bra{a_s}}{\Braket{a_s|a_s}}=p_s$ (projection operator)
\section*{Problem 2}
\newcommand{\Tr}{\mathrm{Tr}}
To prove:
$$\Tr(XY)=\Tr(YX)$$

The trace of an operator can be denoted by $\sum_i \Braket{i|A|i}$, where $\Bra{i},\Ket{i}$ are basis vectors corresponding to the $i$th element being $1$ and the rest $0$.

Thus,

\begin{align*}
\Tr(AB)
&= \sum_i \Braket{i|AB|i}\\
&= \sum_i  \Braket{i|AIB|i}\\
&= \sum_i\sum_j  \Braket{i|A\Ket{j}\Bra{j}B|i}\\
&= \sum_i\sum_j  \Braket{j|A\Ket{i}\Bra{i}B|j}\\
&= \sum_j  \Braket{j|BIA|j}\\
&= \Tr(BA)
\end{align*}

\section*{Problem 7}

Applying $\hat{A}=\hat{Q}\hat{C}+\hat{C}\hat{Q}$ to an eigenstate $\Ket{\psi_q}$, we get:

\begin{align*}
\hat{A}\Ket{\psi_q} &=(\hat{Q}\hat{C}+\hat{C}\hat{Q})\Ket{\psi_q}\\
&= \hat{Q}\hat{C}\Ket{\psi_q}+\hat{C}\hat{Q}\Ket{\psi_q} \\
&= \hat{Q}\Ket{\psi_{-q}}+q\hat{C}\Ket{\psi_q}\\
&= -q\Ket{\psi_{-q}}+q\Ket{\psi_{-q}}\\
&=0
\end{align*}

If $\hat A\Ket{\psi_q}=0$, then $\hat A\left(\sum a_q\Ket{\psi_q}\right)=0$. We can say that the eigenvalue of $\hat A$ is 0.

For a state $\Ket{\psi_q}$ to be an eigenstate of $\hat C$, $c\Ket{\psi_q}=\hat C\Ket{\psi_q}=\Ket{\psi_{-q}}$

Since $\Ket{\psi_{-q}},\Ket{\psi_q}$ have different eigenvalues (except when $q=0$), they are linearly independent, and thus the  only possible value of $c$ is 0, which isn't an eigenstate.

So the only common eigenstate is $\Ket{\psi_0}$, provided that it is not a null vector.
\section*{Problem 9}
\newcommand{\kpsi}{\Ket{\psi}}
\begin{align*}
[\hat x, \exp\left(\frac{i\hat p a}{\hbar}\right)]\kpsi &= [\hat x, \exp\left(\frac{i(-i)\hbar\partial_x a}{\hbar}\right)]\kpsi\\
&=[\hat x, \exp(a\partial_x)]\kpsi\\
&=  x \sum_i \frac1{i!}a^i\partial^i_x\kpsi - \sum_i\frac1{i!} a^i\partial^i_x (x\kpsi) \\
&=  x \sum_i \frac1{i!}a^i\partial^i_x\kpsi - \sum_i\frac1{i!} a^i(x\partial^i_x (\kpsi) + \partial_x^{i-1}i\kpsi)\\
&= - \sum_i\frac1{i!} a^i \partial_x^{i-1}i\kpsi\\
&= - \sum_i\frac1{(i-1)!} a^i \partial_x^{i-1}\kpsi\\
&= - a\exp(a\partial_x)\Ket{\psi}\\
&= -a\exp\left(ia\frac{\hat p}{\hbar}\right)\kpsi\\
\therefore [\hat x, \exp\left(\frac{i\hat p a}{\hbar}\right)] &= -a\exp\left(ia\frac{\hat p}{\hbar}\right)
\end{align*}

\section*{Problem 11}
The first allowed state (ground state) in the new system will be the first odd wavefunction, i.e. when $n=1$. We need to calculate the probability that the current state ($n=0$) becomes $n=1$ in that region. Note that since the space is halved over a symmetric function, the wavefunctions will be normalized by an extra factor of $\frac1{\sqrt2}$

So, the overlap is
\begin{align*}
\int_0^\infty \psi_0(x)\frac1{\sqrt2}\psi_1(x)
&= \int_0^\infty  \left(\frac{\alpha}{\sqrt{\pi}}\right)^{\frac12}e^{-\alpha^2x^2/2}H_0(\alpha x)\left(\frac{\alpha}{\sqrt{\pi}2}\right)^\frac12 e^{-\alpha^2x^2/2}H_2(\alpha x)\\
&= \frac{\alpha}{\sqrt\pi\sqrt2}\cdot \int_0^\infty e^{-\alpha^2x^2}\cdot 2\alpha x\\
&=\frac{2\alpha^2}{\sqrt{2\pi}} \int_0^\infty e^{-\alpha^2x^2}\cdot  x\\
&=\frac{2\alpha^2}{\sqrt{2\pi}}\frac{1}{2\alpha^2}
&=\frac{1}{\sqrt{2\pi}}
\end{align*}

Thus the probability is $\left(\frac1{\sqrt{2\pi}}\right)^2=\boxed{\frac{1}{2\pi}}$

\section*{Problem 13}
$$\hat{A}=\begin{pmatrix}a&0&0\\0&-a&0\\0&0&-a\end{pmatrix},\quad\hat{B}=\begin{pmatrix}b&0&0\\0&0&ib\\0&ib&0\end{pmatrix}$$

To find eigenvectors of $\hat B$, we can multiply it with the vector $X=\begin{pmatrix}x\\y\\z\end{pmatrix}$. We get $\hat BX=\begin{pmatrix}bx\\ibz\\iby\end{pmatrix}=cX$, so for an eigenvector we either have $c=b,ibz=y,iby=z$ (giving $y=z=0$ for a general $b$, and eigenvector $\begin{pmatrix}1\\0\\0\end{pmatrix}$. If $c\neq b$ we have $x=0$, and $y=\pm z$ with eigenvalues $\pm ib$

Therefore the eigenvectors are:

\begin{enumerate}
\item $\begin{pmatrix}1\\0\\0\end{pmatrix}$  or $\Ket{1}$ with eigenvalue $b$
\item $\begin{pmatrix}0\\1\\1\end{pmatrix}$ or $\Ket{2}+\Ket{3}$ with eigenvalue $ib$
\item $\begin{pmatrix}0\\1\\-1\end{pmatrix}$ or $\Ket{2}-\Ket{3}$ with eigenvalue $-ib$
\end{enumerate}
\hfill Ans. (a)

Now,
$$\hat A\hat B=\left(
\begin{array}{ccc}
 a & 0 & 0 \\
 0 & -a & 0 \\
 0 & 0 & -a \\
\end{array}
\right) \left(
\begin{array}{ccc}
 b & 0 & 0 \\
 0 & 0 & i b \\
 0 & i b & 0 \\
\end{array}
\right)=\left(
\begin{array}{ccc}
 a b & 0 & 0 \\
 0 & 0 & 0 \\
 0 & 0 & 0 \\
\end{array}
\right)$$

and

$$\hat B\hat A= \left(
\begin{array}{ccc}
 b & 0 & 0 \\
 0 & 0 & i b \\
 0 & i b & 0 \\
\end{array}
\right)\left(
\begin{array}{ccc}
 a & 0 & 0 \\
 0 & -a & 0 \\
 0 & 0 & -a \\
\end{array}
\right)=\left(
\begin{array}{ccc}
 a b & 0 & 0 \\
 0 & 0 & 0 \\
 0 & 0 & 0 \\
\end{array}
\right)$$

As $\hat A\hat B=\hat B\hat A$ in matrix form, the operators commute.
\hfill Ans. (b)

The eigenkets of $\hat A$ can be easily seen to be $\Ket{1}$ with eigenvalue $a$, and $l\Ket{2}+m\Ket{3}$ with eigenvalue $-a$ ($\forall~l,m$)

We can see that the eigenkets of $B$ are also eigenkets of $A$. They are also orthogonal, after normalizing we have:\\~\\

\begin{tabular}{ >{$}c<{$} >{$}c<{$}  >{$}c<{$} }
\text{Orthonormal Eigenket} & \text{Eigenvalue with }\hat A & \text{Eigenvalue with }\hat B \\
\Ket{1} & b & a\\
\frac{\Ket{2}+\Ket{3}}{\sqrt{2}} & ib & -a\\
\frac{\Ket{2}-\Ket{3}}{\sqrt{2}} & -ib & -a
\end{tabular}

The eigenkets are not completely determined from the eigenvalues from individual eigenvalues, as the eigenvalue $-a$ has multiplicity 2 and thus has an entire space of eigenkets.

However, knowing the eigenvalues from both operators completely specifies the eigenket, barring a constant.
\hfill Ans. (c)
\section*{Problem 16}

$\psi(x)=\frac{1}{\sqrt{2a}}$ in $[-a,a]$. The momentum space function can be found via the fourier transform, \begin{align*}
\tilde{\psi}(p)&=\frac1{\sqrt{2\pi}}\int_{-\infty}^\infty e^{-ikx}\psi(x)dx\\
&= \frac1{\sqrt{2\pi}}\int_{-a}^a\frac{1}{\sqrt{2a}} e^{-ikx}dx\\
&=\frac{i}{2k\sqrt{a\pi}} \left.e^{-ikx}\right|_{-a}^a\\
&=\frac{i}{2k\sqrt{a\pi}} \left(e^{-ika}-e^{ika}\right)\\
&=\frac{i}{2k\sqrt{a\pi}} \cdot -2i\sin ka\\
\therefore \tilde{\psi}(p)&=\frac{\sin \left(\frac{ap}{\hbar} \right)}{p\sqrt{a\pi}}\qquad\text{(Already normalized)}
\end{align*}
\hfill Ans.

Now, \begin{align*}\sigma_x&=\sqrt{\Braket{x^2}-\Braket{x}^2}\\
&=\sqrt{\int \psi^*(x)x^2\psi(x)dx-0}\\
&= \sqrt{\int_{-a}^a \left(\frac{1}{\sqrt{2 a}}\right)^2 x^2 dx}\\
&= \frac{a}{\sqrt{3}}
\end{align*}

And

\begin{align*}\sigma_p&=\sqrt{\Braket{p^2}-\Braket{p}^2}\\
&=\sqrt{\int \tilde{\psi}^*(p)p^2\tilde{\psi}(p)dp-0}\\
&= \sqrt{\int_{-\infty}^\infty \left(\frac{\sin \left(\frac{a p}{\hbar }\right)}{\sqrt{\pi } \sqrt{a} p}\right)^2 p^2 dp - 0}\qquad\text{(The wavefunction is odd so the second term vanishes)}\\
&=\sqrt{\infty}
\end{align*}

The product of the two uncertantainties is greater than $\frac\hbar2$
\section*{Problem 17}

$$\psi(x,t)=\frac{1}{\sqrt{2 \pi  \hbar }}\int_{-\infty }^{\infty }  \phi(p)  e^{-\frac{t \left(i p^2\right)}{2 m}+i p x} \, dp$$

Now, we can rewrite this as $\frac{1}{\sqrt{2 \pi  \hbar }}\int_{-\infty }^{\infty } e^{i p x} \left(\phi(p)  e^{-\frac{t \left(i p^2\right)}{2 m}}\right) \, dp$

which is an inverse fourier transform.

Thus, $\tilde{\psi}(p,t)=\mathcal F(\psi(x,t))=\phi(p)  e^{-\frac{t \left(i p^2\right)}{2 m}}$\\
Now,
\begin{align*}
\Braket{p}&=\int \tilde{\psi}^*(p,t)p\tilde{\psi}(p,t)dp\\
&=\int \phi^*(p)  e^{\frac{t \left(i p^2\right)}{2 m}}p\phi(p)  e^{-\frac{t \left(i p^2\right)}{2 m}}dp\\
&= \int \phi^*(p) p \phi(p) dp
\end{align*}

Thus, $\Braket{\hat p}$ is independant of time\hfill Ans. (a)

Note that $\phi(p)=\tilde{\psi}(p,t=0)$
Now,

\begin{align*}
\Braket{x}= \int \tilde{\psi}^*(p,t)i\hbar\ud{}{p}\tilde{\psi}(p,t)dp\\
&=\int \phi^*(p)e^{\frac{t \left(i p^2\right)}{2 m}}i\hbar\left(\pd{\phi}{p}e^{-\frac{t \left(i p^2\right)}{2 m}}+\phi(p)\frac{2pt}{2m}e^{-\frac{t \left(i p^2\right)}{2 m}}\right)dp\\
&=\int\left( \phi^*(p)i\hbar\pd{\phi}{p} + \frac{t}{m}\phi^*(p)p\phi(p)\right) dp\\
&= \Braket{i\hbar\pd{}{p}}_{t=t_0} + \frac{t}{m}\Braket{p}_{t=t_0}\\
\therefore \Braket{x}&=\Braket{x}_{t=0} + \frac{t}{m}\Braket{p}_{t=0}
\end{align*}

Since this is linear, we can shift by $t_0$ to get $\boxed{\Braket{x}=\Braket{x}_{t=t_0} + \frac{t-t_0}{m}\Braket{p}_{t=t_0}}$\hfill Ans. (b)
\section{Problem 19}
$$\hat H = \frac{\hat p^2}{2m}+V(x)$$

\begin{align*}
[H,\hat x]&=\frac{\hat p^2}{2m}x+V(x)x-x\frac{\hat p^2}{2m}+xV(x)\\
&=-x\frac{\hat p^2}{2m}\\
[[H,\hat x],x]&=-x\frac{\hat p^2}{2m}x - -x^2\frac{\hat p^2}{2m}\\
&=\frac{x^2\hat p^2}{2m}
\end{align*}
\end{document}

Course material/EP 307 - Quantum Mechanics/Assignment 4/assign4.tex


\documentclass{article}

\usepackage{epsfig}
\usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox
\usepackage{caption}
\usepackage{subcaption}
\usepackage{fullpage}
\usepackage{commath}
\usepackage{amssymb}
\usepackage[space]{grffile}
\usepackage{algorithm, algorithmic}

\def\E{\mathbb{E}}
\def\R{\mathbb{R}}
\def\bin{\text{bin}}
\def\bet{\text{beta}}
\def\range{\text{range}}
\def\vec{\text{vec}}

\newcommand\hide[1]{}

\title{HMM with Contexts in DNA Methylation Problem}

\author{Chicheng Zhang}

\begin{document}
\maketitle

\section{The Model}

We are given sequences $\cbr{m_t, c_t}$, where at each time $t$ the methylation count is $m_t \in \cbr{0,1,\ldots,n}$, and the context information is $c_t \in [c]$. We model the data using a hidden Markov model with context information, that is, the underlying dynamics of the hidden states is driven by a Markov chain $\cbr{y_t}$, where $y_t \in [m]$.

It can be described by parameters $(\pi, T, O)$, where $\pi$ is the initial probability distribution $\Pr(y_1)$ and $T$ is the transition matrix of the Markov chain $\Pr(y_{t+1} | y_t)$, $O$ is the observation matrix, namely the conditional probability of methylation given hidden state and context $\Pr(m_t | c_t, y_t)$. See Figure~\ref{fig:contexthmm} for illustration.

\begin{figure}[h]
\centering
\scalebox{0.3}
{
\includegraphics{hmm.png}
}
\caption{Modeling DNA methylation using a Hidden Markov model with context information.}
\label{fig:contexthmm}
\end{figure}

Our objective is to recover parameters $\pi$, $T$ and $O$ based on iid samples drawn from this model.

\section{Algorithm based on Method of Moments}

For each $i$, consider recovering a block of observation matrix $O^{2, i} = \Pr(m_t | c_t = i, y_t)$ separately. We make the assumption that $O^{2, i}$ is of full column rank. Then, the joint cooccurence tensor of $(m_1, m_2, m_3)$, when the context of observation 2 $c_2$ is $i$, has the following structure:
\[ \E [m_1 \otimes m_2 \otimes m_3 | c_2 = i] = \sum_j \omega_j O^{1}_j \otimes O^{2, i}_j \otimes O^{3}_j \]
where $\omega$ is the distribution of $y_2$ given $c_2$, $O^{1} = \E[m_1 | y_2]$, $O^{2,i} = \E[m_2 | y_2, c_2 = i]$, $O^{3} = \E[m_3 | y_2]$.
At this point, standard tensor decomposition method can readily be applied to extract the columns of $O^{2, i}$.

Alternatively, we have
\[ \E [m_1 \otimes m_3] = \sum_j \omega_j O^1_j \otimes O^3_j \]
and
\[ \E [m_1 \otimes m_2 | c_2 = i] = \sum_j \omega_j O^{1}_j \otimes O^{2, i}_j \]
Then standard symmetrization and orthogonalization routine can be applied to recover the columns of $O^{2, i}$.

\section{Binomial Hidden Markov Model}
In this section, we consider HMMs whose observation matrix has structured columns, that is, columns which are probability mass functions of binomial distribution. We first take a step back, considering HMMs without context information. (The approach can be easily generalized to the setting with context information.)

In this model, each element of $O$ can be written as $O_{i,j} = {n \choose i} p_j^i (1-p_j)^{n-i}$, i.e. the probability that there are $i$ heads out of $n$ trials when flipping a coin with bias $p_j$. Instead of recovering $O$, we now turn to the task of recovering $p_j, j = 1,2,\ldots,m$. A naive approach would be to first recover the columns of $O$, e.g. $O_j$, then get $p_j$ using the formula:

\[ p_j = \sum_{i=0}^n \frac{i}{n} {n \choose i} p_j^i (1-p_j)^{n-i} = \sum_{i=0}^n \frac{i}{n} O_{i,j} \]

\subsection{Exploiting Similarity between Observations}
Sometimes it will be beneficial to consider feature representations of observation other than one-hot encoding. Define feature map $\phi: \cbr{0,\ldots,n} \to \R^D$, where $D$ can potentially be very large, even (uncountably) infinite. For example, $\phi(m) = \cbr{t^m (1-t)^{n-m}}_{t \in [0,1]}$, $\phi(m) = \cbr{t^m (1-t)^{n-m}}_{t \in \cbr{0,0.1, \ldots, 1}}$, or $\phi(m) = \cbr{ \frac{1}{\sqrt{2\pi}} \exp(-(t-m)^2/2)}_{t \in \R}$, etc.

Then, standard method of moments can be applied, resulting in the following representation:
\[ \E [\phi(m_1) \otimes \phi(m_2) \otimes \phi(m_3)] = \sum_j \omega_j O^{1}_j \otimes O^{2}_j \otimes O^{3}_j \]
where $\omega$ is the marginal distribution of $y_2$, $O^{1} = \E[\phi(m_1) | y_2]$, $O^{2} = \E[\phi(m_2) | y_2]$, $O^{3} = \E[\phi(m_3) | y_2]$.

Now, to decompose this $D \times D \times D$ tensor, dimensionality reduction tricks should be applied. After getting an estimate of $O^{2} = \E[\phi(m_2) | y_2]$, we can recover $p_j$'s via algebraic manipulations.

\hide
{
\section{Experiment Results}
\subsection{Setting}
In this set of experiments, we focus on the methylation data in cell type E1 and chromosome 1. At this point we do not take into account the contexts, and we further assume that the coverage in different segments are non-uniform. Let $l$ be the length of the input sequence, $s$ be the number of base segments merged to a single segment, and $n$ be the number of hidden states assumed.

Although the ultimate goal is to recover the transition matrix and observation matrix of the hidden Markov model, at the current stage, we recover $\E[\phi(x, y)|h]$ for each value of $h$. Recall that $x = (c, \mu)$ is the (coverage, methylation) count pair in each segment. The value of $p_h$ for each $h$ can be straightforwardly extracted from $\E[\phi(x, y)|h]$. The transition matrix can also be computed subsequently. We leave the recovery of all the parameters for future work.

%In subsequent results, we show the entire $\E[\phi(x,y)|h]$, as opposed to a single number $p_h \in [0,1]$. The reason is that we wish to recover more information about the hidden states learned, to get a better understanding of the HMM model.

%-- what features $\phi$ are you looking at?
%-- why are you showing the entire $\phi$ vector and not a single number?
We focus on two types of feature mappings $\phi$, the first one is binning mapping:
\[ \phi_{\bin}(x,y) = \begin{cases} {I(\frac{\mu}{c} \in (y,y+h])} & c \neq 0 \\ 0 & c = 0\end{cases} \]
where $h$ is the width of the bins.

The second one is Beta map:
\[ \phi(x,y) = \frac{1}{B(\mu+1, c-\mu+1)}y^\mu (1-y)^{c-\mu} \]
In this mapping there is no explicit notion of ``bin width", but the value of $c$ can be thought of as a parameter controlling it: if the coverage $c$ is large, then the bin width is small, and vice versa.

In experiments, since it is impossible to write down $\E[\phi(x_1, \cdot) \otimes \phi(x_2, \cdot) \otimes \phi(x_3, \cdot)]$ and perform tensor decomposition, we use discretization: compute an empirical version of $\E[\phi(x_1, y_1) \otimes \phi(x_2, y_2) \otimes \phi(x_3, y_3)]$, where $y_1, y_2, y_3$ is in $\cbr{0,h,2h,\ldots,1}$. By decomposing this tensor we are able to recover $\E[\phi(x, y) | h]$, where $y$ is in $\cbr{0,h,2h,\ldots,1}$. By mild regularity assumption on the distribution of $x$, this can give a fairly accurate estimate of $\E[\phi(x, y) | h]$ where $y$ ranges in the $[0,1]$ interval.

\subsection{Effect of Sample Size $l$}
We fix $m = 4$, $s = 1$, and vary the sample size (number of triples collected) $l =$ 1000, 10000, 20000, 40000, 80000, 160000, 320000. The samples are drawn without replacement from the original dataset. Figure~\ref{fig:varyl} shows the result. Note that the value of $m$ is the number of hidden states assumed; for example if $m = 4$, then we get $4$ columns of $\E[\phi(x,y)|h]$. We observe that the output of the algorithm stablizes when $l \geq 80000$.

\begin{figure}[H]

    \begin{tabular}{cc}
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 10000_s = 1_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$l = 10000$}
    \end{subfigure}
    &
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 20000_s = 1_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$l = 20000$}
    \end{subfigure}
    \\
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 40000_s = 1_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$l = 40000$}
    \end{subfigure}
    &
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 80000_s = 1_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$l = 80000$}
    \end{subfigure}
    \\
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 160000_s = 1_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$l = 160000$}
    \end{subfigure}
    &
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 320000_s = 1_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$l = 320000$}
    \end{subfigure}
    \\
    \end{tabular}

    \caption{The observation columns recovered $\E[\phi(x,y)|h]$ in terms of $h$, for varying sample size $l$. The $x$-axis is the value of $t$, the $y$-axis is the value of $\E[\phi(x,y)|h]$.}
    \label{fig:varyl}
\end{figure}

\subsection{Effect of Specifying the Number of States}

We fix $l = 320000$, $s = 1$, and vary the number of states $m = 2,3,4,5,6,7,8,9$. Figure~\ref{fig:varym} shows the columns of $\E[\phi(x,y)|h]$ recovered. The spectral algorithm provides reasonable results when $m \leq 4$; when $m \geq 5$, the algorithm started to recover observation columns that has a lot of negative entries.

\begin{figure}[H]

    \begin{tabular}{cc}
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 320000_s = 1_m = 1_n = 30_phi = beta_full.pdf}
        \caption{$m = 1$}
    \end{subfigure}
    &
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 320000_s = 1_m = 2_n = 30_phi = beta_full.pdf}
        \caption{$m = 2$}
    \end{subfigure}
    \\
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 320000_s = 1_m = 3_n = 30_phi = beta_full.pdf}
        \caption{$m = 3$}
    \end{subfigure}
    &
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 320000_s = 1_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$m = 4$}
    \end{subfigure}
    \\
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_l/cell = E1_chr = 1_l = 320000_s = 1_m = 5_n = 30_phi = beta_full.pdf}
        \caption{$m = 5$}
    \end{subfigure}
    \end{tabular}

    \caption{The observation columns recovered $\E[\phi(x,y)|h]$ in terms of $h$, for varying number of states $m$. The $x$-axis is the value of $t$, the $y$-axis is the value of $\E[\phi(x,y)|h]$.}
    \label{fig:varym}
\end{figure}

\subsection{Binning Feature vs. Beta Feature}

We compare the experimental results using two types of feature maps $\phi_{\bin}$ and $\phi_{\bet}$. Although the two mappings are substantially different, their respective $\E[\phi(x,y)|h]$ have some similarities. In some sense, the beta mapping is performing a ``soft'' binning which takes into account the number count $c$ in $x$: fixing the value of methylation probability $m/c$, if $c$ is larger, then the beta mapping is closer to a binning mapping with smaller bin size. Figure~\ref{fig:varyphi} shows the columns of the resulting $\E[\phi(x,y)|h]$ recovered. Generally, $\phi_{\bet}$ produces smoother observation columns.

%-- double check this one experiment -- typo in file naming?

\begin{figure}[H]
    \begin{tabular}{cc}
        \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_phi/cell = E2_chr = 1_l = 320000_s = 1_m = 3_n = 30_phi = beta_full.pdf}
        \caption{$\phi = \phi_{\bet}$ is beta mapping, $m = 3$}
    \end{subfigure}
    &
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_phi/cell = E2_chr = 1_l = 320000_s = 1_m = 3_n = 30_phi = binning_igz.pdf}
        \caption{$\phi = \phi_{\bin}$ is binning mapping, $m = 3$}
    \end{subfigure}
    \\
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_phi/cell = E2_chr = 1_l = 320000_s = 1_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$\phi = \phi_{\bet}$ is beta mapping, $m = 4$}
    \end{subfigure}
    &
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_phi/cell = E2_chr = 1_l = 320000_s = 1_m = 4_n = 30_phi = binning_igz.pdf}
        \caption{$\phi = \phi_{\bin}$ is binning mapping, $m = 4$}
    \end{subfigure}
    \end{tabular}

    \caption{The observation columns recovered $\E[\phi(x,y)|h]$ in terms of $h$, for $m = 4$ and two types of feature map $\phi$. The $x$-axis is the value of $t$, the $y$-axis is the value of $\E[\phi(x,y)|h]$.}
    \label{fig:varyphi}
\end{figure}

\subsection{Effect of Number of Segments Combined}
We fix $l = 320000$, $m = 4$, and vary the number of merged segments $s = 1,2,3,4,5,6,7,8$. Figure~\ref{fig:varys} shows the columns of the resulting $\E[\phi(x,y)|h]$. It can be seen that the recovered result is fairly insensitive to the choice of $s$.

\begin{figure}[H]
    \begin{tabular}{cc}
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_s/cell = E1_chr = 1_l = 320000_s = 1_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$s = 1$}
    \end{subfigure}
    &
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_s/cell = E1_chr = 1_l = 320000_s = 2_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$s = 2$}
    \end{subfigure}
    \\
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_s/cell = E1_chr = 1_l = 320000_s = 3_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$s = 3$}
    \end{subfigure}
    &
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_s/cell = E1_chr = 1_l = 320000_s = 4_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$s = 4$}
    \end{subfigure}
    \\
    \begin{subfigure}[t]{0.45\textwidth}
        \includegraphics[width=\textwidth]{figs/vary_s/cell = E1_chr = 1_l = 320000_s = 5_m = 4_n = 30_phi = beta_full.pdf}
        \caption{$s = 5$}
    \end{subfigure}
    \end{tabular}

    \caption{The observation columns recovered $\E[\phi(x,y)|h]$ in terms of $h$, for $m = 4$ and two types of feature map $\phi$. The $x$-axis is the value of $t$, the $y$-axis is the value of $\E[\phi(x,y)|h]$.}
    \label{fig:varys}
\end{figure}
}

\section{Possible Variants of Model}

\begin{figure}
  \caption{Possible Variants of the Model}
  \centering
  \includegraphics[width=0.8\textwidth]{model_doubt.jpg}
  \label{fig:modeldoubt}
\end{figure}

In the data given, we are not able to observe the context information on exact positions.
Instead, the data is grouped every 100 base pairs, where in each group, we observe
32 numbers $\cbr{(m_{t,i}, c_{t,i})}_{i=1}^{16}$, two for each context, representing
total coverage and total methylation in context-location specific manner.

We can model the data in the following two graphical models (see Figure~\ref{fig:modeldoubt}). The first one models
the sequence in each context separately. The hidden states are not only context specific,
but also location specific. It is not clear -- at least at this moment -- if we should
align the hidden states across different contexts.

The second model is to put the hidden state as the shared information across different
contexts. Then it assumes that given the hidden states, the 16 observations are conditionally
independent. We suspect this is too strong, and it might be preferable to assume the
16 observations to have dependency and directly build a wholistic feature map based
on them altogether.

\section{Efficient Joint Parameter Estimation of Multiple HMMs}
In this section we study the following probem.
Suppose we are given sequences drawn from two HMMs, and we have the prior knowledge that
the parameters of the two HMMs are close to each other.
Furthermore, suppose we have computed the moments from training data
(denoted as $P_{ij}, \tilde P_{ij}$, $P_{ijk}, \tilde P_{ijk}$ for all $(i,j,k)$ pairs).
The goal is to perform method of moments estimating the parameters of the two HMMs.

It is known that
\[ P_{i,j} = \E[x_i \otimes x_j] = \sum_{l=1}^m w_l (O_i)_l \otimes (O_j)_l \]
and
\[ P_{i,j,k} = \E[x_i \otimes x_j \otimes x_k] = \sum_{l=1}^m (O_i)_l \otimes (O_j)_l \otimes (O_k)_l \]

\subsection{Algorithmic Primitive}
\paragraph{Matrix Regularized Least Squares} In subsequent discussions, the following optimization problem is often considered:
\[ \min_{B \in \R^{n \times k}} f(B) = \| M - A B^T \|_F^2 + \lambda \| B - \tilde{B} \|_F^2 \]
where $M \in \R^{m \times n}$, $A \in \R^{m \times k}$ are given.

This optimization problem an be solved by noticing it can be decomposed to functions with
respect to rows of $B$, that is, $B^{1}, \ldots, B^{m}$.
This gives rise to the following optimization problem:
\[ \min_{B^i \in \R^k} \| M_i - A (B^i)^T \|^2 + \lambda \| B^i - \tilde B^i \|^2 \]
Taking derivatives, we have
\[ 2 A^T A (B^i)^T - 2 A^T M_i + 2 \lambda ((B^i)^T - (\tilde B^i)^T) = 0 \]
that is,
\[ (B^i)^T = (\lambda I + A^T A)^{-1} (A^T M_i + \lambda (\tilde B^i)^T ) \]
horizonally stacking the solution, we get
\[ B^T = (\lambda I + A^T A)^{-1} (A^T M + \lambda \tilde B^T) \]
that is, $B = (M^T A + \lambda B)(\lambda I + A^T A)^{-1}$.
(As a sanity check, when $\lambda = 0$, $B = (A^+ M)^T$, which is the correct solution.)

\paragraph{Weighted Extensions} It is sometimes desirable to consider the following
optimization objective:
\[ \min_{B \in \R^{n \times k}} f(B) = \| M - A B^T \|_F^2 + \lambda \| C (B - \tilde{B}) \|_F^2 \]
where $C \in \R^{p \times n}$ is a linear transformation (the objective aims to measure the
$\ell_2$ similarity of transformed $B$.)
Unfortunately, the solution does not admit a succinct representation. But we can still
write the solution. First, let $\vec(B) = ((B^1)^T, (B^2)^T, \ldots, (B^n)^T)$.
We rewrite the objective as:
\[ f(B) = \sum_{i=1}^n \| M_i - A (B^i)^T \|_2^2 + \sum_{j=1}^k \| C B_j - C B_j \|_2^2 \]
Thus, we can formulate the problem as the following least squares problem:
\[
   \begin{bmatrix} M_{11} \\ \ldots \\ M_{m1} \\ \ldots \\ M_{1n} \\ \ldots \\ M_{mn} \\ C^1 \tilde B_1 \\ \ldots \\ C^{n'} \tilde B_1 \\ \ldots \\ C^1 \tilde B_k \\ \ldots \\ C^{n'} \tilde B_k \end{bmatrix}
   =
   \begin{bmatrix}
     & A^1 & \\ & \ldots & \\ & A^m & \\  & & & \ldots & & & \\ & & & & & A^1 \\ & & & & & \ldots \\ & & & & & A^m \\
     C_{1,1} & & \ldots & & C_{1,n} \\& & \ldots \\ C_{n',1} & & \ldots & & C_{n',n} \\ & & \ldots \\
      & & C_{1,1}  &  & \ldots & & C_{1,n} \\& & & & \ldots \\  & & C_{n',1}  &  & \ldots & & C_{n',n}
   \end{bmatrix} \cdot \vec(B)
\]
Letting the vector in the left hand side as $Y$ and the matrix on the right hand side as $H$, we get $\vec(B) = H^+ Y$.

\paragraph{Basic Weighted Least Squares}
Suppose we would like to solve the following least squares problem:
\[ \min f(\tau) = \| T - \sum_{i=1}^k \tau_i T_i \|_F^2 \]
This is equivalent to solving the following equation:
\[
  \begin{bmatrix} T \cdot T_1 \\ \ldots \\ T \cdot T_k \end{bmatrix}
  =
  \begin{bmatrix} T_1 \cdot T_1 & \ldots & T_1 \cdot T_k \\ \ldots & \ldots & \ldots \\ T_k \cdot T_1 & \ldots & T_k \cdot T_k \end{bmatrix} \cdot \tau
\]
Specifically, if $T_i = a_i \cdot b_i \cdot c_i$, then the equation becomes
\[
  \begin{bmatrix} T(a_1, b_1, c_1) \\ \ldots \\ T(a_k, b_k, c_k) \end{bmatrix}
  =
  \begin{bmatrix} (a_1 \cdot a_1) (b_1 \cdot b_1) (c_1 \cdot c_1) & \ldots & (a_1 \cdot a_k) (b_1 \cdot b_k) (c_1 \cdot c_k) \\ \ldots & \ldots & \ldots \\ (a_k \cdot a_1) (b_k \cdot b_1) (c_k \cdot c_1) & \ldots & (a_k \cdot a_k) (b_k \cdot b_k) (c_k \cdot c_k) \end{bmatrix} \cdot \tau
\]
that is,
\[ \tau = ((A^T A) \circ (B^T B) \circ (C^T C))^{-1}  \begin{bmatrix} T(a_1, b_1, c_1) \\ \ldots \\ T(a_k, b_k, c_k) \end{bmatrix} \]

\subsection{Basic Algorithm}
Define tensor $T = P_{123}(U_1,U_2,U_3) = \sum_i w_i (U_1^TO_1)_i \otimes (U_2^TO_2)_i \otimes (U_3^TO_3)_i$

Given rank parameter $m$, we define objective function $F$ as follows:
\[ F(\tau, A, B, C, \tilde\tau, \tilde A, \tilde B, \tilde C) = \| \sum_{i=1}^m \tau_i A_i \otimes B_i \otimes C_i - T \|_F^2 + \| \sum_{i=1}^m \tilde\tau_i \tilde A_i \otimes \tilde B_i \otimes \tilde C_i - \tilde T \|_F^2 + \lambda \| B - \tilde B \|_F^2 \]

We have the following alternating minimization algorithm for the objective function.

\begin{algorithm}
  \caption{Efficient Joint Parameter Estimation; Basic Algorithm}
\begin{algorithmic}[H]
\STATE Randomly initialize $A, B, C, \tau, \tilde A, \tilde B, \tilde C, \tilde \tau$.
\FOR{$t=1,2,\ldots$:}
\STATE Update $A$: $A \gets \del{\del{\lambda I + (\tau \tau^T) \circ (B^T B) \circ (C^T C)}^{-1} \del{\begin{bmatrix} \tau_1 T(I, B_1, C_1) \\ \ldots \\ \tau_k T(I, B_k, C_k) \end{bmatrix} + \lambda \tilde A^T}}^T$
\STATE Update $B$: $B \gets \del{\del{\lambda I + (\tau \tau^T) \circ (A^T A) \circ (C^T C)}^{-1} \del{\begin{bmatrix} \tau_1 T(A_1, I, C_1) \\ \ldots \\ \tau_k T(A_k, I, C_k) \end{bmatrix} + \lambda \tilde B^T}}^T$
\STATE Update $C$: $C \gets \del{\del{\lambda I + (\tau \tau^T) \circ (A^T A) \circ (B^T B)}^{-1} \del{\begin{bmatrix} \tau_1 T(A_1, B_1, I) \\ \ldots \\ \tau_k T(A_k, B_k, I) \end{bmatrix} + \lambda \tilde C^T}}^T$
\STATE Update $\tau$: $\tau \gets ((A^T A) \circ (B^T B) \circ (C^T C))^{-1}  \begin{bmatrix} T(A_1, B_1, C_1) \\ \ldots \\ T(A_k, B_k, C_k) \end{bmatrix}$
\STATE Update $\tilde A$: $\tilde A \gets \del{\del{\lambda I + (\tilde \tau \tilde \tau^T) \circ (\tilde B^T \tilde B) \circ (\tilde C^T \tilde C)}^{-1} \del{\begin{bmatrix} \tilde\tau_1 \tilde T(I, \tilde B_1, \tilde C_1) \\ \ldots \\ \tilde\tau_k \tilde T(I, \tilde B_k, \tilde C_k) \end{bmatrix} + \lambda {\tilde A}^T}}^T$
\STATE Update $\tilde B$: $\tilde B \gets \del{\del{\lambda I + (\tilde \tau \tilde \tau^T) \circ (\tilde A^T \tilde A) \circ (\tilde C^T \tilde C)}^{-1} \del{\begin{bmatrix} \tilde\tau_1 \tilde T(\tilde A_1, I, \tilde C_1) \\ \ldots \\ \tilde\tau_k \tilde T(\tilde A_k, I, \tilde C_k) \end{bmatrix} + \lambda {\tilde B}^T}}^T$
\STATE Update $\tilde C$: $\tilde C \gets \del{\del{\lambda I + (\tilde \tau \tilde \tau^T) \circ (\tilde A^T \tilde A) \circ (\tilde B^T \tilde B)}^{-1} \del{\begin{bmatrix} \tilde\tau_1 \tilde T(\tilde A_1, \tilde B_1, I) \\ \ldots \\ \tilde\tau_k \tilde T(\tilde A_k, \tilde B_k, I) \end{bmatrix} + \lambda {\tilde C}^T}}^T$
\STATE Update $\tilde \tau$: $\tilde \tau \gets ((\tilde A^T \tilde A) \circ (\tilde B^T \tilde B) \circ (\tilde C^T \tilde C))^{-1}  \begin{bmatrix} \tilde T(\tilde A_1, \tilde B_1, \tilde C_1) \\ \ldots \\ \tilde T(\tilde A_k, \tilde B_k, \tilde C_k) \end{bmatrix}$
\ENDFOR
\end{algorithmic}
\end{algorithm}

\subsection{Algorithm Exploiting Three Views}

\subsection{Symmetrization }

Let $U$ be the left singular vectors of $P_{i,1}$. It it known that $\range(U) = \range(O)$
This serves as the projection matrix for dimensionality reduction.
We operate on the following tensor:
\[ T = P_{123}(U,U,U)(S_1, I, S_3) \]
where $S_1 = (U^T P_{23} U)(U^T P_{13} U)^{-1}$ and $S_3 = (U^T P_{21} U)(U^T P_{31} U)^{-1}$.
It is known that
\[ T = \sum_i w_i \]

\end{document}


\section{Exponential Functions}\label{sec:ExpFunctions}
An \dfont{exponential function} is a function of the form $f(x)=a^x$, where $a$ is a constant.
Examples are $2^x$, $10^x$ and $(1/2)^x$.
To more formally define the exponential function we look at various kinds of input values.

It is obvious
that $\ds a^5=a\cdot a\cdot a\cdot a\cdot a$ and $\ds a^3=a\cdot a\cdot a$,
but when we consider an exponential function $\ds a^x$ we can't
be limited to substituting integers for $x$. What does $\ds a^{2.5}$ or
$a^{-1.3}$ or $\ds a^\pi$ mean? And is it really true that
$a^{2.5}a^{-1.3}=a^{2.5-1.3}$? The answer to the first question is
actually quite difficult, so we will evade it; the answer to the
second question is ``yes.''

We'll evade the full answer to the hard question, but we have to know
something about exponential functions. You need first to understand
that since it's not ``obvious'' what $\ds 2^x$ should mean, we are really
free to make it mean whatever we want, so long as we keep the behavior
that {\em is} obvious, namely, when $x$ is a positive integer.
What else do we want to be true about $\ds 2^x$? We
want the properties of the previous two paragraphs to be true for all
exponents: $\ds 2^x2^y=2^{x+y}$ and $\ds (2^x)^y=2^{xy}$.

After the positive integers, the next easiest
number to understand is 0: $\ds 2^0=1$. You have presumably learned this
fact in the past; why is it true?  It
is true precisely because we want $\ds 2^a2^b=2^{a+b}$ to be true about
the function $\ds 2^x$. We need it to be true that $\ds 2^02^x=2^{0+x}=2^x$,
and this only works if $\ds 2^0=1$. The same argument implies that $\ds a^0=1$
for any $a$.

The next easiest set of numbers to
understand is the negative integers: for example, $\ds 2^{-3}=1/2^3$.
We know that whatever $\ds 2^{-3}$ means it must be
that $\ds 2^{-3}2^{3}=2^{-3+3}=2^0=1$, which means that $\ds 2^{-3}$ must be
$1/2^3$. In fact, by the same argument, once we know what $\ds 2^x$ means
for some value of $x$, $\ds 2^{-x}$ must be $\ds 1/2^{x}$ and more generally
$a^{-x}=1/a^x$.

Next, consider an exponent $1/q$, where $q$ is a positive integer. We
want it to be true that $\ds (2^x)^y=2^{xy}$, so $\ds
(2^{1/q})^q=2$. This means that $\ds 2^{1/q}$ is a $q$-th root of 2,
$\ds 2^{1/q}=\root q\of{2\ }$. This is all we need to understand that
$2^{p/q}=(2^{1/q})^p=(\root q\of{2\ })^p$ and
$a^{p/q}=(a^{1/q})^p=(\root q\of{a\ })^p$.

What's left is the hard part: what does $\ds 2^x$ mean when $x$ cannot be
written as a fraction, like $\ds x=\sqrt{2\ }$ or $\ds x=\pi$? What we know so
far is how to assign meaning to $\ds 2^x$ whenever $x=p/q$. If we were to
graph $a^x$ (for some $a>1$) at points $x=p/q$ then we'd see something like this:
$$\includegraphics[width=2.5in]{images/exp1}$$

This is a poor picture, but it illustrates a series
of individual points above the rational numbers
on the $x$-axis. There are really a lot of ``holes'' in the curve,
above $x=\pi$, for example. But (this is the hard part) it is possible
to prove that the holes can be ``filled in'', and that the resulting
function, called $\ds a^x$, really does have the properties we want,
namely that $\ds a^xa^y=a^{x+y}$ and $\ds (a^x)^y=a^{xy}$.
Such a graph would then look like this:
$$\includegraphics[width=2.5in]{images/exp2}$$

\begin{formulabox}[Three Types of Exponential Functions]
There are \ifont{three kinds} of exponential functions $f(x)=a^x$ depending on whether $a>1$, $a=1$ or $0<a<1$:
$$\includegraphics[width=6in]{images/exp3}$$
\end{formulabox}

\subsection*{Properties of Exponential Functions}
The first thing to note is that if $a<0$ then problems can occur.
Observe that if $a=-1$ then $(-1)^x$ is not defined for every $x$.
For example, $x=1/2$ is a square root and gives $(-1)^{1/2}=\sqrt{-1}$ which is not a real number.

\begin{formulabox}[Exponential Function Properties]
\begin{itemize}
\item \ifont{Only defined for positive $a$:} $a^x$ is only defined for all real $x$ if $a>0$
\item \ifont{Always positive:} $a^x>0$, for all $x$
\item \ifont{Exponent rules: }
\begin{multicols}{2}
\begin{enumerate}
	\item $\ds{a^xa^y=a^{x+y}}$
	\item $\ds{\frac{a^x}{a^y}=a^{x-y}}$
	\item $\ds{\left(a^x\right)^y=a^{xy}=a^{yx}=\left(a^y\right)^x}$
	\item $\ds{a^xb^x=(ab)^x}$
\end{enumerate}
\end{multicols}
\item \ifont{Long term behaviour:} If $a>1$, then $a^x\to\infty$ as $x\to\infty$ and $a^x\to 0$ as $x\to-\infty$.
\end{itemize}
\end{formulabox}

The last property can be observed from the graph. If $a>1$, then as $x$ gets larger and larger, so does $a^x$.
On the other hand, as $x$ gets large and negative, the function approaches the $x$-axis, that is, $a^x$ approaches $0$.

\begin{example}{Reflection of Exponential}{ReflectionExponential}
Determine an equation of the function after reflecting $y=2^x$ about the line $x=-2$.
\end{example}

\begin{solution}
First reflect about the $y$-axis to get $y=2^{-x}$.
Now shift by $2\times 2=4$ units to the \ifont{left} to get $y=2^{-(x+4)}$.
Side note: Can you see why this sequence of transformations is the same as reflection in the line $x=-2$?
Can you come up with a general rule for these types of reflections?
\end{solution}

\begin{example}{Determine the Exponential Function}{DetermineExponentialFunction}
Determine the exponential function $f(x)=ka^x$ that passes through the points $(1,6)$ and $(2,18)$.
\end{example}

\begin{solution}
We substitute our two points into the equation to get:
$$x=1,y=6\to6=ka^1$$
$$x=2,y=18\to18=ka^2$$
This gives us $6=ka$ and $18=ka^2$.
The first equation is $k=6/a$ and subbing this into the second gives: $18=(6/a)a^2$.
Thus, $18=6a$ and $a=3$.
Now we can see from $6=ka$ that $k=2$.
Therefore, the exponential function is $$f(x)=2\cdot 3^x.$$
%\vspace{-1cm}
\end{solution}

There is one base that is so important and convenient that we give it a special symbol.
This number is denoted by $e=2.71828\ldots$ (and is an irrational number).
Its \ifont{importance} stems from the fact that it simplifies many formulas
of Calculus and also shows up in other fields of mathematics.

\begin{example}{Domain of Function with Exponential}{DomainFunctionExponential}
Find the domain of $\ds f(x)=\frac{1}{\sqrt{e^x+1}}$.
\end{example}

\begin{solution}
For domain, we cannot divide by zero or take the square root of negative numbers.
Note that one of the properties of exponentials is that they are always positive!
Thus, $e^x+1>0$ (in fact, as $e^x>0$ we actually have that $e^x+1$ is at least one).
Therefore, $e^x+1$ is never zero nor negative, and gives no restrictions on $x$.
Thus, the domain is $\R$.
\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Opensolutionfile{solutions}[ex]
\section*{Exercises for \ref{sec:ExpFunctions}}

\begin{enumialphparenastyle}

%%%%%%%%%%
\begin{ex}
Determine an equation of the function $y=a^x$ passing through the point $(3,8)$.
\begin{sol}
$y=2^x$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Find the $y$-intercept of $f(x)=4^x+6$.
\begin{sol}
$y=7$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Find the $y$-intercept of $f(x)=2\left(\frac{1}{2}\right)^x$.
\begin{sol}
$y=2$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Find the domain of $\ds{y=e^{-x}+e^{\frac{1}{x}}}$.
\begin{sol}
$x\neq 0$
\end{sol}
\end{ex}

\end{enumialphparenastyle}


\subsection{Unitary time}

Why? What's the interpretation here? Is this an assumption, or just a modelling choice?

\(\Psi (t_b-t_a)^* \Psi (t_b-t_a)=e^{(t_b-t_a)X^*} e^{(t_b-t_a)X}\)

\(\Psi (t_b-t_a)^* \Psi (t_b-t_a)=e^{(t_b-t_a)(X^*+X)}\)

\(X=iH\)

\(\Psi (t_b-t_a)^* \Psi (t_b-t_a)=e^{(t_b-t_a)(-iH+iH)}=I\)

\(\Psi (t_b-t_a)=e^{(t_b-t_a)iH}\)