\documentclass[11pt]{article}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{latexsym}
\usepackage{anyfontsize}
\usepackage[super]{nth}
\usepackage{ulem}
\usepackage{multicol}
\usepackage{phaistos}
\usepackage{verbatim}
\usepackage[pdftex]{graphicx}
\usepackage[all,arc]{xy}
\usepackage{url}
\usepackage{epigraph}
\usepackage{mathrsfs}
\usepackage{hyperref}
\hypersetup{colorlinks=true}
\setlength{\oddsidemargin}{.25in}
\setlength{\evensidemargin}{.25in}
\setlength{\textwidth}{6in}
\setlength{\topmargin}{-0.4in}
\setlength{\textheight}{8.5in}


\newcommand{\len}{\textrm{length}}
\input{preamble.tex}

\begin{document}

\lecture{8: A Crash Course in Linear Algebra}{Week 9}
\setlength{\epigraphwidth}{.6\textwidth}
\epigraph{Qu\'e sed\\
de saber cu\'anto!\\}{Pablo Neruda, \textit{Oda a los N\'umeros}}


\section{Linear Algebra}

In the past week, we studied the concept of \textbf{constructible numbers}, and asked whether numbers like $\pi, \sqrt[3]{2}$ or $\cos(20^\circ)$ are constructible!  In this week's lectures, we will prove that they are not constructible; to do this, though, we need some linear algebra machinery!  In these notes we go through the concepts of \textbf{vector spaces}, \textbf{span}, \textbf{basis} and \textbf{dimension}, which are the linear algebra concepts we need for our later work.


\subsection{Vector spaces, informally.}

The two vector spaces you're probably the most used to working with, from either your previous linear algebra classes or even your earliest geometry/precalc classes, are the spaces $\mathbb{R}^2$ and $\mathbb{R}^3$.  We briefly restate how these two vector spaces work here:
\begin{defn}
The \textbf{vector space $\mathbb{R}^2$} consists of the collection of all pairs $(a,b)$, where $a,b$ are allowed to be any pair of real numbers.  For example, $(2,-3), (2, \pi), (-1,1),$ and $(\sqrt{2},\sqrt{2})$ are all examples of vectors in $\mathbb{R}^2$.  We typically visualize these vectors as arrows in the $xy$-plane, with the tail of the arrow starting at the origin\footnote{The origin is the point $(0,0)$ in the plane.} and the tip of the arrow drawn at the point in the plane with $xy$-co\"ordinates given by the vector.  We draw four such vectors here:
\begin{center}
\includegraphics[width=2.2in]{mathcs103_wk1_lecture2_xyplane.pdf}
\end{center}

Given a pair of vectors in $\mathbb{R}^2$, we can \textbf{add} them together.  We do this component-wise, i.e.\ if we have two vectors $(a,b)$ and $(c,d)$, their sum is the vector $(a+c, b+d)$.  For example, the sum of the vectors $(3, -2)$ and $(2,3)$ is the vector $(5,1)$. 

You can visualize this by taking the arrow corresponding to the first vector that we add, and ``translating'' this arrow over to the start of the second vector; if you travel along the first vector and then continue along this second translated vector, you arrive at some point in the plane.  The arrow connecting the origin to this point is the vector given by the sum of these two vectors!  If this seems hard to understand, the diagram below may help some:
\begin{center}
\includegraphics[width=3.4in]{mathcs103_wk1_lecture2_xyplane2.pdf}
\end{center}


We can also \textbf{scale} a vector in $\mathbb{R}^2$ by any real number $a$.  Intuitively, this corresponds to the concept of ``stretching:'' the vector $(x,y)$ scaled by $a$, denoted $a(x,y)$, is the quantity $(ax,ay)$.  For example, $2(1,3) = (2,6)$, and is essentially what happens if we ``double'' the vector $(1,3)$.  We illustrate this below:
\begin{center}
\includegraphics[width=2.5in]{mathcs103_wk1_lecture2_xyplane3.pdf}
\end{center}
\end{defn}

We can define $\mathbb{R}^3$ in a similar fashion: 
\begin{defn}
The \textbf{vector space $\mathbb{R}^3$} consists of the collection of all pairs $(a,b,c)$, where $a,b,c$ are allowed to be any triple of real numbers.  For example, $(0,1,2), (3,0,2),$ and $(3,2,0)$ are all examples of vectors in $\mathbb{R}^3$.  We typically visualize these vectors as arrows in three-dimensional $xyz$-space, with the tail of the arrow starting at the origin and the tip of the arrow drawn at the point in the plane with $xyz$-co\"ordinates given by the vector.  We draw three such vectors here:
\begin{center}
\includegraphics[width=3in]{mathcs103_wk1_lecture2_xyzplane.pdf}
\end{center}

Again, given a pair of vectors in $\mathbb{R}^3$, we can \textbf{add} them together.  We do this component-wise, i.e.\ if we have two vectors $(a,b,c)$ and $(d,e,f)$, their sum is the vector $(a+d, b+e,c+f)$.  For example, the sum of the vectors $(3, -2,0)$ and $(2,1,2)$ is the vector $(5,-1,2)$.  We can also \textbf{scale} a vector in $\mathbb{R}^3$ by any real number $a$: the vector $(x,y,z)$ scaled by $a$, denoted $a(x,y,z)$, is the quantity $(ax,ay,az)$.  These operations can be visualized in a similar fashion to the pictures we drew for $\mathbb{R}^2$:
\begin{center}
\includegraphics[width=3in]{mathcs103_wk1_lecture2_xyzplane2.pdf}
\end{center}
\end{defn}

You can generalize this discussion to $\mathbb{R}^n$, the vector space made out of $n$-tuples of real numbers: i.e. elements of $\mathbb{R}^4$ would be things like $(\pi, 2,2,1)$ or $(-1,2,1,-1)$. 

\subsection{Vector spaces, formally.}

In general, there are many other kinds of vector spaces --- essentially, anything with the two operations ``addition'' and ``scaling'' is a vector space, provided that those operations are well-behaved in certain specific ways.   Much like we did with $\mathbb{R}$ and the field axioms, we can generate a list of ``properties'' for a vector space that seem like characteristics that will insure this ``well-behaved'' nature.  We list a collection of such properties and use them to define a vector space here:
\begin{defn}
A \textbf{vector space} $V$ over a field $F$ is a set $V$ along with the two operations addition and scalar multiplication, such that the following properties hold:
\begin{multicols}{2}
\begin{itemize}
\item \textbf{Closure($+$)}: $\forall \vec{v}, \vec{w} \in V,$ we have $v+w \in V$.
\item \textbf{Identity($+$)}: $\exists\vec{0} \in V$ such that $\forall  \vec{v} \in V$, $\vec{0}+ \vec{v}=  \vec{v}$.
\item \textbf{Commutativity($+$)}: $\forall  \vec{v},  \vec{w} \in V,  \vec{v}+ \vec{w}=  \vec{w}+ \vec{v}$.
\item \textbf{Associativity($+$)}: $\forall  \vec{u},  \vec{v},  \vec{w} \in V, ( \vec{u}+ \vec{v})+ \vec{w} =  \vec{u}+( \vec{v}+ \vec{w})$.
\item \textbf{Inverses($+$)}: $\forall  \vec{v} \in V, \exists \textrm{ some} - \vec{v} \in V \textrm{ such that } \vec{v} + (- \vec{v}) = 0$.
\item  \textbf{Closure($\cdot$)}: $\forall a \in F, \vec{v} \in V,$ we have $a \vec{v} \in V$.
\item \textbf{Identity($\cdot$)}: $\forall \vec{v} \in V$, we have $1 \vec{v} = \vec{v}$.
\item \textbf{Compatibility($\cdot$)}:  $\forall a, b \in F$, we have $a  (b \vec{v}) = (a \cdot b) \vec{v}$.
\item \textbf{Distributivity($+,\cdot$)}: This means two things!  On one hand, $ \forall a \in F,  \vec{v}, \vec{w} \in V,$ we have $a\left( \vec{v} +  \vec{w} \right) = a\vec{v} + a \vec{w}.$  

On the other, $\forall a, b \in F, \vec{v} \in V$, we have $(a+b)\vec{v} = a\vec{v} + b\vec{v}$.
\end{itemize}
\end{multicols}
\end{defn}

As with fields, there are certainly properties that vector spaces satisfy that are not listed above.  For example, consider the following property: 
\begin{itemize}
\item \textbf{New property?($+$)}: The additive identity, $\vec{0}$, is unique in any vector space.  In other words, there cannot be two distinct vectors that are both the additive identity for a given vector space.
\end{itemize}

Just like before, this property turns out to be redundant:\ in other words, this property is implied by the definition of a vector space!  We prove this here:
\begin{claim}
In any vector space, the additive identity is unique.
\end{claim}
\begin{proof}
Take any two elements $\vec{0}, \vec{0'}$ that are both additive identities.  Then, by definition, we know that because $\vec{0}$ is an additive identity, we have
\begin{align*}
\vec{0'} = \vec{0} + \vec{0'}.
\end{align*}
Similarly, because $\vec{0'}$ is an additive identity, we have
\begin{align*}
\vec{0} = \vec{0'} + \vec{0}.
\end{align*}
If we use commutativity to switch the $\vec{0}$ and $\vec{0'}$, we can combine these two equalities to get that
\begin{align*}
\vec{0} = \vec{0'} + \vec{0} = \vec{0} + \vec{0'} = \vec{0'}.
\end{align*}
Therefore, we have shown that $\vec{0}$ and $\vec{0'}$ are equal.  In other words, we've shown that all of the elements that are additive identities are all equal: i.e.\ that they're all the same element!  Therefore, this additive identity element is \textbf{unique}: there is no other element that is somehow an additive identity that is different from $\vec{0}$.
\end{proof}

As we did with fields, there are a number of other properties that $\mathbb{R}^n$ possesses that you can prove that any vector space must have: in your textbook, there are proofs that every vector has a unique additive inverse, that $0 \vec{v}$ is always $\vec{0}$, that $-1\vec{v} = -\vec{v}$, and other such things.  

Instead of focusing on more of these proofs, we shift our attention instead to actually describing some vector spaces!
\subsection{Examples of vector spaces.}
A few of these are relatively simple to come up with:
\begin{itemize}
\item $\mathbb{R}^n$, the example we used to come up with these properties, is a vector space over the field $\mathbb{R}$.  
\item $\mathbb{C}^n$ is similar.  Specifically: $\mathbb{C}^n$ is the set of all $n$-tuples of complex numbers: i.e.\ 
\begin{align*}
\mathbb{C}^n = \{(z_1, \ldots z_n) | z_1, \ldots z_n \in \mathbb{C} \}.
\end{align*}
Just like with $\mathbb{R}^n$, we can add these vectors together and scale them by arbitrary complex numbers, while satisfying all of the vector space properties.  We leave the details for the reader to check, but this is a vector space over the complex numbers $\mathbb{C}$.
\item Similarly, $\mathbb{Q}^n$, the set of all $n$-tuples of rational numbers
\begin{align*}
\mathbb{Q}^n = \{(q_1, \ldots q_n) | q_1, \ldots q_n \in \mathbb{Q} \},
\end{align*}
is a vector space over the field $\mathbb{Q}$.
\item In general, given any field $F$, we can form the vector space $F^n$ by taking our set to be
\begin{align*}
F^n = \{(f_1, \ldots f_n) | f_1, \ldots f_n \in F \}.
\end{align*}
We can add these vectors pairwise: i.e. for any $\vec{f} = (f_1, \ldots f_n), \vec{g} = (g_1, \ldots g_n) \in F^n$, we can form
\begin{align*}
(f_1, f_2, \ldots f_n) + (g_1, g_2, \ldots g_n) = (f_1 + g_1, f_2 + g_2 + \ldots f_n + g_n).
\end{align*}
We can also scale them: for any $\vec{f} \in F^n, a \in F$, we can form the vector 
\begin{align*}
a(f_1, f_2, \ldots f_n)  = (a\cdot f_1, a\cdot f_2, \ldots a \cdot f_n).
\end{align*}
It is not hard to check that because $F$ is a field, $F^n$ is forced to satisfy all of the vector space axioms:
\begin{itemize}
\item \textbf{Closure($+$)}: Immediate.  Because $F$ is a field and is closed under addition, the pairwise sums performed in vector addition must create another vector.
\item \textbf{Identity($+$)}: Because $F$ is a field, it has an additive identity, 0.  The vector $\vec{0} = (0,0,\ldots 0)$ is consequently the additive identity for our vector space, as pairwise adding this vector to any other vector does not change any of the other vector's co\"ordinates.
\item \textbf{Commutativity($+$)}: Again, this is a consequence of $F$ being a vector space.  Because addition is commutative in $F$, the pairwise addition in our vector space is commutative.
\item \textbf{Associativity($+$)}: Once more, this is a consequence of $F$ being a vector space.  Because addition is associative in $F$, the pairwise addition in our vector space is associative.
\item \textbf{Inverses($+$)}: Take any $\vec{f} = (f_1, \ldots f_n) \in F^n$.  Because $F$ is a field, we know that $(-f_1, \ldots -f_n)$ is a vector in $F^n$ as well.  Furthermore, the pairwise addition of these two vectors clearly yields the additive identity $\vec{0}$; therefore, our vector space has inverses.
\item  \textbf{Closure($\cdot$)}: This is a consequence of $F$ being closed under multiplication.
\item \textbf{Identity($\cdot$)}: Because $F$ is a field, it has a multiplicative identity 1.  This 1, when used to scale a vector, does not change that vector at any co\"ordinate because of this multiplicative identity property; therefore 1 is also the scalar multiplicative identity for our vector space.
\item \textbf{Compatibility($\cdot$)}:  This is an immediate consequence from $F$'s multiplication being associative, as for any $a, b \in F$, we have
\begin{align*}
a (b(f_1\ldots f_n) = &a (b\cdot f_1, \ldots b \cdot f_n) = (a \cdot (b \cdot f_1), \ldots a \cdot (b \cdot f_n)) \\
= &(a \cdot b) \cdot f_1, \ldots (a \cdot b) \cdot f_n) = (a \cdot b)(f_1,\ldots f_n).
\end{align*}
\item \textbf{Distributivity($+,\cdot$)}: This is a consequence of $F$ being a vector space.  Because multiplication and addition are distributive in $F$, their combination in our vector space is distributive as well.
\end{itemize}
\item A specific consequence of the above result is that something like $\left(\mathbb{Z}/5\mathbb{Z}\right)^n$ is a vector space.  This is a somewhat strange-looking beast: it's a vector space over a finite-sized field!  In particular, it's a vector space with only finitely many elements, which is weird.

To understand this better, we look at some examples.  Consider $\left(\mathbb{Z}/5\mathbb{Z}\right)^2$.  This is the vector space consisting of elements of the form
\begin{align*}
(a,b),
\end{align*}
where $a, b \in \{0,1,2,3,4\}$.  We add and scale elements in this vector space using mod-5 modular arithmetic: for example,
\begin{align*}
(2,3) + (4,4) = (1, 2),
\end{align*}
because $2 +4 \equiv 1 \mod 5$ and $3+4 \equiv 2 \mod 5$.  Similarly,
\begin{align*}
2(3,1) = (1,2),
\end{align*}
because $2 \cdot 3 \equiv 1 \mod 5$ and $2 \cdot 1 \equiv 2 \mod 5$.

Perhaps surprisingly, these odd-looking vector spaces are some of the most-commonly used spaces in the theoretical computer science/cryptographic settings.  In particular, they come up very often in the field of \href{http://en.wikipedia.org/wiki/Elliptic_curve_cryptography}{elliptic curve cryptography}, and are instrumental to how a number of modern cryptographic schemes work.
\end{itemize}


There are some odder examples of vector spaces:
\begin{itemize}
\item Polynomials!  Specifically, let $\mathbb{R}[x]$ denote the collection of all finite-degree polynomials in one variable $x$ with real-valued coefficients.  In other words,
\begin{align*}
\mathbb{R}[x] = \{ a_0 + a_1x + \ldots a_nx^n | a_0, \ldots a_n \in \mathbb{R}, n \in \mathbb{N}\}.
\end{align*}
Verifying that this is a vector space is not very difficult --- try it if you don't believe it!
\item Matrices!  Specifically, let $M_\mathbb{R}(n,n)$ denote the set of $n \times n$ matrices with real-valued entries.  For example
\begin{align*}
M_{\mathbb{R}}(3,3) = \left\{  \left.  \begin{bmatrix}a&b&c\\d&e&f\\g&h&i\\\end{bmatrix}~ \right|  ~ a,b,c,d,e,f,g,h,i \in \mathbb{R}\right\}.
\end{align*}

If we define matrix addition as simply entrywise addition: i.e.\
\begin{align*}
\begin{bmatrix}a_{11}&a_{12}&\ldots & a_{1n}\\a_{21}&a_{22}&\ldots & a_{2n} \\ \vdots& \vdots& \ddots & \vdots \\ a_{n1} & a_{n2} & \ldots & a_{nn}  \\\end{bmatrix} + \begin{bmatrix}b_{11}&b_{12}&\ldots & b_{1n}\\b_{21}&b_{22}&\ldots & b_{2n} \\ \vdots& \vdots& \ddots & \vdots \\ b_{n1} & b_{n2} & \ldots & b_{nn}  \\\end{bmatrix} = \begin{bmatrix}a_{11}+ b_{11}&a_{12} + b_{12}&\ldots & a_{1n} + b_{1n}\\a_{21} + b_{21}&a_{22}+ b_{22}&\ldots & a_{2n} + b_{2n} \\ \vdots& \vdots& \ddots & \vdots \\ a_{n1} + b_{n1} & a_{n2} + b_{n2} & \ldots & a_{nn} + b_{nn} \\\end{bmatrix}, 
\end{align*}
and scalar multiplcation as simply entrywise multiplication, i.e.\
\begin{align*}
c\begin{bmatrix}a_{11}&a_{12}&\ldots & a_{1n}\\a_{21}&a_{22}&\ldots & a_{2n} \\ \vdots& \vdots& \ddots & \vdots \\ a_{n1} & a_{n2} & \ldots & a_{nn}  \\\end{bmatrix} = \begin{bmatrix}ca_{11}&ca_{12}&\ldots & ca_{1n}\\ca_{21}&ca_{22}&\ldots & ca_{2n} \\ \vdots& \vdots& \ddots & \vdots \\ ca_{n1} & ca_{n2} & \ldots & ca_{nn}  \\\end{bmatrix},
\end{align*}
then this is a vector space!  Specifically, it's a vector space for precisely the same reasons that $\mathbb{R}^n$ is a vector space: if you just think of a $n \times n$ matrix as a very oddly-written vector in $\mathbb{R}^{n^2}$, then every argument for why $\mathbb{R}^{n^2}$ is a vector space carries over to $M_\mathbb{R}(n,n)$.  

It might seem odd to think of matrices as a vector space, but if you go further in physics or pure mathematics, this is an incredibly useful and common construction.
\end{itemize}

Two of the most important concepts when working with vector spaces are the ideas of \textbf{span} and \textbf{linear independence}.  We define these in the next subsection:

\subsection{Span and linear independence.}

When we're working with vectors in a vector space, there's really only two operations we've discussed that we can do: vector addition and scalar multiplication.  A useful thing to think about, then, is the collection of all sorts of objects that we can make using these operations!  We define these things here:
\begin{defn}
Let $V$ be a vector space over some field $F$.  A \textbf{linear combination} of some set of vectors $S$ is any sum of the form
\begin{align*}
a_1 \vec{v_1} + a_2\vec{v_2} + \ldots a_n\vec{v_n},
\end{align*}
where $a_1, \ldots a_n$ are all elements of our field $F$, and $\vec{v_1}, \ldots \vec{v_n} \in S$.
\end{defn}
In other words, a linear combination of some set of vectors is anything we can make by scaling and adding these vectors together.  

A useful thing to study, given some set $\{\vec{v_1}, \ldots \vec{v_n}$ of vectors, is the following: what can we make with these vectors?  In other words, what is the collection of all \textbf{linear combinations} of these vectors?

This question is sufficiently common that we have a term for its related concept: the idea of \textbf{span}!
\begin{defn}
Given any nonempty collection of vectors $A$, the \textbf{span} of $A$, denoted span$(A)$, is the collection of all linear combinations of elements of $A$.  In other words,
\begin{align*}
\textrm{span}(A) = \{ a_1 \vec{v_1} + a_2\vec{v_2} + \ldots a_n\vec{v_n} | n \in \mathbb{N}, a_1\ldots a_n \in \mathbb{R}, \vec{v_1}, \ldots \vec{v_n} \in A\}.
\end{align*}

Notice that the span of any nonempty set of vectors $A \subseteq V$ is a vector space in its own right.  This is not hard to see: I leave the proof to the HW for interested students.
\end{defn}

A genre of questions you'll often encounter in a linear algebra class is ``Given some set $A$ of vectors, what is their span?  Is some other vector $\vec{w}$ contained within this span?''

We give an example of a calculation here:
\begin{quest}
You have been hired as a deep-sea navigator.  Your first task is to pilot a submarine from our ship, anchored at $(0,0,0)$ in the diagram below, to observe a whale at $(12,6,-6)$.  Your submarine has three engines on it.  The first, when ran for a cycle, moves the submarine $(2,1,0)$ units from its current location.  The second, when ran for a cycle, moves the submarine $(0,2,1)$ units from its current location.  Finally, the third, when ran for a cycle, moves the submarine $(1,0,2)$ units from its current location.  Submarine engines can be fired for fractional units of time, and when ran in reverse moves the shuttle backwards along that given vector.
\begin{center}
\includegraphics[width=3in]{math108a_wk1_lecture5_ship_diagram.pdf}
\end{center}
Can you make it to the whale?
\end{quest}
\begin{answer}
Essentially, our question is asking if the vector $(12,6,-6)$ is contained in the span of the three vectors $(2,1,0), (0,2,1), (1,0,2)$.  

I claim that it is!  To see why, simply just start trying to combine these three vectors into $(12,6,-6)$.  If we assume that we fire the first engine for $a$ units, the second for $b$ units, and the third for $c$ units, we're essentially trying to find $a,b,c$ such that 
\begin{align*}
a(2,1,0) + b(0,2,1) + c(1,0,2) = (12,6,-6).
\end{align*}
This gives us three equations, one for the $x$-co\"ordinate, one for the $y$-co\"ordinate, and a third for the $z$-co\"ordinate:
\begin{align*}
2a + 0b + 1c &= 12,\\
1a+2b+0c &= 6,\\
0a+1b+2c &= -6.\\
\end{align*}
Subtracting two copies of the second equation from the first gives us
\begin{align*}
-4b + c = 0,
\end{align*}
in other words $c = 4b$.  
Plugging this into the last equation gives us
\begin{align*}
b + 2(4b) = -6,
\end{align*}
i.e. $b = -\frac{2}{3}$.  This gives us then that $c = -\frac{8}{3}$, and thus that 
\begin{align*}
2a - \frac{8}{3} = 12,
\end{align*}
i.e.\ $a = \frac{22}{3}$.

Consequently, we've just calculated that
\begin{align*}
\frac{22}{3}(2,1,0) - \frac{2}{3}(0,2,1) - \frac{8}{3}(1,0,2) = (12,6,-6);
\end{align*}
in other words, that $(12,6,-6)$ is in the span of our set of vectors, and therefore that we can get to it by using our three engines as described by $a,b,c$!
\end{answer}



We can turn span into a verb as follows:
\begin{defn}
Suppose that $A = \{\vec{v}_1, \ldots \vec{v}_n\}$ is some set of vectors, drawn from some vector space $V$.  In the proposition above, we proved that span$(A)$ is a subspace of the vector space $V$: in other words, span$(A)$ is a vector space in its own right!  Suppose that span$(A)$ is equal to the vector space $U$.  Then we say that $A$ \textbf{spans} $U$.
\end{defn}

This definition motivates a second kind of question: Take some vector space $V$.  Can we find a set $A$ of vectors that spans $V$?  

The answer here is clearly yes: we can just pick $A$ to be $V$ itself!  Then the span of $A$ is certainly $V$, because every vector of $V$ is simply contained in $A$.  Yet, this answer is also kind of\ldots dumb.  While $A$ spans $V$, it does so with a lot of redundancy: i.e.\ if $V$ was $\mathbb{R}^3$, we'd be using a set with infinitely many elements to span $\mathbb{R}^3$, when we really only need the three vectors $(1,0,0), (0,1,0), (0,0,1)$.

Here's a related question, to help us spot this kind of inefficiency: suppose we have some set $A$ of vectors.  Is it possible to remove a vector from $A$ and still have a set with the same span as $A$?

This concept \textbf{also} comes up all the time in mathematics!  Therefore, we have a definition for it:
\begin{defn}
Let $V$ be some vector space over a field $F$, and $A$ be a subset of $V$.  We say that the set $A$ is \textbf{linearly dependent} if there is some $n > 0$ and distinct elements $\vec{v_1}, \ldots \vec{v_n} \in A$, field coefficients $ a_1, \ldots a_n \neq 0 \in F$ such that
\begin{align*}
\vec{0} = a_1 \vec{v_1} + a_2\vec{v_2} + \ldots a_n \vec{v_n}.
\end{align*}
In other words, a set $A$ is linearly dependent if there is a linear combination of elements in $A$ that sums to 0.  

If no such combination exists, then we say that $A$ is \textbf{linearly independent.}
\end{defn}

Notice that if a set is \textbf{linearly dependent}, then there is some vector within it that we can remove without changing its span!  If this was a linear algebra class, we'd prove this here; instead we reserve it for the HW!
\begin{lemma}\label{lindeplem}
Let $V$ be a vector space over a field $F$, and $S$ be a linearly dependent subset of $V$.  Then there is some vector $\vec{v}$ in $S$ that we can remove from $S$ without changing its span.
\end{lemma}

By repeatedly applying Lemma \ref{lindeplem}, you can get the following theorem:
\begin{theorem}
Any finite set of vectors $S$ has a linearly independent subset $T$, such that span$(S) = $ span$(T)$.
\end{theorem}

\begin{aside}
In the infinite case, things are much more complicated.  In particular, the above process, of repeatedly removing elements one-by-one, isn't guaranteed to ever stop!  For example, suppose you had the set $S = \{(z,0): z\neq 0 \in \mathbb{Z}\}$.  

This is an infinite set.  Moreover, because the span of this set is simply $\{(x,0): x \in \mathbb{R}\}$, literally any single element $(z,0)$ of $S$ will have the same span as $S$: this is because $\frac{x}{z}(z,0)$ is a linear combination using just $(z,0)$ that can generate any element in span$(S)$.

However, suppose you were simply removing elements one-by-one from $S$.  It is possible, through sheer bad luck, you would pick the elements $(1,0), (2,0), (3,0), (4,0), \ldots$ all in a row.  This would never get you down to a linearly independent set!  In particular, you'd still have all of the elements $(z,0)$ where $z$ is a negative integer lying around, and there are tons of linear combinations of these elements that combine to $(0,0)$.  

So the argument above doesn't work.  However, the result is still true: there \textbf{is} a subset that is linearly independent with the same span!  Proving that this always exists, though, is tricky, and requires the use of things like the \href{http://en.wikipedia.org/wiki/Axiom_of_choice}{axiom of choice}.  Talk to me if you want to see how this works!
\end{aside}


We define all of this so we can get to the concepts of \textbf{basis} and \textbf{dimension}:
\subsection{Basis and dimension.}

\begin{defn}
Take a vector space $V$.  A \textbf{basis}  $B$ for $V$ is a set of vectors $B$ such that $B$ is linearly independent, and span($B) = V$.
\end{defn}

Bases are really useful things.  You're already aware of a few bases:
\begin{itemize}
\item The set of vectors $\vec{e_1} = (1,0,0\ldots 0), e_2 = (0,1,0\ldots 0), \ldots e_n = (0,0\ldots 0, 1)$ is a basis for $\mathbb{R}^n$.
\item The set of polynomials $1,x,x^2, x^3, \ldots$ is a basis for $\mathbb{R}[x]$.
\end{itemize}

As a quick example, we study another interesting basis:
\begin{quest}
Consider the set of vectors
\begin{align*}
S = \{ (1,1,1,1), (1,1,-1,-1), (1,-1,1,-1), (1,-1,-1,1)\}.
\end{align*}
Show that this is a basis for $\mathbb{R}^4$.
\end{quest}
\begin{proof}
Take any $(w,x,y,z) \in \mathbb{R}^4$.  We want to show that there are always $a,b,c,d$ such that 
\begin{align*}
a(1,1,1,1) + b(1,1,-1,-1) + c(1,-1,1,-1)+ d(1,-1,-1,1) = (w,x,y,z),
\end{align*}
and furthermore that if $(w,x,y,z) = (0,0,0,0)$ that this forces $a,b,c,d$ to all be 0.  This proves that the span of $S$ is all of $\mathbb{R}^4$ and that $S$ is linearly independent, respectively.

We turn the equation above into four equalities, one for each co\"ordinate in $\mathbb{R}^4$:
\begin{align*}
a + b + c + d &= w\\
a + b - c - d &= x\\
a-b +c - d &= y\\
a-b-c+d &= z\\
\end{align*}
Summing all four equations gives us
\begin{align*}
4a = w+x+y+z.\\
\end{align*}
Adding the first two equations and subtracing the second two equations gives us
\begin{align*}
4b = w+x-y-z.\\
\end{align*}
Adding the first and third, and subtracting the second and fourth gives us
\begin{align*}
4c = w+y-x-z.\
\end{align*}
Finally, adding the first and fourth and subtracting the second and third yields
\begin{align*}
4d = w+z-x-y.\\
\end{align*}
So: if $(w,x,y,z) = (0,0,0,0)$, this means that $a=b=c=d=0$.  Therefore, our set is linearly independent.

Furthermore, for any $(w,x,y,z)$, we have that
\begin{align*}
&\frac{w+x+y+z}{4}(1,1,1,1) + \frac{w+x-y-z}{4}(1,1,-1,-1) \\
+& \frac{w+y-x-z}{4}(1,-1,1,-1) + \frac{w+z-x-y}{4}(1,-1,-1,1) = (w,x,y,z).
\end{align*}
Therefore, we can combine these four elements to get any vector in $\mathbb{R}^4$; i.e.\ our set spans $\mathbb{R}^4$.
\end{proof}

This example is interesting because its entries satisfy the following two properties:
\begin{itemize}
\item Every vector is made up out of entries from $\pm 1$.
\item The dot product of any two vectors is 0.
\end{itemize}
Finding a basis of vectors that can do this is actually an open question.  We know that they exist for any $\mathbb{R}^n$ where $n$ is a multiple of 4 up to 664, but no one's found such a basis for $\mathbb{R}^{668}$.  Find one for extra credit?


Another natural idea to wonder about is the following: given a vector space $V$, what is the smallest number of elements we need to make a basis?  Can we have two bases with different lengths?

This is answered in the following theorem:
\begin{thm}
Suppose that $V$ is a vector space with two bases $B_1 = \{\vec{v_1}, \ldots \vec{v_n}\}$, $B_2 = \{\vec{w_1}, \ldots \vec{w_m}\} $ both containing finitely many elements.  Then these sets have the same size: i.e.\ $|B_1| = |B_2|.$
\end{thm}
We again reserve this for the HW!

Using this, we can finally define the concept of \textbf{dimension}:

\begin{defn}
Suppose that $V$ is a vector space with a basis $B$ containing finitely many elements.  Then we say that the \textbf{dimension} of $V$ is the number of elements in $B$.
\end{defn}

For example, the dimension of $\mathbb{R}^n$ is $n$, because this vector space is spanned by the vectors $\vec{e_1} = (1,0,0\ldots 0), e_2 = (0,1,0\ldots 0), \ldots e_n = (0,0\ldots 0, 1)$.



\end{document}