\documentclass[11pt]{article}

\usepackage{systeme}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
%\usepackage{palatino}

\usepackage{xcolor}

%\usepackage[textheight=8.5in, margin=1.6in]{geometry}
\usepackage[total={6in,8in}]{geometry}

\usepackage{tikz}
%\usepackage{pgfplots}
%\tikzstyle{ball} = [circle,shading=ball, ball color=black,
%    minimum size=1mm,inner sep=1.3pt]
%\usetikzlibrary{arrows.meta}
%\tikzset{>={Latex[length=2mm,width=1.5mm]}}

%\usepackage{graphicx}

\usepackage{needspace}  % <-- to prevent bad pagebreak over environment titles
% Use:  \Needspace{3\baselineskip} before opening an environment

\usepackage{enumitem}
\setlist[enumerate]{leftmargin=*,label=(\alph*)}

%\usepackage[colorlinks=true,citecolor=black,linkcolor=black,urlcolor=blue]{hyperref}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\sn}{\mathfrak{S}}
\newcommand{\ve}{\varepsilon}
\newcommand{\ips}[2]{\langle{#1}, {#2}\rangle}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\Span}{\mathrm{Span}}
\DeclareMathOperator{\rk}{\mathrm{rank}}
\DeclareMathOperator{\trace}{\mathrm{tr}}
\DeclareMathOperator{\im}{\mathrm{im}}
\DeclareMathOperator{\Sym}{\mathrm{Sym}}
\DeclareMathOperator{\Hom}{\mathrm{Hom}}
\DeclareMathOperator{\diag}{\mathrm{diag}}
\DeclareMathOperator{\glb}{\mathrm{glb}}
\DeclareMathOperator{\lub}{\mathrm{lub}}

\parskip = 0.05in
\parindent = 0.0in

%\pagestyle{empty}

\begin{document}
\centerline{Math 201 lecture for Monday, Week 4}
\bigskip

\centerline{\bf Dimension I}
\medskip

Recall the following from last time:
\begin{itemize}
  \item A set~$B$ is a \emph{basis} for $V$ if it
    \begin{itemize}
      \item is linearly independent, and
      \item spans~$V$.
    \end{itemize}
  \item If~$B$ is a basis for~$V$, each element of $V$ can be expressed uniquely
    as a linear combination of vectors in~$B$.
  \item If $B=\langle v_{1},\ldots,v_{n}\rangle$ is an ordered basis for $V$,
    then the \emph{coordinates of $v\in V$ with respect to $B$} are $(a_1,\ldots,a_n)$ where
    \[
      v = a_1v_1+\cdots+a_{n}v_{n}.
    \]
\end{itemize}

\textbf{Example.} Find the coordinates of~$(7,-6)\in\R^{2}$ with respect to the
ordered basis $B=\langle(5,3),(1,4)\rangle$.
\smallskip

\emph{Solution.} We need to find~$a,b\in \R$ such that
    \[
      (7,-6)=a(5,3)+b(1,4).
    \]
    Therefore, we solve the system of equations
    \begin{align*}
      5a+b&=7\\
      3a+4b&=-6.
    \end{align*}
    Applying our algorithm yields~$a=2$ and~$b=-3$.  So the coordinates
of~$(7,-6)$ with respect to~$B$ are given by~$(2,-3)$.  We write
\[
[(7,-6)]_{B}=(2,-3).
\]
Figure~\ref{fig:04mon1} gives
the geometry.  The basis vectors are in blue, and the red vectors indicate
how~$(7,-6)$ is a linear combination of the basis vectors.
\begin{figure}[htpb]
  \centering
  \begin{tikzpicture}[scale=0.3]
  \draw[help lines, color=gray!50, dashed] (-4,-13) grid (12,7);
  \draw[->] (-4,0)--(13,0) node[right]{$x$};
  \draw[->] (0,-13)--(0,8) node[above]{$y$};
  \draw[->,thick,blue] (0,0)--(5,3);
  \draw[->,thick,blue] (0,0)--(1,4);
  \draw[->,thick,red] (5,3)--(10,6);
  \node at (13,6) {$2\cdot(5,3)$};
  \draw[->,thick,red] (0,0)--(-3,-12);
  \node at (-7,-12) {$-3\cdot(1,4)$};
  \draw[->,thick,red,dashed] (-3,-12)--(7,-6);
  \draw[->,thick,red,dashed] (10,6)--(7,-6);
  \node at (10,-6) {$(7,-6)$};
  \end{tikzpicture}
  \caption{The coordinates of $(7,-6)$ with respect to the ordered
  basis~$\langle(5,3),(1,4)\rangle$.}
  \label{fig:04mon1}
\end{figure}

\textbf{Remark.} Let~$B=\langle v_{1},\ldots,v_{n}\rangle$ be an ordered basis for a vector space~$V$.  Then
taking coordinates defines a bijective (why?) function
\begin{align*}
  \phi\colon &V\to F^n\\
  v&\mapsto [v]_{B}.
\end{align*}
This function has an important property: it \emph{preserves linear structure}.
By this, we mean the following: let~$u,v\in V$ and let~$\lambda\in F$, then we
claim that
\begin{equation}\label{eqn:04mon1}
 \phi(u+\lambda v)=\phi(u)+\lambda\phi(v).
\end{equation}
Note that addition and scalar multiplication happens in~$V$ on the left-hand
side of this equation, and they happen in~$F^n$ on the right-hand side.  The
fact that $\phi$ is bijective and preserves linear structure means that as
vector spaces~$V$ and~$F^n$ are ``essentially the same''.  We can be more
precise when we introduce linear transformations next week.  For now, let us
prove that equation~\eqref{eqn:04mon1} holds.  We express $u$ and~$v$ in terms
of the basis:
\begin{align*}
  u &= a_1v_{1}+\cdots+a_{n}v_{n}\\
  v &= b_1v_{1}+\cdots+b_{n}v_{n}.
\end{align*}
It follows that
\[
  u+\lambda v=(a_{1}+\lambda b_{1})v_{1}+\cdots+(a_{n}+\lambda b_{n})v_{n}.
\]
Then
\begin{align*}
  \phi(u+\lambda v)&=[u+\lambda v]_{B}\\
  &=(a_{1}+\lambda b_{1},\ldots,a_{n}+\lambda b_{n})\\
  &=(a_{1},\ldots,a_{n})+\lambda(b_{1},\ldots,b_{n})\\
  &=[u]_{B}+\lambda[v]_{B}\\
  &=\phi(u)+\lambda \phi(v).
\end{align*}
\bigskip

\textbf{Definition.} A vector space is \emph{finite-dimensional} if it has a basis
with a finite number of elements.  If a vector space is not finite-dimensional,
it is \emph{infinite-dimensional}.
\medskip

\Needspace{3\baselineskip}
\textbf{Examples.} The following vector spaces are finite-dimensional:
\begin{itemize}[label=--]
  \item $F^n$ (has a basis with~$n$ elements)
  \item $\mathcal{P}_d(F)=F[x]_{\leq d}$  (has a basis with $d+1$ elements)
  \item $M_{m\times n}$ (has a basis with $m\times n$ elements)
  \item $\C$ as a vector space over $\R$ (basis $\{1,i\}$).
\end{itemize}
The following are infinite-dimensional:
\begin{itemize}[label=--]
  \item $\mathcal{P}(F)=F[x]$
  \item $\R^{\R}=\{f\colon \R\to\R\}$
  \item $\left\{f\colon\R\to\R\colon \text{$f$ is continuous}\right\}$
  \item $\left\{f\colon\R\to\R\colon \text{$f$ is differentiable}\right\}$
  \item $\R$ as a vector space over~$\Q$
  \item $\C$ as a vector space over~$\Q$.
\end{itemize}

Our goal today is to show that if~$V$ is a finite-dimensional vector space, then
every basis for~$V$ has the same number of elements.  Thus, the following
definition makes sense:
\medskip

\textbf{Definition.} If~$V$ is a finite-dimensional vector space, then the {\em dimension}
of~$V$, denoted~$\dim V$ or~$\dim_FV$, if we want to make the scalar field
explicit, is the number of elements in any of its bases.
\medskip

\textbf{Exchange Lemma.} Suppose~$B=\left\{ v_1,\dots,v_n \right\}$ is a basis for a
vector space~$V$ over a field~$F$.  Further, suppose that
\[
w=a_1v_1+\dots+a_nv_n\in V\hspace{1in}(\star)
\]
with~$a_i\in F$, and such that~$a_{\ell}\neq 0$ for some~$\ell\in\left\{
1,\dots,n \right\}$.  Let~$B'$ be the set of vectors obtained from~$B$ by
exchanging~$w$ for~$v_{\ell}$, i.e.,
$B':=(B\setminus\left\{v_{\ell}\right\})\cup\left\{w\right\}$.  Then~$B'$ is also a basis for~$V$.
\begin{proof}
  We first show that~$B'$ is linearly independent.  For ease of
  notation, we may assume that~$\ell=1$, i.e., that~$a_1\neq 0$.  Suppose we have
  a linear relation among the elements of~$B'$:
  \[
    bw+b_2v_2+\dots+ b_nv_n=0
  \]
  Substituting for~$w$:
  \[
    0=b(a_1v_1+\dots+a_nv_n)+b_2v_2+\dots+
    b_nv_n=ba_1v_1+(ba_2+b_2)v_2+\dots+(ba_3+b_n)v_n.
  \]
  Since the~$v_i$ are linearly independent,
  \[
    ba_1=ba_2+b_2=\dots=ba_n+b_n=0.
  \]
  Since~$a_1\neq0$, it follows that~$b=0$ and then that~$b_2=\dots=b_n=0$, as
  well.  Therefore,~$B'$ is linearly independent.
  
  We now show that~$B'$ spans~$V$.  First, solve for~$v_1$ in~$(\star)$:
  \[
    v_1=\frac{1}{a_1}w-\frac{a_2}{a_1}v_2-\dots-\frac{a_n}a_n.
  \]
  To see that~$B'$ spans, take~$v\in V$.  Since~$B$ is a basis,~$v$ can be written
  as a linear combination of~$B=\{v_1,\dots,v_n\}$, but then substituting the above
  expression for~$v_1$ will express~$v$ as a linear combination
  of~$B'=\{w,v_2,\dots,v_n\}$, as required:
  \begin{align*}
    v&=c_1v_1+\dots+c_nv_n\\[10pt]
    &=\left( \frac{1}{a_1}w-\frac{a_2}{a_1}v_2-\dots-\frac{a_n}a_nv_n
    \right)+c_2v_2+\dots+c_nv_n\\[10pt]
    &=\frac{1}{a_1}w+\left(-\frac{a_2}{a_1}+c_2 \right)v_2+\dots+
    \left(-\frac{a_n}{a_1}+c_n \right)v_n.
  \end{align*}
\end{proof}

\textbf{Corollary.} Suppose~$B=\left\{ v_1,\dots,v_n \right\}$ is a basis for a
vector space~$V$ over a field~$F$.  Further, suppose that~$w\in V$ is nonzero.
Then there exists~$\ell\in\left\{1,\ldots,n\right\}$ such that
$B':=(B\setminus\left\{v_{\ell}\right\})\cup\left\{w\right\}$ is also a basis for~$V$.
\medskip

\textbf{Theorem.} In a finite-dimensional vector space, every basis has the same
number of elements.
\begin{proof}
  Let~~$V$ be a finite-dimensional vector space.  Among all the
  bases for~$V$, let~$B=\left\{ u_1,\dots,u_n \right\}$ be one of minimal size.
  Since~$B$ has minimal size, we know that $n=|B|\leq|C|$.  Therefore~$C$
  contains at least~$n$ distinct vectors $w_{1},\ldots,w_{n}$ and possibly more.  (Our
  goal is to show that, in fact,~$C$ contains no others.)  

  To take care of a trivial case, suppose~$B=\emptyset$ (the case~$n=0$).  In
  that case, we have
  \[
    V=\Span(C)=\Span(B)=\Span(\emptyset)=\left\{\vec{0}\right\}.
  \]
  The only linearly independent set whose span is~$\left\{\vec{0}\right\}$
  is~$\emptyset$.  So in this case,~$0=|C|=|B|$, as desired.

  Now suppose that~$n\geq 1$. We would again like to show that $C$ has the same
  number of elements as~$B$.  The idea is to start with~$B$, then use the
  exchange lemma to swap in the~$n$ elements $w_{1},\ldots,w_{n}$ from~$C$, one
  at a time, maintaining a basis at each step.  To that end, let~$B_0=B$ and
  consider~$w_1\in C$.  By the exchange lemma, we get a new basis~$B_1$ by
  swapping~$w_1$ with some~$u_{\ell}\in B_0$.  For ease of notation, let's
  suppose that~$\ell=1$.  Therefore,~$B_1=\left\{ w_1,u_2,\dots,u_n \right\}$.
  Since~$B_1$ is a basis for~$V$, it is linearly independent
  and~$V=\Span(B_1)=\Span(B)=\Span(C)$.

  Next, consider~$w_2\in C$.  Since~$B_1$ is a basis, we
  know~$w_2\in\Span(B_1)$, hence, we can write
  \[
    w_2=a_1w_1+a_2u_2+\dots a_nu_n
  \]
  for some~$a_i\in F$.  Since~$w_1$ and~$w_2$ are linearly independent, at least
  one of~$a_2,\dots, a_n$ is nonzero.  Without loss of generality,
  suppose~$a_2\neq0$.  Then by the exchange algorithm,~$B_3:=\left\{
  w_1,w_2,u_3,\dots,u_n \right\}$ is a basis.  Continuing in this way, we
  eventually reach the basis~$B_n=\left\{ w_1,\dots,w_n \right\}\subseteq C$. In
  fact, we must have~$B_n=C$. Otherwise, there is a~$w\in C\setminus B_{n}$.  Since~$B_n$
  is a basis,~$w\in\Span(B_n)$, in other words,~$w=\sum_{i=1}^nd_i
  w_i$ for some~$d_i\in F$.  But that can't happen since~$C$ is a basis: it's
  elements are linearly independent.  So, in fact,~$C$ also has~$n$ elements.
\end{proof}

\textbf{Remark.} If~$V$ is infinite-dimensional, it turns out that any two bases
have the same cardinality.  The above proof does not work to prove that, though.
\end{document}
