% Copyright 2020 Markus J. Pflaum, licensed under CC BY-NC-ND 4.0
% main author:
%   Markus J. Pflaum
%
\section{Infinite tensor products}
\label{sec:infinite-tensor-products}

\para
Infinite tensor products of Hilbert spaces were introduced by  \cite{vNeuIDP}. They were motivated by mathematical physics
where one needs to describe quantum systems with infinitely many degrees of freedom, see e.g.~\cite{EmcAMSMQFT,BraRobOAQSM2}.
The original construction of infinite tensor products was generalized to von Neumann  and $C^*$-algebras
by \cite{GuiPTIRRA}, \cite{BlaITPC*A}, and others. Meanwhile, the topic has been studied in quite some
detail in the operator algebra literature, see e.g.~\cite{NakITPvNAI,NakITPvNAII,StoITPvNA}.
A purely algebraic or better categorical approach allowing the construction of infinite tensor products of modules over
a given commutative ring has been given in \cite[Sec.~III.10]{CheFCA}. The work \cite{NgGIATP} is also in that spirit.
We will essentially follow \cite{CheFCA} and construct the infinite tensor product as a module
universal with respect to multilinear maps. First we present the main algebraic construction, then we explain some of
the subtleties which distinguish infinite from finite tensor products, and finally we construct infinite Hilbert
tensor products and infinite tensor products of $C^*$-algebras.

\para\label{para:canonical-projections-embeddings-multilinear-maps}
Let $R$ be a commutative ring and $(M_i)_{i\in I}$ a possibly infinite family of $R$-modules.
Consider $\prod_{i\in I} M_i$, the product of the family $(M_i)_{i\in I}$  within the category
of $R$-modules. For each $j\in I$ let $\pi_j : \prod_{i\in I} M_i \to M_j $ denote the natural
projection onto the $j$-th factor and $\iota_j :M _j \hookrightarrow  \prod_{i\in I}M_i$ the
uniquely determined natural embedding such that
\[
   \pi_j\circ \iota_i =
   \begin{cases}
       \id_{M_i} & \text{for}\enspace i=j \enspace\text{and} \\
       0 & \text{else} .
   \end{cases}
\]
Given an $R$-module $N$  one then understands by a \emph{multilinear map} from $ \prod_{i\in I}M_i$
to $N$ a map $f:  \prod_{i\in I}M_i \to N$
such that for each $j\in I$ and $x\in \prod_{i\in I} M_i$ with $\pi_j (x)=0$ the map $M_j\to N$, $m\mapsto f(\iota_j(m)+x)$ is linear.
The set of multilinear maps from $\prod_{i\in I} M_i$ to $N$ will be denoted by
$\mlinOps \big(\prod_{i\in I} M_i,N\big)$. It carries a natural structure of an $R$-module
given by pointwise addition of multilinear maps and pointwise action of a scalar on a
multilinear map that is by
\[
  f+ g =  \left( \prod_{i\in I} M_i \ni x \mapsto f(x) + g(x) \in N \right) \quad\text{and}\quad
  r f =  \left( \prod_{i\in I} M_i \ni x \mapsto rf(x)\in N \right)
\]
for all $f,g \in \mlinOps \big(\prod_{i\in I} M_i,N\big)$ and $r\in R$.
Since for $j\in I$ and $x\in \prod_{i\in I} M_i$ with $\pi_j(x)= 0$ the maps
$M_j\to N$, $m \mapsto (f+g) (\iota_j(m) + x) = f (\iota_j(m) + x) + g (\iota_j(m) + x)$
and $M_j\to N$, $m \mapsto rf (\iota_j(m) + x) $ are linear by assumption on $f$ and $g$,
the maps $f+g$ and $rf$ are multilinear again, so $ \mlinOps\big(\prod_{i\in I} M_i,N\big)$ is an
$R$-module indeed with zero element the constant function mapping to $0\in N$.

\begin{remarks}
  Before proceeding further let us make several explanations concerning the notation used.
  \begin{environmentlist}
  \item
    The space of multilinear maps $ \mlinOps \big(\prod_{i\in I} M_i,N\big)$ actually depends
    on the family $(M_i)_{i\in I}$ and the $R$-module $N$, so in principle one should  write
    $ \mlinOps \big((M_i)_{i\in I},N\big)$ instead of $ \mlinOps \big(\prod_{i\in I} M_i,N\big)$.
    Nevertheless we stick to the latter notation since it is closer to standard notation for
    linear maps and since it will not lead  to any confusion.
  \item
    In case the index set $I$ has just two elements $i_1,i_2$, one calls a multilinear map
    $\prod_{i\in I}M_i = M_{i_1}\times M_{i_2} \to N$ a \emph{bilinear map}. If the cardinality of
    $I$ is $3$, one sometimes calls a multilinear map $\prod_{i\in I}M_i \to N$ a
    \emph{trilinear map}.

  \item
     In the following, when saying that $(I_a)_{a\in A}$ is a partition of the set $I$ we mean that
  each $I_a$ is a non-empty subset of $I$, that $I_a   \cap I_b =\emptyset $
  for $a \neq b$ and that $\bigcup_{a \in A} I_a = I$. The empty family is regarded as
  a partition of the empty set.

  \item We will frequently use in this section the same symbol for
  maps with the same ``universal'' properties  despite those maps might be  strictly speaking different.
  For example, $\pi_k$ will stand for the canonical projections
  $\prod_{i\in I} M_i \to M_k$ and $\prod_{j\in J} M_j \to M_k$ whenever $k\in J \subset I$.
  Likewise we use the same notation for the two canonical embeddings
  $M_k \hookrightarrow \prod_{i\in I} M_i $ and $M_k \hookrightarrow \prod_{j\in J} M_j $
  defined in \ref{para:canonical-projections-embeddings-multilinear-maps} and denote them both by $\iota_k$.

  \end{environmentlist}
\end{remarks}

\begin{lemma}[cf.~{\cite[Sec.~III.10, Lemma 1 \& 2]{CheFCA}}]\label{thm:construction-multilinear-maps-composition}
  Assume that $(M_i)_{i\in I}$ is a family of $R$-modules, $N$ an $R$-module, and
  $f : \prod_{i\in I}M_i \to N$ a mutilinear map.
  \begin{romanlist}
  \item
    If $g :N \to N^\prime$ is an $R$-module map, then
    $g\circ f :  \prod_{i\in I}M_i \to N^\prime$ is multilinear.
  \item
    Let $J\subset I$ be non-empty, $y= (y_i)_{i\in I\setminus J}$ an element of the product
    $\prod_{i\in I\setminus J} M_i$, and $ \iota_{J,y} :  \prod_{j\in J} M_j \to \prod_{i\in I} M_i$ the unique map
    such that for all $x = (x_j)_{j\in J} \in  (M_j)_{j\in J}$ and $k\in I$
    \[
      \pi_k \circ \iota_{J,y}\, (x) =
      \begin{cases}
        x_k & \text{for } k\in J , \\
        y_k & \text{for } k \in I\setminus J .
      \end{cases}
    \]
    Then the composition $f\circ \iota_{J,x} : \prod_{j\in J} M_j \to N$ is multilinear.
 \item\label{ite:multilinearity-composition-multilinear-map-product-multilinear-map}
   Let $(I_a)_{a \in A}$ be a partition of the index set $I$ which is assumed to be non-empty.
   Let $(N_a)_{a \in A}$ be a family of $R$-modules, $(g_a)_{a \in A}$
   a family of multilinear maps $g_a : \prod_{i \in I_a} M_i \to N_a$, and
   $h :  \prod_{a \in A}N_a \to N$ multilinear. Define
   $g: \prod_{i\in I} M_i \to  \prod_{a \in A} N_a $ as the unique map
   such that
   \[
      \pi_b \circ g = g_b \circ \pi_{I_b} \quad
      \text{for } b \in A  ,
    \]
    where $\pi_J$ for $J\subset I$ as on the right side stands for the
    projection $\pi_J : \prod_{i\in I} M_i \to  \prod_{j \in J} M_j$
    uniquely determined by $\pi_j \circ \pi_J =\pi_j$ for all $j\in J$.
   Then the  composition $h \circ g : \prod_{i\in I} M_i \to N$ is multilinear.
  \end{romanlist}
\end{lemma}

