NOTE: This page contains all the machineverifiable examples presented during the lectures, as well as all the homework assignments.
Click here to go back to the main page with the course information and schedule.
1. Introduction and Motivation
This section introduces at a high level the direction and goals of this course, as well as some terminology.
Do not worry if all the details are not clear; all this material will be covered in greater detail and with many more examples during the course.
1.1. Models, systems, and system states
When many realworld problems are addressed or solved mathematically and computationally, the details of those problems are abstracted away until they can be represented directly as idealized mathematical structures (e.g., numbers, sets, matrices, and so on). We can talk
about this distinction by calling the realworld problems systems (i.e., organized collections of interdepentend components) that have
distinguishable system states, and the abstract versions of these systems that only capture some parts or aspects of the different
system states as models. Since models are abstractions, we must also consider the interpretation of a model that explains how
the different parts of the model are related to the different parts of the system (i.e., what each part of the model represents).
Definition: We represent the set of all real numbers using the symbol
R.
 =  { 1, 1.2, 3, 4, 1/3, π, e, ... }


The set of real numbers is a very simple kind of model that can be used to represent
quantities or, by considering quantities and fractions of units (e.g., inch, meter, kilogram, and so on), a magnitude.
If we adopt R as our model of a system, we can then represent individual system states using individual real numbers.
model (language for describing system states) 
example of a system state in the model 
interpretation 
system 
R 
7 
number of giraffes 
zoo 
R 
1 
distance in AU between the two objects 
the EarthSun system 
R 
5.6 
temperature in Celsius 
weather in Boston 
Thus, real numbers are a very simple symbolic language for modelling systems. Furthermore, this language allows us to describe characteristics of
systems concisely ("7" is much more concise than a drawing of seven giraffes).
1.2. A language of system states: terms and their algebraic properties
Real numbers can be used to characterize the quantities or magnitudes of parts of a system, but this is often not enough.
We may want to capture within our models certain kinds of changes that might occur to a system. In order to do so, we must
add something to our language of models: binary operators such as +, , ⋅, and so on.
model (language for describing system states) 
a system state in the model 
interpretation 
system 
R with addition (+) 
3 
number of apples in one of the apple baskets 
a collection of apple baskets 
R with addition (+) 
3 + 2 
number of apples in two of the apple baskets 
a collection of apple baskets 
R with addition (+) 
2 + 3 
number of apples in two of the apple baskets 
a collection of apple baskets 
symbolic language 
symbol string (a.k.a., "term") in the language 
meaning of symbol string 
system 
The different parts of this language for models have technical names. So far, we have seen real numbers and operators. We can build up
larger and larger symbol strings using operators and real numbers. These are all called terms.
Definition: The following table defines the collection of symbol strings corresponding to
terms.
term 

0 

1.2 

x 
x is a real number 
t_{1} + t_{2} 
if t_{1} and t_{2} are terms 
t_{1} − t_{2} 
if t_{1} and t_{2} are terms 
− t 
if t is a term 
t_{1} ⋅ t_{2} 
if t_{1} and t_{2} are terms 
Note that in these notes, we use the multiplication symbols ⋅ and * interchangeably, or omit them entirely.
Notice that when our language for models only had real numbers, each symbol corresponded to a unique system state. However, by introducing
operators into our language for describing system states, we are now able to write down multiple symbol strings that represent the same
system state (e.g., 2 + 3 and 3 + 2). In other words, "2 + 3" and "3 + 2" have the same meaning.
Exercise: List as many of the algebraic properties of the operators + and ⋅ over the real numbers as you can.
For all real numbers x ∈ R, y ∈ R, and z ∈ R, it is true that:
1.3. Extending the language of models: vectors and matrices
Real numbers and operators are still not sufficient to capture many interesting aspects of realworld systems: they can only capture quantities,
onedimensional magnitudes (e.g., distance). What if we want to capture multidimensional magnitudes (e.g., temperature and pressure)
or relationships between different quantities? These can correspond to points, lines, planes, spaces; relationships and changes within
such systems can be modelled as translations, rotations, reflections, stretching, skewing, and other transformations.
Example: Suppose we have $12,000 and two investment opportunities: one has an annual return of 10%, and the other has an annual return
of 20%. How much should we invest in each opportunity to get exactly $1800 over one year?
The above problem can be represented as a system in which two magnitudes x ∈ R and y ∈ R have a relationship. Typically, this is
represented using a system of equations:
The possible solutions to this system are the collection of all pairs of real numbers that can be assigned to the pair (
x,
y). These are the
possible system states. Notice that these can be interpreted directly as points on a plane.
How does the above example suggest we might extend our language for system states in a model? We might consider ordered pairs (x,y) of
real numbers. More generally, we might consider ordered lists (x_{1},...,x_{n}) of real numbers. In this course,
we will introduce a few new kinds of terms into our language for models that can help us represent these sorts of relationships within systems:
vectors and matrices. We will also study the algebraic properties of this extended language.
new term language construct 
what it represents 
vectors 
system state in the model 
matrix 
transitions between system states 
matrix 
changes to system states 
matrix 
relationships between system states 
matrix multiplication 
composition of transformations of system states 
1.4. Review: sets and formulas
Definition: The symbols and, or, and not are logical operators. The symbols ∀ and ∃ are
quantifiers, where ∀ is read "for all" and is called the universal quantifier, while ∃ is read "exists"
and is called the existential quantifier.
Definition: Strings of mathematical symbols that can be either true or false are called
formulas. The following
table describes how formulas can be built up using logical operators and logical quantifiers, and their meanings.
formula 
conditions 
meaning 
true 

always true 
false 

always false 
t_{1} = t_{2} 
t_{1} and t_{2} are terms 
true only if the meaning (e.g., system state) of t_{1} and t_{2} is the same 
t_{1} < t_{2} 
t_{1} and t_{2} are terms 
true only if t_{1} and t_{2} represent real numbers, and t_{1} is less than t_{2} 
f_{1} and f_{2} 
if f_{1} and f_{2} are formulas 
only true if both f_{1} and f_{2} are true; otherwise, it is false 
f_{1} or f_{2} 
if f_{1} and f_{2} are formulas 
true if f_{1}, f_{2}, or both are true; only false if both are false 
not f 
if f is a formula 
true if f is false; false if f is true 
f_{1} implies f_{2} 
if f_{1} and f_{2} are formulas 
only true if f_{2} is true whenever f_{1} is true, or equivalently, only true if f_{1} is false or f_{2} is true 
f_{1} iff f_{2} 
if f_{1} and f_{2} are formulas 
only true if f_{1} and f_{2} are both true, or f_{1} and f_{2} are both false 
∀ x ∈ S, f 
if S is a set and f is a formula 
true only if taking for every element of S, replacing x inside f with that element makes f true 
∃ x ∈ S, f 
if S is a set and f is a formula 
true only if there is at least one element of S that can replace x inside f so that f is true 
Definition: The symbols =, <, >, ≤, ≥, ≠, and ∈ are
relational operators or relations. Given two terms, t_{1} and t_{2}, apply any of these operators to the terms produces
a formula that is either true of false (e.g., "5 ≤ 6").
Fact: The relational operator = (the
equality relation or just
equality) has the following properties.
property 
definition 
example 
reflexivity 
for any term t, t = t 
∀ x ∈ R, x = x
\forall x \in \R, x = x

symmetry 
for any terms t_{1} and t_{2}, t_{1} = t_{2} implies t_{2} = t_{1} 
∀ x,y ∈ R, x = y implies y = x
\forall x,y \in \R, x = y \implies y = x

transitivity 
for any terms t_{1}, t_{2}, and t_{3}, t_{1} = t_{2} and t_{2} = t_{3} implies t_{1} = t_{3} 
∀ x,y,z ∈ R, x = y y = z implies x = z
\forall x,y,z \in \R, x = y y = z \implies x = z

The above properties always apply to =. The properties below are assumptions we
make in this course (they are extensions of the definition of equality):

equality of vectors: for any terms t_{1}, t_{2}, and t_{3}, t_{1} = t_{3} and t_{2} = t_{4} iff

replacement:
for any terms t_{1}, t_{2}, and t_{3}, t_{1} = t_{2} iff
2. Vectors
In this section we consider a particular kind of term: a vector. A vector can have many interpretations, but the most common
is that of a point in a geometric space. We first define a notation for names of vectors. Vectors will be written using any
of the the following equivalent notations:
(2,3) [2;3]
(
x,
y,
z) [
x;
y;
z]
2.1. Defining operations on vectors
We have introduced a new kind of term (vectors) with their own corresponding notation.
As with R, the set of real numbers, we define symbol to represent the sets of vectors.
Definition: We represent the set of all vectors with two components using the symbol
R^{2}:
Definition: For positive
n ∈ N, we represent the set of all vectors with
n components using the symbol
R^{n}:
 =  {    x_{1} ∈ R, ..., x_{n} ∈ R }


We will also use symbols to name some geometric manipulations of vectors. One such operation is addition. Suppose we treat vectors as paths
from (0,0), so that (2,3) is the path from (0,0) to (2,3) and (1,2) is the path from (0,0) to (1,2). Then vector addition would represent
the final destination if someone walks first along the length and direction specified by one vector, and then from that destination along
the length and direction specified by the other. The following definition for the operation + and vectors of two components corresponds
to this intuition.
Definition: The following formula is assumed to be true; it defines what operation the symbol + represents when applied to two vectors.
We call +
vector addition in this context.
\forall x, y, x', y' \in \R,
[x; y] + [ x'; y'] = [x + x'; y + y']
Notice that we have defined an entirely new operation; we are merely reusing (or "overloading") the + symbol to represent this operation.
We cannot assume that this operation has any of the properties we normally associate with addition of real numbers. However, we do know
that according to our interpretion of vector addition (walking along one vector, then along the other from that destination), this operation
should be commutative. Does our symbolic definition conform to this interpretation? If it does, then we should be able to show that
[x;y] + [x';y'] and [x+x';y+y'] are names for the same vector. Using the commutativity of the real numbers and our definition
above, we can indeed write the proof of this property.
Fact: Vector addition is commutative.
\forall x, y, x', y' \in \R,
[x; y] + [x'; y'] = [x + x'; y + y']
`` = [x' + x; y' + y]
`` = [x'; y'] + [x; y]
Recall that we can view multiplication by a number as repeated addition. Thus, we could use this intuition and our new notion of vector addition
defined above to define multiplication by a real number; in this context, it will be called a scalar, and the operation is known as
scalar multiplication.
Definition: The following formula is assumed to be true; it defines what operation the symbol ⋅ represents when applied to
a
scalar (a real number)
s ∈ R and a vector. We call ⋅
scalar multiplication in this context.
\forall s,x,y \in \R,
s * [x; y] = [s * x; s * y]
Note that, as with multiplication, the symbol is sometimes omitted.
Scalar multiplication has some of the intuitive algebraic properties that are familiar to us from our experience with R. Below, we provide
proofs of a few.
Fact: The following fact is true for scalar multiplication.
\forall s, t, x, y \in \R,
s (t [x; y]) = s ([t x; t y])
`` = [ s (t x); s (t y) ]
`` = [ (s t) x; (s t) y ]
`` = [ (t s) x; (t s) y ]
`` = [ t (s x); t (s y) ]
`` = t [ s x; s y ]
`` = t (s ( [x; y]))
# alternatively, we could also derive...
[ s (t x); s (t y) ] = [ (s t) x; (s t) y ]
`` = (s t) [x;y]
Once we have defined scalar multiplication, we can now assign a meaning to the negation operator (interpreting v for any vector v ∈ R^{2} as
referring to the scalar multiplication −1 ⋅ v).
Definition: The following formula is assumed to be true; it defines what operation the symbol − represents when applied to
a vector.
\forall x,y \in \R,
 [x; y] = [ x;  y]
The above definition allows us to define vector subtraction: for two vectors v and w ∈ R^{2}, v  w = v + (w).
Notice that we did not define vector division. In fact, division by a vector is undefined (in the same way that division by 0 is undefined).
However, we can prove a cancellation law for vectors.
Fact: Let [
x;
y] =
v ∈ R^{2} be a vector
with at least one nonzero real number component,
and let
a,
b ∈ R be scalars. Suppose that
a ⋅
v =
b ⋅
v. If
x is a nonzero component, then we have that:
Notice that we used division by x, a real number.
2.2. Properties of vector operations
In this course, we will study collections of vectors that have particular properties. When a collection of vectors satisfies these properties,
we will call it a vector space. We list these eight properties (in the form of equations) below. These must hold for any u, v, and w
in the collection, and 0 must also be a vector in the collection.
Note that these are not unique; we could have specified an alternative equation for the additive identity.
v + 0 = v
Each equation can be derived from the other using the commutativity
v + 0 = 0 + v
These eight equations can be called axioms (i.e., assumptions) when we are studying vector spaces without thinking about the internal
representation of vectors. For example, the above derivation of the alternative additive identity equation is based entirely on the axioms
and will work for any vector space. However, to show that some other structure, such as R^{2}, is a vector space we must prove that these
properties are satisfied. Thus, to define a new vector space, we usually must:
 define a way to construct vectors;
 define a vector addition operator + (i.e., how to add vectors that we have constructed);
 specify the vector that is the additive identity (call it 0);
 define vector inversion: a process for constructing the inverse of a vector;
 prove that the eight properties of a vector space are satisfied by the vectors, +,0, and *.
Example: Assuming the following equation is true, solve for
x ∈ R and
y ∈ R:
\forall x, y \in \R,
[x; 10] = 2 * [4; y]
\implies
[x; 10] = [2 * 4 ; 2 * y]
`` = [8 ; 2 * y]
x = 8
10 = 2 * y
(0.5) * 10 = 0.5 * (2 * y)
5 = (0.5 * 2) * y
5 = 1 * y
5 = y
y = 5
Example: Assuming the following equation is true, solve for
x ∈ R and
y ∈ R:
\forall x, y \in \R,
[x; 2 * x] = 5 * [2 * y; 20]
\implies
[x; 2 * x] = 5 * [2 * y; 20]
`` = [5 * (2 * y); 5 * 20]
[x; 2 * x] = [(5 * 2) * y; 100]
2 * x = 100
0.5 (2 * x) = 0.5 * 100
(0.5 * 2) x = 50
1 * x = 50
x = 50
x = 10 * y
0.1 * 50 = 0.1 * (10 * y)
`` = (0.1 * 10) * y
`` = 1 * y
`` = y
y = 5
In this assignment you will perform stepbystep algebraic manipulations involving vectors and vector operations. In doing
so, you will assemble machineverifiable proofs of algebraic facts.
Your proofs must be automatically verifiable using the proof verifier.
Please submit a single text file a1.txt
containing your proof scripts for each of the problem parts below.
Working with machine verification can be frustrating; minute operations that are normally implied must often be explicit.
However, the process should familiarize you with common practices of rigorous algebraic reasoning in mathematics: finding, applying,
or expanding definitions to reach a particular formula that represents a desired argument or solution.

 Finish the proof below by solving for a using a sequence of permitted algebraic manipulations.
\forall a, b \in \R,
[3; a] = [b; b + 8]
\implies
# ... put proof steps here ...
a = ? # replace "?" with an integer
 Finish the proof below by solving for b in terms of a.
\forall a,b \in \R,
[b; 38] = [3; 7] a + [0; 4] b
\implies
# ... put proof steps here ...
b = ? # replace "?" with a term containing "a"
 Finish the proof below to show that [1;2] and [2;1] are linearly independent.
[1; 2] * [2; 1] = 1 * 2 + 2 * 1 \and
# ... put proof steps here ...
`([1; 2]) and ([2; 1]) are orthogonal`
 Solve for x (the solution is an integer).
\forall x \in \R,
`([x; 4]) and ([1; 1]) are orthogonal`
\implies
# ... put proof steps here ...
x = ?
 Show that no [x; y] exists satisfying both of the below properties by deriving a contradiction (e.g.,
1 = 0
).
\forall x,y \in \R,
`([x; y]) is a unit vector`
`([x*x; y*y]) and ([1; 1]) are orthogonal`
\implies
# ... put proof steps here ...
? # this should be a contradiction
 We have shown in lecture that R^{2}, together with vector addition and scalar multiplication, satisfies some of the vector space axioms.
In this problem, you will show that the remaining axioms are satisfied.
 Finish the proof below showing that [0; 0] is a left identity for addition of vectors in R^{2}.
\forall x,y \in \R,
# ... put proof steps here ...
[0; 0] + [x; y] = [x; y]
 Finish the proof below showing that [0; 0] is a right identity for addition of vectors in R^{2}.
\forall x,y \in \R,
# ... put proof steps here ...
[x; y] + [0; 0] = [x; y]
 Finish the proof below showing that 1 is the identity for scalar multiplication of vectors in R^{2}.
\forall x,y \in \R,
# ... put proof steps here ...
1 * [x; y] = [x; y]
 Finish the proof below showing that the componentwise definition of inversion is consistent with the inversion axiom for vector spaces.
\forall x,y \in \R,
# ... put proof steps here ...
[x; y] + ([x; y]) = [0; 0]
 Finish the proof below showing that the addition of vectors in R^{2} is associative.
\forall a,b,c,d,e,f \in \R,
# ... put proof steps here ...
[a; b] + ([c; d] + [e; f]) = ([a; b] + [c; d]) + [e; f]
 Finish the proof below showing that the distributive property applies to vector addition and scalar multiplication for R^{2}.
\forall s, x, y, x', y' \in \R,
# ... put proof steps here ...
s ([x; y] + [x'; y']) = (s [x; y]) + (s [x'; y'])

Any point p on the line between vectors u and v can be expressed as a(uv)+u for some scalar a. In fact, it can also be
expressed as b(uv)+v for some other scalar b. In this problem, you will prove this fact for R^{3}.
Given some p = a(uv)+u, find a formula for b in terms of a so that p = b(uv)+v. Add this formula to the beginning
of the proof (after a =
) and then complete the proof.
\forall a,b \in \R, \forall u,v,p \in \R^3,
p = a (u  v) + u
a = ? # define a in terms of b
\implies
# ... put proof steps here ...
p = b (u  v) + v
The verifier's library contains
a variety of derived algebraic properties for R and R^{3} in addition to the vector space axioms for R^{3}. Look over them
to see which might be useful.
2.4. Common vector properties, relationships, and operators
We introduce two new operations on vectors (e.g. u and v): the norm ( ... ) and the dot product (u ⋅ v). When interpreting some other structure,
such as R^{2}, as a vector space, we must provide definitions for these operators in order to use them.
Definition: The operator ⋅ when applied to two vectors with the same number of components is called the
dot product, and
is defined for
x,
y,
x',
y'
∈ R as:
The operator  ...  when applied to a vector is called the
norm and is defined as:
The norm 
v  of a vector
v represents its length in Euclidean space.
Notice that the dot product is a new, distinct form of multiplication (distinct from multiplication of real numbers, and distinct from scalar multiplication). Also
notice that the two operations are related:
Fact: The following equation is true for all
x,
y,
x',
y'
∈ R:
 =  √(x*x + y*y) = √([x; y] ⋅ [x; y])


These operations can be shown to have various algebraic properties.
Fact: The dot product is commutative. Notice that below, the dot product is a real number.
\forall a,b,c,d \in \R,
[a; b] * [c; d] = a*c + b*d
`` = c*a + d*b
`` = [c; d] * [a; b]
We also introduce several vector properties. Some deal with a single vector; some deal with two vectors; and some deal with three vectors.
Definition: The table below summarizes the definitions of several vector properties and relationships and how they are related in some
cases to vector operators and associated algebraic properties.
property 
definition(s) 
algebraic properties for R^{2} u = [x;y], v = [x',y'], w = [x'',y''] 
v has length s 
v = s or √(v ⋅ v) = s 
v = √(x*x + x*y) = √([x,y] ⋅ [x,y]) 
v is a unit vector 
v = 1 or v ⋅ v = 1 
1 = v = √(x*x + x*y) = √([x,y] ⋅ [x,y]) 1 = v = x*x + x*y = [x,y] ⋅ [x,y] 
u and v are linearly dependent u and v are collinear 
∃ a ∈ R, a ⋅ u = v 
y/x = y'/x' (the vectors have the same slope) 
u and v are linearly independent 
∀ a ∈ R, a ⋅ u ≠ v or equivalently, not (∃ a ∈ R, a ⋅ u = v) 
y/x ≠ y'/x' (the vectors have different slopes) 
u and v are orthogonal 
u ⋅ v = 0 
y/x = x'/y' 
w is a projection of v onto u 
w = (v ⋅ (u/u)) ⋅ u/u 