\begin{proof}
  \begin{adromanlist}
  \item
    Let $j\in I$ and $x\in \prod_{i\in I} M_i$ with $\pi_j (x)=0$.
    By multilinearity of $f$ and linearity of $g$, the map $M_j\to N^\prime$,
    $m\mapsto g f (\iota_j(m)+x)$ then has to be linear, hence $g\circ f$ is multilinear.
  \item
    Let $j \in J$ and $x\in \prod_{i\in J} M_i$ with $\pi_j (x)= 0$.
    % Define $\widetilde{x}$ as the unique element of $\prod_{i\in I}M_i$ such that
    % \[
    %    \pi_k (\widetilde{x}) =
    %    \begin{cases}
    %      \pi_k(x)  &\text{for } k \in J,\\
    %      y_k &\text{for } k \in I\setminus J .
    %    \end{cases}
    % \]
    Then $\pi_j(\iota_{J,y}(x))=0$ and $f \iota_{J,y} (\iota_j(m)+x) =
    f(\iota_j(m) + \iota_{J,y}(x)$ for all $m\in M_j$ by  construction of $\iota_{J,y}$.
    Hence the map $M_j\to N$, $m\mapsto f \iota_{J,y} (\iota_j(m)+x)$ is linear by
    multilinearity of $f$. This proves that $f\circ \iota_{J,y}$ is multilinear.
  \item
    Given $j\in I$ let $b$ be the unique element of $A$  such that $j\in I_b$.
    Assume  that $x\in \prod_{i\in I} M_i$ with $\pi_j (x)=0$.
    By construction one has $\pi_j(\pi_{I_b} (x))=0$.
    Now let $y \in \prod_{a \in A}N_a$ such that
    \[
       \pi_a (y) =
       \begin{cases}
         0 & \text{for } a = b , \\
         g_a \pi_{I_a} (x) & \text{for } a  \neq b.
       \end{cases}
    \]
    One then obtains for $m\in M_j$
    \[
    \pi_a g ( \iota_j(m) + x)=
    \begin{cases}
      g_b \pi_{I_b} (\iota_j(m)+x) = g_b (\iota_j (m) + \pi_{I_b} (x)) &\text{for }a = b, \\
      g_a \pi_{I_a} (x) =  \pi_a (y)  & \text{for } a  \neq b .
    \end{cases}
    \]
    Hence
    \[
      h g (\iota_j(m)+ x) =
      h \big( \iota_b \big( g_b ( \iota_j(m) + \pi_{I_b} (x) \big) + y \big) \ ,
    \]
    and the map $M_j\to N$, $m\mapsto h g (\iota_j(m)+ x)$ is linear as the composition of two linear maps.
  \end{adromanlist}
\end{proof}

\begin{lemma}\label{thm:associator-cartesian-product}
  Assume to be given a non-empty family of $R$-modules $(M_i)_{i\in I}$ and a partition
  $(I_a)_{a \in A}$ of the index set $I$. Then there exists a natural ismorphism
  \[
    \kappa_{I,A}:  \prod_{i \in I} M_i \to \prod_{a \in A}  \prod_{i \in I_a} M_i
  \]
  uniquely determined by the condition that $\pi_a \circ \kappa_{I,A} = \pi_{I_a}$ for all
  $a\in A$.
  % where $\pi_a$ on the right hand side stands for the unique projection
  % $\pi_a : \prod_{i \in I} M_i \to \prod_{i \in I_a} M_i$ which satisfies
  % $\pi_k \circ \pi_a = \pi_k$ for all $k\in I_a$.
\end{lemma}
\begin{proof}
  By the universal property of the product the $R$-module map
  $ \kappa = \kappa_{I,A}:  \prod_{i \in I} M_i \to \prod_{a \in A}  \prod_{i \in I_a} M_i$
  exists and is uniquely determined by the requirement  that $\pi_a \circ \kappa_{I,A} = \pi_{I_a}$
  for all $a\in A$. Naturality also follows from the universal property of the product.
  It remains to show that $\kappa$ is an isomorphism. By construction,
  $\pi_i(x) = \pi_i \pi_a \kappa (x) =0$ for all $i\in I$ and $a(i)\in A$ such that $i\in I_{a(i)}$,
  hence $x=0$.
  So $\kappa$ is injective. It is also surjective. To see this pick $x_a \in \prod_{i \in I_a} M_i$
  for each $a\in A$. With $a(i)$ for $i\in I$ defined as before put
  $x = \big( \pi_i (x_{a(i)} )\big)_{i\in I}$. Then, by construction,
  $\pi_i \pi_{a} \kappa (x) = \pi_i \pi_{a} (x) = \pi_i (x) = \pi_i (x_{a})$ for all $a\in A$ and
  $i\in I_a$,
  hence $\big(\pi_a \kappa (x) \big)_{a \in A} = (x_a)_{a \in A}$
  and $\kappa$ is surjective.
\end{proof}

\begin{proposition}[Exponential law for multilinear maps]
\label{thm:exponential-law-multilinear-maps}
  Let $(M_i)_{i\in I}$ be a family of $R$-modules over a commutative ring $R$,
  $N$ an $R$-module,
  and assume that $J \subset I$ is a non-empty subset such that the complement
  $K = I\setminus J$ is also non-empty. Then the map
  \begin{equation*}
  \begin{split}
    \eta_{I,J}: \:&
    \mlinOps \left( \prod_{j\in J} M_j , \mlinOps \left(\prod_{k\in K} M_k ,N \right)\right)
    \rightarrow \mlinOps \left( \prod_{i\in I} M_i, N \right), \\
    & \hspace{1em} f \mapsto \left( \prod_{i\in I} M_i\ni (x_i)_{i\in I} \mapsto
    f\big( (x_j)_{j\in J} \big)\left( (x_k)_{k\in K} \right)  \in N \right)
  \end{split}
  \end{equation*}
  is an isomorphism which is natural in $(M_i)_{i\in I}$ and $N$.
\end{proposition}

\begin{proof}

  We first show that $\eta= \eta_{I,J} $ is linear. To this end let\\
  $f,g \in \mlinOps \left( \prod_{j\in J} M_j , \mlinOps \left(\prod_{k\in K} M_k ,N \right)\right)$ and $r\in R$.
  Then, for all $x = (x_i)_{i\in I} \in \prod_{i\in I} M_i$,
  \begin{equation*}
  \begin{split}
    \big( \eta (f & +g)\big) (x)  = \big(f+g\big) \big( (x_j)_{j\in J} \big)\left( (x_k)_{k\in K} \right)
    = \big( f((x_j)_{j\in J}) + g ((x_j)_{j\in J})\big) \left( (x_k)_{k\in K} \right) = \\
    & = f((x_j)_{j\in J})  \left( (x_k)_{k\in K} \right) +  g ((x_j)_{j\in J}) \left( (x_k)_{k\in K} \right) =
     \big( \eta f \big) (x) + \big( \eta g \big) (x) =  \big( \eta f + \eta g \big) (x)
  \end{split}
  \end{equation*}
  and
  \begin{equation*}
  \begin{split}
    \big( \eta (rf)\big) (x) & = (rf) ((x_j)_{j\in J})  \left( (x_k)_{k\in K} \right) =
    \big( r f((x_j)_{j\in J})\big) \left( (x_k)_{k\in K} \right) =
    r \big( f((x_j)_{j\in J})\left( (x_k)_{k\in K} \right)\big) = \\
    & = r \big( \eta f (x)\big) =  \big( r (\eta f ) \big) (x) \ .
  \end{split}
  \end{equation*}
  Hence $\eta$ is an $R$-module map.

  Next we show that $\eta$ is an isomorphism by constructing an inverse.
  Given $f \in \mlinOps \big( \prod_{i\in I} M_i, N \big)$ we define
  $f^\sharp : \mlinOps \big( \prod_{j\in J} M_j \big) \to \mlinOps \big(\prod_{k\in K} M_k ,N \big)$ by the requirement that
  \[
      f^\sharp (y) (z) = f (x_{y,z}) \quad \text{for all}\enspace y = (y_j)_{j\in J}\enspace \text{and} \enspace z = (z_k)_{k \in K} \ ,
  \]
  where $x_{y,z}$ is the  element of $\prod_{i\in I}M_i$ uniquely determined by
  \[
    \pi_i (x_{y,z}) =
    \begin{cases}
      y_i & \text{for}\enspace i \in J , \\
      z_i & \text{for}\enspace i \in K .
    \end{cases}
  \]
  One thus obtains an $R$-module map
  \[
    (-)^\sharp_{I,J} :
    \mlinOps \left( \prod_{i\in I} M_i, N \right) \to
    \mlinOps \left( \prod_{j\in J} M_j , \mlinOps \left(\prod_{k\in K} M_k ,N \right)\right),\quad f \mapsto f^\sharp
  \]
  which by construction is inverse to $\eta_{I,J}$.

  Naturality of $\eta_{I,J}$ in $(M_j)_{j\in J}$ and $N$ is clear by definition.
\end{proof}

\begin{definition}
  Let $(M_i)_{i\in I}$ be a family of $R$-modules over a commutative ring $R$. By a
  \emph{tensor product} of  $(M_i)_{i\in I}$ one understands an $R$-module $\bigotimes_{i\in I}M_i$
  together with a multilinear map
  $\tau : \prod_{i\in I}M_i \to \bigotimes_{i\in I}M_i$ such that the following universal property is fulfilled:
  \begin{axiomlist}[\hspace{2.5em}]
  \item[\textup{\sffamily (ITensor)}]
   \label{axiom:hilbert-tensor-product}
   For every $R$-module $N$ and every multilinear map
   $f : \prod_{i\in I}M_i \to N$ there exists a unique $R$-module map
   $\overline{f}: \bigotimes_{i\in I}M_i \to N$
   such that the diagram
   \begin{displaymath}
   \begin{tikzcd}
       \prod\limits_{i\in I}M_i  \ar[d,"\tau",swap] \ar[r,"f"]  & N \\
       \bigotimes\limits_{i\in I}M_i \ar[ru,"\overline{f}",swap]
   \end{tikzcd}
   \end{displaymath}
   commutes.
 \end{axiomlist}

 The linear map $\overline{f}$ making the diagram comute will sometimes be called the \emph{linearization}
 of the multilinear map $f$.

 Given a tensor product
 $\big( \bigotimes_{i\in I}M_i,\tau\big)$, we will usually denote the image of an element
 $(x_i)_{i\in I} \in \prod_{i\in I}M_i$
 under the map $\tau$ by $\otimes_{i\in I} x_i$.
\end{definition}

\begin{remarks}
  \begin{environmentlist}
  \item
    Strictly speaking, a tensor product of a family $(M_i)_{i\in I}$ of $R$-modules is a pair
    $\big( \bigotimes_{i\in I}M_i,\tau\big)$ having the above properties. By slight abuse of language, one
    usually denotes a tensor product just by its first component, the $R$-module $\bigotimes_{i\in I}M_i$.
    When helpful for clarity, the associated map $\tau: \prod_{i\in I}M_i \to \bigotimes_{i\in I}M_i$
    will be denoted by $\tau_{(M_i)_{i\in I}}$ or by $\tau_I$.
  \item
    In the case where the index set $I$  of the family $(M_i)_{i\in I}$ is infinite, one
    sometimes calls $\bigotimes_{i\in I}M_i$ an \emph{infinite tensor product}.
  \end{environmentlist}
\end{remarks}

\begin{theorem}\label{thm:construction-fundamental-properties-infinite-tensor-product}
  Let $(M_i)_{i\in I}$ be a family of $R$-modules over a commutative ring $R$. Then the following
  holds true.
  \begin{romanlist}
  \item
    A tensor product $\bigotimes_{i\in I}M_i$ of the family $(M_i)_{i\in I}$ exists and is
    unique up to isomorphism.
    If $I$ is the empty set, then $\bigotimes_{i\in I}M_i = R$, if $I$ contains a single element $i_\circ$,
    then  $\bigotimes_{i\in I}M_i =M_{i_\circ}$.
  \item
    If $(N_i)_{i\in I}$ is a second family of $R$-modules and $(f_i)_{i\in I}$ a family
    $R$-module maps $f_i :M_i \to N_i$, then there exists a unique linear map
    $\bigotimes_{i\in I}f_i: \bigotimes_{i\in I}M_i \to \bigotimes_{i\in I}N_i$ making
    the  diagram
    \begin{displaymath}
    \begin{tikzcd}
       \prod\limits_{i\in I}M_i  \ar[d,"\tau",swap] \ar[r,"f"] & \bigotimes\limits_{i\in I}N_i   \\
       \bigotimes\limits_{i\in I}M_i \ar[ru,"\bigotimes\limits_{i\in I}f_i",swap]
   \end{tikzcd}
   \end{displaymath}
   commute, where $f:\prod_{i\in I}M_i\to \bigotimes_{i\in I}N_i$ is the multilinear map
   $(x_i)_{i\in I}\mapsto \otimes_{i\in I} f_i(x_i)$.
 \item
   Let $J\subset I$ be a finite non-empty subset set such that  $M_j$ is isomorphic  to $R$ for all $j\in J$.
   Denote for each $j\in J$ by $1_j$ the image of the unit $1\in R$ under the isomorphism $R\cong M_j$
   and by $1_J$ the family $(1_j)_{j\in J}$. Moreover, for every family $y =(y_j)_{j\in J}$
   let $\iota_{J,y} : \prod_{i\in I\setminus J} M_i \to \prod_{i\in I}M_i$ be the map which associates
   to $x\in\prod_{i\in I\setminus J} M_i$ the family $ (x_i)_{i\in I}$ such that $x_i =\pi_i (x)$ for
   $i \in I\setminus J$ and  $x_i = y_i$ for $i \in J$. Then the linearization
   $\overline{\iota}_{J,1_J}: \bigotimes_{i\in I\setminus J}M_i \to  \bigotimes_{i\in I}M_i $ of the multilinear map
   $\tau_I \circ \iota_{J,1_J}: \prod_{i\in I\setminus J}M_i \to  \bigotimes_{i\in I}M_i$ is an isomorphism.
  \end{romanlist}
\end{theorem}

\begin{proof}
\begin{adromanlist}
\item
  By its universal property, the tensor product of the family $(M_i)_{i\in I}$ is uniquely determined
  up to isomorphism. Hence it remains to show the existence of the tensor product.
  To this end consider the free $R$-module  % $R^{(\prod_{i\in I}M_i)}$
  over the set $\prod_{i\in I}M_i$ and denote it by $F$. Let  $\delta: \prod_{i\in I}M_i \hookrightarrow F$ be
  the canonical injection
  %Identify an element $(x_i)_{i\in I}\in\prod_{i\in I}M_i$
  %with its image in $F$ under the canonical injection $\iota : \prod_{i\in I}M_i \hookrightarrow F$
  and $U$ be the submodule of $F$ spanned by the elements
  \[
    \delta \big( \iota_j (r y_j + z_j) + (x_i)_{i\in I} \big) - r \delta \big( \iota_j (y_j) + (x_i)_{i\in I}\big)
    - \delta \big( \iota_j (z_j) + (x_i)_{i\in I}\big) \ ,
  \]
  where $j\in I$, $y_j , z_j \in M_j$, $r \in R$,  and $(x_i)_{i\in I} \in \pi_j^{-1} (0)$. Then put
  $\bigotimes_{i\in I}M_i = F/U$ and define $\tau$ as the composition of the canonical projection
  $\pi : F \to \bigotimes_{i\in I}M_i$  with $\delta : \prod_{i\in I}M_i \to F$. By construction, $\tau$ is multilinear.
  Assume that $N$ is an $R$-module and $f : \prod_{i\in I}M_i \to N$ is a multilinear map. By the universal property of
  free $R$-modules, $f$ lifts to a unique $R$-linear map $f^\prime : F \to N$ such that $f = f^\prime \circ \delta$.
  By multilinearity of $f$, the map $f^\prime$ vanishes on the submodule $U$, hence descends to an $R$-linear
  $\overline{f}: \bigotimes_{i\in I}M_i \to N$ such that $f^\prime = \overline{f} \circ \pi$.
  Hence  $f = f^\prime \circ \delta = \overline{f} \circ \pi  \circ \delta  = \overline{f} \circ \tau$.
  By surjectivity of $\delta$ and uniqueness of $f^\prime$, $\overline{f}$ is the unique $R$-linear map satisfying
  $f = \overline{f} \circ \tau$. Hence $\big( \bigotimes_{i\in I}M_i,\tau\big)$ is a tensor product of the family
  $(M_i)_{i\in I}$.

  In case $I=\emptyset$, the cartesian product $\prod_{i\in I}M_i$ is final in the category of sets, hence
  consists of only one element $\star$ only. This means in particular that
  for an $R$-module $N$  any map $f: \prod_{i\in I}M_i = \{ \star\} \to N$ is multilinear. Put
  $\bigotimes_{i\in I}M_i = R$ and let $\tau : \{ \star\} \to R$ be the map $\star \mapsto 1$.
  Now let $\overline{f}: R \to N$ be the unique linear map such that $\overline{f}(1)= f(\star)$.
  Then $f = \overline{f}\circ \tau$
  and the pair $(R,\tau)$ fulfills the universal property of the tensor product.

  If $I$ is a singleton with unique element $i_0$, then $\prod_{i\in I} M_i = M_{i_0}$
  and a map $f: \prod_{i\in I} M_i \to N$ is multilinear if and only if $f$ as a map from $M_{i_\circ}$ to $N$
  is linear. This implies that the pair $(M_{i_0},\id_{M_{i_\circ}})$ then is a tensor product
  for the family $(M_i)_{i\in I}$.
\item This is an immediate consequence of the universal property of the tensor product.
\item
  We construct an inverse to
  $\overline{\iota}_{J,1_J}: \bigotimes_{i\in I\setminus J}M_i \to  \bigotimes_{i\in I}M_i $.
  Let $x = (x_i)_{i\in I}$ be an element of $\prod_{i\in I}M_i$ and put
  \[
    \lambda (x) =  \left( \prod_{j\in J} x_j \right)\cdot \otimes_{i\in I\setminus J} x_i
    \left( \prod_{j\in J} x_j \right) \cdot \tau_{I\setminus J} ((x_i)_{i\in I\setminus J}) \ .
  \]
  Then $\lambda : \prod_{i\in I}M_i \to \bigotimes_{i\in \setminus J} M_i$
  is multilinear by construction, hence factors through a linear map
  $\overline{\lambda} : \bigotimes_{i\in I}M_i \to \bigotimes_{i\in I \setminus J} M_i$.
  By definition, $\overline{\lambda}$ is a left inverse of $\overline{\iota}_{J,1_J}$. It is also a
  right inverse since for all $(x_i)_{i\in I} \in \prod_{i\in I}M_i$  by multilinearity of $\tau_I$
  \begin{equation*}
  \begin{split}
     \overline{\iota}_{J,1_J} \circ  \overline{\lambda}\circ  \tau_I  \left( (x_i)_{i\in I} \right) &  =
    \overline{\iota}_{J,1_J}
    \left( \left( \prod_{j\in J} x_j \right) \cdot  \otimes_{i\in I\setminus J} x_i \right)
    =\left( \prod_{j\in J} x_j\right)\cdot\left( \overline{\iota}_{J,1_J} \circ \tau_{I\setminus J}
    \left((x_i)_{i\in I\setminus J}\right)\right) = \\ & \hspace{-5em}
    =\left( \prod_{j\in J} x_j\right)\cdot\left( \tau_I \circ
    \iota_{J,1_J}\left( (x_i)_{i\in I\setminus J}\right)\right) =
    \tau_I \circ \iota_{J,(x_j)_{j\in J}}\left( (x_i)_{i\in I\setminus J}\right) =
    \tau_I \left( (x_i)_{i\in I}\right) % = \otimes_{i\in I} x_i
  \end{split}
  \end{equation*}
  and since by construction of the tensor product the image of $\tau_I$ is a generating system for
  the $R$-module $\bigotimes_{i\in I}M_i$.
\end{adromanlist}
\end{proof}

\begin{lemma}\label{thm:image-generating-system-canoncial-map-finite-tensor-product-generating-system}
  Assume that $(M_i)_{i\in I}$ is a finite family of $R$-modules such that for every $i\in I$ a
  generating set $S_i$ of the $R$-module $M_i$ has been given. Then the set
  $S = \tau \left( \prod_{i\in I}S_i \right)$ is a generating set of the tensor product
  $\bigotimes_{i\in I} M_i$.
\end{lemma}

\begin{proof}
  By construction of the tensor product in the proof of
  \Cref{thm:construction-fundamental-properties-infinite-tensor-product} it is clear that
  a generating set of $\bigotimes_{i\in I} M_i$ is given by the set
  of elements of the form $\otimes_{i\in I}x_i$ where $(x_i)_{i\in I}\in \prod_{i\in I}M_i$.
  Each of the $x_i$ can now be represented in the form
  \[
    x_i = \sum_{k=1}^{n_i} r_{i,k} s_{i,k} \quad\text{with}\enspace r_{i,1},\ldots ,r_{i,n_i}\in R,\enspace
    s_{i,1},\ldots ,s_{i,n_i}\in S_i \ .
  \]
  Hence, by multilinearity of $\tau$ and with $I=\{ i_1,\ldots ,i_d\}$,
  \[
    \otimes_{i\in I}x_i = \tau \left( (x_i)_{i\in I} \right) =
    \sum_{k_{i_1} =1}^{n_{i_1}}\cdots  \sum_{k_{i_d} =1}^{n_{i_d}} r_{i_1,k_{i_1}} \cdot \ldots \cdot r_{i_d,k_{i_d}}
    \cdot \tau \left( (s_{i,k_i})_{i\in I} \right)  \ ,
  \]
  so $\otimes_{i\in I}x_i$ is a linear combination of elements of $S$ and the claim is proved.
\end{proof}

\begin{lemma}\label{thm:componentwise-multilinear-maps-factorization}
  Let $(M_i)_{i\in I}$ be a family of $R$-modules, $(I_a)_{a\in A}$ a finite partition
  of the index set $I$, and $N$ an $R$-module. For $a\in A$ put
  $N_a = \bigotimes_{i\in I_a} M_i$ and let $\tau_a:  \prod_{i\in I_a} M_i \to  N_a$
  denote the canonical map. Assume that
  $f : \prod_{a\in A}\prod_{i\in I_a} M_i \to N$ is a map which is
  \emph{componentwise multilinear} in the following sense.
  \begin{itemize}
  \item[$(\mathsf{ CM})$\hspace{-1mm}]
    Let $b\in A$ and $y=(y_a)_{a\in A}   \in \prod_{a\in A}\prod_{i\in I_a} M_i $
    a family with $y_b =0$. If for all $j\in I_b$ and families
    $x=(x_i)_{i\in I_b}\in \prod_{i\in I_b} M_i$ with $x_j  =0$ the  map
    \[
       M_j \to N , \enspace m \mapsto f( \iota_b (\iota_j (m) + x) + y)
    \]
    is linear, then $f$ factors through
    $(\tau_a)_{a\in A}: \prod_{a\in A}\prod_{i\in I_a} M_i \to
    \prod_{a\in A}N_a $. More precisely, there exists
    a unique multilinear map $\overline{f} : \prod_{a\in A}N_a \to N$ such that
    \[
       f = \overline{f} \circ (\tau_a)_{a\in A} \ .
    \]
  \end{itemize}
\end{lemma}

\begin{proof}
  We prove the claim by induction on the cardinality of $A$.
  If $A$ is a singleton, then $\prod_{a \in A} \prod_{i\in I_a} M_i$ canonically
  coincides with $\prod_{i\in I} M_i$ and $f: \prod_{i\in I_a} M_i \to N$
  is multilinear, hence by the universal property of the tensor product there
  exists a unique linear map $\overline{f}: N_a \to N$ such that
  $f = \overline{f} \circ \tau_a$.

  Now assume that the claim holds whenever the cardinality of the index set $A$ is
  $\leq n$ for some $n \in \N^*$.
  Assume to be given initial data $(M_i)_{i\in I}$ and $§N$, a partition
  $(I_a)_{a\in A}$ of $A$ with $|A| = n+1$ and  componentwise multilinear map
  $f: \prod_{a\in A}\prod_{i\in I_a} M_i \to N$. Fix $a \in A$ and put
  $B =A \setminus \{ a\}$. Let
  $x = (x_i)_{i\in I_a} \in \prod_{i\in I_a}M_i$
  and $\widetilde{x}$ be the element of $ \prod_{d\in A}\prod_{i\in I_d} M_i $ such that
  \[
    \pi_d (\widetilde{x}) =
    \begin{cases}
      x &\text{for} \enspace d = a \ , \\
      0 &\text{else} \ .
    \end{cases}
  \]
  The map
  \[
    f_x: \prod_{b\in B}\prod_{i\in I_b} M_i \to N , \enspace
         y  \mapsto f (\iota_B (y) + \widetilde{x})
  \]
  then is componentwise multilinear. Hence by inductive assumption there  exists
  a unique multilinear map $\overline{f_x} : \prod_{b\in B}N_b \to N$ such that
  $f_x = \overline{f_x}\circ (\tau_b)_{b\in B}$. By assumption on $f$
  the map
  $\prod_{i\in I_a} M_i \to \Map \left( \prod_{b\in B} \prod_{i\in I_b} M_i,N\right) $,
  $x \mapsto f_x$ is multilinear which implies multilinearity of
  \[
    \overline{f_\bullet} :
    \prod_{i\in I_a} M_i \to \mlinOps \left( \prod_{b\in B} N_b ,N \right),
    \enspace x \mapsto \overline{f_x} \ .
  \]
  Let $F: N_a \to \mlinOps \left( \prod_{b\in B} N_b,N \right)$ be its
  linearization. Application of the exponential law for multilinear maps,
  \Cref{thm:exponential-law-multilinear-maps}, now gives a
  multilinear map $\eta (F) : \prod_{d \in A} N_d \to N$ which we denote
  by $\overline{f}$. Given a family $(x_d)_{d\in A}$ of families
  $x_d =(x_i)_{i\in I_d}$ one checks
  \[
    \overline{f} \left( \big(\tau_d (x_d)\big)_{d\in A} \right)
    = F \big( \tau_a(x_a) \big) \left( \big(\tau_b (x_b)\big)_{b\in B} \right)
    = \overline{f}_{x_a} \left( \big(\tau_b (x_b)\big)_{b\in B} \right)
    = f_{x_a} \left( (x_b)_{b\in B} \right) = f  \left( (x_d)_{d\in A} \right) \ .
  \]
  Hence $\overline{f} \circ (\tau_d)_{d\in A} =f$.
  To finish the induction step it remains to prove uniqueness.
  So let $\overline{g} :  \prod_{d \in A} N_d \to N$ be another multilinear map
  such that $\overline{g} \circ (\tau_d)_{d\in A} =f$  and consider
  the induced linear map
  $\overline{g}^\sharp =\eta^{-1} (\overline{g}) : N_a \mapsto \mlinOps (\prod_{b\in B}N_b, N)$.
  Then for every $x\in \prod_{i\in I_a}M_i$ the relation
  \[
    \overline{g}^\sharp (\tau_a(x)) \circ (\tau_b)_{b\in B} = f_x =
    \overline{f}_x \circ (\tau_b)_{b\in B}
  \]
  is satisfied.
  Hence $\overline{g}^\sharp (\tau(x)) = \overline{f}_x$ for all $x\in \prod_{i\in I_a}M_i$ which entails
  that $\overline{g}^\sharp$ coincides with $F$. By
  \Cref{thm:exponential-law-multilinear-maps} one obtains
  $\overline{g} = \overline{f}$. This finishes the induction step and the lemma
  is proved.
\end{proof}

\begin{proposition}
  Let $(M_i)_{i\in I}$ be a family of $R$-modules and $(I_a)_{a\in A}$ a finite partition of the index set $I$.
  Then there exists a natural isomorphism
  \[
    \alpha_{I,A}: \bigotimes_{i \in I} M_i \to \bigotimes_{a \in A}  \bigotimes_{i \in I_a} M_i .
  \]
\end{proposition}

\begin{proof}
  Put $N_a = \bigotimes_{i \in I_a} M_i$  for  $a \in A$ and let
  $\tau_a :  \prod_{i \in I_a} M_i \to  N_a$ be the canonical map to the tensor product.
  Let $\tau_A :\prod_{a \in A}N_a \to \bigotimes_{a \in A} N_a$ be the canonical map to
  the tensor product of the modules $N_a$.
  Define $\tau_{I,A}: \prod_{i \in I} M_i\to \prod_{a \in A} N_a$ as the unique map so that
  $\pi_a  \circ \tau_{I,A} = \tau_a \circ \pi_{I_a}$  for all $a\in A$.
  % As before, the map $\pi_a$ on the right hand side is hereby the unique map
  % $\pi_{I_a} : \prod_{i\in I} M_i\to\prod_{i\in I_a} M_i $
  % such that $\pi_k \circ \pi_{I_a} =\pi_k$ for all $k\in I_a$.
  By construction $\tau_{I,A} = (\tau_a)_{a\in A} \circ \kappa_{I,A}$,
  where $\kappa_{I,A} :  \prod_{i\in I} M_i \to \prod_{a \in A} \prod_{i \in I_a} M_i$ is the natural isomorphism from
  \Cref{thm:associator-cartesian-product}.
  The composition $\tau_A \circ \tau_{I,A}$ then is multilinear by \Cref{thm:construction-multilinear-maps-composition}
  \ref{ite:multilinearity-composition-multilinear-map-product-multilinear-map}, hence factors through a linear map
  $\alpha_{I,A} : \bigotimes_{i\in I} M_i \to \bigotimes_{a \in A} N_a$
  that is
  \begin{equation}\label{eq:defining-equation-associator-map-tensor-product}
    \tau_A \circ (\tau_a)_{a\in A} \circ \kappa_{I,A} =
    \alpha_{I,A} \circ \tau_I \ .
  \end{equation}

  Naturality of $\alpha_{I,A}$ in  $(M_i)_{i\in I}$ is clear by definition so it remains to
  construct an inverse to $\alpha_{I,A}$.  Consider the composition
  $\tau_I \circ \kappa^{-1}: \prod_{a \in A} \prod_{i \in I_a} M_i
   \to \bigotimes_{i\in I} M_i$. Assume that $a \in A$ and
  $(y_b)_{b\in A\setminus\{a\}} \in \prod_{b \in A\setminus\{a\}} \prod_{i \in I_b} M_i$
  have been chosen. Let $y_a\in \prod_{i \in I_a} M_i$ be $0$, put
  $\widetilde{y} =(y_d)_{d\in A} \in \prod_{d \in A}  \prod_{i \in I_d} M_i$, and let
  $y\in  \prod_{i \in I} M_i$ be the family such that $\pi_i(y) = \pi_i (y_{a(i)})$ for
  all $i\in I$, where $a(i)$ denotes the unique element of $A$  such that
  $i\in I_{a(i)}$. In other words let $y =\kappa^{-1} (\widetilde{y})$.
  For every $j\in I_a$ and $x= (x_i)_{i\in I_a}\in \prod_{i\in I_a}M_i$
  with $\pi_j (x)=0$ the map
  \[
    M_j \to \bigotimes_{i\in I} M_i,\enspace m \mapsto \tau_I \circ \kappa^{-1} \left( \iota_a (\iota_j(m)+x)+\widetilde{y}\right)
    = \tau_I \left( \iota_j (m) + \iota_{I_a}(x) + y \right)
  \]
  then is multilinear since $\tau_I$ is multilinear and $\pi_j(\iota_{I_a}(x) + y)=\pi_j(x) +\pi_j(y_a) = 0$.
  Hence $\tau_I \circ \kappa^{-1}$ is componentwise multilinear and therefore,
  by \Cref{thm:componentwise-multilinear-maps-factorization}, factors
  through the map
  $(\tau_a)_{a\in A} : \prod_{a\in A} \prod_{i\in I_a} M_i\to \prod_{a\in A} N_a$
  which means that
  \begin{equation}\label{eq:defining-equation-inverse-associator-map-tensor-product}
    \tau_I \circ \kappa^{-1} = \lambda_{I,A}\circ (\tau_a)_{a\in A}
  \end{equation}
  for some uniquely defined multilinear map
  $\lambda_{I,A} : \prod_{a\in A} N_a\to\bigotimes_{i\in I} M_i$.
  Let
  \[ \overline{\lambda}_{I,A} : \bigotimes_{a\in A} N_a\to\bigotimes_{i\in I} M_i\]
  be the linearization of $\lambda_{I,A}$.
  We claim that $\overline{\lambda_{I,A}}$ is inverse to $\alpha_{I,A}$.
  By definition of $\overline{\lambda_{I,A}}$ and
  Eqs.~\eqref{eq:defining-equation-associator-map-tensor-product} and
  \eqref{eq:defining-equation-inverse-associator-map-tensor-product} one concludes
  %
  \[
    \overline{\lambda_{I,A}} \circ \alpha_{I,A} \circ \tau_I =
    \overline{\lambda_{I,A}} \circ \tau_A \circ (\tau_a)_{a\in A} \circ \kappa_{I,A} =
    \lambda_{I,A} \circ (\tau_a)_{a\in A} \circ \kappa_{I,A} = \tau_I \ .
  \]
  Since the image of $\tau_I$ generates $\bigotimes_{i\in I} M_i$ as an $R$-module,
  $\overline{\lambda_{I,A}}$ has to be left inverse to $\alpha_{I,A}$.
  Using Eqs.~\eqref{eq:defining-equation-associator-map-tensor-product} and
  \eqref{eq:defining-equation-inverse-associator-map-tensor-product} again compute
  \[
    \alpha_{I,A} \circ\overline{\lambda_{I,A}} \circ \tau_A \circ (\tau_a)_{a\in A} =
    \alpha_{I,A} \circ \lambda_{I,A} \circ (\tau_a)_{a\in A} = \alpha_{I,A}\circ\tau_A\circ \kappa_{I,A}^{-1}
    =  \tau_A \circ (\tau_a)_{a\in A} \ .
  \]
  Since by \Cref{thm:image-generating-system-canoncial-map-finite-tensor-product-generating-system}
  the image of
  $\tau_A \circ (\tau_a)_{a\in A}$ generates $\bigotimes_{a \in A}  \bigotimes_{i \in I_a} M_i$,  the equality
  \[ \alpha_{I,A} \circ\overline{\lambda_{I,A}}=\id_{\bigotimes_{a \in A}  \bigotimes_{i \in I_a} M_i} \]
  follows and the proposition is proved.
\end{proof}

\begin{propanddef}
  Let $(A_i)_{i\in I}$ be a family of $R$-algebras. Then the tensor product
  $A = \bigotimes_{i\in I} A_i$ carries in a natural way the structure of an
  $R$-algebra where the product map is defined by
  \[
    \cdot :  A \times A \to A , \enspace
    (\otimes_{i\in I} a_i , \otimes_{i\in I} b_i)\mapsto
    \otimes_{i\in I} (a_i\cdot b_i) \ .
  \]
  In case each of the algebras $A_i$ is commutative, then $A$ is commutative
  as well.
  Likewise, if each $A_i$ is unital and $1_i$ denotes the unit element of
  $A_i$, then $A$ is unital with unit given by $1 = \otimes_{i\in I} 1_i$.
  One calls $A$ the \emph{tensor product algebra} of the family of algebras
  $(A_i)_{i\in I}$.
\end{propanddef}

\begin{proof}
  The map
  \[
    \prod_{(i,k)\in I \times \{ 1,2\}} A_i \to A,\enspace
    (a_{i,k})_{(i,k) \in I\times \{1,2\}} \mapsto\otimes_{i\in I}(a_{i,1}\cdot a_{i,2})
  \]
  is multilinear by bilinearity of the product maps on the $A_i$ and multilinearity of $\tau_I$,
  so factors through a linear map
  $\mu: A \otimes A \cong \bigotimes_{(i,k)\in I\times \{1,2\}} A_i \to A$. Composition of
  $\mu$ with the canonical bilinear map $A \times A \to A\otimes A$ gives the product map
  $\cdot : A \times A\to A$
  and shows that the product on $A$ is well-defined. By construction, the product map $\cdot$
  is bilinear. Given $\otimes_{i\in I} a_i, \otimes_{i\in I} b_i, \otimes_{i\in I} c_i \in A$ one
  computes
  \[
    \big( \otimes_{i\in I} a_i \cdot \otimes_{i\in I} b_i \big) \cdot \otimes_{i\in I} c_i
    = \otimes_{i\in I} ((a_i\cdot b_i)\cdot c_i) =
    \otimes_{i\in I} (a_i\cdot( b_i\cdot c_i)) =
    \otimes_{i\in I} a_i \cdot \big( \otimes_{i\in I} b_i  \cdot \otimes_{i\in I} c_i\big) \ .
  \]
  This entails that the product on $A$ is associative. In the same way one shows
  that $A$ is commutive respectively unital if each of the $A_i$ is.
\end{proof}

\para
As we have seen, the infinite tensor product construction works well for objects of
algebraic categories like $R$-modules, vector spaces or $R$-algebras. As soon as
a topologies compatible with the algebraic structure come in it becomes difficult and
sometimes even impossible to construct or even define


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tcolorbox}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{float}
\usepackage[
top    = 2.50cm,
bottom = 2.50cm,
left   = 2.75cm,
right  = 2.75cm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Linear algebra basics}
\rhead{EPFL/Alp Ozen}

\newtheorem{thm}{Theorem}[subsection]
\newtheorem{property}{Property}
\newtheorem{cor}{Corollary}[subsection]
\newtheorem{prop}{[Proposition]}
\newtheorem{rem}{Remark}[subsection]
\newtheorem{definition}{Definition}[subsection]
\numberwithin{equation}{subsection}

\title{Linear Algebra 1}
\author{alp.ozen}
\date{September 2019}

\begin{document}

\maketitle

\section{Linear equations}
\subsection{Basics}

\begin{tcolorbox}
A linear equation is any equation of form:
$a_{1}x_{1}+ ..... + a_{n}x_{n} = b$
where the a are 'scalars' that belong to a field and the x belong to the vector set.
\end{tcolorbox}

A \textit{system of linear equation}s is simply a collection of linear equations. The solution of this system, if there is any, is an ordered list $(s_{1},...,s_{n})$ where each $s_{i}$ is the value of each $x_{i}$.
\\

A system consisting of 2 unknowns and two linear equations is generally the intersection of two lines on a cartesian plane. Note that the lines may be parallel or even colinear.
\\

In general, a system will have:
\begin{itemize}
    \item no solution
    \item unique solution
    \item infinite solutions
\end{itemize}
\\

We may choose to represent a system of linear equations as an \textit{augmented matrix}. A matrix is called n$\times$m if it is of form:
\begin{equation*}
    \begin{bmatrix}
    a_{11} && a{12} &&  ... \\
    a_{21} && a {22}  && ... \\
    \end{bmatrix}
\end{equation*}

\subsection{Solving a linear system}
\subsubsection{Basics}

When solving a system, our goal is to replace each linear equation with an equivalent set(one that has the same solution) and obtain single linear equations which are trivial to solve.
\\

In solving a system, we use the elementary row operations which are:

\begin{tcolorbox}
\begin{itemize}
    \item Interchange two rows (or columns).
    \item Multiply each element in a row (or column) by a non-zero number.
    \item Multiply a row (or column) by a non-zero number and add the result to another row (or column).
\end{itemize}
\end{tcolorbox}

Our goal is to transform our matrix into echelon or row reduced echelon form. A matrix is in echelon form if it looks like this: \begin{equation*}
\begin{bmatrix}
    \blacktriangledown &&  \blacktriangle && \blacktriangle \\
    0 && \blacktriangledown && \blacktriangle \\
    0 && 0 && \blacktriangledown

\end{bmatrix}

\end{equation*}

Here, each $\blacktriangledown$ and $\blacktriangle$ may take on any value from the set the vector space is defined on.
\\

To obtain this form, we first arrange our matrix into a form where the row with the least amount of trailing zeros is placed uptop. Then we ensure the \textit{pivot position}(meaning first non-zero entry) has only 0 in its own column. When done, we move on the second row, find the pivot position and repeat. We repeat this process for all rows.
\\

If we have a system where the number of unknowns exceeds the number of equations, we obtain a parametric solution. Consider this:

\begin{example}
\begin{equation*}
  \begin{bmatrix}
    1 && 0 &&  -5 && 1 \\
    0 && 1 && 1 && 4 \\
    0 && 0  && 0 && 0 \\
    \end{bmatrix}
\end{equation*}

Which means:
$$ x_{1} - 5x_{3} = 1$$
$$ x_{2} +  x_{3} = 4$$

Now, we can express both $x_{1}$ and $x_{2}$ in terms of $x_{3}$. We call $x_{1}$ and $x_{2}$ basic variables and $x_{3}$ the free variable. We call $x_{3}$ a free variable as we are free to choose any value for it.
\end{example}

Most importantly, these are the conditions for row echelon and reduced row echelon form.

\begin{tcolorbox}
 \textbf{Row echelon form if:}
 \begin{itemize}
     \item all nonzero rows are above zero rows
     \item a leading entry is the right column of a leading entry above it
     \item all entries in a column below a leading entry are 0
 \end{itemize}
 \textbf{Reduced row echelon also if:}
 \begin{itemize}
     \item leading entry in each nonzero row is 1
     \item the entries in the column of the leading entry are 0
 \end{itemize}
\end{tcolorbox}
\\

To obtain reduced row echelon form, starting from the lowest row, the terms in the column with the leading term are made zero and the leading term scaled to 1. We repeat this process.
\\

As a general remark, we obtain the following.

\begin{thm}
A system is consistent iff, the rightmost column has no pivot. More simply, iff the lowest row is not of the form:
\begin{bmatrix}
    0 && 0 \dots && b
\end{bmatrix}
where b is nonzero.
\end{thm}
\\

A common confusion when solving a linear system is why the Gaussian algorithm works? To help answer this, the idea is to visualize a Cartesian plane with two random lines intersecting. Now, there can be multiple lines that intersect at the same point. But the intersection of something like $x=2$ and $y=5$ is obviously $(2,5)$ and requires less effort to solve. Thus, we try to replace our equations with those that are easier to solve and have the same solution set.

\begin{figure}[h]
    \centering
    \includegraphics[scale=0.5]{epflSemesterOne/linearAlgebra/figures/linearGauss.png}
    \caption{Equivalent systems}
    \label{fig1}
\end{figure}

\subsubsection{Reducing a system to reduced row echelon form}

\begin{tcolorbox}
    \begin{align*}
     \text{Given} \left(\begin{matrix}0&3&-6&6&4&-5\\3&-7&8&-5&8&9\\3&-9&12&-9&6&15\end{matrix}\right)\\
     \text{We first realign to get} \left(\begin{matrix}3&-7&8&-5&8&9\\3&-9&12&-9&6&15\\0&3&-6&6&4&-5\end{matrix}\right) \\
     \text{After applying elementary row operations, we get the reduced row echelon form of}\\
     \left(\begin{matrix}1&0&-2&3&0&-24\\0&1&-2&2&0&-7\\0&0&0&0&1&4\end{matrix}\right)\\
     \text{Now anything which is not a pivot column is called a free variable.}\\
     x_{5} = 4\\
     x_{2} = 2x_{3} - 2x_{4} - 7\\
     x_{1} = 2x_{3} + 2x_{4} - 24
     \end{align*}
\end{tcolorbox}

\subsubsection{High school basics}

When solving systems of 2 unknowns or 3 unknowns, we simply are considering the system of lines or planes. Sticking to 3 dimensions, let's quickly recall how we obtain the formula's of a line and plane in 3-d.
\\
A line in 3-d may be desribed in Vector form as:
\begin{equation*}
    l_[1] : \begin{bmatrix}
        A\\
        B\\
        C
    \end{bmatrix}
    +
    \lambda\begin{bmatrix}
        D\\
        E\\
        F
    \end{bmatrix}
    +
    \psi\begin{bmatrix}
        G\\
        H\\
        I
    \end{bmatrix}
\end{equation*}

or may be simplified to cartesian form as:
\begin{equation*}
    k = \frac{x + A}{B} = \ldots
\end{equation*}

Now, the equation of a plane is most commonly written in the form:

\begin{equation*}
    Ax + By + Cz \ \text{where (A,B,C) is the normal vector to the plane.}
\end{equation*}

\section{Introducing vector spaces}
\subsection{Basics}
A vector space is an algebraic structure consisting of two sets, a scalar set and the vector set. The scalar set happens to be field and the vector set an additive abelian group. We also define a 'scalar multiplication' between the scalars and vectors to satisfy the following:

\begin{itemize}
    \item $r_{1}r_{2}(v_{1}) = (r_{1}r_{2})v_{1}$  \textbf{associativity of scalar multiplication}
    \item $r_{1}(v_{1}+v_{2}) = r_{1}v_{1}+ r_{1}v_{2}$ and the opposite as well, thus multiplication distributes over addition.
    \item $1_{r}v_{1} = v_{1}$
\end{itemize}

\begin{property}
From the above properties, we can neatly deduce also that $0_{r}v_{1} = 0$
\begin{align*}
    0_{r}v_{1} = (1-1)v_{1}\\
    1v_{1} - 1v_{1} = 0
\end{align*}
\end{property}
\\
The most common vector space is that of $\mathbb{R}^{n}$. It's vector and scalar set are the same.
\subsection{Linear combinations,span and matrix theorems}

\begin{tcolorbox}
  A \textbf{linear combination} of vectors is simply a sum of vectors multiplied by scalars.
  \begin{equation*}
      v_{i} = a_{1}v_{1} + \ldots + a_{k}v_{k}
  \end{equation*}
  A \textbf{span} for given vector set $\{v_{1}\ldots v_{k}\}$is simply a set that consists of all the possible outputs of $\sum_{i=1}^{k} a_{i}v_{i}$
\end{tcolorbox}

A common idea in linear algebra is to view a linear combination as the product of two matrices. We can't help but notice that:

\begin{equation*}
    a_{1}v_{1} + \ldots + a_{k}v_{k} = \begin{bmatrix}
        v_{1}  \ldots v_{k}
    \end{bmatrix} \begin{bmatrix}
        a_{1} \\
        \vdots \\
        a_{k}
    \end{bmatrix}
\end{equation*}

An important theorem that follows from the fact that $Ax=b$ is a set of equivalent statements(meaning they always have the same truth value.)

\begin{thm}
\text{The following are equivalent:}
\begin{enumerate}
    \item $\forall b \in \mathbb{R}^{m}, Ax=b$ \text{has a solution}
    \item $ \forall b \in \mathbb{R}^{m}$ \text{b is a linear combination of the columns of A.}
    \item \text{columns of A span} $\mathbb{R}^{m}$
    \item \text{A(the coefficient matrix!) has a pivot position in each row. }
\end{enumerate}
\end{thm}

\subsection{Homogeneous system of equations}

Any system of linear equations that can be written of the form $Ax = 0$ is called \textbf{Homogeneous}. Clearly, this system has at least one solution which is when x is equal to the 0 vector. The non-trivial solution is if $x$ is not equal to 0 in which case the solution is described in terms of a parameter. Now, a theorem that follows is, for a non-homogeneous system $Ax=b$ with solution $p$, the solution set of $Ax=b$ is the set of vectors of the form $w = p + v_{h}$ where $v_{h}$ is any solution to $Ax = 0$.
\\ We now list some useful theorems.
\begin{thm}
A homogeneous equation $Ax = 0$ has a nontrivial solution iff it has at least one free variable.
\end{thm}

\begin{thm}
Columns of A are linearly dependent iff $Ax=0$ has a trivial solution.
\end{thm}

\begin{thm}
Suppose the equation $Ax=b$ has a solution p. Then the set of possible solutions to $Ax=b$ are of the form $w = p + v_{h}$ where $v_{h}$ is a solution of $Ax = 0$.(Ofcourse assuming $Ax=b$ is consistent) That is to say, if we knew two solutions to $Ax=b$, we could find a solution to $Ax=0$.
\end{thm}

\subsection{Linear Independence}
A set of vectors is linearly independent if the solution to:

\begin{equation*}
    a_{1}v_{1} + \ldots + a_{k}v_{k} = 0
\end{equation*}

is only the trivial solution, that is the $0_{v} \in \mathbb{R}^{k}$.
\\
We now present some common statements concerning linear independence.
\begin{tcolorbox}
  \begin{thm}
    Whenever $Ax=0$ has a nontrivial solution, the columns of $A$ are linearly dependent.
    \end{thm}

    \begin{thm}
    A set of vectors is linearly dependent if at least one of the vectors is a scalar multiple of the other.
    \end{thm}

    \begin{thm}
    If a set contains the zero vector, then it is linearly dependent.
    \end{thm}

    \begin{thm}
    If a set of vectors contain more vectors than vector entries, the set is linearly dependent.
    \end{thm}

    \begin{thm}
    A set of vectors is linearly dependent if the row echelon form of A to $Ax=0$ has at least one free variable.
    \end{thm}

\begin{thm}
\label{comb}
A set of vectors is linearly dependent iff at least one of the vectors can be written as a linear combination of the others.
\end{thm}

\begin{cor}
Two vectors are linearly dependent iff one is a scalar multiple of the other
\end{cor}

\end{tcolorbox}
Let's now prove the most useful out of these theorems.

\begin{proof}
Let's first prove \ref{comb}.
\\
($\rightarrow$)
   Now suppose that for $S = \{ v_{1}, \ldots , v_{k}\}, v_{1} = a_{2}v_{2} + \ldots a_{k}v_{k}$ Then:
   $$ 0 = a_{2}v_{2} + \ldots - v_{1}$$
   In which case $v_{1}$ has a nonzero coefficient implying a nontrivial solution.
   \\
($\leftarrow$)
Let $j$ represent the vectors that have a nonzero coefficient in $a_{1}v_{1} + \ldots + a_{j}v_{j} + \ldots a_{k}v_{k}$
\\
Now, WLOG, we get for all subscripts less than or equal to $j$:

$$ v_{1} = - \frac{a_{2}}{a_{1}}v_{2} - \ldots - \frac{a_{k}}{a_{1}}v_{k}$$
    \tag*{\qedhere}
\end{proof}

\subsection{Lec 05 notes}

\begin{property}
A linear $T$ maps linear line segments in $\mathbb{R}^{n}$ to linear line segments in $\mathbb{R}^{m}$
\end{property}

\subsubsection{Matrix transformations}

\begin{tcolorbox}
  In general, the columns of a matrix are the dimensions of the domain set and the rows of the matrix are the codomain.
\end{tcolorbox}

\begin{thm}
Let $T$ be a square matrix, that is $T:\mathbb{R}^n \to \mathbb{R}^n$. Then, T is surjective iff it is injective.
\end{thm}

\begin{proof} Proving both directions:
\\
($\rightarrow$) (T is injective iff T is surjective)
\\
Now whenever T is surjective, we have that there are no rows of 0. It also means that each row has a pivot. Given this, we check the condition that $T(v_{1}) = T(v_{2}) \rightarrow v_{1} = v_{2}$ Now we would essentially obtain this in trying to solve it:
\begin{equation*}
    T \times v = a
\end{equation*}
where $a \in \mathbb{R}^n$. Now because the reduced matrix has no 0 row and as many pivots as the number of variables, we get that there is only one such $v$ resulting in $v_{1} = v_{2}$
\\
($\leftarrow$) (T is surjective iff T is injective)
From $T$ is injective, we get that there is only one solution to $T \times v = a$ and considering the homogeneous $Tv=0$ we get that only 0 would be the solution implying columns of T are a basis hence must span $\mathbb{R}^n$
 \tag*{\qedhere}

\end{proof}

\subsection{Linear transformations}

\begin{definition}
A linear map is function between $\mathbb{R}^n \to \mathbb{R}^m$ such that:
\begin{align*}
    i) \ cT(v) = T(cv) \forall c \in \mathbb{R}, \forall v \in \mathbb{R}^n\\
    ii) \ T(v + u) = T(v) + T(u) \forall v,u \in \mathbb{R}^n
\end{align*}
\end{definition}

A condition equivalent to a linear map is:
\begin{prop}
Whenever we can show that for some $T$, $T(cv_{1} + dv_{2}) = cT(v_{1}) + dT(v_{2})$, we have that $T$ is a linear map.
\end{prop}

\begin{proof}(We must show both conditions i) and ii) defined above)
\\

Now showing i) is simple. Simply fix $d=0$. Then we get that $T(cv_{1} + 0) = cT(v_{1})$.
\\

To show ii), fix $c,d$ to be 1 and there we have it!

\end{proof}

\begin{thm}
For a linear transformation $T:\mathbb{R}^n \to \mathbb{R}^m$, there exists a unique $m\times n$matrix $A$ such that $T(x) = Ax$
\end{thm}

\begin{proof}
Now, we can write $x$ as $I_{n}x$ from which we get $\begin{bmatrix}
    e_{1} \ldots e_{n}
\end{bmatrix}x = x_{1}e_{1} + \ldots + x_{n}e_{n}$. Taking $T(x)$ we obtain $x_{1}T(e_{1}) + \ldots + x_{n}T(e_{n})$ which is equal to $$\begin{bmatrix}
    T(e_{1}) \ldots T(e_{n})
\end{bmatrix} \begin{bmatrix}
    x_{1} \\
    \vdots \\
    x_{n}
\end{bmatrix}$$
\end{proof}

And here are some examples to capturing linear transforms as matrices mainly in $\mathbb{R}^2$
\begin{example}
\begin{enumerate}
    \item Anti-clockwise rotation by $\theta$ degrees. $A = \begin{bmatrix}
        \cos{\theta} & -\sin{\theta}\\
        \sin{\theta} & \cos{\theta}
    \end{bmatrix}$
    \item $T(x) = 3x$ for $x \in \mathbb{R} ^ 2$, then $A = \begin{bmatrix}
        3 & 0 \\
        0 & 3
    \end{bmatrix}$
    \item Reflection through the y-axis $A = \begin{bmatrix}
        -1 & 0\\
        0 & 1
    \end{bmatrix}$
    \item Contraction or an expansion depending on $k$ $ A = \begin{bmatrix}
        k & 0\\
        0 & 1
    \end{bmatrix}$
    \item Shear $\begin{bmatrix}
        1 & k\\
        0 & 1
    \end{bmatrix}$
    \item Projection $\begin{bmatrix}
        0 & 0\\
        0 & 1
    \end{bmatrix}$

\end{enumerate}
\end{example}

And now we present some theorems relating to surjectivity and injectivity:

\begin{thm}
Taking $T: \mathbb{R}^n \to \mathbb{R}^m$ we have that $T$ is injective iff the homogeneous $T(x) = 0$ has the trivial solution.
\end{thm}

\begin{proof}(To show this, we show that the two statements always have the same truth value, that they are equivalent)

Now when $T(x)$ is injective, it means that $T(x) = 0$ can have only a unique solution by definition of injectivity. Now when $T(x)$ is not injective, it means that $\exists b$ s.t. $T(u) = b$ and $T(v) = b$ where $u \not = v$. Now $T(u) - T(v) = b-b = 0 = T(u-v)$ and since $u\not=v$ we have that $0$ is not the only solution.
\end{proof}

\section{Matrix algebra}

\subsection{Basics}

\begin{property}
Properties of the matrix transpose:
\begin{align*}
    (A^T)^T = A\\
    (A + B)^T = A^T + B^T\\
    (rA)^T = rA^T\\
    (AB)^T = B^TA^T
\end{align*}
\end{property}

\begin{property}
\begin{align*}
    A + B = B + A\\
    (A + B) + C = A + (B + C)\\
    A + 0 = A\\
    r(A + B) = rA + rB\\
    (r+s)A = rA + rS\\
    rs(A) = r(sA)
\end{align*}
\end{property}

And here is the general formula for the $i-j^{th}$ entry of $AB$ whenever defined:

$$(AB)_{ij} = a_{i1}b_{1j} + \ldots + a_{in}b_{nj}$$

\begin{remark}
We note that Matrices who's entries belong to $\mathbb{R}$ form a vector space.
\end{remark}

And now some warnings about matrix multiplication. We note that in general if $AB = AC$ then it does not hold that $B=C$ And if $AB=0$ we can not conclude that $A$ or $B$ is $0$. We also note that whenever a matrix has entries only along its main diagonal, then to take any power, we simply take the power of each diagonal entry.
\\
A transpose of a matrix is defined as swapping the rows of $A$ with its columns. \\
\begin{thm}
A matrix $A$ is invertible if $\exists C$ s.t. $AC = I , CA=I$ meaning that the inverse is unique. Non-invertible matrices are called \textbf{singular}. And note that only square matrices are invertible. The reason for this is that for a matrix to be invertible, it must be bijective which can only be the case if it is square
\end{thm}

\begin{proof}(Proving that the inverse matrix is unique)
Suppose $\exists B,C s.t. AB = I, \ AC=I$. We want to show that $B = C$.
\\
$B = BI = BAC = IC = C$
\end{proof}

\subsection{Computing inverses}

The way we find inverses is best done by Gaussian elimination. We are simply looking for a solution to the equation $Ax=I$ hence we write this as an augmented matrix $\begin{bmatrix}
    A | I
\end{bmatrix}$ and solve.

\begin{thm}
\textbf{Elementary} matrices are obtained by only performing one elementary row operation on an identity matrix, thus all elementary matrices are invertible.
\end{thm}

\begin{thm}
Because inverses are only defined on bijective mappings, whenever a square matrix is invertible, we have that $Ax=b$ has a unique solution $x = A^{-1}b$
\end{thm}

\subsection{Every matrix is the product of elementary matrices with the identity}

Consider the matrix $E_{1}=$\begin{bmatrix}
    1 && 0 && 0\\
    0 && 1 && 0\\
    -4 && 0 && 1
\end{bmatrix} and $A=$ $E_{1}=$\begin{bmatrix}
    a && b && c\\
    d && e && f\\
    g && h && i
\end{bmatrix} Then notice that $E_{1}A=$ $E_{1}=$ \begin{bmatrix}
    a && b && c\\
    d && e && f\\
    g -4a && h -4b && i -4b
\end{bmatrix}

Which goes on to show that every row operation can be represented as the product of elementary matrices.

\subsection{Characterizing inverse matrices}

 \begin{tcolorbox}[drop shadow, title=(Theorem on inverse matrices),lower separated=true]
    \centering
        \includegraphics[scale = 0.9,valign=t]{epflSemesterOne/linearAlgebra/figures/invertible.JPG}
\end{tcolorbox}

\clearpage

\begin{figure}[H]
    \centering
    \includegraphics{epflSemesterOne/linearAlgebra/figures/proof.JPG}

\end{figure}

\section{Determinants}
\subsection{Basics}

First of all, determinant is only defined on an $nxn$ matrix and is denoted $det(A)$ or simply $|A|$
\\
The most useful formula for a determinant is

$$ det(A) = \sum_{j=1}^{n} a_{1j}C_{1j}$$ or equivalently
$$ det(A) = \sum_{i=1}^{n} a_{i1}C_{i1}$$
where $C_{ij}$ which is known as a \textit{cofactor} of matrix A is defined as:

$$ C_{ij} = (-1)^{i+j}det(A_{ij})$$ wherein $A_{ij}$ denotes a submatrix of A obtained by cancelling out the ith row and jth column of A.
\\
Now the above formula is one way to calculate the determinant. An alternative method comes from the realization that whenever a matrix is triangular, its determinant is the product of the terms along its diagonal. Hence given a matrix $A$ we may row reduce it to its echelon form and simply find the product of all pivots. But noticing how

$$ A = E_{1}\ldots E_{n}I$$ we get that

$$det(A) = det(E_{1})\ldots det(E_{n})$$

which means that because after row reduction we obtain $[I | A^{-1}]$, $det(A) = det(E_{1})\ldots det(E_{n}) \cdot det(I)$

This brings us to the following properties:

\begin{enumerate}
    \item If a multiple of one row is added to another to obtain matrix $B$, then $det(A) = det(B)$
    \item If a row is scaled by $k$ to obtain matrix $B$, then $det(B) = k \cdot det(A)$
    \item If two rows are interchanged, then $det(B) = -det(A)$
\end{enumerate}

\clearpage

And now a very important theorem is:

\begin{thm}
A matrix is $A$ invertible iff $det(A) \not = 0$
\end{thm}

\begin{proof}
When a matrix is invertible, we have that the solution to $Ax = 0$ is unique implying linear independence. And linear independence implies that $det(A) \not = 0$.
\end{proof}

\begin{thm}
If $A$ is $nxn$, then $det(A^{T}) = det(A)$
\end{thm}

\begin{proof}
This is obvious. We have that the cofactors along the columns of $A^{T}$ are equal to cofactors of $A$ along rows and by definition of the transpose we have that $a_{1j} = a_{j1}$ which implies the coefficients are also equal. This also suggests why the earlier formula for $det(A)$ comes in two forms.
\end{proof}

And now yet another theorem:

\begin{thm}
$det(AB) = det(A)det(B)$
\end{thm}

And now we come to Cramer's rule. It provides us with an alternative method for solving a system of equations using determinants. It states the following:

\begin{thm}(\textbf{Cramer's Rule})
\\
Where $A$ is an $n x n$ matrix, the solution to $Ax=b$ is of form
$$x_{i} = \frac{|A_{i}(b)|}{|A|} \ i=1,2,3\ldots$$
where $A_{i}(b)$ is obtained by replacing the ith column of A with the vector b.
\end{thm}

\begin{proof}
Again quite simple. Notice that

$$A\cdot I_{i}(b) = A[e_{1} \ldots b \dots e_{n}] = [a_{1} \ldots \underbrace{b}_{since Ax = b} \ldots a_{n}] = A_{i}(b)$$
Taking determinants we get $$det(A)\underbrace{det(I_{i}(b)}_{=x_{i}} = det(A_{i}(b)$$ to give $$ x_{i} = \frac{det(A_{i}(b))}{det(A)}$$
\end{proof}
\\
And now an important theorem is the following:

\begin{thm}
The area of the parallelogram determined by $a_{1}$ and $a_{2}$ is the same as that determined by $a_{1}$ and $a_{2} + ca_{1}$
\end{thm}

And furthermore:

\begin{thm}
For a linear transformation $T: \mathbb{R^{n}} \to  \mathbb{R^{n}}$ we have that whenever S is the generic shape in this vector space than the new area after T is given by:

$$ |T(s)| = |\det{A} \cdot |S|s$$
\end{thm}

\clearpage

\section{More on vector spaces}
\subsection{Basics}

\begin{tcolorbox}
\begin{definition}
A \textbf{Vector space} is an algebraic structure satisfying:

\begin{enumerate}
    \item For some vector set $V$ we have that $V$ is an abelian group under addition.
    \item Scalar multiplication between members of a scalar field and vector elements is defined and closure holds.
    \item Scalar multiplication of a vector associates
    \item $\forall v \in V$ we have that $1\cdot v = v$
    \item Multiplication of a scalar with two vectors distributes and multiplication of a vector with two scalars distributes.
\end{enumerate}
\end{definition}
\end{tcolorbox}

Now three important facts that follow from these axioms are:

\begin{align}
    \label{1}0v = 0 \ \forall v \in V\\
    \label{2}c0 = 0 \ \forall c \in F\\
    \label{3}-u = (-1)u \ \forall u \in V
\end{align}

Let's prove these solely using the axioms.
\begin{proof}
\\

\textbf{\ref{1}}
$$ 0v = (a-a)v = \underbrace{av - av}_{\text{\makebox[0pt]{additive inverse} }} = 0 $$

\textbf{\ref{2}}

$$ c0 = c(0-0) = c0 - c0 = 0$$

\textbf{\ref{3}}
\begin{align*}
    0u = (1-1)u\\
    0 = u + (-1)u\\
    -u = \underbrace{-u + u + (-1)u}_{\text{\makebox[0pt]{right additive inverse} }}
\end{align*}
\end{proof}

\begin{definition}
For a vector space $V$, $S$ is said to be a subspace if:

\begin{enumerate}
    \item $0_{v} \in S$
    \item $S$ is closed under scalar multiplication and vector addition
\end{enumerate}
\end{definition}

\begin{definition}(Null space)
\\
For some matrix $A$, the \textbf{Null space} is such that:
$$Nul A = \{v\in V| Av = 0_{v}\} $$
\end{definition}

\begin{prop}
$Nul A$ is a subspace of $V$
Now clearly $0 \in V$ as $0$ is the trivial solution to $Ax = 0$.
\\
We now need that $\forall u,v \in Nul A$, $u+v \in Nul A$.
$$A(u+v) = \underbrace{Au + Av}_{\text{\makebox[0pt]{matrices are linear maps}}} = 0 + 0 = 0$$
\\
We now also need $\forall u \in Nul A, \ cu \in A$

$$ A(cu) = cA(u) = c0 = 0$$
\end{prop}

\begin{thm}
The span of any single vector space elements is a subspace.
\end{thm}

\begin{definition}(Column space
The column space $Col A$ is the set of all possible linear combinations of the columns of a matrix A and is also a subspace.
\end{definition}

And now some examples of vector spaces:

\begin{example}
\begin{itemize}
    \item $\mathbb{R}^{n}$ is the most common example equipped with $\mathbb{R}$ as scalars.
    \item Set of polynomials of degree at most $n$ denoted $P_{n}$
    \item set of all real valued functions. This one is a little more subtle. Our 'vectors' are functions $f(x)$ and for instance the 0 vector is the map $g(x) = 0$. We define addition as $f(x) + g(x) = (f+g)(x)$ and scalar multiplication as $cf(x) = f(cx)$
\end{itemize}
\end{example}

Under light of vector spaces, a \textbf{linear transformation} is now much more clear as being a mapping that respects the two operations of vector spaces.

\end{document}


\documentclass[a4paper,12pt]{article}
%\documentclass[a4paper,12pt]{scrartcl}

\usepackage{xltxtra}

\input{../preamble.tex}

% \usepackage[spanish]{babel}

% \setromanfont[Mapping=tex-text]{Linux Libertine O}
% \setsansfont[Mapping=tex-text]{DejaVu Sans}
% \setmonofont[Mapping=tex-text]{DejaVu Sans Mono}

\title{Homework \#03: Independent events}
\author{Isaac Ayala Lozano}
\date{2020-01-20}

\begin{document}
\maketitle

\section{Problem}
Let A and B be two events in the sample space S.
Show that if $P(A) $ and $P(B)$ are
non-zero, then A and B cannot be mutually exclusive and independent.

\section{Proof}

From \cite{stewart2009probability} we observe that for events A and B to be independent then

\begin{equation}
 P(A \cap B) = P(A) P(B)
\end{equation}

Recall that for two events to be mutually exclusive then

\begin{equation}
 P(A \cap B) = 0
\end{equation}

Thus for two events to be independent and mutually exclusive at the same time then $P(A) P(B) = 0$.
The problem states that both $P(A)$ and $P(B)$ are non-zero, hence we conclude that A and B \emph{cannot} be mutually exclusive and independent at the same time because $P(A\cap B)  \neq 0$.

\printbibliography

\end{document}


\chapter{Supplemental Proofs}

\section{For Chapter~\ref{chap:solution-transfer}}

\subsection{Allowing Tessellation with Inverted Triangles}

\begin{lemma}\label{lemma:bad-triangle}
Consider three smooth curves
\(b_0, b_1, b_2\) that form a closed loop: \(b_0(1) = b_1(0)\),
\(b_1(1) = b_2(0)\) and \(b_2(1) = b_0(0)\).
Take \emph{any} smooth map \(\varphi(s, t)\) on \(\utri\) that
sends the edges to the three curves:
\begin{equation}
\varphi(r, 0) = b_0(r), \quad \varphi(1 - r, r) = b_1(r),
  \quad \varphi(0, 1 - r) = b_2(r) \quad \text{for } r \in \left[0, 1\right].
\end{equation}
Then we must have
\begin{equation}
2 \int_{\utri} \det(D\varphi) \left[F \circ \varphi\right] \, dt \, ds =
\oint_{b_0 \cup b_1 \cup b_2} H \, dy - V \, dx
\end{equation}
for antiderivatives that satisfy \(H_x = V_y = F\).

When \(\det(D\varphi) > 0\), this is just the change of variables
formula combined with Green's theorem.
\end{lemma}

\begin{proof}
Let \(x(s, t)\) and \(y(s, t)\) be the components of \(\varphi\). Define
\begin{equation}
\Delta S = H(x, y) y_s - V(x, y) x_s \quad \text{and} \quad
\Delta T = H(x, y) y_t - V(x, y) x_t.
\end{equation}
On the unit triangle \(\utri\), Green's theorem gives
\begin{equation}\label{eq:basic-greens}
\int_{\mathcal{U}} \left[\partial_s \Delta T -
  \partial_t \Delta S\right] \, dV =
\oint_{\partial \mathcal{U}} \Delta S \, ds + \Delta T \, dt.
\end{equation}
The boundary \(\partial \utri\) splits into the bottom edge \(E_0\),
hypotenuse \(E_1\) and left edge \(E_2\).

Since
\begin{equation}
E_0 = \left\{ \left[ \begin{array}{c} r \\ 0 \end{array}\right] \mid
  r \in \left[0, 1\right] \right\}
\end{equation}
we take \(\varphi(r, 0) = b_0(r)\) hence
\begin{equation}
dx = x_s \, dr, dy = y_s \, dr \Longrightarrow
H dx - V dy = \Delta S \, dr.
\end{equation}
We also have \(ds = dr\) and \(dt = 0\) due to the
parameterization, thus
\begin{equation}
\int_{E_0} \Delta S \, ds + \Delta T \, dt =
  \int_{r = 0}^{r = 1} \Delta S \, dr = \int_{b_0} H \, dx - V \, dy.
\end{equation}
We can similarly verify that
\(\int_{E_j} \Delta S \, ds + \Delta T \, dt = \int_{b_j} H \, dx - V \, dy\)
for the other two edges. Combining this with~\eqref{eq:basic-greens}
we have
\begin{equation}
\int_{\mathcal{U}} \left[\partial_s \Delta T -
  \partial_t \Delta S\right] \, dV =
\oint_{b_0 \cup b_1 \cup b_2} H \, dx - V \, dy.
\end{equation}
To complete the proof, we need
\begin{equation}
\int_{\mathcal{U}} \left[\partial_s \Delta T -
  \partial_t \Delta S\right] \, dV =
2 \int_{\mathcal{U}} \det(D\varphi) \left[F \circ \varphi\right] \, dV
\end{equation}
but one can show directly that
\begin{equation}
\partial_s \Delta T - \partial_t \Delta S =
  2 \left(x_s y_t - x_t y_s\right) F(x, y) =
  2 \det(D\varphi) \left[F \circ \varphi\right]. \tag*{\qedhere}
\end{equation}
\end{proof}

\section{For Chapter~\ref{chap:k-compensated}}

\subsection{Proof of Lemma~\ref{lemma:ell-tilde}}\label{proof:ell-tilde}

\begin{proof}
We'll start with the \(F = 1\) case. Recall where the terms originate:
\begin{align}
\left[P_1, e_1\right] &= \mathtt{TwoProd}\left(\widehat{r},
  \widehat{b}_j^{(k + 1)}\right) \\
\left[P_2, e_2\right] &= \mathtt{TwoProd}\left(s,
  \widehat{b}_{j + 1}^{(k + 1)}\right) \\
\left[\widehat{b}_j^{(k)}, e_3\right] &= \mathtt{TwoSum}\left(P_1, P_2\right).
\end{align}
Hence Theorem~\ref{thm:eft} tells us that
\begin{align}
\left|P_1\right| &\leq (1 + \mach)\left|\widehat{r} \cdot
  \widehat{b}_j^{(k + 1)}\right| \leq (1 + \mach)^2 (1 - s)
  \left|\widehat{b}_j^{(k + 1)}\right| \\
\left|e_1\right| &\leq \mach \left|\widehat{r} \cdot
  \widehat{b}_j^{(k + 1)}\right| \leq \mach(1 + \mach)(1 - s) \left|
  \widehat{b}_j^{(k + 1)}\right| \\
\left|P_2\right| &\leq (1 + \mach) s
  \left|\widehat{b}_{j + 1}^{(k + 1)}\right| \\
\left|e_2\right| &\leq \mach s \left|\widehat{b}_{j + 1}^{(k + 1)}\right| \\
\left|e_3\right| &\leq \mach \left|P_1\right| + \mach\left|P_2\right| \\
\left|\rho \cdot \widehat{b}_j^{(k + 1)}\right| &\leq
(1 + \mach)(1 - s) \left|\widehat{b}_j^{(k + 1)}\right|.
\end{align}
In general, we can swap \(\mach\left|P_j\right|\) for
\((1 + \mach)\left|e_j\right|\) based on how closely related the bound
on the result and the bound on the error are. Thus
\begin{align}
\widetilde{\ell}_{1, j}^{(k)} &= \left|e_1\right| + \left|e_2\right| +
  \left|e_3\right| + \left|\rho \cdot \widehat{b}_j^{(k + 1)}\right| \\
&\leq (2 + \mach)\left(\left|e_1\right| + \left|e_2\right|\right) +
  (1 + \mach)(1 - s) \left|\widehat{b}_j^{(k + 1)}\right| \\
&\leq \left[(1 + \mach)^3 - 1\right] (1 - s) \left|
  \widehat{b}_j^{(k + 1)}\right| + \left[(1 + \mach)^2 - 1\right] s \left|
  \widehat{b}_{j + 1}^{(k + 1)}\right| \\
&\leq \gamma_3 \left((1 - s) \left|\widehat{b}_j^{(k + 1)}\right| +
  s \left|\widehat{b}_{j + 1}^{(k + 1)}\right|\right).
\end{align}
For \(\widetilde{\ell}_{F + 1}\), we want to relate the ``current'' errors
\(e_1, \ldots, e_{5F + 3}\) to the ``previous'' errors \(e_1',
\ldots, e_{5F - 2}'\) that show up in \(\widetilde{\ell}_F\). In the same
fashion as above, we track where the current errors come from:
\begin{align}
\left[S_1, e_1\right] &= \mathtt{TwoSum}\left(e_1', e_2'\right) \\
\left[S_2, e_2\right] &= \mathtt{TwoSum}\left(S_1, e_3'\right) \\
&\mathrel{\makebox[\widthof{=}]{\vdots}} \nonumber \\
\left[S_{5F - 3}, e_{5F - 3}\right] &=
  \mathtt{TwoSum}\left(S_{5F - 4}, e_{5F - 2}'\right) \\
\left[P_{5F - 2}, e_{5F - 2}\right] &= \mathtt{TwoProd}\left(\rho,
  \cdb{F - 1}_j^{(k + 1)}\right) \\
\left[\widehat{\ell}_{F, j}^{(k)}, e_{5F - 1}\right] &=
  \mathtt{TwoSum}\left(S_{5F - 3}, P_{5F - 2}\right) \\
\left[P_{5F}, e_{5F}\right] &= \mathtt{TwoProd}\left(s,
  \cdb{F}_{j + 1}^{(k + 1)}\right) \\
\left[S_{5F + 1}, e_{5F + 1}\right] &=
  \mathtt{TwoSum}\left(\widehat{\ell}_{F, j}^{(k)}, P_{5F}\right) \\
\left[P_{5F + 2}, e_{5F + 2}\right] &= \mathtt{TwoProd}\left(\rho,
  \cdb{F}_j^{(k + 1)}\right) \\
\left[\cdb{F}_j^{(k)}, e_{5F + 3}\right] &= \mathtt{TwoSum}\left(
  S_{5F + 1}, P_{5F + 2}\right).
\end{align}
Arguing as we did above, we start with
\(\left|e_1\right| \leq \mach \left|e_1'\right| + \mach \left|e_2'\right|\)
and build each bound recursively based on the previous, e.g.
\(\left|e_2\right| \leq \mach \left|S_1\right| + \mach \left|e_3'\right| \leq
(1 + \mach) \mach \left|e_1'\right| + (1 + \mach) \mach \left|e_2'\right| +
\mach \left|e_3'\right|\). Proceeding in this fashion, we find
\begin{align}
\widetilde{\ell}_{F + 1, j}^{(k)} &= \left|e_1\right| + \cdots +
  \left|e_{5F + 3}\right| + \left|\rho \cdot \cdb{F}_j^{(k + 1)}\right| \\
&\leq \gamma_{5F} \left|e_1'\right| + \gamma_{5F} \left|e_2'\right| +
  \gamma_{5F - 1} \left|e_3'\right| + \cdots +
  \gamma_4 \left|e_{5F - 2}'\right| +
  \gamma_4 \left|\rho \cdot \cdb{F - 1}_j^{(k + 1)}\right| \\
&\qquad + \gamma_3 (1 - s) \left|
  \cdb{F}_j^{(k + 1)}\right| + \gamma_3 s \left|
  \cdb{F}_{j + 1}^{(k + 1)}\right| \\
&\leq \gamma_3 \left(
  (1 - s) \left|\cdb{F}_j^{(k + 1)}\right| +
  s \left|\cdb{F}_{j + 1}^{(k + 1)}\right|\right) +
  \gamma_{5F} \cdot \widetilde{\ell}_{F, j}^{(k)}
\end{align}
as desired.
\end{proof}

\subsection{Proof of Lemma~\ref{lemma:L-and-D-bounds}}
\label{proof:L-and-D-bounds}

\begin{proof}
First, note that for \emph{any} sequence \(v_0, \ldots, v_{k + 1}\) we
must have
\begin{equation}
\sum_{j = 0}^k \left[(1 - s) v_j + s v_{j + 1}\right] B_{j, k}(s) =
\sum_{j = 0}^{k + 1} v_j B_{j, k + 1}(s).
\end{equation}
For example of this in use, via \eqref{eq:ell-tilde-1}, we have
\begin{equation}
  L_{1, k} \leq \gamma_3 \sum_{j = 0}^{k + 1} \left|
  \widehat{b}_j^{(k + 1)}\right| B_{j, k + 1}(s).
\end{equation}
In order to work with sums of this form, we define Bernstein-type
sums related to \(L_{F, k}\):
\begin{align}
D_{0, k} &\coloneqq \sum_{j = 0}^k \left|\widehat{b}_j^{(k)}\right|
B_{j, k}(s) \\
D_{F, k} &\coloneqq \sum_{j = 0}^k \left|\cdb{F}_j^{(k)}\right| B_{j, k}(s).
\end{align}
Hence Lemma~\ref{lemma:ell-tilde} gives
\begin{align}
L_{1, k} &\leq \gamma_3 D_{0, k + 1} \label{eq:ell-1-k} \\
L_{F + 1, k} &\leq \gamma_3 D_{F, k + 1} + \gamma_{5F} L_{F, k}
\label{eq:ell-F-k}
\end{align}
In addition, for \(F \geq 1\) since
\begin{align}
\cdb{F}_j^{(k)} &= \widehat{\ell}_{F, j}^{(k)} \oplus \left(
  s \otimes \cdb{F}_{j + 1}^{(k + 1)}\right) \oplus \left((1 \ominus s) \otimes
  \cdb{F}_{j}^{(k + 1)}\right) \\
&= (1 - s) \cdot \cdb{F}_j^{(k + 1)}(1 + \theta_3) +
  s \cdot \cdb{F}_{j + 1}^{(k + 1)}(1 + \theta_3) +
  \widehat{\ell}_{F, j}^{(k)} (1 + \theta_2)
\end{align}
we have
\begin{equation}\label{eq:df-first}
D_{F, k} \leq (1 + \gamma_3) D_{F, k + 1} + (1 + \gamma_2) \sum_{j = 0}^k
\left|\widehat{\ell}_{F, j}^{(k)}\right| B_{j, k}(s).
\end{equation}
Since \(\ell_{F, j}^{(k)}\) has \(5F - 1\) terms (only the last of which
involves a product), the terms in the computed value will be involved in
at most \(5F - 2\) flops, hence
\(\left|\widehat{\ell}_{F, j}^{(k)}\right| \leq
\left(1 + \gamma_{5F - 2}\right) \widetilde{\ell}_{F, j}^{(k)}.\)
Combined with \eqref{eq:df-first} and the fact that there is no local error
when \(F = 0\), this means
\begin{align}
D_{0, k} &\leq (1 + \gamma_3) D_{0, k + 1} \label{eq:d-0-k} \\
D_{F, k} &\leq (1 + \gamma_3) D_{F, k + 1} + (1 + \gamma_{5F}) L_{F, k}.
\label{eq:d-F-k}
\end{align}
The four inequalities \eqref{eq:ell-1-k}, \eqref{eq:ell-F-k}, \eqref{eq:d-0-k}
and \eqref{eq:d-F-k} allow us to write all bounds in terms of
\(D_{0, n} = \widetilde{p}(s)\) and \(D_{F, n} = 0\). From \eqref{eq:d-0-k}
we can conclude that \(D_{0, n - k} \leq \left(1 + \gamma_{3k}\right) \cdot
\widetilde{p}(s)\) and from \eqref{eq:ell-1-k} that \(L_{1, n - k} \leq
\gamma_3 \left(1 + \gamma_{3(k - 1)}\right) \cdot \widetilde{p}(s)\).

To show the bounds for higher values of \(F\), we'll assume we have
bounds of the form
\(D_{F, n - k} \leq \left(q_F(k) \mach^F + \bigO{\mach^{F + 1}}\right) \cdot
\widetilde{p}(s)\) and
\(L_{F, n - k} \leq \left(r_F(k) \mach^F + \bigO{\mach^{F + 1}}\right) \cdot
\widetilde{p}(s)\) for two families of polynomials \(q_F(k), r_F(k)\). We
have \(q_0(k) = 1\) and \(r_1(k) = 3\) as our base cases and can build from
there. To satisfy \eqref{eq:d-F-k}, we'd like
\(q_F(k) = q_F(k - 1) + r_F(k)\)
and for \eqref{eq:ell-F-k}
\(r_{F + 1}(k) = 3 q_F(k - 1) + 5 F r_F(k)\).
Since the forward difference \(\Delta q_F(k) = r_F(k + 1)\) is known,
we can inductively solve for \(q_F\) in terms of \(q_F(0)\). But
\(D_{F, n} = 0\) gives \(q_F(0) = 0\).

For example, since we have \(r_1(k) = 3 \binom{k}{0}\) we'll have
\(q_1(k) = 3 \binom{k}{1}\). Once this is known
\begin{equation}
r_2(k) = 3 q_1(k - 1) + 5 r_1(k) = 3 \cdot 3 \binom{k - 1}{1} +
5 \cdot 3 \binom{k}{0} = 9 \binom{k}{1} + 6 \binom{k}{0}.
\end{equation}
If we write these polynomials in the ``falling factorial'' basis of
forward differences, then we can show that
\begin{equation}
r_F(k) = 3^F \binom{k}{F} + \cdots
\end{equation}
which will complete the proof of the first inequality. To see this, first
note that for a polynomial in this basis
\(f(k) = A \binom{k}{d} + B \binom{k}{d - 1} + C \binom{k}{d - 2} +
D \binom{k}{d - 3} + \cdots\) we have
\begin{align}
f(k + 1) &= A \binom{k}{d} + (A + B) \binom{k}{d - 1} +
  (B + C) \binom{k}{d - 2} + (C + D) \binom{k}{d - 3} + \cdots \\
f(k - 1) &= A \binom{k}{d} + (B - A) \binom{k}{d - 1} +
  (C - B + A) \binom{k}{d - 2} + (D - C + B - A) \binom{k}{d - 3} + \cdots
\end{align}
Using these, we can show that if
\(r_F(k) = \sum_{j = 0}^{F - 1} c_j \binom{k}{j}\) then
\begin{align}
q_F(k) &= c_{F - 1} \binom{k}{F} + \sum_{j = 1}^{F - 1}
  (c_j + c_{j - 1}) \binom{k}{j} \\
r_{F + 1}(k) &= 3 \left[-c_0 \binom{k}{0} +
  \sum_{j = 1}^F c_{j - 1} \binom{k}{j}\right] +
5F \left[\sum_{j = 0}^{F - 1} c_j \binom{k}{j}\right] =
3 c_{F - 1} \binom{k}{F} + \cdots
\end{align}
Under the inductive hypothesis \(c_{F - 1} = 3^F\) so that
the lead term in \(r_{F + 1}(k)\) is \(3 c_{F - 1} \binom{k}{F}
= 3^{F + 1} \binom{k}{F}\).

For the second inequality, we'll show that
\begin{equation}
\sum_{k = 0}^{n - 1} \gamma_{3k + 5F} L_{F, k} \leq
  \left[q_{F + 1}(n) \mach^{F + 1} +
  \bigO{\mach^{F + 2}}\right] \cdot \widetilde{p}(s)
\end{equation}
and then we'll have our result since we showed above that
\(q_{F + 1}(n) = 3^{F + 1} \binom{n}{F + 1} + \bigO{n^F}\). Since
\(\gamma_{3k + 5F} L_{F, k} \leq (3k + 5F) L_{F, k} \mach +
\bigO{\mach^{F + 2}} \widetilde{p}(s)\) it's enough to consider
\begin{equation}
\sum_{k = 0}^{n - 1} (3k + 5F) r_F(n - k) =
\sum_{k = 1}^n (3(n - k) + 5F) r_F(k).
\end{equation}
Since \(q_F(k) = q_F(k - 1) + r_F(k)\) and \(q_F(0) = 0\) we have
\(q_{F}(n) = \sum_{k = 1}^n r_{F}(k)\) thus
\begin{equation}
q_{F + 1}(n) = \sum_{k = 1}^n r_{F + 1}(k)
= \sum_{k = 1}^n 3 q_F(k - 1) + 5 F r_F(k)
= \sum_{k = 1}^n 3 \left[\sum_{j = 1}^{k - 1} r_F(j)\right] + 5 F r_F(k).
\end{equation}
Swapping the order of summation and grouping like terms, we have our
result.
\end{proof}

\subsection{Proof of Lemma~\ref{lemma:k-order}}\label{proof:k-order}

\begin{proof}
As in \eqref{eq:matrix-de-casteljau}, we can express the compensated
de Casteljau algorithm as
\begin{equation}
\db{F}^{(k)} = U_{k + 1} \db{F}^{(k + 1)} + \ell_{F}^{(k)}
\Longrightarrow \db{F}^{(0)} = \sum_{k = 0}^{n - 1}
U_1 \cdots U_k \ell_F^{(k)} = \sum_{k = 0}^{n - 1}
\left[\sum_{j = 0}^k \ell_{F, j}^{(k)} B_{j, k}(s)\right].
\end{equation}
For the inexact equivalent of these things, first note that
\(\widehat{r} = (1 - s)(1 + \delta)\). Due to this,
we put the \(\widehat{r}\) term at the end of each update step to reduce
the amount of round-off:
\begin{align}
  \cdb{F}_j^{(k)} &=
  \widehat{\ell}_{F, j}^{(k)} \oplus
  \left(s \otimes \cdb{F}_{j + 1}^{(k + 1)}\right) \oplus
  \left(\widehat{r} \otimes \cdb{F}_j^{(k + 1)}\right) \\
&= (1 - s) \cdot \cdb{F}_j^{(k + 1)}(1 + \theta_3) +
  s \cdot \cdb{F}_{j + 1}^{(k + 1)}(1 + \theta_3) +
  \widehat{\ell}_{F, j}^{(k)} (1 + \theta_2) \\
\Longrightarrow \cdb{F}^{(k)} &=
  U_{k + 1} \cdb{F}^{(k + 1)}(1 + \theta_3) +
  \widehat{\ell}_{F}^{(k)} (1 + \theta_2) \\
\Longrightarrow \cdb{F}^{(0)} &=
  \sum_{k = 0}^{n - 1}
  U_1 \cdots U_k \widehat{\ell}_F^{(k)} (1 + \theta_{3k + 2})
  = \sum_{k = 0}^{n - 1}
  \left[\sum_{j = 0}^k \widehat{\ell}_{F, j}^{(k)} (1 + \theta_{3k + 2})
    B_{j, k}(s)\right].
\end{align}
Since
\begin{equation}
\db{F + 1}_0^{(0)} = \db{F}_0^{(0)} - \cdb{F}_0^{(0)} = \sum_{k = 0}^{n - 1}
\sum_{j = 0}^k \left(\ell_{F, j}^{(k)} -
\widehat{\ell}_{F, j}^{(k)} (1 + \theta_{3k + 2})\right) B_{j, k}(s)
\end{equation}
it's useful to put a bound on \(\ell_{F, j}^{(k)} -
\widehat{\ell}_{F, j}^{(k)} (1 + \theta_{3k + 2})\). Via
\begin{align}
\widehat{\ell}_{F, j}^{(k)} &= e_1 \oplus \cdots \oplus e_{5F - 2} \oplus
\left(\rho \otimes \cdb{F - 1}_j^{(k + 1)}\right) \\
&= e_1\left(1 + \theta_{5F - 2}\right) + \cdots +
e_{5F - 2}\left(1 + \theta_2\right) +
\rho \cdot \cdb{F - 1}_j^{(k + 1)} \left(1 + \theta_2\right)
\end{align}
we see that
\begin{equation}
\left|\ell_{F, j}^{(k)} -
\widehat{\ell}_{F, j}^{(k)} (1 + \theta_{3k + 2})\right| \leq
\gamma_{3k + 5F} \cdot \widetilde{\ell}_{F, j}^{(k)}
\Longrightarrow
\left|\db{F + 1}_0^{(0)}\right| \leq \sum_{k = 0}^{n - 1}
\gamma_{3k + 5F} \sum_{j = 0}^k \widetilde{\ell}_{F, j}^{(k)} B_{j, k}(s).
\end{equation}
Applying \eqref{eq:L-sum-bound} directly gives
\begin{equation}
\left|\db{F + 1}_0^{(0)}\right| \leq
  \left[\left(3^{F + 1} \binom{n}{F + 1} + \bigO{n^F}\right)
  \mach^{F + 1} + \bigO{\mach^{F + 2}}\right] \cdot \widetilde{p}(s).
\end{equation}
Letting \(K = F + 1\) we have our result.
\end{proof}

\subsection{Proof of Theorem~\ref{thm:k-comp-result}}
\label{proof:k-comp-result}

\begin{proof}
Since
\begin{equation}
\mathtt{CompDeCasteljau}(p, s, K) = \mathtt{SumK}\left(\left[
  \widehat{b}_0^{(0)}, \ldots, \cdb{K - 1}_0^{(0)}\right], K\right),
\end{equation}
applying Theorem~\ref{thm:sum-k} tells us that
\begin{multline}\label{eq:sum-k-applied}
\left|\mathtt{CompDeCasteljau}(p, s, K) - \sum_{F = 0}^{K - 1}
\cdb{F}_0^{(0)}\right| \leq \\
\left(\mach + 3 \gamma_{n - 1}^2\right) \left|\sum_{F = 0}^{K - 1}
\cdb{F}_0^{(0)}\right| +
\gamma_{2n - 2}^K \sum_{F = 0}^{K - 1} \left|\cdb{F}_0^{(0)}\right|.
\end{multline}
Since
\begin{equation}
p(s) = b_0^{(0)} = \widehat{b}_0^{(0)} + \db{1}_0^{(0)}
= \cdots
= \widehat{b}_0^{(0)} + \cdb{1}_0^{(0)} + \cdots
+ \cdb{K - 1}_0^{(0)} + \db{K}_0^{(0)}
\end{equation}
we have
\begin{gather}
\left|\sum_{F = 0}^{K - 1} \cdb{F}_0^{(0)}\right|
\leq \left|p(s)\right| + \left|\db{K}_0^{(0)}\right| \quad \text{and} \\
\begin{multlined}
\left|\mathtt{CompDeCasteljau}(p, s, K) - p(s)\right| \leq \\
\left|\mathtt{CompDeCasteljau}(p, s, K) - \sum_{F = 0}^{K - 1}
\cdb{F}_0^{(0)}\right| +
\left|\db{K}_0^{(0)}\right| \label{eq:triangle-ps}.
\end{multlined}
\end{gather}
Due to Lemma~\ref{lemma:k-order}, \(\db{F}_0^{(0)} =
\bigO{\mach^F} \widetilde{p}(s)\), hence
\begin{align}
\left(\mach + 3 \gamma_{n - 1}^2\right) \left|\sum_{F = 0}^{K - 1}
\cdb{F}_0^{(0)}\right| &\leq
\left[\mach + \bigO{\mach^2}\right] \left|p(s)\right| +
\bigO{\mach^{K + 1}} \widetilde{p}(s) \\
\gamma_{2n - 2}^K \sum_{F = 0}^{K - 1} \left|\cdb{F}_0^{(0)}\right| &\leq
\gamma_{2n - 2}^K \left|\widehat{b}_0^{(0)}\right| +
\bigO{\mach^{K + 1}} \widetilde{p}(s) \\
&\leq
\gamma_{2n - 2}^K \left[\left|p(s)\right| +
  \bigO{\mach} \widetilde{p}(s)\right] +
\bigO{\mach^{K + 1}} \widetilde{p}(s).
\end{align}
Combining this with \eqref{eq:sum-k-applied} and \eqref{eq:triangle-ps}, we
see
\begin{align}
& \left|\mathtt{CompDeCasteljau}(p, s, K) - p(s)\right| \\
\leq &
\left[\mach + \bigO{\mach^2}\right] \left|p(s)\right| +
\left|\db{K}_0^{(0)}\right| +
\bigO{\mach^{K + 1}} \widetilde{p}(s) \\
\leq &
\left[\mach + \bigO{\mach^2}\right] \left|p(s)\right| +
\left[\left(3^{K} \binom{n}{K} + \bigO{n^{K - 1}}\right) \mach^K +
\bigO{\mach^{K + 1}} \right]
\widetilde{p}(s).
\end{align}
Dividing this by \(\left|p(s)\right|\), we have our result.
\end{proof}


%!TEX root = uber.tex

\section{Modeling a Strategic Driver}
\begin{frame}{Modeling a City}
\begin{columns}
\begin{column}{0.70\textwidth}
\begin{itemize}
	\item<1->\textcolor{BlueGreen}{\bf Discrete model:}
		\begin{itemize}
			\item[--]<1-> {\bf Nodes}: Set of $n$ city-zones ($\mathcal{X}$).
			\item[--]<1-> {\bf Edges}: Rides between each pair of zones.
			\item[--]<1-> {\bf Time}: advances in discrete time steps.
		\end{itemize}
	\item<2->\textcolor{BlueGreen}{\bf Empirical Transition Matrix ($F$):}
		\begin{itemize}
			\item[--]<2-> $f(i,j)$: probability of passenger in zone $i$\\ traveling to zone $j$.
		\end{itemize}
	\item<2->\textcolor{BlueGreen}{\bf Rewards Matrix ($R$):}
		\begin{itemize}
			\item[--]<2-> $r(i,j)$: net reward from zone $i$ to zone $j$.
			\item[--]<2-> $r(i,j)$ = earnings$(i,j)$ - cost$(i,j)$.
		\end{itemize}
	\item<2->\textcolor{BlueGreen}{\bf Travel Time Matrix ($T$):}
		\begin{itemize}
			\item[--]<2-> $\tau(i,j)$: travel time from zone $i$ to zone $j$.
		\end{itemize}
\end{itemize}
\end{column}
\begin{column}{0.30\textwidth}
\only<1>{
\begin{figure}[tbh]
\includegraphics[scale=1.8]{figures/nyc3.pdf}
\end{figure}
}
\only<2->{
\begin{figure}[tbh]
\includegraphics[scale=1.8]{figures/nyc4.pdf}
\end{figure}
}
\end{column}
\end{columns}
\vspace{0.5cm}
\uncover<3->{\alert{\textbf{In general, all these matrices are time-dependent, their entries change throughout the day.}}}
\end{frame}

\begin{frame}{Modeling a Driver}
\begin{itemize}
	\item<1->\textcolor{BlueGreen}{\bf Home Zone:}
		\begin{itemize}
			\item[--]<1-> The zone from which driver starts the day.
		\end{itemize}
		\vspace{0.25cm}
	\item<2->\textcolor{BlueGreen}{\bf Finite Horizon ($N$):}
		\begin{itemize}
			\item[--]<2->Total time steps in optimization period.
		\end{itemize}
		\vspace{0.25cm}
	\item<3->\textcolor{BlueGreen}{\bf Driving Budget ($B$):}
		\begin{itemize}
			\item[--]<3->Maximum time steps a driver is willing to drive. Obviously, $B \leq N$.
		\end{itemize}
		\vspace{0.25cm}
	\item<4->\textcolor{BlueGreen}{\bf Actions ($\mathcal{A}$):}
		\begin{itemize}
			\item[--]<4-|alert@5,6,7,8> \textbf{Get Passenger} \tikzmark{start}
			\item[--]<4-|alert@6,8> \textbf{Go Home}
			\item[--]<4-|alert@7,8> \textbf{Relocate} \tikzmark{end}
		\end{itemize}
		\uncover<5>{\naive}
		\uncover<6>{\flexible}
		\uncover<7>{\relocation}
		\uncover<8>{\flexiblerelocation}
	\item<9->\textcolor{BlueGreen}{\bf Driver Policy ($\pi$):}
		\begin{itemize}
			\item[--]<9->Time and location dependent actions takes by driver.
			\item[--]<9->Let $\Pi$ denote entire policy space of size $\big|n \times N \times B \times \mathcal{A}\big|$.
		\end{itemize}

\end{itemize}
\end{frame}

\begin{frame}{Problem Definition}
\begin{itemize}
	\item[] \textbf{\textsc{MaxEarnings Problem}:} Given a set of time-evolving $F, T$ and $R$ matrices, as well as the driver's budget $B$, find a policy $\pi^\ast$ such that:
	\begin{equation*}
	\pi^\ast = \argmax_{\pi \in \Pi} \mathcal{E}(\pi, F, T, R, B)
	\end{equation*}
	where $\mathcal{E}(.)$ denotes total expected earnings.% and $\Pi$ is entire policy space $\bigg(\big||\mathcal{X}| \times N \times \mathcal{A}\big|\bigg)$.
\end{itemize}
\pause
	\only<2>{
	\begin{figure}
	\centering
	\includegraphics[scale=0.45]{figures/matrix.pdf}
	\end{figure}
	}
	\only<3>{
	\begin{figure}
	\centering
	\includegraphics[scale=0.45]{figures/matrix0.pdf}
	\end{figure}
	}
	\only<4>{
	\begin{figure}
	\centering
	\includegraphics[scale=0.45]{figures/matrix1.pdf}
	\end{figure}
	}
	\only<5>{
	\begin{figure}
	\centering
	\includegraphics[scale=0.45]{figures/matrix2.pdf}
	\end{figure}
	}
	\only<6>{
	\begin{figure}
	\centering
	\includegraphics[scale=0.45]{figures/matrix3.pdf}
	\end{figure}
	}
	\only<7>{
	\begin{figure}
	\centering
	\includegraphics[scale=0.45]{figures/matrix4.pdf}
	\end{figure}
	}\only<8>{
	\begin{figure}
	\centering
	\includegraphics[scale=0.45]{figures/matrix5.pdf}
	\end{figure}
	}
	\pause
	\alert{Dynamic Program solvable in $O(n^2NB)$.}
\end{frame}