d is the (Euclidean) distance between v and w 
d = u  v = v  u 
d = √((x  x')^{2} + (y  y')^{2}) 
L is the unique line parallel to v ∈ R^{2} 
L = { a ⋅ v  a ∈ R } L = { p  ∃ a ∈ R, p = a ⋅ v } 
{ [x',y']  y' = m x' } where m = y/x 
L is the unique line orthogonal to v ∈ R^{2} 
L = { w  v ⋅ w = 0 } 

L is the unique line defined by the two points u ∈ R^{2} and v ∈ R^{2} 
L = { a (u  v) + u  a ∈ R } L = { p  ∃ a ∈ R, p = a (u  v) + u } 

P is the unique plane orthogonal to v ∈ R^{3} 
P = { w  v ⋅ w = 0 } 

P is the unique plane of linear combinations of v, w ∈ R^{3} where v and w are linearly independent 
P = { a v + b w  a ∈ R, b ∈ R } 

w is a linear combination of u and v 
∃ a,b ∈ R, w = au + bv 

{u, v, w} are linearly independent 
not (u is a linear combination of v and w) and
not (v is a linear combination of u and w) and
not (w is a linear combination of u and v)


In R^{2}, we can derive the linear independence of [x;y] and [x';y'] from the orthogonality of [x;y] and [x';y'] using a proof
by contradiction.
Fact: If [
x;
y] and [
x';
y'] are orthogonal (and have nonzero length), then they are linearly independent.
Suppose that [x;y] and [x';y'] are both orthogonal and linearly dependent. Since they are linearly dependent, we have that
there exists an a ∈ R such that:
Since they are orthogonal, we have that:
 =  
 =  
x ⋅ (a ⋅ x) + y ⋅ (a ⋅ y)  
 =  
 =  
 =  
 =  
 =  
 =  
 =  
No real numbers
y and
x satisfy the above equation, so we must have introduced a contradiction by supposing that [
x;
y] and [
x';
y']
are
not linearly independent. Thus, they must be linearly independent.
Also, notice that [0;0] is the only solution to x^{2} + y^{2} = 0. Thus, all vectors in
R^{2} are linearly dependent, linearly independent, and orthogonal with [0;0].
Fact: If
v ∈ R^{2} is a vector that has nonzero length,
then we know that the vector
v/
v: (1) is linearly dependent with
v, and (2) is a unit vector.
 Because v is a vector, then v is a real number that is nonzero, and 1/v is a real number. By our definition of
linear dependence, (1/v) ⋅ v = v/v is linearly dependent with v because 1/v exists.
 Let v = [x;y]. We have that:
Then, we have that:
 =    x / √(x^{2} + y^{2})  y / √(x^{2} + y^{2}) 
 



If we take the norm of the above vector, we have:
   x / √(x^{2} + y^{2})  y / √(x^{2} + y^{2}) 
 
   
 =  √( (x / √(x^{2} + y^{2}))^{2} + (y / √(x^{2} + y^{2}))^{2} ) 

 =  √( (x^{2} / (x^{2} + y^{2})) + (y^{2} / (x^{2} + y^{2})) ) 

 =  √( (x^{2} + y^{2}) / (x^{2} + y^{2}) ) 

 =  
 =  
Thus,  v/v  = 1, so v/v is a unit vector.
Example: List all the unit vectors that are linearly dependent with:
It is sufficient to solve for s ∈ R, x ∈ R, and y ∈ R that satisfy the following equations:
One approach is to write
x and
y in terms of
s and then solve for
s using the second equation.
Example: Solve the following three problems.

Solve the following equation for x ∈ R:

Solve the following equation for x ∈ R and y ∈ R:

  and   are linearly dependent



Determine if the following two vectors are linearly dependent or linearly independent:
In the case of vectors in R^{2}, the properties of linear dependence and orthogonality can be defined in terms of
the slopes of the vectors involved. However, note that these definitions in terms of slope are a special case for R^{2}.
The more general definitions (in terms of scalar multiplication and dot product, respectively) apply to any vectors in a vector space.
Thus, we can derive the slope definitions from the more general definitions.
Fact: If two vectors [
x;
y]
∈ R^{2} and [
x';
y']
∈ R^{2} are linearly dependent, then
x/
y =
x'/
y'.
If the two vectors a linearly dependent, then there exists a scalar
s ∈ R such that:
Fact: If two vectors [
x;
y]
∈ R^{2} and [
x';
y']
∈ R^{2} are orthogonal, then
x/
y = 
y'/
x':
Example: List all unit vectors orthogonal to:
It is sufficient to solve for x ∈ R and y ∈ R that satisfy the following equations:
We can solve the above for the two vectors by first solving for both possible values of
x, then finding the corresponding values for
y:
 =  
 =  
 =  
 =  
√((9/9)x^{2} + (16/9)x^{2}  
 =  
 =  
 =  
 =  
 =  
Thus, the two vectors are:
Orthogonal projections of vectors have a variety of interpretations and applications; one simple interpretation of the projection of
a vector v onto a vector w is the shadow of vector v on w with respect to a light source that is orthogonal to w.
Example: Consider the vector following vectors, where
u,
v ∈ R^{2} and
u is a unit vector:
What is the orthogonal projection of
v onto
u? It is simply the
x component of
v, which is
x. Thus:
  is the projection of v onto u


Notice that we can obtain the length of the orthogonal projection using the dot product:
Since
u is a unit vector, we can then simply multiply
u by the scalar
x to obtain the actual projection:
The above example can be generalized to an arbitrary vector v and unit vector u; then, it can be generalized to any vector u by using
the fact that u/u is always a unit vector.
Example: Compute the orthogonal projection of
v onto
u where:
We can apply the formula:
 =  
 =  
 =  
 =  
(v ⋅ (u/u)) ⋅ (u/u)  
 =  
 =  
 =  
 =  

 =  
Other tools available online
can be used to perform and check computations such as the above.
Example: Solve the problems below.

Compute the orthogonal projection of v onto u where u is a unit vector and:
We can apply the formula:
(v ⋅ (u/u)) ⋅ (u/u)  
 =  
 =  
 =  

Compute the projection of v onto w where:
We can apply the formula:
 =  
 =  
 =  
 =  
(v ⋅ (w/w)) ⋅ (w/w)  
 =  
 =  
 =  
 =  
Fact: Given the points
u = [
x_{1},
y_{1}] and
v = [
x_{2},
y_{2}], we can find the equation of the line between these two points in the
form
y =
mx +
b.
We recall the definition for a line L defined by two points:
 =  { p  ∃ a ∈ R, p = a (u  v) + u }.


Thus, if [
x;
y] is on the line, we have:
This implies the following system of equations (one from the
x components in the above, and one from the
y components):
 =  a (x_{1}  x_{2}) + x_{1} 

 =  a (y_{1}  y_{2}) + y_{1}


If we solve for
a in terms of
x, we can recover a single equation for the line:
 =  (x  x_{1})/(x_{1}  x_{2}) 

 =  ((x  x_{1})/(x_{1}  x_{2})) (y_{1}  y_{2}) + y_{1} 

 =  ((y_{1}  y_{2})/(x_{1}  x_{2})) (x  x_{1}) + y_{1}


Notice that we can set
m = (
y_{1} 
y_{2})/(
x_{1} 
x_{2}) because that is exactly the slope of the line between [
x_{1};
y_{1}] and [
x_{2};
y_{2}].
We see that we can set b =  m x_{1} + y_{1}.
 =  (y_{1}  y_{2})/(x_{1}  x_{2}) 

 =  
 =  
 =  
2.5. Solving common problems involving vector algebra
We review the operations and properties of vectors introduced in this section by considering several example problems.
Example: Are the vectors [2; 1] and [3; 2] linearly independent?
There are at least two ways we can proceed in checking pairwise linear independence. Both involve checking if the vectors
are linearly dependent. If they are linearly dependent, then they cannot be linearly independent. If they are not linearly
dependent, they must be linearly independent.
We can compare the slopes; we see they are different, so they must be linearly independent.
1/2 ≠ 2/3
We can also use the definition of linear dependence. If they are linearly dependent, then we know that
Does such an
a exist? We try to solve for it:
Since we derive a contradiction, there is no such a, so the two vectors are not linearly dependent, which means they
are linearly independent.
Example: Given
v = [15; 20], list the vectors that are orthogonal to
v, but of the same length as
v.
The two constraints on the vectors [x;y] we seek are:
We take the first constraint and solve for x in terms of y.
We now plug this into the second equation.
 =  
 =  √((400/225) y^{2} + y^{2}) 

 =  
 =  
 =  
 =  
Thus, the vectors are [20; 15] and [20; 15].
Example: Given constants
a,
b,
c ∈ R, find a vector orthogonal to the plane
P defined
by:
 =  {    a (x + y + z) + b (y + z) + c z = 0 }.


We only need to rewrite the equation defining the plane in a more familiar form. For any [
x;
y;
z]
∈ P, we know that:
a (x + y + z) + b (y + z) + c z  
 =  
ax + (a + b) y + (a + b + c) z  
 =  
 =  
In order to be orthogonal to a plane, a vector must be orthogonal to all vectors [
x;
y;
z] on that plane.
Since all points on the plane are orthogonal to [
a;
a +
b;
a +
b +
c] by the above argument, [
a;
a +
b;
a +
b +
c] is such a point.
Example: Define the line
L that is orthogonal to the vector [
a;
b] but also crosses [
a;
b] (i.e, [
a;
b] falls on the line).
We know that the line must be parallel to the vector that is orthogonal to [a; b]. The line L_{0} crossing [0; 0] that is orthogonal
to [a; b] is defined as:
However, we need the line to also cross the point [
a;
b]. This is easily accomplished by adding the vector [
a;
b] to all the points
on the orthogonal line going through [0; 0] (as defined above). Thus, we have:
If we want to find points [
x ;
y ] on the line directly without the intermediate term [
x' ;
y' ], we can solve for
[
x' ;
y' ] in terms of [
x ;
y ]:
We can then substitute to obtain a more direct definition of
L (in terms of a constraint on the
vectors [
x ;
y ] in
L):
 =  
 =  { (   −   ) +      ⋅ (   −   ) = 0 } 

 =  
Example: Is [7; −1] on the line defined by the points
u = [19; 7] and
v = [1; −5]?
To solve this problem, we recall the definition for a line defined by two points:
{ p  ∃ a ∈ R, p = a (u  v) + u }.
Thus, we want to know if [7; 1] is in the set defined as above. This can only occur if there exists
an a such that [7; 1] = a (u  v) + u.
We solve for a; if no solution exists, then the point [7; 1] is not on the line L. If an a exists, then it is. In this case,
a = 1/3 is a solution to both equations, so [7; 1] is on the line.
Example: Define the line that is orthogonal to the vector [3; 5] but also crosses [3; 5] (i.e, [3; 5] falls on the line).
We know that the line must be parallel to the vector that is orthogonal to [3; 5]. The line crossing [0; 0] that is orthogonal
to [3; 5] is defined as:
We can rewrite the above in a more familiar form:
However, we need the line to also cross the point [3; 5]. This is easily accomplished by adding the vector [3; 5] to all the points
on the orthogonal line going through [0; 0] (as defined above). Thus, we have:
We can rewrite the above by defining:
Now we substitute [
x;
y] with [
x',
y'] in our definition of the line:
We can now write the equation for the line:
Notice that, alternatively, we could have instead simply found the
yintercept
b ∈ R of the following equation using the point [3;5]:
Example: Is [8; 6] a linear combination of the vectors [19; 7] and [1; 5]?
We recall the definition of a linear combination and instantiate it for this example:
Thus, if we can solve for a and b, then [8; −6] is indeed a linear combination.
Example: Are the vectors
V = {[2; 0; 4; 0], [6; 0; 4; 3], [1; 7; 4; 3]} linearly independent?
The definition for linear independence requires that none of the vectors being considered can be expressed
as a sum of the others. Thus, we must check all pairs of vectors against the remaining third vector not in the pair.
There are 3!/(2!*1!) such pairs:
can   be expressed as a combination of   and   ? 

can   be expressed as a combination of   and   ? 

can   be expressed as a combination of   and   ?


For each combination, we can check whether the third vector is linearly dependent.
If it is linearly dependent, we can stop and say that the three vectors are not
linearly independent. If it is not, we must continue checking all the pairs. If all the pairs are incapable of
being scaled and added in some way to obtain the third vector, then the three vectors are linearly independent.
not (u, v, w are linearly independent) iff (∃ a,b ∈ R, u,v,w ∈ V, w is a linear combination of u and v)
Notice that this an example of a general logical rule:
not (∀ x ∈ S, p) iff (∃ x ∈ S, not p)
We check each possible combination and find that we derive a contradiction if we assume they are not independent.
Thus, V is a set of linearly independent vectors.
2.6. Using vectors and linear combinations to model systems
In the introduction we noted that in this course, we would define a symbolic language for working with a certain
collection of idealized mathematical objects that can be used to model system states of realworld systems in an abstract
way. Because we are considering a particular collection of objects (vectors, planes, spaces, and their relationships),
it is natural to ask what kinds of problems are wellsuited for such a representation (and also what problems are
not wellsuited).
What situations and associated problems can be modelled using vectors and related operators and properties?
Problems involving concrete objects that have a position, velocity, direction, geometric shape, and relationships between
these (particularly in two or three dimensions) are natural candidates. For example, we have seen that it is possible
to compute the projection of one vector onto another. However, these are just a particular example of a more general
family of problems that can be studied using vectors and their associated operations and properties.
A vector of real numbers can be used to represent an object or collection of objects with some fixed number of characteristics (each
corresponding to a dimension or component of the vector) where each characteristic has a range of possible values.
This range could be a set of magnitudes (e.g., position, cost, mass), a discrete collection of states (e.g.,
absence or presence of an edge in a graph), or even a set of relationships (e.g., for every cow, there are four
cow legs; for every $1 invested, there is a return of $0.02). Thus, vectors are wellsuited for representing
problems involving many instances of objects where all the objects have the same set of possible characteristics
along the same set of linear dimensions. In these instances, many vector operations also have natural interpretations.
For example, addition and scalar multiplication (i.e., linear combinations) typically correspond to the aggregation
of a property across multiple instances or copies of objects with various properties (e.g., the total mass of a
collection of objects).
In order to illustrate how vectors and linear combinations of vectors might be used in applications, we recall the
notion of a system. A system is any physical or abstract phenomenon, or observations of a phenomenon, that
we characterize as a collection of real values along one or more dimensions. A
system state or state a system is a particular collection
of real values. For example, if a system is represented by R^{4}, states of that system are represented by individual vectors
in R^{4} (note that not all vectors need to correspond to valid or possible states; see the examples below).
Example: Consider the following system: a barn with cows and chickens inside it. There are several dimensions along
which an observer might be able to measure this system (we assume that the observer has such poor eyesight that chickens and
cows are indistinguishable from above):
 number of chickens inside
 number of cows inside
 number of legs that can be seen by peeking under the door
 number of heads that can be seen by looking inside from a high window
Notice that we could represent a particular
state of this system using a vector in
R^{4}. However, notice also that
many vectors in
R^{4} will
not correspond to any system that one would expect to observe. Usually, the number of
legs and heads in the entire system will be a
linear combination of two vectors: the number of legs per cow,
and the number of legs per chicken:
Given this relationship, it may be possible to derive some characteristics of the system given only partial information.
Consider the following problem: how many chickens and cows are in a barn if 8 heads and 26 legs were observed?
Notice that a linear combination of vectors can be viewed as a translation from a vector describing one set of
dimensions to a vector describing another set of dimensions. Many problems might exist in which the values are
known along one set of dimensions and unknown along another set.
Example: We can restate the example from the introduction using linear combinations. Suppose we have $12,000 and two
investment opportunities: A has an annual return of 10%, and B has an annual return of 20%. How much should we invest
in each opportunity to get $1800 over one year?
The two investment opportunities are twodimensional vectors representing the rate of return on a dollar:
The problem is to find what combination of the two opportunities would yield the desired observation of the entire system:
  1 dollar  0.1 dollars of interest 
 

⋅ x dollars in opportunity A
+   1 dollar  0.2 dollars of interest 
 

⋅ y dollars in opportunity B
 
 =    12,000 dollars  1800 dollars of interest 
 



Next, we consider a problem with discrete dimensions.
Example: Suppose there is a network of streets and intersections and the city wants to set up cameras
at some of the intersections. Cameras can only see as far as the next intersection. Suppose there are five
streets (#1, #2, #3, #4, #5) and four intersections (A, B, C, and D) at which cameras can be placed, and the city
wants to make sure a camera can see every street while not using any cameras redundantly (i.e., two cameras
should not film the same street).
Vectors in R^{5} can represent which streets are covered by a camera. A fixed collection of vectors, one for each
intersection, can represent what streets a camera can see from each intersection. Thus, the system's dimensions
are:
 is street #1 covered by a camera?
 is street #2 covered by a camera?
 is street #3 covered by a camera?
 is street #4 covered by a camera?
 is street #5 covered by a camera?
 is there a camera at intersection A? (represented by the variable a below)
 is there a camera at intersection B? (represented by the variable b below)
 is there a camera at intersection C? (represented by the variable c below)
 is there a camera at intersection D? (represented by the variable d below)
Four fixed vectors will be used to represent which streets are adjacent to which intersections:
Placing the cameras in the way required is possible if there is integer solution to the following equation
involving a linear combination of the above vectors:
Example: Suppose a chemist wants to model a chemical reaction. The dimensions of the system might be:
 how many molecules of C_{3}H_{8} are present?
 how many molecules of O_{2} are present?
 how many molecules of CO_{2} are present?
 how many molecules of H_{2}O are present?
 how many atoms of carbon are present?
 how many atoms of hydrogen are present?
 how many atoms of oxygen are present?
Individual vectors in R^{3} can be used to represent how many atoms of each element are in each type of
molecule being considered:
C_{3}H_{8}:   , O_{2}:   , CO_{2}:   , H_{2}O:  


Suppose we know that the number of atoms in a system may never change during a reaction, and that some quantity
of C_{3}H_{8} and O_{2} can react to yield only CO_{2} and H_{2}O. How many molecules of each compound will be involved in the reaction? That is the solution
to the following linear combination.
For example, suppose we start with 1000 molecules of C_{3}H_{8} and 5000 molecules of O_{2}. If both of these compounds react to produce only
CO_{2} and H_{2}O, how many molecules of each will be produced?
Thus, a = 3000 molecules of CO_{2} and b = 4000 molecules of H_{2}O will be produced.
The notion of a linear combination of vectors is common and can be used to mathematically model a wide variety of problems.
Thus, a more concise notation for linear combinations of vectors would be valuable. This is one of the issues addressed by introducing
a new type of term: the matrix.
3. Matrices
In this section we introduce a new kind of term: a matrix. We define some operations on matrices and some
properties of matrices, and we describe some of the possible ways to interpret and use matrices.
3.1. Matrices and multiplication of a vector by a matrix
Matrices are a concise way to represent and reason about linear combinations and linear independence of vectors (e.g., setwise linear
independence might be difficult to check using an exhaustive approach), reinterpretations of systems using different dimensions,
and so on. One way to interpret a matrix is as a collection of vectors. Multiplying a matrix by a vector corresponds to computing a linear
combination of that collection of vectors.
As an example, we consider the case for linear combinations of two vectors. The two scalars in the linear combination
can be interpreted as a 2component vector. We can then put the two vectors together into a single object in our
notation, which we call a matrix.
Notice that the columns of the matrix are the vectors used in our linear combination. Notice also that we can now
reinterpret the result of multiplying a vector by a matrix as taking the dot product of each of the matrix rows with the
vector.
Fact:
 =  
 =  
 =  
 =    (a,b) ⋅ (x,y)  (c,d) ⋅ (x,y) 
 



Because a matrix is just two column vectors, we can naturally extend this definition of multiplication
to cases in which we have multiplication of a matrix by a matrix: we simply multiply each column of the
second matrix by the first matrix and write down each of the resulting columns in the result matrix.
Definition:
 =    (a,b) ⋅ (x,y)  (a,b) ⋅(s,t)  (c,d) ⋅ (x,y)  (c,d) ⋅ (s,t) 
 



These definitions can be extended naturally to vectors and matrices with more than two components. If we denote using M_{ij} the entry in a matrix M found
in the ith row and jth column, then we can define the result of matrix multiplication of two matrices A and B as a matrix M such that
M_{ij} = ith row of A ⋅ jth column of B.


3.2. Interpreting matrices as tables of relationships and transformations of system states
We saw how vectors can be used to represent system states. We can extend this interpretation to matrices and use
matrices to represent relationships between the dimensions of system states. This allows us to interpret matrices as transformations
between system states (or partial observations of system states).
If we again consider the example system involving a barn of cows and chickens, we can reinterpret the matrix as a table of relationships between
dimensions. Each entry in the table has a unit indicating the relationship it represents.

chickens 
cows 

heads 
1 head/chicken 
1 head/cow 

legs 
2 legs/chicken 
4 legs/cow 

Notice that the column labels in this table represent the dimensions of an "input" vector that could be multiplied by this matrix, and
the row labels specify the dimensions of the "output" vector that is obtained as a result. That is,
if we multiply using the above matrix a vector that specifies the number of chickens and the number of cows in a system state, we will get a
vector that specifies the number of heads and legs we can observe in that system.
  1 head/chicken  1 head/cow 
2 legs/chicken  4 legs/cow 
 

⋅
 
 
 =  
Thus, we can interpret multiplication by this matrix as a function that takes system states that only specify the number of chickens and
cows, and converts them to system states that only specify the number of heads and legs:
(# chickens × # cows) → (# heads × # legs)
3.3. Interpreting multiplication of matrices as composition of system state transformations
Example: Suppose that we have a system with the following dimensions.
 number of wind farms
 number of coal power plants
 units of power
 units of cost (e.g., pollution)
 number of single family homes (s.f.h.'s)
 number of businesses
Two different matrices might specify the relationships between some combinations of dimensions in this system.
M_{1} =   100 power/wind farm  250 power/coal plant 
50 cost/wind farm  400 cost/coal plant 
 

,
M_{2} =   4 s.f.h./unit power  2 s.f.h./unit cost 
1 businesses/unit power  0 businesses/unit cost 
 



Notice that these two matrices both represent transformations between partial system state descriptions.
T_{1}: (# wind farms × # coal plants) → (units of power × units of cost)
T_{2}: (units of power × units of cost) → (# s.f.h. × # businesses)
Notice that because the interpretion of a result obtained using the first transformation matches the interpretation of an input to the second, we
can compose these transformations to obtain a third transformation.
T_{2} o T_{1}: (# wind farms × # coal plants) → (# s.f.h. × # businesses)
This corresponds to multiplying the two matrices to obtain a third matrix. Notice that the units of the resulting matrix can be computed using a
process that should be familiar to you from earlier coursework.
  4 s.f.h./unit power  2 s.f.h./unit cost 
1 businesses/unit power  0 businesses/unit cost 
 

⋅
  100 power/wind farm  250 power/coal plant 
50 cost/wind farm  400 cost/coal plant 
 

 
 = 
  300 s.f.h./wind farm  200 s.f.h./coal plant 
100 business/wind farm  250 businesses/coal plant 
 



Thus, given some vector describing the number of wind farms and coal plants in the system, we can multiply that vector by (M_{2} ⋅ M_{1})
to compute the number of single family homes and business we expect to find in that system.
Example: Suppose that a gram of gold costs $50, while a gram of silver costs $10. After purchasing some of each, you have spent $350 on
15 grams of material. How many grams of each commodity have you purchased?
 Write down four dimensions describing this system.

Define a matrix A that can be used to convert a description of a system state that specifies only the amount of gold and silver purchased into
a description of the system state that specifies only the cost and total weight.
 Write down a matrix equation describing this problem and solve it to find the solution.

Define a matrix B such that for any description of a system state v that specifies only the total weight and amount spent, B ⋅ v
is a description of that system state that specifies the amount of gold and silver in that system state.
Example: Suppose we characterize our system in terms of two dimensions:
 number of single family homes (s.f.h.'s)
 number of power plants (p.p.'s)
In this example, instead of studying the relationships between dimensions, we want to study how the dimensions
change (possibly in an interdependent way) over time. For example, the following matrix might capture how
the system state evolves from year to year:
M =   2 s.f.h. in year 1/s.f.h. in year 0  1 s.f.h. in year 1/p.p. in year 0 
0 p.p. in year 1/s.f.h in year 0  1 p.p. in year 1/p.p. in year 0 
 



We can parameterize the above in terms of a year
t ∈ R. Notice that the matrix above is just a special case of the matrix below (when
t = 0):
M =   2 s.f.h. in year t+1/s.f.h. in year t  1 s.f.h. in year t+1/p.p. in year t 
0 p.p. in year t+1/s.f.h in year t  1 p.p. in year t+1/p.p. in year t 
 



What does
M ⋅
M represent? If we consider the units, we have:
M ⋅ M =   4 s.f.h. in year t+2/s.f.h. in year t  3 s.f.h. in year t+2/p.p. in year t 
0 p.p. in year t+2/s.f.h in year t  1 p.p. in year t+2/p.p. in year t 
 



Suppose
v = [
x;
y]
∈ R^{2} represents the number of single family homes and factories in a given year. We can then define the number of single
family homes and factories after
t years as:
If we wanted to write the number of single family homes and factories as a function of
t ∈ R and an initial state
x_{0},
y_{0} ∈ R, we
could nest the dot products as follows and use algebra to simplify:
 =  2 ( 2 ( 2 ( ... 2 (2 x_{0}  y_{0})  y_{0} ... )  y_{0})  y_{0})  y_{0} 

 =  2^{t} x_{0}  (2^{t1} + ... + 4 + 2 + 1) y_{0} 

 =  2^{t} x_{0}  (2^{t}  1) y_{0} 

 =  2^{t} x_{0}  2^{t} y_{0} + y_{0} 

 =  0 ⋅ x_{t} + 1 ⋅ ( ... (0 ⋅ x_{2} + 1 ⋅ ( 0 ⋅ x_{1} + (0 ⋅ x_{0} + 1 ⋅ y_{0}))) ... ) 

 =  
In this assignment you will solve problems involving vectors and matrices.
Please submit a single file a2.*
containing your solutions. The file extension may be anything you choose;
please ask before submitting a file in an exotic or obscure file format (plain text is preferred).
 Consider the line L in R^{2} that passes through the following two vectors:
 Using set notation, define L in terms of u and v.
 Determine whether the following vectors are on the line L:
 Find all unit vectors orthogonal to L.
 Define the line L^{⊥} that passes through the origin and is orthogonal to L using an equation of the form:
In other words, find m, b ∈ R such that:
 For each of the following collections of vectors, determine whether the collection is
linearly independent. If it is, explain why; if not, show that one of the vectors is a
linear combination of the other vectors in the collection.
 The following two vectors in R^{2}:
 The following three vectors in R^{2}:
 The following three vectors in R^{4}:
 Consider the following vectors in R^{3}:
 Compute the orthogonal projection of w onto the vector:
 Determine whether each of the following points lies on the plane perpendicular to u:
 Extra credit: Given the vector v and w, let P be the plane orthogonal to v, and let Q be the plane orthogonal to w.
Find a vector p ∈ R^{3} that lies on the line in R^{3} along which P and Q intersect, and provide a definition of the line.

You decide to drive the 2800 miles from New York to Los Angeles in a hybrid vehicle.
A hybrid vehicle has two modes: using only the electric motor and battery, it can travel 1 mile on 3 units of battery power;
using only the internal combustion engine, it can travel 1 mile on 0.1 liters of gas (about 37 mpg) while also charging the
battery with 1 unit of battery power. At the end of your trip, you have 1400 fewer units of battery power than you did when
you began the trip. How much gasoline did you use (in liters)?
You should define a system with the following dimensions:
 net change in the total units of battery power;
 total liters of gasoline used;
 total number of miles travelled;
 number of miles travelled using the electric motor and battery;
 number of miles travelled using the engine.
You should define a matrix M ∈ R^{3×2} to characterize this system. Then, write down an equation containing
that matrix (and three variables in R), and solve it to obtain the quantity of gasoline.

Suppose we create a very simple system for modelling how predators and prey interact in a closed environment.
Our system has only two dimensions: the number of prey animals, and the number of predators. We want to model
how the state of the system changes from one generation to the next.
If there are x predators and y prey animals in a given generation, in the next generation the following will be the case:
 all predators already in the system will stay in the system;
 all prey animals already in the system will stay in the system;
 for every prey animal, two new prey animals are introduced into the system;
 for every predator, two prey animals are removed from the system;
 we ignore any other factors that might affect the state (e.g., natural death or starvation).

Specify explicitly a matrix T in R^{2×2} that takes a description of the system state
in one generation and produces the state of the system during the next generation. Note: you may simply
enter the matrix on its own line for this part of the problem, but you must also use it in the
remaining three parts below.

Show that the number of predators does not change from one generation to the next.

Determine what initial state [x_{0}; y_{0}] is such that there is no change in the state from one generation to another.

Suppose that in the fourth generation of an instance of this system (that is, after the transformation has
been applied three times), we have 2 predators and 56 prey animals. How many predators and prey animals were
in the system in the first generation (before any transformations were applied)? Let [x; y] represent the
state of the system in the first generation. Set up a matrix equation that involves [x; y] and
matrix multiplication, and solve it to obtain the answer.
3.5. Matrix operations and their interpretations
The following table summarizes the matrix operations that we are considering in this course.
term 
definition 
restrictions 
general properties 
M_{1} + M_{2} 
componentwise 
matrices must have the same number of rows and columns 
commutative,
associative,
has identity (matrix with all 0 components),
has inverse (multiply matrix by 1),
scalar multiplication is distributive

M_{1} ⋅ M_{2} 
rowcolumnwise dot products 
columns in M_{1} = rows in M_{2} rows in M_{1} ⋅ M_{2} = rows in M_{1} columns in M_{1} ⋅ M_{2} = columns in M_{2} 
associative,
has identity I (1s in diagonal and 0s elsewhere),
distributive over matrix addition,
not commutative in general,
no inverse in general

M^{ 1} 

columns in M = rows in M
matrix is invertible

M^{ 1} ⋅ M = M ⋅ M^{ 1} = I

The following tables list some highlevel intuitions about how matrix operations can be understood.
level of abstraction 
interpretations of multiplication of a vector by a matrix 
applications 
transformation of system states 
extraction of information about system states 
computing properties of combinations or aggregations of objects (or system states) 
conversion of system state observations from one set of dimensions to another 
geometry 
"moving" vectors in a space (stretching, skewing, rotating, reflecting) 
projecting vectors 
taking a linear combination of two vectors 
reinterpreting vector notation as referring to a collection of noncanonical vectors 
level of abstraction 
interpretations of multiplication of two matrices 
applications 
composition of system state transformations or conversions 
geometry 
sequencing of motions of vectors within a space (stretching, skewing, rotating, reflecting) 
level of abstraction 
invertible matrix 
singular matrix 
applications 
reversible transformation of system states 
extraction of complete information uniquely determining a system state 
irreversible transformation of system states 
extraction of incomplete information about a system state 
geometry 
reversible transformation or motion of vectors in a space 
projection onto a strict subset of a set of vectors (space) 
symbolic 
reversible transformation of information numerically encoded in matrix
(example of such information: system of linear equations encoded as matrix)

irreversible/"lossy" transformation of information encoded in matrix 
Suppose we interpret multiplication of a vector by a matrix M as a function from vectors to vectors:
f(v) = M v.
Fact: Notice that for any M, if f(v) = M v then f is always a function because M v has only one possible result (i.e.,
matrix multiplication is deterministic) for a given M and v.
Fact: If
f(
v) =
M v, then
f is invertible if
M is an invertible matrix. The inverse of
f is then defined to be:
f^{ 1}(v) = M^{ 1} v.
Notice that f^{ 1} is a function because M^{ 1} v only has one possible result. Notice that f^{ 1} is the inverse of f because
f^{ 1}(f(v)) = M^{ 1} M v = I v = v.
Fact: If the columns of a matrix
M are linearly dependent and
f(
v) =
M v, then
M cannot have an inverse. We consider the case
in which
M ∈ R^{2×2}. Suppose we have that
If the columns of
M are linearly dependent, then we know that there is some
s ∈ R such that
This means that we can rewrite
M:
Since matrix multiplication can be interpreted as taking a linear combination of the column vectors, this means that for
x,
y ∈ R,
But this means that for any two vectors [
x;
y] and [
x';
y'], if
x +
sy =
x' +
sy' then multiplying by
M will lead to the same result.
Thus,
f is a function that takes two different vector arguments and maps them to the same result. If we interpret
f as a relation and take
its inverse
f^{ 1},
f^{ 1} cannot be a function.
Thus, M cannot have an inverse (if it did, then f^{ 1} would be a function).
Fact: If the columns of a matrix
M are linearly independent and
f(
v) =
M v, then
M has an inverse. We consider the case
in which
M ∈ R^{2×2}. Suppose we have that
If the columns of
M are linearly independent, then we know that
a d 
b % c ≠ 0:
Suppose we pick the following
M^{ 1}:
The we have that:
 =  
 =  (1/(a d  b c)) ⋅   a d  b c  bd  bd  ac  ac  a d  b c 
 
 

 =  
 =  
Example: Solve the following problems.
 Determine which of the following matrices are not invertible:
The columns of the first matrix are linearly dependent, so it is not invertible. The first column of
the second matrix can be obtained by multiplying the second column by 0, so the two columns of that
matrix are linearly dependent; thus, it is not invertible. For the third matrix, the following equation
has no solution:
Thus, the third matrix is invertible. It is also possible to determine this by computing the
determinant for each matrix.

The matrix below is not invertible, and the following equation is true. What is the matrix? List all four of its components (real numbers).
Since the matrix is not invertible, it must be that its determinant is 0. Thus, we have the
following system of equations:
If we solve the above, we get:
3.6. Matrix properties
The following are subsets of R^{n×n} that are of interest in this course because they
correspond to transformations and systems that have desirable or useful properties. For some of these
sets of matrices, matrix multiplication and inversion have properties that they do not in general.
subset of R^{n×n} 
definition 
closed under matrix multiplication 
properties of matrix multiplication 
inversion 
identity matrix 
∀ i,j M_{ij} = 1 if i=j, 0 otherwise 
closed 
commutative, associative, distributive with addition, has identity 
has inverse (itself); closed under inversion 
elementary matrix 
can be obtained via an elementary row operation from I:
 add nonzero multiple
of one row of the matrix to another row
 multiply a row by a
nonzero scalar
 swap two rows of the
matrix
Note: the third is a combination of the first two operations.


associative, distributive with addition, have identity 
have inverses; closed under inversion 
scalar matrices 
∃ s ∈ R, ∀ i,j M_{ij} = s if i=j, 0 otherwise 
closed 
commutative, associative, distributive with addition, have identity 
nonzero members have inverses; closed under inversion 
diagonal matrices 
∀ i,j M_{ij} ∈ R if i=j, 0 otherwise 
closed 
associative, distributive with addition, have identity 
nonzero members have inverses; closed under inversion 
matrices with constant diagonal 
∀ i,j M_{ii} = M_{jj} 

associative, distributive with addition, have identity 

symmetric matrices 
∀ i,j M_{ij} = M_{ji} 

associative, distributive with addition, have identity 

symmetric matrices with constant diagonal 
∀ i,j M_{ii} = M_{jj} and M_{ij} = M_{ji} 
closed 
commutative, associative, distributive with addition, have identity 

upper triangular matrices 
∀ i,j M_{ij} = 0 if i > j 
closed 
associative, distributive with addition, have identity 
not invertible in general; closed under inversion when invertible 
lower triangular matrices 
∀ i,j M_{ij} = 0 if i < j 
closed 
associative, distributive with addition, have identity 
not invertible in general; closed under inversion when invertible 
invertible matrices 
∃ M^{ 1} s.t. M^{ 1} M = M M^{ 1} = I 
closed 
associative, distributive with addition, have identity 
nonzero members have inverses; closed under inversion 
square matrices 
all of R^{n×n} 
closed 
associative, distributive with addition, have identity 

Two facts presented in the above table are worth noting.
Fact: Suppose A is invertible. Then the inverse of A^{ 1} is A, because A A^{ 1} = I. Thus, (A^{ 1})^{ 1} = A.
Fact: If
A and
B are invertible, so is
AB. That is, invertible matrices are closed under matrix multiplication. We can show
this by using the associativity of matrix multiplication. Since
A and
B are invertible, there exist
B^{ 1} and
A^{ 1} such that:
Thus, since there exists a matrix (B^{ 1} A^{ 1}) such that (B^{ 1} A^{ 1}) A B = I, (B^{ 1} A^{ 1}) is the inverse of AB.
Example:
Given an invertible upper triangular matrix
M ∈ R^{2×2},
show that
M^{ 1} is also upper triangular.
Hint: write out
the matrix
M explicitly.
Suppose we have the following upper triangular matrix:
If it is invertible, then there exists an inverse such that:
This implies that
Because M is invertible, we know that z ≠ 0. Since zc = 0, This means that c = 0. Thus, we have that the inverse is upper triangular.
Alternatively, we can observe that c = 0, and that using the formula for the inverse would yield a lowerleft
matrix entry equal to −c/(det M) = 0.
Example: In terms of
a,
b ∈ R where
a ≠ 0 and
b ≠ 0, compute the inverse of:
While we could perform the instances of matrix multiplication stepbystep and then invert the result (either by solving an equation or
using the formula for the inverse of a matrix in R^{2×2}), it's easier to recall that diagonal matrices behave in a manner that is very
similar to the real numbers. Thus, the above product is equal to
and its inverse simply has the multiplicative inverses of the two diagonal entries as its diagonal entries:
Another fact not in the table is also worth noting.
Fact: Any product of a finite number of elementary row matrices is invertible. This fact follows from the fact that all
elementary matrices are invertible, and that the set of invertible matrices is closed under multiplication.
Given the last fact, we might ask whether the opposite is true: are all invertible matrices the product of a finite number of elementary
matrices? The answer is yes, as we will see further below.
3.7. Solving the equation M v = w for M with various properties
Recall that for v,w ∈ R^{n} and M ∈ R^{n×n}, an equation of the following form
can represent a system of equations:
M v = w
Notice that if M is invertible, we can solve for v by multiplying both sides by M^{ 1}. More generally, if M is a member of
some of the sets in the above table, we can find straightforward algorithms for solving such an equation for v.
M is ... 
algorithm to solve M v = w for v 
the identity matrix 
w is the solution 
an elementary matrix 
perform a row operation on M to obtain I; perform the same operation on w 
a scalar matrix 
divide the components of w by the scalar 
a diagonal matrix 
divide each component of w by the corresponding matrix component 
an upper triangular matrix 
start with the last entry in v, which is easily obtained;
move backwards through v, filling in the values by
substituting the already known variables

a lower triangular matrix 
start with the first entry in v, which is easily obtained;
move forward through v, filling in the values by
substituting the already known variables

product of a lower triangular matrix
and an upper triangular matrix 
combine the algorithms for upper and lower triangular
matrices in sequence (see example below)

an invertible matrix 
compute the inverse and multiply w by it 
Example: We consider an equation
M v =
w where
M is a diagonal matrix (the identity matrix and all scalar matrices are also diagonal
matrices).
Example: We consider an equation
M v =
w where
M is a lower triangular matrix.
Fact: Suppose that
M =
L U where
L is lower triangular and
U is upper triangular. How can we solve
M v =
w?
First, note that because matrix multiplication is associative, we have
We introduce a new vector for the intermediate result U v, which we call u. Now, we have a system of matrix equations.
We first solve for u using the algorithm for lower triangular matrices, then we solve for v using the algorithm for upper triangular
matrices.
Example: Solve the following equation for
x,
y,
z ∈ R:
We first divide the problem into two steps using the intermediate vector [ a ; b ; c ]:
Example: The inverse of a matrix in
R^{2×2} can be computed as follows.
 =    d/(ad − bc)  −b/(adbc)  −c/(ad − bc)  a/(ad − bc) 
 



Thus, if we find that the determinant of a matrix M ∈ R^{2×2} is nonzero, the algorithm for solving M v = w is
straightforward. Consider the following example.
 =  
 =  
 = 
  4/((1⋅4)(2⋅3))  −2/((1⋅4)(2⋅3))  −3/((1⋅4)(2⋅3))  1/((1⋅4)(2⋅3)) 
 
   

 =  
 =  
3.8. Row echelon form and reduced row echelon form
We define two more properties that a matrix may possess.
M is in row echelon form 
 all nonzero rows are above any rows consisting of all zeroes
 the first nonzero entry (from the left) of a nonzero row is strictly
to the right of the first nonzero entry of the row above it
 all entries in a column below the first nonzero entry in a row are zero
(the first two conditions imply this)

M is in reduced row echelon form 
 M is in row echelon form
 the first nonzero entry in every row is 1;
this 1 entry is the only nonzero entry in its column

We can obtain the reduced row echelon form of a matrix using a sequence of appropriately chosen elementary row operations.
Example: Suppose we want to find the reduced row echelon form of the matrix below. We list the steps of the procedure.
Fact: For any matrix
M, there may be more than one way to reach the reduced row echelon form using elementary row operations. However,
it is always possible, and there is exactly one unique reduced row echelon form for that matrix
M. We do not prove this result in this course,
but fairly short proofs by induction can be found elsewhere (such as
here).
Because the reduced row echelon form of a matrix
M is unique, we use the following notation to denote it:
rref M.
Example: Determine which of the following matrices are elementary:
The matrices are:
(a) not elementary (not square, so not invertible),
(b) not elementary (composition of two elementary row operations applied to the identity),
(c) not elementary (multiplication of a row by the 0 scalar is not invertible),
and (d) elementary (multiple of first row added to last row).
Example: Determine which of the following matrices are in reduced row echelon form:
The matrices are:
(a) in reduced row echelon form,
(b) not in reduced row echelon form,
(c) in reduced row echelon form,
(d) not in reduced row echelon form,
and (e) in reduced row echelon form.
Example: Suppose the matrix below is in reduced row echelon form. Solve for
a,
b ∈ R.
Without loss of generality, we can focus on four possibility: a is either zero or nonzero, and
b is either zero or nonzero. We can further simplify this by considering 1 as the only nonzero
value of interest. Then we have that:
 if a = 0 and b = 0, then the matrix is not in reduced row echelon form;
 if a = 0 and b = 1, then the matrix is not in reduced row echelon form;
 if a = 1 and b = 0, then the matrix is in reduced row echelon form;
 if a = 1 and b = 1, then the matrix is not in reduced row echelon form.
Thus,
a = 1 and
b = 0.
Question: For a given matrix in reduced row echelon form, how many different matrices can be reduced to it (one or more than one)?
Fact: It is always true that rref M = rref (rref M). Thus, the rref operation is idempotent.
Fact: If rref
M is
I (the identity matrix), then
M is invertible. This is because
I is an elementary matrix, and the row operations
used to obtain rref
M from
M can be represented as a product of elementary (and thus, invertible) matrices
E_{1} ⋅ ... ⋅
E_{n}. Thus, we have:
 =  
(E^{ 1}_{n} ⋅ ... ⋅ E^{ 1}_{1}) ⋅ E_{1} ⋅ ... ⋅ E_{n} ⋅ M  
 =  (E^{ 1}_{n} ⋅ ... ⋅ E^{ 1}_{1}) ⋅ I 

 =  (E^{ 1}_{n} ⋅ ... ⋅ E^{ 1}_{1}) ⋅ I


Since elementary matrices and I are invertible, and invertible matrices are closed under matrix multiplication, M must be invertible, too.
Fact: A matrix M ∈ R^{n×n} is not invertible iff the bottom row of rref M has all zeroes. This is because when all
rows of rref M ∈ R^{n×n} have at least one nonzero value, rref M must be the identity matrix (try putting a nonzero value on the bottom row, and see what the
definition of reduced row echelon form implies about the rest of the matrix). Since rref M = I, this implies that M must then be invertible by the fact immediately above this one.
Fact: For any invertible matrix
M ∈ R^{n×n}, the reduced row echelon form of
M is
I ∈ R^{n×n}.
We can show this is true using a proof by contradiction. Suppose that M is invertible, but rref M ≠ I. We know that rref M can be
obtained via a finite number of elementary row operations E_{1} ⋅ ... ⋅ E_{n}:
(E_{1} ⋅ ... ⋅ E_{n}) M = rref M.
If rref M is not I, then the last row of rref M must consist of only zeroes. But because M is invertible, we have:
((E_{1} ⋅ ... ⋅ E_{n}) M) M^{ 1}  
 =  
 =  
Since the product of elementary matrices is invertible, (rref M) ⋅ M^{ 1} is also invertible. But if the last row of rref M consists of only
zeroes, then the last row of (rref M) M^{ 1} also contains only zeroes, so it cannot be that (rref M) M^{ 1} is invertible. Thus, we have a contradiction, so our assumption that rref M ≠ I is false.
The following table provides an alternative illustration of how the contradiction is derived:
M is invertible 
rref M ≠ I 
the matrix M^{ 1} exists 
the last row of rref M is all zeroes 
(E_{1} ⋅ ... ⋅ E_{n}) M = rref M 
((E_{1} ⋅ ... ⋅ E_{n}) M) M^{ 1} = (rref M) ⋅ M^{ 1} 
E_{1} ⋅ ... ⋅ E_{n} = (rref M) ⋅ M^{ 1} 
the last row of (rref M) ⋅ M^{ 1} is all zeroes 
(rref M) ⋅ M^{ 1} is invertible because it is a product of the invertible matrices E_{1}, ..., E_{n} 
(rref M) ⋅ M^{ 1} is not invertible because multiplication by it is a manytoone function 
The above result implies the following fact.
Fact: If a matrix M is invertible, it is the product of a finite number of elementary matrices. This is because rref M is
the identity, which is an elementary matrix, and M can be reduced via a finite number of invertible row operations to I. Thus, the
elementary matrices can be used to generate every possible invertible matrix.
Example: Suppose that for some matrix
M ∈ R^{2×2}, the following row operations can be applied to
M (in the order
specified) to obtain the identity matrix
I:
 add the bottom row to the top row;
 swap the two rows;
 multiply the bottom row by 1/3.
Find the matrix
M^{ 1}.
We know that performing the three row operations on M will result in I. Thus,
we can write out the row operations as three matrices E_{1}, E_{2}, and E_{3}:
E_{3} ⋅ E_{2} ⋅ E_{1} ⋅ M  
 =  
 =  

Thus, we have that:
We can also find
M:
The following table summarizes the results.
fact 
justification 
(1) 
{M  M is a finite product of elementary matrices} 
= 
{M  rref M = I} 
I is an elementary matrix; sequences of row operations are equivalent to multiplication by elementary matrices 
(2) 
{M  M is a finite product of elementary matrices} 
⊂ 
{M  M is invertible} 
elementary matrices are invertible; products of invertible matrices are invertible 
(3) 
{M  rref M = I} 
⊂ 
{M  M is invertible} 
fact (1) in this table; fact (2) in this table; transitivity of equality 
(4) 
{M  M is invertible} 
⊂ 
{M  rref M = I} 
proof by contradiction; noninvertible M implies rref M has all zeroes in bottom row 
(5) 
{M  M is invertible} 
= 
{M  rref M = I} 
for any sets A,B, A ⊂ B and B ⊂ A implies A = B 
(6) 
{M  M is a finite product of elementary matrices} 
= 
{M  M is invertible} 
fact (1) in this table; fact (5) in this table; transitivity of equality 
Given all these results, we can say that the properties for a matrix M in the following table are all equivalent:
if any of these is true, then all of them are true. If any of these is false, then all of them are false.
M is invertible 
det M ≠ 0 
the columns of M are (setwise) linearly independent 
Mv = w has exactly one solution 
M is a finite product of elementary matrices 
Fact: For matrices
M ∈ R^{n×n}, rref
M is guaranteed to be upper triangular. Notice that this means that for some finite
product of elementary matrices
E_{1} ⋅ ... ⋅
E_{n}, it is the case that
M = (E_{1} ⋅ ... ⋅ E_{n}) ⋅ U.
If E_{1} ,..., E_{n} are all lower triangular, then then M has an LU decomposition. However, this will not always be the case. But recall that
E_{1} ,..., E_{n} are all elementary matrices.
Fact: Given any product of elementary matrices
E_{1} ⋅ ... ⋅
E_{n}, it is possible to find a lower triangular matrix
L by applying a finite number of elementary
swap operations
S_{1} ,...,
S_{n} such that
L =
S_{1} ⋅ ... ⋅
S_{n} ⋅
E_{1} ⋅ ... ⋅
E_{n} is lower triangular; then we have:
 =  S_{1} ⋅ ... ⋅ S_{n} ⋅ E_{1} ⋅ ... ⋅ E_{n} 

(S_{n}^{ 1} ⋅ ... ⋅ S_{1}^{ 1}) ⋅ L  
 =  
Thus,
E_{1} ⋅ ... ⋅
E_{n} can be decomposed into a lower triangular matrix and a product of elementary swap matrices.
Fact: Any product of a finite number of swap elementary matrices S_{1} ,..., S_{n} is a permutation matrix.
Fact: Any matrix
M can be written as the product of three matrices
P ⋅
L ⋅
U where
P is a permutation matrix,
L is a lowertriangular matrix, and
U is an uppertriangular matrix,
where:
Example: Suppose we have a system in which a single object is traveling along one spatial dimension (i.e., in a straight line).
The object has a distance travelled, a velocity, and an acceleration; these are the three dimensions of the system:
 distance (m)
 velocity (m/s)
 acceleration (m/s^{2})
Consider the following equations that can be used to compute the distance the object travels and its final velocity given its
acceleration a ∈ R^{+}, initial velocity v_{0} ∈ R^{+}, and the amount of time t ∈ ∈ R^{+} it travels.
Suppose we want to convert a view of the system state that describes the acceleration and velocity at time 0 into a view of the system
state that represents the distance travelled and velocity at time
t. This conversion operation can be represented using a matrix
M.
 =    0.5 t^{2} dist. at t+1 / accel. at t  t dist. at t+1 / vel. at t 
t vel. at t+1 / accel. at t  1 vel. at t+1 / vel. at t 
 
 

 =    0.5 t^{2} m / (m/s^{2})  t m / (m/s) 
t (m/s) /(m/s^{2})  1 (m/s)/(m/s) 
 
 

 =    0.5 t^{2} s^{2}  t s 
t s  1 scalar identity 
 



This matrix is invertible. This immediately tells us that it is possible to derive the initial
acceleration and velocity given only the amount of time that has elapsed,
the distance travelled, and the final velocity.
By computing the inverse of this matrix, we can obtain formulas that allow us to derive the
initial velocity and acceleration of an object given how much time has passed, how far it has travelled, and its current velocity.
 = 
  2/t^{2} accel. at t / dist. at t+1
 t accel. at t / vel. at t+1
 t vel. at t / dist. at t+1
 1 vel. at t / vel. at t+1

 
 

 = 
  2/t^{2} (m/s^{2})/m
 2/t (m/s^{2}) / (m/s)
 2/t (m/s) / m
 1 (m/s)/(m/s)

 
 

 = 
  2/t^{2} 1/s^{2}
 2/t 1 / s
 2/t 1 / s
 1 scalar identity

 



The formulas can be obtained by multiplying
M^{ 1} by a system state describing the distance travelled and current velocity.
This yields:
We could have also obtained the above formulas using manipulation of equations of real numbers,
or via the corresponding row operations. Let us consider the latter approach:
 =  
  0.5 t^{2}  t  t − (2/t ⋅ 0.5 t^{2})  1 − (2/t ⋅ t) 
 
 ⋅    
 =  
 =  
 =  
  0.5 t^{2} − (t ⋅ 0)  t − (t ⋅ 1)  0  1 
 
 ⋅    
 =    d − (t ⋅ ((2d/t) − v))  (2d/t) − v 
 
 

 =  
 =    (2/t^{2}) ⋅ (− d + v t)  (2d / t) − v 
 
 

 =    −2d/t^{2} + v/t  2d / t − v 
 



3.9. Matrix transpose
Definition: The transpose of a matrix M ∈ R^{n×n}, denoted M^{⊤}, is defined to be A such that for all i and j, A_{ij} = M_{ji}.
Fact: If a matrix M is scalar, diagonal, or symmetric, M^{⊤} = M. If a matrix M is upper triangular, M^{⊤} is lower triangular (and vice versa).
Example: Below are some examples of matrices and their transposes:
Fact: For
A,
B ∈ R^{n×n}, it is always the case that:
Fact: It is always the case that (
AB)
^{⊤} =
B^{⊤} A^{⊤}. If
M =
AB, then:
 =  ith row of A ⋅ jth column of B 

 =  ith column of A^{⊤} ⋅ jth row of B^{⊤} 

 =  jth row of B^{⊤} ⋅ ith column of A^{⊤} 

 =  
Example: We consider the following example with matrices in
R^{3× 3}. Let
a,
b,
c,
x,
y, and
z be vectors in
R^{3}, with
v_{i} representing the
ith entry in a vector
v. Suppose we have the following product of two matrices. Notice that
a,
b, and
c are the rows of the lefthand matrix,
and
x,
y, and
z are the columns of the righthand matrix.
  a_{1}  a_{2}  a_{3}  b_{1}  b_{2}  b_{3}  c_{1}  c_{2}  c_{3} 
 

⋅
  x_{1}  y_{1}  z_{1}  x_{2}  y_{2}  z_{2}  x_{3}  y_{3}  z_{3} 
 

 
 = 
  (a_{1}, a_{2}, a_{3}) ⋅ (x_{1}, x_{2}, x_{3})  (a_{1}, a_{2}, a_{3}) ⋅ (y_{1}, y_{2}, y_{3})  (a_{1}, a_{2}, a_{3}) ⋅ (z_{1}, z_{2}, z_{3})
 (b_{1}, b_{2}, b_{3}) ⋅ (x_{1}, x_{2}, x_{3})  (b_{1}, b_{2}, b_{3}) ⋅ (y_{1}, y_{2}, y_{3})  (b_{1}, b_{2}, b_{3}) ⋅ (z_{1}, z_{2}, z_{3})
 (c_{1}, c_{2}, c_{3}) ⋅ (x_{1}, x_{2}, x_{3})  (c_{1}, c_{2}, c_{3}) ⋅ (y_{1}, y_{2}, y_{3})  (c_{1}, c_{2}, c_{3}) ⋅ (z_{1}, z_{2}, z_{3})

 
 

 =    a ⋅ x  a ⋅ y  a ⋅ z
 b ⋅ x  b ⋅ y  b ⋅ z
 c ⋅ x  c ⋅ y  c ⋅ z

 



Suppose we take the transpose of both sides of the equation above. Then we would have:
(   a_{1}  a_{2}  a_{3}  b_{1}  b_{2}  b_{3}  c_{1}  c_{2}  c_{3} 
 

⋅
  x_{1}  y_{1}  z_{1}  x_{2}  y_{2}  z_{2}  x_{3}  y_{3}  z_{3} 
 
 )^{⊤}
 
 = 
  a ⋅ x  a ⋅ y  a ⋅ z
 b ⋅ x  b ⋅ y  b ⋅ z
 c ⋅ x  c ⋅ y  c ⋅ z

 
 ^{⊤} 

 =    a ⋅ x  b ⋅ x  c ⋅ x
 a ⋅ y  b ⋅ y  c ⋅ y
 a ⋅ z  b ⋅ z  c ⋅ z

 
 

 = 
  x ⋅ a  x ⋅ b  x ⋅ c
 y ⋅ a  y ⋅ b  y ⋅ c
 z ⋅ a  z ⋅ b  z ⋅ c

 
 

 = 
  x_{1}  x_{2}  x_{3}
 y_{1}  y_{2}  y_{3}
 z_{1}  z_{2}  z_{3} 
 

⋅
  a_{1}  b_{1}  c_{1}
 a_{2}  b_{2}  c_{2}
 a_{3}  b_{3}  c_{3} 
 
 

 = 
  x_{1}  y_{1}  z_{1}  x_{2}  y_{2}  z_{2}  x_{3}  y_{3}  z_{3} 
 
 ^{⊤}
⋅
  a_{1}  a_{2}  a_{3}  b_{1}  b_{2}  b_{3}  c_{1}  c_{2}  c_{3} 
 
 ^{⊤}


Fact: If
A is invertible, then so is
A^{⊤}. This can be proven using the fact directly above.
\forall A,B \in \R^(2 \times 2),
`(A) is invertible`
\implies
(A^(1)) * A = [1 , 0; 0 , 1]
A^\t * (A^(1))^\t = ((A^(1)) * A)^\t
`` = [1,0;0,1]^\t
`` = [1,0;0,1]
Fact: det
A = det
A^{⊤}. We can see this easily in the
A ∈ R^{2×2} case.
\forall a,b,c,d \in \R,
\det [a,b;c,d] = a db c
`` = a d  c b
`` = \det [a,c;b,d]
\det [a,b;c,d] = \det [a,c;b,d]
3.10. Orthogonal matrices
Definition: A matrix M ∈ R^{n×n} is orthogonal iff M^{⊤} = M^{ 1}.
Fact: The columns of orthogonal matrices are always orthogonal unit vectors.
The rows of orthogonal matrices are always orthogonal unit vectors.
We can see this in the
R^{2×2} case. For columns, we use the fact that
M^{⊤} ⋅
M =
I:
 =  
 =  
  (a,c) ⋅ (a,c)  (a,c) ⋅ (b,d)  (b,d) ⋅ (a,c)  (b,d) ⋅ (b,d) 
 
  
 =  
For rows, we use that
M ⋅
M^{⊤} =
I:
 =  
 =  
  (a,b) ⋅ (a,b)  (a,b) ⋅ (c,d)  (c,d) ⋅ (a,b)  (c,d) ⋅ (c,d) 
 
  
 =  
Below, we provide a verifiable argument of the above fact for the R^{2×2} case.
\forall a,b,c,d \in \R,
[a,b;c,d] * [a,b;c,d]^\t = [1,0;0,1]
\implies
[a,b;c,d] * [a,c;b,d] = [1,0;0,1]
[a a + b b, a c + b d; c a + d b, c c + d d] = [1,0;0,1]
a a + b b = 1
[a;b] * [a;b] = 1
[a;b] = 1
`([a;b]) is a unit vector`
c c + d d = 1
[c;d] * [c;d] = 1
[c;d] = 1
`([c;d]) is a unit vector`
a c + b d = 0
[a;b] * [c;d] = 0
`([a;b]) and ([c;d]) are orthogonal`
Fact: Matrices representing rotations and reflections are orthogonal. We can show this for the general (counterclockwise) rotation matrix:
 =  
 =    cos ^{2} θ + sin ^{2} θ  cos θ sin θ + sin θ cos θ  sin θ cos θ + cos θ sin θ  sin ^{2} θ + cos ^{2} θ 
 
 

 =  
Example: Suppose that the hour hand of an animated
12hour clock face is represented using a vector [
x ;
y ]. To
maintain the time, the coordinates [
x ;
y ] must be updated once
every hour by applying a matrix
M to the vector representing
the hour hand. What is the matrix
M?
Since the hour hand must be rotated by 360/12 = 30 degrees in the clockwise direction while
the rotation matrix represents counterclockwise rotation, we actually want to find the
rotation matrix for 360  (360/12) = 330 degrees.
Thus, M must be the rotation matrix for θ = 2π  (2π / 30), where θ is specified
in radians. Thus, we have:
 =  
 =  
 =    cos (330/360 ⋅ 2π)  −sin (330/360 ⋅ 2π)  sin (330/360 ⋅ 2π)  cos (330/360 ⋅ 2π) 
 
 

 =  
Example: You are instructed to provide a simple algorithm for
drawing a spiral on the Cartesian plane. The spiral is obtained using
counterclockwise rotation, and for every 360 degree
turn of the spiral, the spiral arm's distance from the origin
should double. Provide a matrix
M ∈ R^{2×2} that will
take any point [
x ;
y ] on the spiral and provide the next point
[
x' ;
y' ] after θ radians of rotation (your definition of
M should contain θ).
It is sufficient to multiply a rotation matrix by a scalar
matrix that scales a vector according to the angle of
rotation. If the angle of rotation is θ, then the
scale factor s should be such that:
In the above, if
n = π/θ then
s is the
nth root of 2.
Thus
M would be:
  2^{θ/(2π)}  0  0  2^{θ/(2π)} 
 

⋅  
 
 =    2^{θ/(2π)} cos θ
 − (2^{θ/(2π)}) sin θ
 2^{θ/(2π)} sin θ
 2^{θ/(2π)} cos θ 
 
 


Fact: Orthogonal matrices are closed under multiplication. For orthogonal
A,
B ∈ R^{n×n} we have:
Fact: Orthogonal matrices are closed under inversion and transposition. For orthogonal
A ∈ R^{n×n} we have:
Thus, we can show that both A^{ 1} and A^{⊤} are orthogonal.
We can summarize this by adding another row to our table of matrix subsets.
subset of R^{n×n} 
definition 
closed under matrix multiplication 
properties of matrix multiplication 
inversion 
orthogonal matrices 
M^{⊤} = M^{ 1} 
closed 
associative, distributive with addition, have identity 
nonzero members have inverses; closed under inversion 
Example: Let
A ∈ R^{2×2} be an orthogonal matrix. Compute
A A^{⊤} A.
We recall that because A is orthogonal, A^{⊤} = A^{ 1}. Thus, we have that
A A^{⊤} A = (A A^{ 1}) A = I A = A.
Fact: Suppose the last row of a matrix
M ∈ R^{n×n} consists of all zeroes. Show that
M is not invertible.
Suppose M is invertible. Then M^{⊤} is invertible. But the last column of M is all zeroes, which means it is a trivial linear
combination of the other column vectors of M. Thus, we have a contradiction, so M cannot be invertible.
3.11. Matrix rank
Yet another way to characterize matrices is by considering their rank.
Definition: We can define a the rank of a matrix M, rank M, as the number of nonzero rows in rref M.
We will see in this course that rank M is related in many ways to the various characteristics of a matrix.
Fact: Matrix rank is preserved by elementary row operations. Why is this the case? Because rref is idempotent and rank is defined in
terms of it:
 =  
number of nonzero rows in rref M  
 =  number of nonzero rows in rref (rref M) 

 =  
Fact: If M ∈ R^{n×n} is invertible, rank M = n. How can we prove this? Because all invertible matrices
have rref M = I, and I has no rows with all zeroes. If I ∈ R^{n×n}, then I has n nonzero rows.
Fact: For A ∈ R^{n×n}, rank A = rank (A^{⊤}).
We will not prove the above in this course in general, but typical proofs
involve first proving that for all A ∈ R^{n×n}, rank A ≤ rank (A^{⊤}). Why is this sufficient to complete the proof? Because we
can apply this fact for both A and A^{⊤} and use the fact that (A^{⊤})^{⊤} = A:
To get some intuition about the previous fact, we might consider the following question: if the columns of a matrix M ∈ R^{2×2}
are linearly independent, are the rows also linearly independent?
Fact: The only matrix in R^{n×n} that has no nonzero rows in reduced row echelon form is I.
Fact: If a matrix M ∈ R^{n×n} has rank n, then it must be that rref M = I (and, thus, M is invertible). This is derived from
the fact above.
Fact: Invertible matrices are closed under the transposition operation. In other words, if
M is invertible, then
M^{⊤} is invertible. How
can we prove this using the rank operator? We know that rank is preserved under transposition, so we have:
Thus, the rank of rank(A^{⊤}) is n, so it is invertible.
The following table summarizes the important facts about the rank and rref operators.
rank (rref M) = rank M 
rref (rref M ) = rref M 
rank (M^{⊤}) = rank M 
for M ∈ R^{n×n}, M is invertible iff rank M = n 
3.12.
Assignment #3: Matrix Properties and Operations (show only this assignment)
In this assignment you will use Python to implement several of the vector and matrix operations and predicates we have introduced
so far.
Please submit a single file a3.py
containing your solutions.
Your file may not import any modules or employ any external library functions
(unless the problem statement explicitly permits this).
You will be graded on the correctness, concision, and mathematical legibility of your code.
The different problems and problem parts rely on each other; carefully consider whether you can use functions you define
in one part within subsequent parts.
 In this assignment, we will represent vectors as Python tuples.
For example, the vector [1;2;3] would be represented in Python as
(1,2,3)
.
 Define a Python function
scale(s,v)
that takes two arguments: a scalar s
and a vector v
.
The function should return the result of multiplying the vector by the scalar.
scale(2, (3,4,5)) # Returns (6,8,10).
 Define a Python function
norm(v)
that takes a vector argument v
and returns its norm (i.e., its length).
 Define a Python function
dot(v,w)
that takes two vectors as arguments and returns their dot product.
If the two vectors do not have the same number of components, the function should return None
.
Include a comment explaining exactly how many addition operations and how many multiplication operations your
implementation performs when the input is a pair of vectors that each have n
components.
dot((1,2), (3,4)) # Returns 11.
dot((5,1,0), (1,1,2)) # Returns 6.
dot((5,1,0,4), (1,2)) # Returns None.
 Define a Python function
orthogonal(v,w)
that takes two vectors as arguments and returns True
only
if the two input vectors are orthogonal to one another; if they are not orthogonal, it returns False
.
If the two vectors do not have the same number of components, the function should return None
.
 Define a Python function
proj(v,w)
that takes two vectors as arguments and returns a vector that
is the projection of v
onto w
.
 In this assignment, we will represent matrices as tuples of tuples. For example, the matrix
would be represented as
((1,2),(3,4))
:
 Define a Python function
mult(A,B)
that takes two matrix arguments and returns the matrix that is
the result of multiplying A
by B
. If either argument is not a valid matrix, or if
the two matrices cannot be multiplied because the number of rows and/or columns does not match as necessary,
the function should return None
.
Include a comment explaining exactly how many addition operations and how many multiplication operations your
implementation performs when the input is a pair of matrices that each have n
rows and columns.
mult(((1,2),(3,4)), ((5,6),(7,8))) # Returns ((9,10),(13,14)).
 Define a Python function
upper(A)
that takes a matrix argument and returns True
only if
the matrix A
is upper triangular; otherwise, it returns False
.
 Define a Python function
transpose(A)
that takes a matrix argument and returns the transpose of that matrix.
 Define a Python function
lower(A)
that takes a matrix argument and returns True
only if
the matrix A
is lower triangular; otherwise, it returns False
.
 Define a Python function
symmetric(A)
that takes a matrix argument and returns True
only if
the matrix A
is symmetric; otherwise, it returns False
.
 Define a Python function
orthogonal(A)
that takes a matrix argument and returns True
only if
the matrix A
is orthogonal; otherwise, it returns False
.
You may name this function orthogonal2()
if all your tests are at the
end of your file
and you don't want this definition to hide the definition of orthogonal()
from Problem #1(d) above.
 In this problem you will implement functions that can be used to generate elementary matrices corresponding to the
three types of elementary row operations. In matrices, the first row is indexed as
i = 1
(unlike
tuples and lists in Python). Thus, you will need to convert the row indices i
and j
into the corresponding Python tuple indices.
Hint: begin with the identity matrix and apply the row operation to that matrix.
 Define a Python function
elementary_swap(r,c,i,j)
. This function should take four integer arguments:
r
is the number of rows
c
is the number of columns;
i
and j
are the two rows to swap.
The function should return a single matrix that can then be used to swap row i
with row j
by using matrix multiplication. See example below.
mult(elementary_swap(3,3,1,3), ((1,2,3), (0,0,0), (7,8,9))) # Returns ((7,8,9), (0,0,0), (1,2,3)).
 Define a Python function
elementary_scale(r,c,i,s)
. This function should take four integer arguments:
r
and c
are the row and column counts, respectively;
i
is the row to scale;
s
is the scalar to use.
The function should return a single matrix that can then be used to scale row i
using the scalar s
.
See example below.
mult(elementary_scale(2,2,2,1), ((1,2), (3,4))) # Returns ((1,2), (3,4)).
 Define a Python function
elementary_add(r,c,i,j,s)
. This function should take four integer arguments:
r
and c
are the row and column counts, respectively;
i
is the row to add to row j
;
s
is the scalar with which to scale row i
before adding it to row j
.
The function should return a single matrix that can then be used to add a multiple (by s
) of row i
to row j
. See example below.
mult(elementary_add(3,3,1,2,1), ((1,2,3), (0,0,0), (7,8,9))) # Returns ((1,2,3), (1,2,3), (7,8,9)).
 Define a Python function
is_rref(A)
that takes a matrix argument A
and returns True
only if A
is in reduced row echelon form; otherwise, it returns False
.
Review 1. Vector and Matrix Algebra and Applications
The following is a breakdown of what you should be able to do at this point in the course
(and of what you may be tested on in an exam).
Notice that many of the tasks below can be composed.
This also means that many problems can be solved in more than one way.
 vectors
 definitions and algebraic properties of scalar and vector operations (addition, multiplication, etc.)
 vector properties and relationships between vectors
 dot product of two vectors
 norm of a vector
 unit vectors
 orthogonal projection of a vector onto another vector
 orthogonal vectors
 linear dependence of two vectors
 linear independence of two vectors
 linear combinations of vectors
 linear independence of three vectors
 lines and planes
 line defined by a vector and the origin ([0; 0])
 line defined by two vectors
 line in R^{2} defined by a vector orthogonal to that line
 plane in R^{3} defined by a vector orthogonal to that plane
 matrices
 algebraic properties of scalar and matrix multiplication and matrix addition
 collections of matrices and their properties (e.g., invertibility, closure)
 identity matrix
 elementary matrices
 scalar matrices
 diagonal matrices
 upper and lower triangular matrices
 matrices in reduced row echcelon form
 determinant of a matrix in R^{2×2}
 inverse of a matrix and invertible matrices
 other matrix operations and properties
 determine whether a matrix is invertible
 using the determinant for matrices in R^{2×2}
 using facts about rref for matrices in R^{n×n}
 algebraic properties of matrix inverses with respect to matrix multiplication
 transpose of a matrix
 algebraic properties of transposed matrices with respect to matrix addition, multiplication, and inversion
 matrix rank
 matrices in applications
 solve an equation of the form LU = w
 matrices and systems of states
 interpret partial observations of system states as vectors
 interpret relationships betweem dimensions in a system of states as a matrix
 given a partial description of a system state and a matrix of relationships, find the full description of the system state
 interpret system state transitions/transformations over time as matrices
 population growth/distributions over time
 compute the system state after a specifieds amount of time
 find the fixed point of a transition matrix
Below is a comprehensive collection of review problems going over the course material covered until this point. These problems are an
accurate representation of the kinds of problems you may see on an exam.
Example: Find any
h ∈ R such that the following two vectors are linearly independent.
There are many ways to solve this problem. One way is to use the definition of linear dependence and find an
h that does not satisfy it.
Then, we have that any
h such that
h ≠ 8 is sufficient to contradict linear dependence (and, thus, imply linear independence):
Another solution is to recall that orthogonality implies linear independence. Thus, it is sufficient to find
h such that
the two vectors are orthogonal.
This implies
h = 100.
5(20) + (5)(20) + (2)h  
 =  
 =  
Example: Suppose we have a matrix
M such that the following three equations are true:
Compute the following:
We should recall that multiplying a matrix by a canonical unit vector with 1 in the ith row in the vector gives us the ith column of the matrix.
Thus, we can immediately infer that:
Thus, we have:
 =    (3,3,3) ⋅ (2,1,1)  (2,0,1) ⋅ (2,1,1) 
 
  
 =  
Example: List at least three properties of the following matrix:
The matrix has many properties, such as:
 it is an elementary matrix
 it is an invertible matrix
 it is an orthogonal matrix
 it is a symmetric matrix
 it has rank n
 its reduced row echelon form is the identity
Example: Find the matrix
B ∈ R^{2×2} that is symmetric, has a constant diagonal
(i.e., all entries on the diagonal are the same real number), and satisfies the following
equation:
We know that B is symmetric and has a constant diagonal, so we need to solve for a and b in:
Example: Compute the inverse of the following matrix:
One approach is to set up the following equation and solve for a,b,c, and d:
Another approach is to apply the formula for the inverse of a matrix in
R^{2×2}:
Example: Let
a ∈ R be such that
a ≠ 0. Compute the inverse of the following matrix:
As in the previous problem, we can either solve an equation or apply the formula:
Example: Suppose
x ∈ R is such that
x ≠ 0. Compute the inverse of the following matrix:
Because we have an upper triangular matrix, computing the inverse by solving the following equation is fairly efficient. Start by considering
the bottom row and its product with each of the columns. This will generate the values for g, h, and i. You can then proceed to the other
rows.
The solution is:
 1/x  0  1/(2x)  0  1/x  0  0  0  1/4x 
 
Example: Assume a matrix
M ∈ R^{2×2} is symmetric, has constant diagonal, and all its entries are nonzero. Show that
A cannot
be an orthogonal matrix.
Let a ≠ 0 and b ≠ 0, and let us define:
Suppose that M is an orthogonal matrix; then, we have that:
Thus, we have ba + ab = 0, so 2ab = 0. This implies that either a = 0 or b = 0. But this contradicts the assumptions, so M cannot be
orthogonal.
Example: Suppose the Earth is located at the origin and your spaceship is in space at the location corresponding to the vector
[ 5 ; 4; 2 ]. Earth is sending transmissions along the vector [ √(3)/3 ; √(3)/3 ; √(3)/3 ]. What is the shortest distance
your spaceship must travel in order to hear a transmission from Earth?
By the triangle inequality, for any vector v ∈ R^{3}, the closest point to v on a line is the orthogonal projection
of v onto that line. We need to find the distance from the spaceship's current position to that point.
We first compute the orthogonal projection of [ 5 ; 4; 2 ] onto the line L
defined as follows:
We can compute the orthogonal projection using the formula for an orthogonal projection of one vector onto another.
Notice that the vector specifying the direction of transmission is already a unit vector:
Now, we must compute the distance between the destination above and the spaceship's current position:
 =  
 =  √((16/3)^{2} + (11/3)^{2} + (5/3)^{2}) 

 =  
 =  
Thus, the shortest distance is √(402)/3.
Example: Two communication towers located at
v ∈ R^{2} and
u ∈ R^{2} are sending directed signals to each other (it is only possible to hear
the signal when in its direct path). You are at the origin and want to travel the shortest possible distance to
intercept their signals. What vector specifies the distance and direction you must travel to intercept their signals?
We can solve this problem by recognizing that the closest point to the origin on the line along which the signals can be intercepted is the vector that is orthogonal to the line (i.e., it is the orthogonal projection of the origin onto the
line). The definition of the line is:
 =  { a ⋅ (u  v) + v  a ∈ R}


Thus, the point
p ∈ R^{2} to which we want to travel must be both
on the line and
orthogonal to the
line (i.e., its slope must be orthogonal to any vector that represents the slope of the line, such as
u 
v). In other words, it must satisfy the following two equations:
Thus, it is sufficient to solve the above system of equations for
p.
4. Vector Spaces
We are interested in studying sets of vectors because they can be used to model sets of system states, observations
and data that might be obtained about systems, geometric shapes and regions, and so on. We can then represent realworld problems
(e.g., given some observations, what is the actual system state) as equations of the form M ⋅ v = w, and sets of vectors as
the collections of possible solutions to those equations. But what is exactly the set of possible solutions to M ⋅ v = w?
Can we characterize it precisely? Can we define a succinct notation for it? Can we say anything about it beyond simply solving the equation?
Does this tell us anything about our system?
In some cases, it may make more sense to consider only a finite set of system states, or an infinite set of discrete states (i.e., only
vectors that contain integer components); for example, this occurs if vectors are used to represent the number of atoms, molecules, cows, chickens,
power plants, single family homes, and so on. However, in this course, we make the assumption that our our sets
of system states (our models of systems) are infinite and continuous (i.e., not finite and not discrete); in this context, this simply
means that the entries in the vectors we use to represent system states are real numbers.
Notice that the assumption of continuity means that, for example, if we are looking for a particular state (e.g., a state corresponding
to some set of observations), we allow the possibility that the state we find will not correspond exactly to a state that "makes sense". Consider
the example problem involving the barn of cows and chickens. Suppose we observe 4 heads and 9 legs. We use the matrix that
represents the relationships between the various dimensions of the system to find the number of cows and chickens:
Notice that the solution above is not an integer solution; yet, it is a solution to the equation we introduced because the set of system states
we are allowing in our solution space (the
model of the system) contains all vectors in
R^{2}, not just those with integer entries.
As we did with vectors and matrices, we introduce a succinct language (consisting of symbols, operators, predicates, terms, and formulas) for
infinite, continuous sets of vectors. And, as with vectors and matrices, we study the algebraic laws that govern these symbolic expressions.
4.1. Sets of vectors and their notation
We will consider three kinds of sets of vectors in this course; they are listed in the table below.
kind of set (of vectors) 
maximum cardinality ("quantity of elements") 
solution space of a... 
examples 
finite set of vectors 
finite 

 {(0,0)}
 {(2,3),(4,5),(0,1)}

vector space 
infinite 
homogenous system of linear equations: M ⋅ v = 0 
 {(0,0)}
 R
 R^{2}
 span{(1,2),(2,3),(0,1)}
 any point, line, or plane
intersecting the origin

affine space 
infinite 
nonhomogenous system of linear equations: M ⋅ v = w 
 { a + v  v ∈ V} where
V is a vector space and a is a vector
 any point, line, or plane

To represent finite sets of vectors symbolically, we adopt the convention of simply listing the vectors between a pair of braces (as with any
set of objects). However, we need a different convention for symbolically representing vector spaces and affine spaces. This is because we
must use a symbol of finite size to represent a vector space or affine space that may contain an infinite number of vectors.
If the solution spaces to equations of the form M ⋅ v = w are infinite, continuous sets of vectors, in what way can be characterize them?
Suppose that M ∈ R^{2×2} and that is M invertible. Then we have that:
 =  
 =  
 =  
 =  
 =  
 =  (s/(ad−bc)) ⋅   + (t/(ad−bc)) ⋅  


Notice that the set of possible solutions
v is a
linear combination of two vectors in
R^{2}. In fact, if a collection of solutions
(i.e., vectors) to the equation
M ⋅
v =
0 exists, it must be a set of linear combinations (in the more general case of
M ⋅
v =
w, it is a set of linear combinations with some specified offset). Thus, we introduce a succinct notation
for a collection of linear combinations of vectors.
Definition: A
span of a set of vectors {
v_{1}, ...,
v_{n} } is the set of all linear combinations of vectors in {
v_{1}, ...,
v_{n} }:
span { v_{1}, ..., v_{n} } = { a_{1} ⋅ v_{1} + ... + a_{n} ⋅ v_{n}  a_{1} ∈ R, ..., a_{n} ∈ R }


Example: For each of the following spans, expand the notation into the equivalent set comprehension and determine if the set
of vectors is a point, a line, a plane, or a threedimensional space.
 The set defined by:
The above span is a line.
 The set defined by:
The above span is a line.
 The set defined by:
The above span is a plane.
 The set defined by:
The above span is a set containing a single point (the origin).
 The set defined by:
 =  {a ⋅   + b ⋅   + c ⋅    a,b,c ∈ R}
 
 =  
The above span is a threedimensional space.
Example: Using span notation, describe the set of vectors that are orthogonal to the vector [ 1 ; 2 ]
∈ R^{2}.
We know that the set of vectors orthogonal to [ 1 ; 2 ] can be defined as the line L where:
It suffices to find a vector on the the line
L. The equation for the line is:
We can choose any point on the line
y = (1/2)
x; for example, [ 2 ; 1 ]. Then, we have that:
Example: Using span notation, describe the set of solutions to the following matrix equation:
Notice that the above equation implies two equations:
In fact, the second equation provides no additional information because 2 ⋅ [ 1 ; 2 ] = [ 2 ; 4 ]. Thus, the solution space
is the set of vectors:
We can now use our solution to the previous problem to find a span notation for the solution space:
Example: Suppose also that system states are described by vectors
v ∈ R^{3} with the following units for each dimension:
 =    x # carbon atoms  y # hydrogen atoms  z # oxygen atoms 
 



Individual molecules are characterized using the following vectors:
C_{3}H_{8}:   , O_{2}:   , CO_{2}:   , H_{2}O:  



Suppose that a mixture contains only molecules of water (H_{2}O) and carbon dioxide (CO_{2}).
Using the span notation, specify the possible set of system states that satisfy these criteria.
The possible set of system states for the mixture is:
Recall that the above set is continuous. In this particular problem, only vectors with integer components
would be of interest; thus, the above set is at least guaranteed to contain all possible system states that satisfy
the specified criteria.
Then, if we wanted to solve a more constrained problem that satisfies the above criteria, we would know that we should only
consider vectors v ∈ V as possible solutions.

Suppose we observe the following system state (in terms of the number of each kind of atom):
How can we determine whether the above mixture could contain only H_{2}0 and CO_{2}?

Suppose we want to know if a mixture of only C_{3}H_{8} and O_{2} can ever react to produce a mixture of only CO_{2} and H_{2}O.
How can we represent this as an equation of spans? This problem can be represented as follows:
Recall the definition for what constitutes a vector space (there are many equivalent definitions).
Definition: A
vector space is a set of vectors that contains
0, is closed under vector addition and scalar multiplication, and is
such that all the elements in the set satisfy the vector space
axioms governing vector addition and scalar multiplication.
Fact: Any set of linear combinations of a collection of vectors is closed under vector addition and scalar multiplication, contains
0, and satisfies the vector space axioms. In other words, for any collection of vectors v_{1}, ..., v_{n}, span{v_{1}, ..., v_{n}} is a vector space.
Fact: For any set of vectors V ⊂ R^{n} that satisfies the vector space axioms, there exists a finite set of at most n vectors
v_{1}, ..., v_{k} (where k ≤ n) such that span{v_{1}, ..., v_{k}} = V.
Given the two facts above, we can safely adopt span{v_{1}, ..., v_{n}} as a standard notation for vector spaces. In addition to this notation,
we will also often use the notation R^{n} for specific values of n (e.g., R^{2} is equivalent to span{[1;0],[0;1]}), and {0} for specific
vector 0 (e.g., {[0;0]} is equivalent to span{[0;0]}).
4.2. Membership and equality relations involving sets of vectors
Recall that many of the algebraic laws we saw governing operators on vectors and matrices involved equality of vectors and matrices. In fact, one
can view these laws as collectively defining the semantic equality of the symbols (i.e., they specify when two symbols refer to the same
object).
The meaning of symbols is closely tied to the equality relation we define over them. In the case of the span notation, one potential
problem is that there is more than one way to describe a set using span notation. For example:
How can we determine if two spans are equivalent? We must define the equality relation (i.e., the relational operator) that applies
to sets of vectors (including infinite sets containing all linear combinations of vectors). We first recall the definition of equality
for our vector notation.
Fact: Recall that two vectors
v,
w ∈ R^{n} are equal if and only if their components are equivalent:
 iff 
a_{1} = b_{1} and a_{2} = b_{2} and ... and a_{n} = b_{n}


With the equality of pairs of vectors defined, it is possible to provide a definition of equality for sets of vectors (both finite and infinite).
However, we will build the definition gradually. First, let us define when a vector is a member of a finite set of vectors using
vector equality.
Fact: A vector
v ∈ R^{n} is a member of the finite set of vectors {
w_{1}, ...,
w_{k} } ⊂
R^{n} if it is equivalent to one of the
vectors in the set:
v ∈ { w_{1}, ..., w_{k} }
 
 iff 
∃ w ∈ { w_{1}, ..., w_{k} } s.t. v = w


Notice that the above defines membership of v in the set using an equation (in this case, v = w_{i} where i ∈ {1,...,k}). We can
take the same approach in the case of an infinite set of vectors.
Fact: A vector
v ∈ R^{n} is a member of the set of vectors span {
w_{1}, ...,
w_{k} } ⊂
R^{n} if it is equivalent to one of the
vectors in the set:
v ∈ span { w_{1}, ..., w_{k} }
 
 iff  ∃ w ∈ span { w_{1}, ..., w_{k} } s.t. v = w 

 iff  ∃ w ∈ { a_{1} ⋅ w_{1} + ... + a_{k} ⋅ w_{k}  a_{1} ∈ R, ..., a_{n} ∈ R } s.t. v = w 

 iff  ∃ a_{1} ⋅ w_{1} + ... + a_{k} ⋅ w_{k} ∈ span { w_{1}, ..., w_{k} } s.t. v = a_{1} ⋅ w_{1} + ... + a_{k} ⋅ w_{k} 

 iff  ∃ a_{1} ∈ R ,..., a_{n} ∈ R s.t. v = a_{1} ⋅ w_{1} + ... + a_{n} ⋅ w_{n} 

 iff  

Thus, we can determine membership of a vector in a span by solving a matrix equation of the form
M ⋅
u =
v.
Example: Determine whether the following formula is true:
We proceed as in the fact above:
 iff  ∃ w ∈ span {   ,   } s.t.   = w 

 iff  ∃ w ∈ { a ⋅   + b ⋅    a ∈ R, b ∈ R } s.t.   = w 

 iff  ∃ a ⋅   + b ⋅   ∈ span {   ,   } s.t.   = a ⋅   + b ⋅   

 iff  ∃ a ∈ R, b ∈ R s.t.   = a ⋅   + b ⋅   

 iff  

Since a solution to the matrix equation exists, the formula is true:
Example: Solve each of the following problems.
 Determine whether the following formula is true or false:
 Define the following line using span notation:
Now suppose we want to determine if a finite set of vectors is a subset of a span. Let us first consider how we would check if a
finite set of vectors is a subset of another finite set of vectors.
Fact: A finite set of vectors {
v_{1}, ...,
v_{j} } ⊂
R^{n} is a subset of the finite set of vectors {
w_{1}, ...,
w_{k} } ⊂
R^{n} if every
member of {
v_{1}, ...,
v_{j} } is a member of {
w_{1}, ...,
w_{k} }:
{ v_{1}, ..., v_{j} } ⊂ { w_{1}, ..., w_{k} }
 
 iff 
∀ v ∈ { v_{1}, ..., v_{j} }, ∃ w ∈ { w_{1}, ..., w_{k} } s.t. v = w


Thus, we can generalize the above by replacing the second finite set of vectors with a span.
Fact: A finite set of vectors {
v_{1}, ...,
v_{j} } ⊂
R^{n} is a subset of the set of vectors span {
w_{1}, ...,
w_{k} } ⊂
R^{n} if every
member of {
v_{1}, ...,
v_{j} } is a member of span {
w_{1}, ...,
w_{k} }:
{ v_{1}, ..., v_{j} } ⊂ span { w_{1}, ..., w_{k} }
 
 iff  ∀ v ∈ { v_{1}, ..., v_{j} }, ∃ w ∈ span { w_{1}, ..., w_{k} } s.t. v = w 

 iff  ∀ v ∈ { v_{1}, ..., v_{j} }, ∃   ∈ R^{k} s.t.   ⋅   = v 

 iff  ∃   a_{11}  ...  a_{1j}  ⋮   ⋮  a_{1k}  ...  a_{kj} 
 

∈ R^{k × j}
s.t.
 
⋅   a_{11}  ...  a_{1j}  ⋮   ⋮  a_{1k}  ...  a_{kj} 
 

=   


Fact: For any finite set of vectors {
v_{1}, ...,
v_{j} } ⊂
R^{n}, for any real number scalars
a_{1} ∈ R, ...,
a_{j} ∈ R,
we have that:
{ v_{1}, ..., v_{j} } ⊂ span { w_{1}, ..., w_{k} } implies a_{1} ⋅ v_{1} + ... + a_{j} ⋅ v_{j} ∈ span { w_{1}, ..., w_{k} }


We can see the above is true, because:
 =  s_{11} ⋅ w_{1} + ... + s_{k1} ⋅ w_{k} 

 ⋮  
 =  s_{1j} ⋅ w_{1} + ... + s_{kj} ⋅ w_{k} 

 =  (a_{1} s_{11}) ⋅ w_{1} + ... + (a_{1} s_{k1}) ⋅ w_{k} 

 ⋮  
 =  (a_{j} s_{1j}) ⋅ w_{1} + ... + (a_{j} s_{kj}) ⋅ w_{k} 

a_{1} ⋅ v_{1} + ... + a_{j} ⋅ v_{j}  
 =  (a_{1} s_{11} + ... + a_{j} s_{1j}) w_{1} + ... + (a_{1} s_{k1} + ... + a_{j} s_{kj}) w_{k}


Thus, we have that:
{ v_{1}, ..., v_{j} } ⊂ span { w_{1}, ..., w_{k} } implies span { v_{1}, ..., v_{j} } ⊂ span { w_{1}, ..., w_{k} }


Definition: Using facts about sets,
we can then specify the following definition of equality between two spans for two finite sets of vectors
V ⊂
R^{n} and
W ⊂
R^{n}:
 iff  span W ⊂ span V and span V ⊂ span W


Example: Determine whether the following formula is true:
It suffices to set up two matrix equations and determine if solutions
A ∈ R^{2 × 3} and
B ∈ R^{3 × 2}
exist:
Alternatively, we can check each vector individually (this is analogous to considering the above equations for
A and
B one column at a time).
Is   a linear combination of   ,   , and   ? 

Is   a linear combination of   ,   , and   ? 

Is   a linear combination of   and   ? 

Is   a linear combination of   and   ? 

Is   a linear combination of   and   ?


If all of the above are true, then the two spans are equivalent. If
any of the above is false, then the two spans are not equivalent.
The above implies that a matrix can be used to represent a particular vector space. We will see in other sections
further below that a given vector space can be represented in more than one way by a matrix, and that more than one matrix can be used
to represent a vector space.
Definition: Given two vector spaces
W and
V, we have:
W is a (vector) subspace of V iff V ⊂ W.
4.3. Vector spaces as abstract structures
Our definitions of a vector space so far have explicitly referenced sets of concrete vectors as we usually understand them. However, this is not
necessary.
Definition: A
vector space is a set of objects
X that satisfies the following conditions:
 addition ⊕: X × X → X is an operation on elements of X such that:
 X is closed under ⊕, so for any x,y ∈ X:
 ⊕ is commutative and associative; for any x,y,z ∈ X, we have:
 there is a unique additive identity 0 ∈ X for the operation ⊕ where for any x ∈ X:
 every element x ∈ X has an additive inverse x where:
 scalar multiplication ⊗: R × X → X is an operation on elements of X such that:
 X is closed under ⊗, so for any s ∈ R, x ∈ X:
 1 ∈ R is an identity with ⊗, so for any x ∈ X:
 ⊗ is associative, so for any s, t ∈ R, x ∈ X:
 ⊗ distributes across ⊕, so for any x,y ∈ X:
The above definition specifies conditions under which any set of objects S can be studied as a vector space.
We have encountered many sets that satisfy the above properties (thus making them vector spaces); below is a table of vector spaces,
including vector spaces we have already encountered and vector spaces we will encounter later in the course.
vector space 
addition operation 
additive identity 
scalar multiplication operation 
R 
addition of real numbers 
0 
multiplication of real numbers 
R^{2} 
vector addition:
[ a ; b ] + [ c ; d ] = [ a + c ; b + d ]

[ 0 ; 0 ] 
scalar multiplication:
s ⋅ [ a ; b ] = [ s ⋅ a ; s ⋅ b ]

R^{3} 
vector addition:
[ a ; b ; c ] + [ d ; e ; f ] = [ a + d ; b + e ; c + f ]

[ 0 ; 0 ; 0] 
scalar multiplication:
s ⋅ [ a ; b ; c ] = [ s ⋅ a ; s ⋅ b ; s ⋅ c ]

R^{n} 
vector addition:
[ a_{1} ; ... ; a_{n} ] + [ b_{1} ; ... ; b_{n} ] = [ a_{1} + b_{1} ; ... ; a_{n} + b_{n} ]

[ 0 ; ... ; 0 ] 
scalar multiplication:
s ⋅ [ a_{1} ; ... ; a_{n} ] = [ s ... a_{1} ; ... ; s ⋅ a_{n} ]

span { [0;0] } = { [0;0] } 
vector addition

[0;0] 
scalar multiplication of vectors in R^{2}

span { v_{1} , ... , v_{k} } ⊂ R^{n} 
vector addition

[ 0 ; ... ; 0 ] 
scalar multiplication of vectors in R^{n}

R^{2×2} 
matrix addition

[ 0 , 0 ; 0 , 0 ] 
scalar multiplication of a matrix

R^{n×n} 
matrix addition

[ 0, ..., 0 ; ... ; 0, ..., 0 ] 
scalar multiplication of a matrix

affine space with origin at a ∈ R^{2} 
v ⊕ w = (v  a) + (w  a) + a

a 
s ⊗ v = s ⋅ (v  a) + a

set of lines through the origin f(x) = a x 
f ⊕ g = h where h(x) = f(x) + g(x)

f(x) = 0 ⋅ x 
s ⊗ f = h where h(x) = s × f(x)

set of polynomials of degree 2 f(x) = a x^{2} + b x + c 
f ⊕ g = h where h(x) = f(x) + g(x)

f(x) = 0 
s ⊗ f = h where h(x) = s × f(x)

set of polynomials of degree k f(x) = a_{k} x^{k} + ... + a_{0} 
f ⊕ g = h where h(x) = f(x) + g(x)

f(x) = 0 
s ⊗ f = h where h(x) = s × f(x)

Example: The affine space
A = {
a +
v 
v ∈ V} is a vector space for appropriate definitions of addition, scalar multiplication, and identity.
An abstract definition of vector spaces is useful because it also allows
us to study by analogy and learn about other objects that are not necessarily sets of vectors. All the properties we can derive about vector
spaces using the above definition will apply to other sets of objects that also satisfy the above definition.
Example: We consider the set of functions
F = {
f 
f(
x) =
cx,
c ∈ R}. How do we show that
F is a vector
space?
Example: Show that
F = {
f 
f(
x) =
bx^{2} +
cx,
b,
c ∈ R} is a vector space.
For our purposes, it is sufficient to show that there is an additive identity, that the set is closed under addition, and that the set is closed under
scalar multiplication. There is an additive identity:
The set is closed under the usual addition operation on polynomial curves; for any
f,
g ∈ F we have
f +
g =
h where:
 =  
 =  
 =  (bx^{2} + cx) + (b'x^{2} + c'x) 

 =  (b + b') ⋅ x^{2} + (c + c') ⋅ x 

 =  (b + b') ⋅ x^{2} + (c + c') ⋅ x 

 ∈  
For any
f ∈ F and
s ∈ R we have
h =
s ⋅
f where:
Example: Find two elements in
F = {
f 
f(
x) =
bx^{2} +
cx +
d,
b,
c,
d ∈ R} that are linearly independent. What does it mean for
two functions to be linearly independent?
Two vectors g, h ∈ \F are linearly independent if they are not linearly dependent. This means there exists no scalar such that
s ⋅ g = h or s ⋅ h = g. One example of such a pair would be:
There is no single scalar by which we can multiply the curve
h(
x) = 1 to obtain a parabola, and there is no single scalar by which we can
multiply the parabola to obtain a nonzero flat line.
Example: What is a finite set of functions that spans {
f 
f(
x) =
bx^{2} +
cx +
d,
b,
c,
d ∈ R}? One such set is:
{f,g,h} where f(x) = 1, g(x) = x, h(x) = x^{2}
Example: We consider the set of functions {
f 
f(
x) = x
^{k},
k ∈ R}. The following definitions of addition and scalar multiplication
make this set of functions a vector space.
Fact: Once we start thinking of curves as a vector space, we can rewrite curvefitting problems as equations involving linear combinations of
curves. For example, suppose we have some curve φ for which we do not know the formula...
...that represents some observable phenomenon. We can hypothesize that
the curve φ(
x) is a linear combination of simpler curves, such as
f(
x) =
x and
g(
x) =
x^{2}. This is equivalent to
hypothesizing that φ is in the following vector space:
span {f, g} = { f  f(x) = a x^{2} + b x where a,b ∈ R }


We can then set up the following
equation:
However, the above equation cannot directly be solved for
a,
b ∈ R because we do not know the formula for φ. Suppose we can
sample
φ on some finite collection of input values {
x_{1},...,
x_{m} } ⊂
R.
We can then write an equation that
approximates the above equation at those
points:
The above is equivalent to the following system of equations:
a ⋅ f(x_{1}) + b ⋅ g(x_{1})  
 =  
 ⋮  
a ⋅ f(x_{m}) + b ⋅ g(x_{m})  
 =  
It can also be rewritten as the following matrix equation:
  f(x_{1})  g(x_{1})  ⋮  f(x_{m})  g(x_{m}) 
 
 ⋅    
 =  
Notice that because we know
f and
g exactly, the matrix above has all constant entries. Furthermore, the righthand side of the equation also
consists of a vector with all constants as entries because we assumed we can sample φ on those inputs. Thus, we now have a matrix equation of
the form
M ⋅
v =
w.
We can now use rref computation or, if the matrix is invertible, any other method for computing the matrix inverse to solve
the above equation for a,b ∈ R. This would give us the exact coefficients of a curve in span {f, g} that fits φ at the x values { x_{1},...,x_{m} }.
Fact: For any two natural numbers
k,
m ∈ N where
k ≠
m, the curves
f and
g defined below are linearly independent:
Corollary: For any natural number
k ∈ N, the curves
f and
g defined below are linearly independent:
We can see this by choosing any set of real number inputs {
x_{1},...,
x_{k+2} }; the equation below then has no solution
s ∈ R:
Since no such
s exists,
f and
g must be linearly independent.
Example: Suppose we have the following two curves:
If we choose any three inputs, e.g., {1,2,3}, we will find that
g cannot be a linear combination of
f because the three points will not be collinear.
Since we derived a contradiction above, no such
s exists, so
f and
g must be linearly independent.
Fact: For any collection of exactly
k points in
R^{2}:
there exists a polynomial
f(
x) =
a_{k1}x^{k1} + ... +
a_{1} x +
a_{0} that fits those points exactly.
We know the above must be true because the columns of the following matrix in R^{k × k} must be linearly independent:
  (x_{1})^{k1}  ...  (x_{1})  1 
⋮   ⋮  ⋮ 
(x_{k})^{k1}  ...  (x_{k})  1 
 



This means that the equation below must have a unique solution:
  (x_{1})^{k1}  ...  (x_{1})  1 
⋮   ⋮  ⋮ 
(x_{k})^{k1}  ...  (x_{k})  1 
 
 ⋅  
 
 =  
Example: Just as with any vector space, we can set up and solve problems involving linear combinations of vectors. Suppose we want to find a
function in the space {
f 
f(
x) =
ax^{3} +
bx^{2} +
cx +
d,
a,
b,
c,
d ∈ R} that fits a certain collection of points, such as:
{(1,3), (1,13), (2,1), (2,33)}
We can interpret each point as a pair (x, f(x)). We can then set up the following system of equations:
Expanding, we have:
a(1)^{3} + b(1)^{2} + c(1) + d  
 =  
a(1)^{3} + b(1)^{2} + c(1) + d  
 =  
a(2)^{3} + b(2)^{2} + c(2) + d  
 =  
a(2)^{3} + b(2)^{2} + c(1) + d  
 =  

Notice that we can rewrite this in the form of an equation M v = w:
  (1)^{3}  (1)^{2}  (1)  1  (1)^{3}  (1)^{2}  (1)  1  (2)^{3}  (2)^{2}  (2)  1   (2)^{3}  (2)^{2}  (2)  1 
 

⋅    
 =  
This shows us that we can interpret individual objects in {f  f(x) = ax^{3} + bx^{2} + cx + d, a,b,c,d ∈ R} as vectors in R^{4}.
We can also view this problem in terms of systems, system states, and observations. If the function f(x) = ax^{3} + bx^{2} + cx + d that solves
the above system is a state of the system, then (3, 13, 1, 33) is a partial observation of that state along four distinct "dimensions".
Note that finding the equation for a line that crosses two points is just a special case of the above.
Example: We want to find a function
f(
x) =
cx +
d such that the points (2,3) and (5,4) fall on the line the equation represents. Thus,
we have:
We can consider many spaces of functions beyond spaces of polynomial functions. For example, suppose exp(x) = e^{x}.
Then we can define the following vector space:
span{ exp, cos , sin }.
We can also generalize this approach to families of related functions.
Example: Consider the following set of vectors of functions, where
f' denotes the derivative of a function
f:
F = { (f, f, f')  f(x) = bx^{2} + cx + d }
The set F is a vector space. Now, suppose we have the following problem. Find the function for a parabola in F such that
(1,4) and (2,3) lie on the parabola, and the maximum or minimum point on the parabola is at x = 1. Such a function is
represented by the solution to the following equation:
  (1)^{2}  (1)  1  (2)^{2}  (2)  1  2(1)  1  0 
 
 ⋅    
 =  
Note that the number of rows in the matrix (and result vector) corresponds to the number of data points for which
a model is being sought, and is not bounded.
Example: Find the order 5 polynomial that exactly fits the following points in
R^{2}:
We must first compute the vectors that approximate each of the following curves that span our space of possible polynomials
at each of the x components of the points above:
{ f  f(x) = a_{5} x^{5} + a_{4} x^{4} + a_{3} x^{3} + a_{2} x^{2} + a_{1} x + a_{0} + % where a_{i} ∈ R }
 
 =  
where
Thus, we want to solve for the coefficients of the following linear combination of curves:
a_{5} f + a_{4} g + a_{3} h + a_{2} i + a_{1} j + a_{0} l  
 =  curve represented by data points


Thus, we would have the following approximation of the above linear combination at the specific
x values in { 1, 8, 6, 2, 10, 15 }:
a_{5}   f(1)  f(8)  f(6)  f(2)  f(10)  f(15) 
 
 +
a_{4}   g(1)  g(8)  g(6)  g(2)  g(10)  g(15) 
 
 +
a_{3}   h(1)  h(8)  h(6)  h(2)  h(10)  h(15) 
 
 +
a_{2}   i(1)  i(8)  i(6)  i(2)  i(10)  i(15) 
 
 +
a_{1}   j(1)  j(8)  j(6)  j(2)  j(10)  j(15) 
 
 +
a_{0}   l(1)  l(8)  l(6)  l(2)  l(10)  l(15) 
 

 
 =  
We can convert the above into the following matrix equation:
  f(1)  g(1)  h(1)  i(1),  j(1)  l(1) 
f(8)  g(8)  h(8)  i(8),  j(8)  l(8) 
f(6)  g(6)  h(6)  i(6),  j(6)  l(6) 
f(2)  g(2)  h(2)  i(2),  j(2)  l(2) 
f(10)  g(10)  h(10)  i(10)  j(10)  l(10) 
f(15)  g(15)  h(15)  i(15)  j(15)  l(15) 
 

⋅
  a_{5}  a_{4}  a_{3}  a_{2}  a_{1}  a_{0} 
 

 
 =  
It is then sufficient to solve the above equation to obtain the ceofficients, and thus the degree 5 polynomial that exactly fits the points
above.
The disadvantage to using the approach presented in this subsection to fitting functions to data points is that the data must
match an actual function perfectly (or, equivalently, the space of functions being considered must be rich
enough to contain a function that can fit the data points exactly). We will see further below
how to find functions that have the "best" fit (for one particular definition of "best") without necessarily matching the points exactly.
Example: Let polynomials in
F = {
f 
f(
t) =
a t^{2} +
b t +
c } represent a space of possible radio signals.
To send a vector
v ∈ R^{3} to Bob, Alice sets her device to generate the signal corresponding to the polynomial in
F whose coefficients
are represented by
v.
Bob can then let his radio receiver sample the radio signals in his environment at multiple points in time
t to retrieve the message.
Suppose Alice wants to transmit the following vector v ∈ R^{3} to Bob:
Alice sets her radio transmitter to generate a signal whose amplitude as a function of time is:
How can Bob recover the message Alice is sending?
Bob can recover the message by having his device sample the signal at three points, e.g.,
t_{1} = 1,
t_{2} = 2, and
t_{3} = 3.
Once Bob does this, he can set up an equation to recover the curve Alice used to generate the signal:
  (1)^{2}  (1)  1  (2)^{2}  (2)  1  (3)^{2}  (3)  1 
 
 ⋅ v  
 =  
 =  
The above equation can then be solved to obtain Alice's message
v.
4.4.
Assignment #4: Vector Spaces and Polynomials (show only this assignment)
In this assignment you will use Python to implement several functions that operate on vector spaces and polynomials.
Please submit a single file a4.py
containing your solutions.
Your file may not import any modules or employ any external library functions
(unless the problem statement explicitly permits this).
You will be graded on the correctness, concision, and mathematical legibility of your code.
The different problems and problem parts rely on each other; carefully consider whether you can use functions you define
in one part within subsequent parts.
In this assignment, we will represent vectors in R^{n} and matrices in R^{n×n} using Python tuples and nested tuples, respectively
(as we did in Assignment #3).
A helper function solve()
is provided below. This function takes a square matrix M
as its first argument and a vector
w
as its second argument. If there is a solution v
to the equation M * v = w
, it returns the vector v
;
otherwise, it returns None
.
The solve()
method has been updated. Please use the implementation below, which should handle
zero rows and columns correctly.
def solve(M, w, epsilon = 1.0/(10**10)):
rows, cols = len(M)+1, len(M[0])+1
if rows != cols: return None
I = [[1 if c==r else 0 for c in range(cols)] for r in range(rows)]
M = [([M[c][r] for c in range(cols1)] if r < rows1 else list(w))+[0]+I[r] for r in range(rows)]
def soln(M):
if len([1 for i in range(cols) if abs(M[1][i]) > epsilon]) > 0: return None
return tuple([1*M[1][cols+j] for j in range(cols1)])
for r in range(rows):
lead = 0
if lead >= cols: return soln(M)
i = r
while M[i][lead] == 0:
i += 1
if i == rows:
i, lead = r, lead + 1
if cols == lead: return soln(M)
while abs(M[r][lead]) < epsilon: lead += 1
if abs(M[r][lead]) > epsilon:
M[r] = [ mrx / M[r][lead] for mrx in M[r]]
for i in [j for j in range(rows) if j != r]:
if r < rows1:
M[i] = [ iv  M[i][lead]*rv for rv,iv in zip(M[r],M[i])]
return soln(M)
Below is an example of
solve()
being invoked:
solve( ((1,3),(2,1)), (5,6) ) # Returns (2.6, 0.8).
 A definition of the
Span
class is provided below. Objects of this class represent spans; the vectors
field
of each object is the finite set of vectors { v_{1}, ..., v_{k} } in the notation span { v_{1}, ..., v_{k} }.
class Span():
def __repr__(self): return "span " + str(self.vectors)
def __str__(self): return "span " + str(self.vectors)
def __init__(self, vectors): self.vectors = vectors
def contains(self, v):
pass # Implement for Problem #1, part (a).
def __eq__(span1, span2):
pass # Implement for Problem #1, part (b).
def basis(self):
pass # Implement for Problem #1, part (c).
def dim(self):
pass # Implement for Problem #1, part (d).
def orthonormal(self):
pass # Implement for Problem #1, part (e).
 Define the
Span
class's contains()
method, which returns True
if the vector argument
v
is in the vector space defined by the span, and False
otherwise.
V = Span( { (1,0), (0,1) } )
V.contains((2,3)) # Returns True.
 Define the
Span
class's __eq__()
method, which takes two arguments that are both Span
objects. The method should return True
if the two spans are equivalent; it should return False
otherwise.
This method is invoked if you apply the ==
operator to two Span
objects:
Span( { (1,0), (0,1) } ) == Span( { (2,3) } ) # Returns False.
 Define the
Span
class's basis()
method, which returns a finite set of vectors corresponding to a basis
of the vector space represented by the Span
object.
 Define the
Span
class's dim()
method, which returns a positive integer corresponding to the dimension
of the vector space represented by the Span
object.
 Define the
Span
class's orthonormal()
method, which returns a finite set of vectors corresponding to an
orthonormal basis of the vector space represented by the Span
object.
 Define a function
exactFit()
that takes as its input a set of vectors in R^{2}.
If there are k + 1 vectors in the input, the function should find a
polynomial of the form f(x) = a_{k} x^{k} + ... + a_{1} x + a_{0} that exactly fits these vectors.
The function should return a single vector (a_{k}, ..., a_{1}, a_{0}) containing the coefficients of the polynomial.
exactFit( {
(1,31), (4, 268327), ( 1, 17), (5, 1520701), ( 3, 389147), \
(3, 78869), (6, 19979509), ( 5, 29571949), ( 0, 1), (2, 5027) \
} )
# The above should return (8, 36, 1, 2, 0, 9, 4, 0, 10, 1) where k is 9.
 In this problem, input polynomials are represented as Python functions. Below are a few examples:
def f(x): return 2 * x**2 + 3 * x  5
def g(x): return x**3 + 4 * x**2  2 * x + 8
Implement the following functions.
 Define a function
findK()
that takes two inputs, a function f
and a positive integer
k
. If there exists a polynomial of the form f(x) = a_{k} x^{k} + ... + a_{1} x + a_{0} that represents
the function f
, the function should return a vector (a_{k}, ..., a_{1}, a_{0}) containing the coefficients of the polynomial.
Otherwise, it should return None
.
def f(x): return x**3 + 4 * x**2  2 * x + 8
findK(f, 3) # Should return (1, 4, 2, 8).
 Define a function
find()
that takes a single input, a function f
.
If for any k there exists a polynomial of the form f(x) = a_{k} x^{k} + ... + a_{1} x + a_{0} that represents
the function f
, the function should return a vector (a_{k}, ..., a_{1}, a_{0}) containing the coefficients of the polynomial.
Otherwise, it should return None
.
def f(x): return x**3 + 4 * x**2  2 * x + 8
find(f) # Should return (1, 4, 2, 8).
Try to make your implementation of
find()
as efficient as possible.
4.5. Basis, dimension, and orthonormal basis of a vector space
We have adopted span{v_{1},...,v_{n}} as our notation for vector spaces. However, this makes it possible to represent a given vector space
in a variety of ways:
span{(0,1),(1,0)} = span{(0,1),(1,0),(1,0)} = span{(0,1),(1,0),(1,0),(1,0)}, and so on.
We might naturally ask: given
a vector space V, what is the smallest possible size for a finite set of vectors W such that V = span W?
Definition: A finite set of vectors B is a basis of the vector space V if span B = V and for all finite
sets of vectors W such that span W = V, B ≤ W.
Fact: A finite set of vectors v_{1},...,v_{n} is a basis for V iff span {v_{1},...,v_{n}} = V and the vectors v_{1},...,v_{n}
are setwise linearly independent.
Fact: Given a finite set of vectors v_{1},...,v_{n}, we can find the basis for span {v_{1},...,v_{n}} by creating a matrix M in which the
rows are the vectors v_{1},...,v_{n} and computing rref M. The set of distinct nonzero rows in rref M is a basis for span {v_{1},...,v_{n}}.
Example: We can find the basis of
V = span {[3;0;7;0], [9;0;21;0], [0;0;2;8], [0;0;1;4], [3;0;13;4], [0;0;1;0]} by computing
the reduced row echelon form of the following matrix. We can use a thirdparty tool to do so (e.g.,
WolframAlpha).
 =    3  0  7  0  9  0  21  0  0  0  2  8  0  0  1  4  3  0  13  4  0  0  1  0 
 
 

 =    1  0  0  0  0  0  1  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0 
 
 


The rows of the matrix rref
M will correspond to the vectors in a basis for
V. Thus, we have that:
Definition: The dimension of a vector space V, which we write as dim V, is the size of any basis of V (recall that every basis
is the same size as every other basis, since they all must have the smallest size of any set of vectors that spans V).
Example: What is the dimension of {
f 
f(
x) =
ax^{3} +
bx^{2} +
cx +
d,
a,
b,
c,
d ∈ R}?
The dimension of a space is the size of its basis.
A basis must consist of vectors that are linearly independent from one another, and it must span the space. We know that the following set B
spans the space:
We also know that the curves
f,
g,
h, and
l are linearly independent. Thus,
B is a basis. Since 
B = 4 and span
B =
V, then we
have that:
Example: Consider the vector space
V consisting of finite sets of real numbers:
What are the basis and dimension of this vector space?
The basis of the space is B = { {1} } since you can obtain any finite set of real numbers
by taking linear combinations of the set {1} ∈ V. Since span { {1} } = V and { {1} } = 1, dim V = 1.
Definition: A finite set of vectors B is an orthonormal basis of the vector space V if B is a basis of V,
all the vectors in B are unit vectors, and the vectors in B are setwise orthogonal.
Recall that for any vector v ∈ R^{n} and any unit vector u ∈ R^{n}, (v ⋅ u) ⋅ u is the projection of v onto the line parallel to
u (i.e., the vector space {a u  a ∈ R}). We can use this fact to define a process for turning an arbitrary basis into an orthonormal basis.
Fact: Given a basis
B = {
v_{1},...,
v_{n}}, it is possible to turn it into an orthonormal basis {
e_{1},...,
e_{n}} by using the GramSchmidt process. This
algorithm can be summarized as follows.
 =    e_{1} = u_{1} / u_{1}  

 =  v_{2} − ((v_{2} ⋅ e_{1}) ⋅ e_{1})  
  e_{2} = u_{2} /  u_{2}  

 =  v_{3} − ((v_{3} ⋅ e_{1}) ⋅ e_{1}) − ((v_{3} ⋅ e_{2}) ⋅ e_{2})  
  e_{3} = u_{3} /  u_{3}  

 =  v_{4} − ((v_{4} ⋅ e_{1}) ⋅ e_{1}) − ((v_{4} ⋅ e_{2}) ⋅ e_{2}) − ((v_{4} ⋅ e_{3}) ⋅ e_{3})  
  e_{4} = u_{4} /  u_{4}  

 ⋮    
 =  v_{n} − Σ_{i = 1}^{n1} ((v_{n} ⋅ e_{i}) ⋅ e_{i})  
  e_{n} = u_{n} /  u_{n} 


Intuitively, for each vector v_{i} ∈ B, the algorithm substracts out the contributions of the alreadycomputed orthogonal unit vectors from
v_{i}, obtaining u_{i}, and then rescales u_{i} to make it into a unit vector e_{i}.
At the end of the above process, {e_{1},...,e_{n}} is the orthonormal basis (and {e_{1},...,e_{n}} is a basis of orthogonal vectors that are not
necessarily unit vectors).
Many computational environments for mathematics that support linear algebra provide an operator for turning a basis into an orthonormal basis.
Why is an orthonormal basis useful? Once again, we appeal to the fact that (v ⋅ u) ⋅ u is the projection of v onto u, where
v ⋅ u is the length of that projection. Suppose we want to determine how to express an arbitrary vector v using an orthonormal
basis u_{1},...,u_{n}.
Fact: Given a vector
v ∈ R^{n}, and an orthonormal basis
B = {
u_{1},...,
u_{n}} for
R^{n}, we can determine what linear combination of the vectors
u_{1},...,
u_{n} yields
v by computing:
a = (M_{B})^{⊤} ⋅ v.
Notice that the components of the vector a, which we will call a_{1},...,a_{n}, are the scalars needed to compute v as a
linear combination of the vectors u_{1},...,u_{n}:
v = a_{1} u_{1} + ... + a_{n} u_{n} = M_{B} a.
Fact: Given a vector v ∈ R^{n}, some k < n, and an orthonormal basis B = {u_{1},...,u_{k}} for a subspace W ⊂ R^{n},
the product (M_{B} ⋅ (M_{B})^{⊤} ⋅ v) is the projection of v onto W.
Example: Notice the relationship of the above fact to projection onto the span of a single unit vector
u = (
x,
y) in
R^{2}.
Suppose we have a basis
B = {
u} for a subspace {
s ⋅
u 
s ∈ R^{2}} ⊂
R^{2}. Then we have:
Thus, for an arbitrary
v ∈ R^{2} not necessarily in {
s ⋅ (
x,
y) 
s ∈ R^{2}} we have:
Thus, we see that the projection of a vector onto another unit vector in R^{2} is just a special case of the general approach to projection.
Example: Suppose we want to project the vector
v ∈ R^{2} onto the space
W ⊂
R^{2} where:
We compute the matrix
M_{B} and its transpose.
M_{B} is a 2 × 1 matrix in this case, and (
M_{B})
^{⊤} is a 1 × 2 matrix:
We can now apply the formula. Notice that it is equivalent to the formula for projection of
v onto the single vector that spans
W:
Thus, the projection of
v onto
W is [3; 3].
Example: Suppose we want to project the vector
v ∈ R^{3} onto the space
W ⊂
R^{3} where:
We compute the matrix
M_{B} and its transpose.
M_{B} is a 3 × 2 matrix in this case, and (
M_{B})
^{⊤} is a 2 × 3 matrix:
We can now apply the formula:
Thus, the projection of
v onto
W is [3; 3; 5].
Example: Suppose we want to project the vector
v ∈ R^{3} onto the space
W ⊂
R^{3} where:
What is the orthogonal projection of
v onto
W?
Since the two vectors that span W are already an orthonormal basis, we can simply project v onto the two individual vectors in the
orthonormal basis and take the sum to obtain the orthogonal projection of v onto W:
Example: Suppose we want to project the vector
v ∈ R^{3} onto the space
W ⊂
R^{3} where:
What is the orthogonal projection of
v onto
W?
Since the two vectors that span W are already orthogonal, it is sufficient to turn them into unit vectors in order to obtain an
orthonormal basis of W. We can then project v onto the two individual vectors in the
orthonormal basis and take the sum to obtain the orthogonal projection of v onto W:
 =  span {   ,   }
(   ⋅   ) ⋅   + (   ⋅   ) ⋅  
 
 =  
 =  
4.6. Homogenous, nonhomogenous, overdetermined, and underdetermined systems
While we have usually considered n × n matrices, in realworld applications (especially those involving data), system states usually have
a shorter description than the corpus of data (e.g., observational data) being used to determine the system state. Thus, problems in such applications
usually involve matrices in which the number of rows is very different from the number of columns. Furthermore, the data may be noisy,
which means that there may be no exact system state that matches the data. Informally, this might mean that the system of equations being
used to determine a system state is overdetermined. On the other hand, if the amount of data is not sufficient to determine a single system
state, a system is underdetermined.
Definition: For any matrix M ∈ R^{n×m} and vector v ∈ R^{m}, the system M x = v is overdetermined if there exist
no solutions to the equation M x = v.
Definition: For any matrix M ∈ R^{n×m} and vector v ∈ R^{m}, the system M x = v is undetermined if there exist
two or more solutions for x that satisfy the equation M x = v.
Definition: For any matrix M ∈ R^{n×m}, the system M x = 0 is homogenous.
Definition: For any matrix M ∈ R^{n×m} and vector v ∈ R^{m} where v ≠ 0, the system M x = v is nonhomogenous.
Fact: A homogenous system M x = 0 has at least one solution.
Fact: A homogenous system M x = 0 is never overdetermined.
Fact: The solution space of a homogenous system is a vector space:
 there is a unique additive identity: 0 is a solution
 adding two solutions yields a solution:
 multiplying a solution by a scalar yields a solution:
Fact: The solution space of a nonhomogenous system is an affine space.
Motivating Example: Suppose we have a nonhomogenous system
M x =
v where
v ∈ R^{1000000}.
We may not know ahead of time whether or
not it is overdetermined. Suppose we do not want to incur the cost of attempting to solve M x = v exactly. This might be because we only want to make
one pass of the data to reduce costs, but it might also be because this is a data stream that is too voluminous to store, so the data will be
gone unless we solve the system right away (e.g., data from a telescope, a particle collider, or Twitter).
In such cases, we can typically assume the data will have noise, so the system is overwhelmingly likely to be overdetermined and have no solution.
Thus, we are okay with finding an approximate solution.
We do know, however, that M x = 0 has at least one solution, and that the solution space is a vector space (so, for example, we
could try to "search" for a better solution using some other technique involving addition and scalar multiplication
once we find at least one nontrivial one). Thus, we might instead
choose to solve the system M x = 0, knowing that even in the worst case, a very poor approximate solution of 0 will always be found
in the worst case.
Is there a better compromise between these two strategies of keeping v or changing it to 0? Can we find some other space of
solutions that won't be overdetermined, but will
still allow us to find a nontrivial (nonzero) approximate solution? One possibility is to project the vector v onto a subspace
of the solution space, ensuring that the system is no longer overdetermined. This approach is covered in the section below.
4.7. Application: approximating overdetermined systems
Fact: Suppose we have an overdetermined system where
M ∈ R^{m × n},
v ∈ R^{n}, and
w ∈ R^{m}:
Let us rewrite
M in terms of its columns
c_{i} ∈ R^{m}:
Let
B = {
c_{1},...,
c_{n}} be a basis for span
B ⊂
R^{m}. To be more general, we will use
W =
R^{m} and
W' = span
B:
Now, it is possible to restate the fact that
M ⋅
v =
w has no solution in a different way:
 =  
 =  
x_{1} ⋅ c_{1} + ... + x_{n} ⋅ c_{n}  
 =  
x_{1} ⋅ c_{1} + ... + x_{n} ⋅ c_{n}  
 ∈  
 ∈  
 ∉  
The above tells us that the real problem is that
w ∉ span
B. It also tells us that for any
w' in the span of the columns of
M (which we call span
B),
M ⋅
v =
w'
will have a solution:
 =  
 ∈  
 =  w' has at least one solution


Definition: Suppose we have an overdetermined system where
v ∈ R^{n}, and
w ∈ R^{m}:
We can find an
approximate solution v' by picking some
w'
∈ span {
c_{1}, ...,
c_{n}} and solving the new equation:
The
error of the approximate solution
v' is defined to be 
w' −
w.
We see that we may have many choices for w' in changing an overdetermined system M ⋅ v = w to a system with at least one solution M ⋅ v' = w'.
Above, we have introduced a notion of error so that we can compare the quality of different choices of w'. How can we pick the w' that minimizes the
error w  w'? Let us first define what the vector leading to the minimal error is.
Definition: Given
w ∈ W and a subspace
W' ⊂
W, the vector
w' within the subspace
W' that is
closest to
w is
a vector
w*
∈ W' such that 
w 
w* is minimal. In other words, for all
w'
∈ W,
w  w* ≤ w  w'.
How do we find w*?
Fact: We first review the triangle inequality in the case of a right triangle. Suppose we have a triangle with a height
a, a base length of
b, and
a hypotenuse of length
c. Then we have:
This implies that the orthogonal projection of a vector
v ∈ V onto a subspace
W ⊂
V is the closest point in
W to
v.
Fact: Given w ∈ W and a subspace W' ⊂ W, the orthogonal projection w* of w onto W' is the closest vector in W' to w.
Fact: Suppose we are given an overdetermined system:
We assume the matrix can be written in terms of its columns:
The
leastsquares approximate solution to
M ⋅
v =
w is the solution
v* to the equation:
where
w* is the orthogonal projection of
w onto span {
c_{1}, ...,
c_{n}}.
The solution
v* is the one that leads to the smallest possible error for any possible vector
v that we can multiply by
M:
w  M v* ≤ w  M_{B} v
Why is it called a "leastsquares" approximate solution? In the table below, we summarize the correspondences used in the above facts.
concept related to solving M_{B} x = v 
notation 
relationship 
notation 
geometric concept 
the space of values W' with which we can replace w in the overdetermined system M v = w to make a system M v = w' that has solutions 
{M ⋅ v  v ∈ R^{n}} 
the span of the columns of M 
span B 
the subspace W' of W spanned by B 
the error of an approximate solution v' 
w  M v'  
M v' = w' 
w  w' 
the distance between w ∈ W and w' ∈ span B 
M ⋅ v* where v* is the minimum error solution 
for all v', w  M w*  ≤ w  M w'  
M v* = w* 
for all w' ∈ span B, w  w* ≤ w  w' 
the orthogonal projection w* of w ∈ W onto span B (the closest vector in span B to w) 
Notice that we know a solution to M v* = w* exists, and that we can show this in two different ways. Since w* ∈ span B, it
must be that w is a linear combination of the vectors in B, so it is a linear combination of the columns in M. Alternatively, if M is
a square matrix and we know that B is a basis, then the columns of M are linearly independent, which means M is invertible, so
v* = M^{ 1} w*.
Fact: We can compute the leastsquares approximate solution
v* to any equation
M ⋅
v =
w by using the following process:
 break M up into a set of its column vectors
 find an orthonormal basis B of the span of the column vectors of M to make M_{B}
 use M_{B} to compute the projection w* of w onto span B
 solve the system M v* = w* (e.g., by finding the rref of an augmented matrix)
Example: Find the leastsquares approximate solution
v* to the following equation:
We have an overdetermined system (i.e., an equation with no solution) of the form M ⋅ v = w. We must turn it into an equation M ⋅ v = w*
that does have a solution by replacing w with w*, the orthogonal projection of w that is in the span of the columns of M.
Let W be the span of the columns of the matrix in the equation above:
We first need to find an orthonormal basis of
W. Since the two vectors above are already orthogonal, it is sufficient to normalize them.
More generally, we would need to apply the GramSchmidt process (this is technically what we are doing here, it is just that the terms
we need to subtract are always 0 in this case). Thus, we have an orthonormal basis:
We now compute the orthogonal projection of
w to find
w*
∈ W:
Thus, we now have a solvable equation
M ⋅
v =
w*:
The error of the approximate solution is 
w −
w*:
error of the approximate solution    
 =  
 =  
 =  
 =  
Example: Suppose a matrix
M is such that
M ⋅
v =
0 has exactly one solution. What can we say about the error of the leastsquares
approximation of any system
M ⋅
v =
w?
Since M is invertible (because there is exactly one solution to M ⋅ v = 0), then there is always an exact solution v to M ⋅ v = w:
Thus, the columns of
M are linearly indepenent and span the space of all possible vectors that can appear on the righthand side of the equation.
This means that
w* =
w, so the error is 
w −
w* = 
w −
w = 0.
Example: Suppose a matrix
M is such that
M ⋅
v =
0 has
R^{n} as its space of solutions. What can we say about any system
M ⋅
v =
w?
What can we say about the error of any leastsquares approximation of a solution for
M ⋅
v =
w?
This means that M is the matrix consisting of all zeroes. Thus, the span of its columns is { 0 }, the set consisting of only the origin. Thus, the error of
any approximate solution will be w  0 = w.
Example: We saw that if
M is the matrix consisting of all zero entries,
w* must be the zero vector (i.e,. the origin). Are there other
matrices
M for which
w* will be
0?
Yes, if all the columns of M are orthogonal to w, then the orthogonal projection of w onto the span of the columns of M will be the origin, 0.
For example, consider the following overdetermined system:
Since [−2; 1] ⋅ [1; 2] = 0 and [−2; 1] ⋅ [2; 4] = 0, the orthogonal projection of [−2; 1] onto the span of the two columns will be [0; 0].
Relationship to curve fitting and linear regressions in statistics
The method described above does overlap with standard curve fitting and linear regression techniques you see
in statistics. There are many variants to these approaches, and the one considered above corresponds to a fairly
basic variant that has no specialized characteristics (i.e., it makes no special assumptions about the data points,
the relative importance of the data points, their distribution, or the way they can be interpreted).

The approach above is known as
ordinary least squares and as
linear least squares.

The case in which the function space is {f  f(x) = ax + b, a,b ∈ R}
corresponds to a simple linear regression.
This involves fitting a line to a collection of points while minimizing the sum of the squares of the
distances parallel to the yaxis between all the data points and the approximate line.
This diagram
is an illustration of this. The method in these notes is more general in that it is not restricted to
polynomials of order 1, but can be used to fit polynomials of any order to data.

We can restate the least squares method described in these notes as finding x* such that
the vector ε in M x* = v  ε is minimized. Notice that ε + w = v.
The length of the vector ε can be viewed as the sum of squares of yaxisaligned distances from the
estimate curve to the actual data points:
ε = v  M x*.

This diagram illustrates the
projection method being used.

The matrix M in M x = v is sometimes called the
design matrix.
The same term is used to refer to the
corresponding
matrix in a simple linear regression.
4.8. Application: approximating a model of system state dimension relationships
The approach described in the previous section can be used to approximate a solution to the equation M v = w. Usually, if M describes
a model of a system (in this sense, system refers to a system of states that are described by values along some number of dimensions),
solving M v = w corresponds to determining a system state v given some other information about a system state w.
What if we instead have a large collection of pairs of observations of system states of the form (v,w) (or, more generally, any collection of
observations of a system along multiple dimensions). Can we approximate a model of a set of relationships between some two subsets of the
dimensions in the system? In other words, if we take all our observations (x_{1}, ..., x_{n}) and divide them into pairs of descriptions
x = (x_{1},...,x_{k}) and v = (x_{k+1},...,x_{n}), can we find the best M that approximates the relationship between incomplete
system state descriptions x and v?
Example: Suppose we have the following dimensions in our system:
 number of red dwarf stars
 number of G type stars
 number of pulsars
 units of infrared (IR) radiation observed
 units of ultraviolet (UV) radiation observed
 units of gamma (γ) radiation observed
Suppose that we already have some set of confirmed (but possibly noisy) observations of systems along all the dimensions (the dimensions
of the quantities in each point correspond to the list of dimensions above):
For the above observations, we want to find a matrix that relates the first three dimensions (the number of each type of star) to the last
three dimensions (the amount of each kind of radiation). In other words, we are looking for a matrix M ∈ R^{3× 3} of the
form:
 a units IR/red dwarf  b units IR/G type  c units IR/pulsar 
d units UV/red dwarf  e units UV/G type  f units UV/pulsar 
g units γ/red dwarf  h units γ/G type  i units γ/pulsar 
 
Multiplication by the above matrix represents a system state description transformation with the following units:
(# red dwarf stars, # G type stars, # pulsars)
→ (units IR, units UV, units γ)
We can split the data into two collections of points: those that specify the number of each type of star (the inputs to the above transformation),
and those that specify the amount of each kind of radiation (the output of the above transformation). Below, we call these P and Q. We then
turn these two sets of data points into matrices. In order to turn this problem into the familiar form M v = w, we can transpose the two
matrices.
Example: Suppose we have four dimensions in our system. Also, suppose that we already have some set of
confirmed (but possibly noisy) observations of systems along
all the dimensions (the dimensions
of the quantities in each point correspond to the list of dimensions above):
For the above observations, we want to find a matrix that relates the first two dimensions to the last
two dimensions. We would then set up the following equations:
Unfortunately, there is no single solution
a,
b,
c,
d ∈ R to the above collection of equations.
To find an approximate solution, we can convert the above into a single matrix equation:
We can go further and turn this into an equation of the form
M ⋅
v =
w:
  1  0  0  0  0  1  0  0  2  0  0  0  0  1  0  0 
0  0  1  0  0  0  0  1  0  0  2  0  0  0  0  1 
 

⋅  
 
 =  
In either case, we can now approach the problem by finding the
closest vector or matrix that is in the span of the matrix on the lefthand side of the equation.
We do this by finding the orthogonal projection of the righthand side onto the span of the matrix.
The above tells us that it is sufficient to project the vector [2; 3; 4; 2] onto the span. The projection is:
(   ⋅   ⋅ (1/√(3))) ⋅   ⋅ (1/√(3))
+ (   ⋅   ⋅ (1/√(2))) ⋅   ⋅ (1/√(2))


The above yields:
We can now set up an equation that has a solution:
 =    1  10/3  0  5/2  2  20/3  0  5/2 
 
 

 ≈  
4.9. Application: distributed computation of leastsquares approximations
Fact: We assume there are
n distinct computing devices {
C_{0}, ...,
C_{n}} (e.g., servers, virtual machines, motes, mobile devices, etc.), that
any device can communicate with a small number (e.g., two) of other devices at any given moment in time, and that all devices can compute or
communicate simultaneously (i.e., independently of one another). Then the following are true:
 if C_{i} knows some small piece of information (e.g., a real number r ∈ R), the devices can distribute r to all the devices in about log n time steps;
 if every device C_{i} has some real number r_{i}, the devices can collectively compute r_{1} + ... + r_{n} in about log n time steps.
Fact: The process of finding an approximate solution
v* to an overdetermined system
M ⋅
v =
w can be broken down into the following basic operations:
 addition and subtraction of vectors;
 projection of one vector onto another vector;
 solving a system M ⋅ v* = w* that must have a solution.
Fact: If two vectors [a_{1}; ...; a_{n}] and [b_{1}; ...; b_{n}] are stored in a distributed manner across multiple devices {C_{0}, ..., C_{n}} such that device C_{i} stores only a_{i} and b_{i}, then the devices can collective compute the sum of these two vectors in one time step: each device C_{i} simply computes a_{i} + b_{i}
and stores the result internally.
4.10. Orthogonal complements and algebra of vector spaces
Definition: The orthogonal complement
W^{⊥} of a vector subspace
W ⊂
V is the set of all vectors in
V that are orthogonal
to all the vectors in
W:
W^{⊥} = {v  v ∈ V, ∀ w ∈ W, v ⋅ w = 0}
Notice that the orthogonal complement of a subspace is always taken within the context of some specified space V.
We consider vector spaces, their orthogonal complements, and common set operations: set union, set intersection, and set product.
Example: Given any two vectors spaces
V and
W, is
V ∪
W a vector space?
No. For example, consider
V = span{[1;0]} ∪ span{[0;1]}.
We have that [1;0] ∈ V and [0;1] ∈ V, but not [1;0] + [0;1] = [1;1] ∈ V.
Example: Given any two vectors spaces
V and
W, is
V ∩
W a vector space?
Yes.
 there is a unique additive identity: 0 ∈ V and 0 ∈ W, so 0 ∈ V ∩ W
 V ∩ W is closed under addition (+): if v,w ∈ V ∩ W then we have that v ∈ V and w ∈ V, and we also have that
v ∈ W and w ∈ W, so we have that
v + w ∈ V and v + w ∈ W, so v + w ∈ V ∩ W.
Since addition satisfies the vector space axioms for elements V and W, it also does so for elements in V ∩ W.
 V ∩ W is closed under scalar multiplication (⋅): if v ∈ V ∩ W then we have that v ∈ V and w ∈ V, so we have that
sv ∈ V and sv ∈ W, so sv ∈ V ∩ W.
Since scalar multiplication satisfies the vector space axioms for elements V and W, it also does so for elements in V ∩ W.
Example: Given any two vectors spaces
V and
W, is
V ×
W a vector space?
Yes.
Exercise: For a vector space W ⊂ V, compute W ∩ W^{⊥}.
Fact: For a vector subspace
W ⊂
V,
dim W + dim W^{⊥} = dim V.
Fact: For a vector subspace
W ⊂
V,
W × W^{⊥} = V.
5. Linear Transformations
5.1. Set products, relations, and maps
We consider the following sets of vectors and their properties.
construct 
definition 
example 
graphical example 
V × W 
{ (v,w)  v ∈ V, w ∈ W } 
{1,2,3} × {4,5,6} = {(1,4),(1,5),(1,6), (2,4),(2,5),(2,6), (3,4),(3,5),(3,6)} 

R is a relation between V and W 
R ⊂ V × W 
{(1,D), (2,B), (2,C)} is a relation between {1,2,3,4} and {A,B,C,D} 

f is a function from V to W f is a map from V to W 
f is a relation between V and W and
∀ v ∈ V, there is at most one w ∈ W s.t. f relates v to w

{ (x,f(x))  f(x) = x^{2} } 

R^{ 1} is the inverse of R 
{ (w,v)  (v,w) ∈ R } 


f: X → Y is injective 



f: X → Y is surjective 



f: X → Y is bijective 



Notice that we may have f such that f is a function, but f^{ 1} is not a function.
Fact: If we say that a map f is a relation between V and W, we can denote this as f : V → W or f ∈ V → W.
Then, V is the domain of f and W is the codomain.
Notice that the definition of f does not uniquely determine its codomain. For example,
f(x) = x^{2} could have a codomain of R if f : R → R, or it could have a codomain of R^{+} if f : R → R^{+}.
Example: Describe with as much detail as you can the domains, codomains, and images of the following maps (there is more than one right
answer for these, as the definitions do not specify the domains of the functions). Determine whether each map is injective, surjective, or both
given the domains and codomains you chose.
 =    
 =    
 =    
 =    
 =    
 =    where M and N are matrices


Fact: Given some
f:
V →
W, the following process can be used to show a map
f is injective:
 assume v,v' ∈ V and v ≠ v';
 it is necessary to show that f(v) ≠ f(v'):
 expand f(v) and f(v') using the definition of f;
 use algebraic properties or other facts to derive f(v) ≠ f(v').
Alternatively, we can use the following approach:
 assume v,v' ∈ V;
 assume f(v) = f(v'):
 expand f(v) and f(v') using the definition of f;
 use algebraic properties or other facts to derive v = v'.
Fact: Given some
f:
V →
W, the following process can be used to determine whether a map
f is surjective:
 let w ∈ W;
 solve f(v) = w:
 if you can solve the equation (or derive an equation v = g(w)) such that v ∈ V, f:V → W is surjective;
 if the equation has no solutions in V, f:V → W is not surjective.
Notice that the above does not mean that there is not some V' where V ⊂ V' that does have a solution
to the equation f(v) = w. For example, f(x) = 3 x is surjective if f ∈ R → R but not surjective
if f ∈ Z → Z.
Example: Show that
f:
R →
R where
f(
x) =
x + 1 is injective.
We can show this as follows by first adding 1 to both sides, then applying the definition of f:
Alternatively, we could use the other method by first apply the definition of
f, then subtracting 1 from both sides.
Example: Show that
f:
R →
R where
f(
x) =
x + 1 is surjective.
Suppose any value in the codomain r ∈ R is chosen. Then we can solve the following equation for a corresponding value x in the domain:
Definition: A map f: V → W is a bijection or is bijective if f is an injection from V to W and f is a surjection from V to W.
Example: Show that f: R → R where f(x) = x + 1 is bijective.
Definition: Given a map
f:
V →
W, we call {
f(
v) 
v ∈ V } the
image of
f:
5.2. Homomorphisms and isomorphisms
The previous section defined a number of properties of functions f: A → B that only address the equality of elements in A and B. However,
what if A and B have relations and operators? For example, what if A and B are vector spaces with an identity, an addition operation, and a
scalar multiplication operation?
We can restrict our notion of a map or function to maps or functions f: A → B that somehow preserve or consistently transform the properties
of operators and relations we may have already defined on A and B. For example, suppose we have A = {a_{1}, a_{2}, a_{3}}, B = {b_{1}, b_{2}, b_{3}},
an operator ⊕ such that a_{1} ⊕ a_{2} = a_{3}, and an operator ⊕ over elements of B such that b_{3} ⊕ b_{2} = b_{1}. A map f from
A to B that preserves (or respects, or consistently transforms) ⊕ would be such that
Notice that the above map is such that the operation ⊕ is respected by the map f:
f(a_{3}) = f(a_{1} ⊕ a_{2}) = f(a_{1}) ⊕ f(a_{2}) = b_{3} ⊕ b_{2} = b_{1} 


Definition: Given a binary operator ⊗ over
A and another operator ⊕ over
B, we say that a map
f:
A →
B is a
homomorphism
if we have that
∀ a,a' ∈ A, f(a ⊗ a') = f(a) ⊕ f(a').
Notice that a homomorphism might have, but does not necesserily have, any of the properties we introduced for maps: it could be injective, surjective,
and so on.
Definition: A bijective homomorphism f: A → B is called an isomorphism.
5.3. Linear transformations
In this course we are interested in a specific kind of homomorphism.
Definition: For any two vector spaces
V and
W, a map
f:
V →
W is a
linear transformation iff we have that for all
v,
v'
∈ V and
scalars
s ∈ R,
In other words, a linear transformation is a homomorphism between vector spaces that preserves vector addition and scalar multiplication.
If a map f does not satisfy the above properties, it is not a linear transformation.
Example: For any matrix
M ∈ R^{n×m}, the map
f :
R^{m} → R^{n} defined as
f(
v) =
M ⋅
v is a linear transformation.
We can confirm that any such f satisfies the properties of a linear transformation:
Example: Representation of a polynomial curve
f as a vector of its
y values on some fixed number of inputs
x_{1},...,
x_{n} is a linear transformation.
Suppose we have the transformation φ defined as follows:
We can confirm that φ is a linear transformation. Suppose that
h(
x) =
f(
x) +
g(
x). Then we have:
 =  
 =  
 =    f(x_{1}) + g(x_{1})  ⋮  f(x_{n}) + g(x_{n}) 
 
 

 =  
 =  
Suppose that
h(
x) =
s ⋅
f(
x). Then we have:
 =  
 =  
 =    s ⋅ f(x_{1})  ⋮  s ⋅ f(x_{n}) 
 
 

 =  
 =  
Fact: For any two linear transformations
f:
V →
W,
g:
U →
V, the composition
f o g:
U →
W is also a linear transformation.
To show this, we must demonstrate that if
h(
x) =
f(
g(
x)) then
h respects vector addition and scalar multiplication. For any
u,
u'
∈ U, and
s ∈ R, we have:
and
Because linear transformations are homomorphisms (and, thus, maps), we can ask whether they have properties of maps (i.e., whether they are injective,
surjective, bijective, and so on). We will do so further below.
Example: Let the map φ :
R^{3} → {
f 
f(
x) =
a x^{2} +
b x +
c} be defined as follows:
 =  h where h(x) = a x^{2} + b x + c


It is the case that φ is a linear transformation and a bijection. Thus, φ is an isomorphism between
R^{3} and
{
f 
f(
x) =
a x^{2} +
b x +
c}.
Example: Differentiation (i.e., finding the derivative) of polynomials is a linear transformation.
As an example, consider the space of polynomials of the form f(x) = a x^{2} + b x + c. If each polynomial is represented as a vector
of its coefficients, the differentiation operator for this vector space of functions can be represented as a matrix: