Lecture Notes
Lecture Notes
David Lerner
Department of Mathematics
University of Kansas
These are notes of a course given in Fall, 2007 and 2008 to the Honors sections of our
elementary linear algebra course. Their comments and corrections have greatly improved
the exposition.
c
2007,
2008 D. E. Lerner
Contents
1 Matrices and matrix algebra
1.1 Examples of matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Operations with matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 Matrices and systems of linear equations
2.1 The matrix form of a linear system . . .
2.2 Row operations on the augmented matrix
2.3 More variables . . . . . . . . . . . . . .
2.4 The solution in vector notation . . . . .
1
1
2
.
.
.
.
7
7
8
9
10
12
12
13
15
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
16
16
17
18
19
20
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
23
23
25
26
27
29
29
31
34
34
36
36
. . . .
. . . .
. . . .
work?
. . . .
5 Homogeneous systems
5.1 Solutions to the homogeneous system . . . . . . . .
5.2 Some comments about free and leading variables . .
5.3 Properties of the homogenous system for Amn . . .
5.4 Linear combinations and the superposition principle .
.
.
.
.
.
.
.
.
.
.
38
38
38
40
40
41
43
45
45
46
10 Subspaces
49
53
53
54
55
56
56
59
60
60
62
14 Change of basis
14.1 The coordinates of a vector . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.2 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
65
66
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
70
70
73
74
75
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
77
77
78
80
81
17 Inner products
17.1 Definition and first properties . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2 Euclidean space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
84
84
86
to Rm
. . . .
. . . .
. . . .
ii
.
.
.
.
89
89
90
.
.
.
.
93
93
94
96
97
.
.
.
.
99
99
100
102
103
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
transformations
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
iii
119
To the student
These are lecture notes for a first course in linear algebra; the prerequisite is a good course
in calculus. The notes are quite informal, but they have been carefully read and criticized by
two sections of honors students, and their comments and suggestions have been incorporated.
Although Ive tried to be careful, there are undoubtedly some errors remaining. If you find
any, please let me know.
The material in these notes is absolutely fundamental for all mathematicians, physical scientists, and engineers. You will use everything you learn in this course in your further studies.
Although we cant spend too much time on applications here, three important ones are
treated in some detail the derivative (Chapter 9), Helmholtzs theorem on infinitessimal
deformations (Chapter 21) and least squares approximations (Chapters 22 and 23).
These are notes, and not a textbook; they correspond quite closely to what is actually said
and discussed in class. The intention is for you to use them instead of an expensive textbook,
but to do this successfully, you will have to treat them differently:
Before each class, read the corresponding lecture. You will have to read it carefully,
and youll need a pad of scratch paper to follow along with the computations. Some
of the easy steps in the computations are omitted, and you should supply them. Its
not the case that the important material is set off in italics or boxes and the rest can
safely be ignored. Typically, youll have to read each lecture two or three times before
you understand it. If youve understood the material, you should be able to work most
of the problems. At this point, youre ready for class. You can pay attention in class
to whatever was not clear to you in the notes, and ask questions.
The way most students learn math out of a standard textbook is to grab the homework
assignment and start working, referring back to the text for any needed worked examples. That wont work here. The exercises are not all at the end of the lecture; theyre
scattered throughout the text. They are to be worked when you get to them. If you
cant work the exercise, you dont understand the material, and youre just kidding
yourself if you go on to the next paragraph. Go back, reread the relevant material and
try again. Work all the unstarred exercises. If you cant do something, get help,
or ask about it in class. Exercises are all set off by Exercise: , so theyre easy to
find. The ones with asterisks (*) are a bit more difficult.
You should treat mathematics as a foreign language. In particular, definitions must
be memorized (just like new vocabulary words in French). If you dont know what
the words mean, you cant possibly do the math. Go to the bookstore, and get yourself
a deck of index cards. Each time you encounter a new word in the notes (you can tell,
because the new words are set off by Definition: ), write it down, together
with its definition, and at least one example, on a separate index card. Memorize
the material on the cards. At least half the time when students make a mistake, its
because they dont really know what the words in the problem mean.
Theres an appendix on proofs and symbols; its not really part of the text, but you
iv
may want to check there if you come upon a symbol or some form of reasoning thats
not clear.
Along with definitions come proofs. Doing a proof is the mathematical analog of
going to the physics lab and verifying, by doing the experiment, that the period of
a pendulum depends in a specific way on its length. Once youve done the proof or
experiment, you really know its true; youre not taking someone elses word for it.
The proofs in this course are (a) relatively easy, (b) unsurprising, in the sense that the
subject is quite coherent, and (c) useful in practice, since the proof often consists of
an algorithm which tells you how to do something.
This may be a new approach for some of you, but, in fact, this is the way the experts learn
math and science: we read books or articles, working our way through it line by line, and
asking questions when we dont understand. It may be difficult or uncomfortable at first,
but it gets easier as you go along. Working this way is a skill that must be mastered by any
aspiring mathematician or scientist (i.e., you).
To the instructor
These are lecture notes for our 2-credit introductory linear algebra course. They correspond
pretty closely to what I said (or should have said) in class. Two of our Math 291 classes
have gone over the notes rather carefully and have made many useful suggestions which have
been happily adopted. Although the notes are intended to replace the standard text for this
course, they may be somewhat abbreviated for self-study.
How to use the notes: The way Ive used the notes is simple: For each lecture, the students
homework was to read the section (either a chapter or half of one) of the text that would
be discussed in class. Most students found this difficult (and somewhat unpleasant) at first;
they had to read the material three or four times before it began to make sense. They also
had to work (or at least attempt) all the unstarred problems before class. For most students,
this took between one and three hours of real work per class. During the actual class period,
I answered questions, worked problems, and tried to lecture as little as possible. This worked
quite well for the first half of the course, but as the material got more difficult, I found myself
lecturing more often - there were certain things that needed to be emphasized that might
not come up in a discussion format.
The students soon became accustomed to this, and even got to like it. Since this is the
way real scientists learn (by working though papers on their own), its a skill that must be
mastered and the sooner the better.
Students were required to buy a 3 5 inch deck of index cards, to write down each definition
on one side of a card, and any useful examples or counterexamples on the back side. They
had to memorize the definitions: at least 25% of the points on each exam were definitions.
The only problems collected and graded were the starred ones. Problems that caused trouble
(quite a few) were worked out in class. There are not many standard drill problems.
Students were encouraged to make them up if they felt they needed practice.
Comments on the material: Chapters 1 through 8, covering the solution of linear algebraic
systems of equations, contains material the students have, in principle, seen before. But
there is more than enough new material to keep everyone interested: the use of elementary
matrices for row operations and the definition of the determinant as an alternating form are
two examples.
Chapter 9 (optional but useful) talks about the derivative as a linear transformation.
Chapters 10 through 16 cover the basic material on linear dependence, independence, basis,
dimension, the dimension theorem, change of basis, linear transformations, and eigenvalues.
The learning curve is fairly steep here; and this is certainly the most challenging part of the
course for most students. The level of rigor is reasonably high for an introductory course;
why shouldnt it be?
Chapters 17 through 21 cover the basics of inner products, orthogonal projections, orthonormal bases, orthogonal transformations and the connection with rotations, and diagonalization of symmetric matrices. Helmholtzs theorem (optional) on the infinitessimal motion of
a non-rigid body is used to motivate the decomposition of the derivative into its symmetric
vi
vii
Chapter 1
Matrices and matrix algebra
1.1
Examples of matrices
A=
5
2
0 3 1
1.2 0.7
x 3
3
4
6 27
is a matrix with 3 rows and 5 columns (a 3 5 matrix). The 15 entries of the matrix are
referenced by the row and column in which they sit: the (2,3) entry of A is 0.7. We may
also write a23 = 0.7, a24 = x, etc. We indicate the fact that A is 3 5 (this is read as
three by five) by writing A35 . Matrices can also be enclosed in square brackets as well as
large parentheses. That is, both
2
4
2
4
and
1 6
1 6
y
v=
z
is a 3 1 matrix. We will generally use upper case Latin letters as symbols for general
matrices, boldface lower case letters for the special case of vectors, and ordinary lower case
letters for real numbers.
Definition: Real numbers, when used in matrix computations, are called scalars.
Matrices are ubiquitous in mathematics and the sciences. Some instances include:
1
Systems of linear algebraic equations (the main subject matter of this course) are
normally written as simple matrix equations of the form Ax = y.
The derivative of a function f : R3 R2 is a 2 3 matrix.
First order systems of linear differential equations are written in matrix form.
The symmetry groups of mathematics and physics, some of which well look at later,
are groups of matrices.
Quantum mechanics can be formulated using infinite-dimensional matrices.
1.2
2
3
7
1
6 1.2
8 0.2
4 +
x = 3 4 + x .
0
1
1
8
1
Definition: If the matrices A and B have the same size, then their sum is the matrix A + B
defined by
(A + B)ij = aij + bij .
Their difference is the matrix A B defined by
(A B)ij = aij bij
.
Definition: A matrix A can be multiplied by a scalar c to obtain the matrix cA, where
(cA)ij = caij .
This is called scalar multiplication. We just multiply each entry of A by c. For example
1 2
3 6
3
=
3 4
9 12
Definition: The m n matrix whose entries are all 0 is denoted 0mn (or, more often, just
by 0 if the dimensions are obvious from context). Its called the zero matrix.
Definition: Two matrices A and B are equal if all their corresponding entries are equal:
A = B aij = bij for all i, j.
2
Definition: If the number of columns of A equals the number of rows of B, then the product
AB is defined by
k
X
(AB)ij =
ais bsj .
s=1
1 2 3
1 0 4
1 0
10
13
1
1
+
2
4
+
3
1
1
0
+
2
2
+
3
3
4 2 =
=
5 12
1 1 + 0 4 + 4 1 1 0 + 0 2 + 4 3
1 3
If AB is defined, then the number of rows of AB is the same as the number of rows of A,
and the number of columns is the same as the number of columns of B:
Amn Bnp = (AB)mp .
Why define multiplication like this? The answer is that this is the definition that corresponds
to what shows up in practice.
Example: Recall from calculus (Exercise!) that if a point (x, y) in the plane is rotated
counterclockwise about the origin through an angle to obtain a new point (x , y ), then
x = x cos y sin
y = x sin + y cos .
In matrix notation, this can be written
x
cos sin
x
.
=
y
sin
cos
y
If the new point (x , y ) is now rotated through an additional angle to get (x , y ), then
x
cos sin
x
=
y
sin
cos
y
x
cos sin
cos sin
=
y
sin cos
sin cos
x
cos cos sin sin (cos sin + sin cos )
=
y
cos sin + sin cos
cos cos sin sin
x
cos( + ) sin( + )
=
y
sin( + )
cos( + )
3
This is obviously correct, since it shows that the point has been rotated through the total
angle of + . So the right answer is given by matrix multiplication as weve defined it, and
not some other way.
Matrix multiplication is not commutative: in English, AB 6= BA, for arbitrary matrices A and B. For instance, if A is 3 5 and B is 5 2, then AB is 3 2, but BA is not
defined. Even if both matrices are square and of the same size, so that both AB and BA
are defined and have the same size, the two products are not generally equal.
Exercise: Write down two 2 2 matrices and compute both products. Unless youve been
very selective, the two products wont be equal.
Another example: If
A=
then
2
3
2 4
3 6
AB =
1 2
, and B =
, while BA = (8).
t
1 2
3 4 = 1 3 5 .
2 4 6
5 6
2 1
3 0
2 7
3 6
, and B =
, so (AB) =
4
1 2
4 3
2 3
7
6
And
t
BA =
as advertised.
1 4
2 3
2 3
1 0
2 3
7
6
Exercise: ** Can you show that (AB)t = B t At ? You need to write out the (i, j)th entry of
both sides and then observe that theyre equal.
Definition: A is square if it has the same number of rows and columns. An important
instance is the identity matrix In , which has ones on the main diagonal and zeros elsewhere:
Example:
1 0 0
I3 = 0 1 0 .
0 0 1
Often, well just write I without the subscript for an identity matrix, when the dimension is
clear from the context. The identity matrices behave, in some sense, like the number 1. If
A is n m, then In A = A, and AIm = A.
Definition: Suppose A and B are square matrices of the same dimension, and suppose that
AB = I = BA. Then B is said to be the inverse of A, and we write this as B = A1 .
Similarly, B 1 = A. For instance, you can easily check that
1 0
1 1
2 1
,
=
0 1
1
2
1 1
and so these two matrices are inverses of one another:
1
1
2 1
1 1
1 1
2 1
=
and
=
.
1 1
1
2
1
2
1 1
Example: Not every square matrix has an inverse. For instance
3 1
A=
3 1
has no inverse.
Exercise: * Show that the matrix A in the above example has no inverse. Hint: Suppose that
a b
B=
c d
is the inverse of A. Then we must have BA = I. Write this out and show that the equations
for the entries of B are inconsistent.
5
Exercise: Which 1 1 matrices are invertible, and what are their inverses?
Exercise: Show that if
1
d b
a b
1
.
, and ad bc 6= 0, then A =
A=
a
c d
ad bc c
Hint: Multiply A by the given expression for A1 and show that it equals I. If ad bc = 0,
then the matrix is not invertible. You should probably memorize this formula.
Exercise: * Show that if A has an inverse that its unique; that is, if B and C are both
inverses of A, then B = C. (Hint: Consider the product BAC = (BA)C = B(AC).)
Chapter 2
Matrices and systems of linear equations
2.1
(2.1)
This system can be solved easily: Multiply the 2nd equation by 4, and add the two resulting
equations to get 11x = 5 or x = 5/11. Substituting this into either equation gives y = 10/11.
In this case, a solution exists (obviously) and is unique (theres just one solution, namely
(5/11, 10/11)).
We can write this system as a matrix equation, in the form Ax = y:
3
4
x
5
=
.
2 1
y
0
Here
x=
x
y
, and y =
5
0
, and A =
3
4
2 1
(2.2)
This formula works because if we multiply the two matrices on the left, we get the 2 1
matrix equation
3x + 4y
5
=
.
2x y
0
And the two matrices are equal if both their entries are equal, which holds only if both
equations in (2.1) are satisfied.
2.2
Of course, rewriting the system in matrix form does not, by itself, simplify the way in which
we solve it. The simplification results from the following observation:
The variables x and y can be eliminated from the computation by simply writing down a
matrix in which the coefficients of x are in the first column, the coefficients of y in the second,
and the right hand side of the system is the third column:
3
4 5
.
(2.3)
2 1 0
We are using the columns as place markers instead of x, y and the = sign. That is, the
first column consists of the coefficients of x, the second has the coefficients of y, and the
third has the numbers on the right hand side of (2.1).
We can do exactly the same operations on this matrix as we did on the original system1 :
3
4 5
: Multiply the 2nd eqn by 4
8 4 0
3 4 5
: Add the 1st eqn to the 2nd
11 0 5
3 4 5
: Divide the 2nd eqn by 11
5
1 0 11
The second equation now reads 1 x + 0 y = 5/11, and weve solved for x; we can now
substitute for x in the first equation to solve for y as above.
Definition: The matrix in (2.3) is called the augmented matrix of the system, and can
be written in matrix shorthand as (A|y).
Even though the solution to the system of equations is unique, it can be solved in many
different ways (all of which, clearly, must give the same answer). For instance, start with
the same augmented matrix
3
4 5
.
2 1 0
1
5 5
2 1 0
1
5
5
:
0 11 10
1 5 5
:
10
0 1 11
The purpose of this lecture is to remind you of the mechanics for solving simple linear systems. Well
give precise definitions and statements of the algorithms later.
The second equation tells us that y = 10/11, and we can substitute this into the first equation
x + 5y = 5 to get x = 5/11. We could even take this one step further:
5
1 0 11
: We added -5(eqn 2) to eqn 1
0 1 10
11
The complete solution can now be read off from the matrix. What weve done is to eliminate
x from the second equation, (the 0 in position (2,1)) and y from the first (the 0 in position
(1,2)).
Exercise: Whats wrong with writing the final matrix as
1 0 0.45
?
0 1 0.91
The system above consists of two linear equations in two unknowns. Each equation, by itself,
is the equation of a line in the plane and so has infinitely many solutions. To solve both
equations simultaneously, we need to find the points, if any, which lie on both lines. There
are 3 possibilities: (a) theres just one (the usual case), (b) there is no solution (if the two
lines are parallel and distinct), or (c) there are an infinite number of solutions (if the two
lines coincide).
Exercise: (Do this before continuing with the text.) What are the possibilities for 2 linear
equations in 3 unknowns? That is, what geometric object does each equation represent, and
what are the possibilities for solution(s)?
2.3
More variables
Lets add another variable and consider two equations in three unknowns:
2x 4y + z = 1
4x + y z = 3
(2.4)
Rather than solving this directly, well work with the augmented matrix for the system which
is
2 4
1 1
.
4
1 1 3
We proceed in more or less the same manner as above - that is, we try to eliminate x from
the second equation, and y from the first by doing simple operations on the matrix. Before
we start, observe that each time we do such an operation, we are, in effect, replacing the
original system of equations by an equivalent system which has the same solutions. For
instance, if we multiply the first equation by the number 2, we get a new equation which
has exactly the same solutions as the original.
Exercise: * This is also true if we replace, say, equation 2 with equation 2 plus some multiple
of equation 1. Why?
9
So, to business:
1
1
1 2
2
2
4
1 1 3
1
1
1 2
2
2
0
9 3 1
1
1 2
2
1
0
1 3
1 0 16
0 1 13
1
2
1
9
13
18
1
9
(2.5)
(2.6)
The matrix (2.5) is called an echelon form of the augmented matrix. The matrix (2.6) is
called the reduced echelon form. (Precise definitions of these terms will be given in the
next lecture.) Either one can be used to solve the system of equations. Working with the
echelon form in (2.5), the two equations now read
x 2y + z/2 = 1/2
y z/3 = 1/9.
So y = z/3 + 1/9. Substituting this into the first equation gives
x = 2y z/2 + 1/2
= 2(z/3 + 1/9) z/2 + 1/2
= z/6 + 13/18
Exercise: Verify that the reduced echelon matrix (2.6) gives exactly the same solutions. This
is as it should be. All equivalent systems of equations have the same solutions.
2.4
We see that for any choice of z, we get a solution to (2.4). Taking z = 0, the solution is
x = 13/18, y = 1/9. But if z = 1, then x = 8/9, y = 4/9 is the solution. Similarly for any
other choice of z which for this reason is called a free variable. If we write z = t, a more
familiar expression for the solution is
1 13
t 13
x
+ 18
6
6
18
y = t + 1 = t 1 + 1 .
(2.7)
3
9
3
9
t
1
0
z
This is of the form r(t) = tv + a, and you will recognize it as the (vector) parametric form
of a line in R3 . This (with t a free variable) is called the general solution to the system
(??). If we choose a particular value of t, say t = 3, and substitute into (2.7), then we have
a particular solution.
Exercise: Write down the augmented matrix and solve these. If there are free variables, write
your answer in the form given in (2.7) above. Also, give a geometric interpretation of the
solution set (e.g., the common intersection of three planes in R3 .)
10
1.
3x + 2y 4z = 3
x 2y + 3z = 4
2.
2x 4y = 3
3x + 2y = 1
x y = 10
3.
x + y + 3z = 4
It is now time to think about what weve just been doing:
Can we formalize the algorithm weve been using to solve these equations?
Can we show that the algorithm always works? That is, are we guaranteed to get all
the solutions if we use the algorithm? Alternatively, if the system is inconsistent (i.e.,
no solutions exist), will the algorithm say so?
Lets write down the different operations weve been using on the systems of equations and
on the corresponding augmented matrices:
1. We can multiply any equation by a non-zero real number (scalar). The corresponding
matrix operation consists of multiplying a row of the matrix by a scalar.
2. We can replace any equation by the original equation plus a scalar multiple of another
equation. Equivalently, we can replace any row of a matrix by that row plus a multiple
of another row.
3. We can interchange two equations (or two rows of the augmented matrix); we havent
needed to do this yet, but sometimes its necessary, as well see in a bit.
Definition: These three operations are called elementary row operations.
In the next lecture, well assemble the solution algorithm, and show that it can be reformulated in terms of matrix multiplication.
11
Chapter 3
Elementary row operations and their
corresponding matrices
3.1
Elementary matrices
As well see, any elementary row operation can be performed by multiplying the augmented
matrix (A|y) on the left by what well call an elementary matrix. Just so this doesnt
come as a total shock, lets look at some simple matrix operations:
Suppose EA is defined, and suppose the first row of E is (1, 0, 0, . . . , 0). Then the first
row of EA is identical to the first row of A.
Similarly, if the ith row of E is all zeros except for a 1 in the ith slot, then the ith row
of the product EA is identical to the ith row of A.
It follows that if we want to change only row i of the matrix A, we should multiply A
on the left by some matrix E with the following property:
Every row except row i should be the ith row of the corresponding identity matrix.
The procedure that we illustrate below is used to reduce any matrix to echelon form (not
just augmented matrices). The way it works is simple: the elementary matrices E1 , E2 , . . .
are formed by (a) doing the necessary row operation on the identity matrix to get E, and
then (b) multiplying A on the left by E.
Example: Let
A=
3
4 5
2 1 0
1. To multiply the first row of A by 1/3, we can multiply A on the left by the elementary
matrix
1
0
3
E1 =
.
0 1
12
(Since we dont want to change the second row of A, the second row of E1 is the same
as the second row of I2 .) The first row is obtained by multiplying the first row of I by
1/3. The result is
4
5
1
3
3
E1 A =
.
2 1 0
You should check this on your own. Same with the remaining computations.
2. To add -2(row1) to row 2 in the resulting matrix, multiply it by
1 0
.
E2 =
2 1
The general rule here is the following: To perform an elementary row operation on
the matrix A, first perform the operation on the corresponding identity matrix
to obtain an elementary matrix; then multiply A on the left by this elementary
matrix.
3.2
4
5
1
3
3
11
10
0 3 3
1 43
0 1
5
3
10
11
Last, we clean out the second column by adding (-4/3)(row 2) to row 1. The corresponding
elementary matrix is
1 43
E4 =
.
0
1
Carrying out the multiplication, we obtain the Gauss-Jordan form of the augmented matrix
5
1 0 11
.
E4 E3 E2 E1 A =
0 1 10
11
13
Naturally, we get the same result as before, so why bother? The answer is that were
developing an algorithm that will work in the general case. So its about time to formally
identify our goal in the general case. We begin with some definitions.
Definition: The leading entry of a matrix row is the first non-zero entry in the row,
starting from the left. A row without a leading entry is a row of zeros.
Definition: The matrix R is said to be in echelon form provided that
1. The leading entry of every non-zero row is a 1.
2. If the leading entry of row i is in position k, and the next row is not a row of zeros,
then the leading entry of row i + 1 is in position k + j, where j 1.
3. All zero rows are at the bottom of the matrix.
The following matrices are in echelon form:
1
0 1
1
, 0 0 1 , and 0 0 1 .
0 1
0 0 0
0 0 0 1
Here the asterisks (*) stand for any number at all, including 0.
1
1 0
,
0 0
0 1
0 0
0
0 1 0 0
1 , and 0 0 1 0 .
0 0
0 0 0 1
Exercise: Suppose A is 3 5. What is the maximum number of leading 1s that can appear
when its been reduced to echelon form? Same questions for A53 . Can you generalize your
results to a statement for Amn ?. (State it as a theorem.)
Once a matrix has been brought to echelon form, it can be put into reduced echelon form
by cleaning out the non-zero entries in any column containing a leading 1. For example, if
1 2 1 3
2 0 ,
R= 0 1
0 0
0 1
which is in echelon form, then it can be reduced to Gauss-Jordan form by adding (-2)(row
2) to row 1, and then (-3)(row 3) to row 1. Thus
1 2 0
1 2 1 3
1 0 5 3
0
1 0 0 1
2 0 = 0 1
2 0 .
0
0 1
0 0
0 1
0 0
0 1
14
and
1 0 3
1 0 5 3
1 0 5 0
0 1
0 0 1
2 0 = 0 1
2 0 .
0 0
1
0 0
0 1
0 0
0 1
Note that column 3 cannot be cleaned out since theres no leading 1 there.
3.3
There is one more elementary row operation and corresponding elementary matrix we may
need. Suppose we want to reduce the following matrix to Gauss-Jordan form
2
2 1
0
3 .
A= 0
1 1
2
Multiplying row 1 by 1/2, and then adding -row 1 to row 3 leads to
1
1 0 0
0
0
2
2
1
1
1
2
2
0
3 = 0
0
3 .
E2 E1 A = 0 1 0 0 1 0 0
5
1 0 1
0 0 1
1 1
2
0 2
2
Now we can clearly do 2 more operations to get a leading 1 in the (2,3) position, and another
leading 1 in the (3,2) position. But this wont be in echelon form (why not?) We need to
interchange rows 2 and 3. This corresponds to changing the order of the equations, and
evidently doesnt change the solutions. We can accomplish this by multiplying on the left
with a matrix obtained from I by interchanging rows 2 and 3:
1 0 0
1
1 21
1
1 21
5
0
3 = 0 2
E3 E2 E1 A = 0 0 1 0
.
2
5
0 2
0
0
3
0 1 0
2
Exercise: Without doing any written computation, write down the Gauss-Jordan form for
this matrix.
Exercise: Use elementary matrices to reduce
A=
2 1
1 3
Chapter 4
Elementary matrices, continued
We have identified 3 types of row operations and their corresponding elementary matrices.
To repeat the recipe: These matrices are constructed by performing the given row operation
on the identity matrix:
1. To multiply rowj (A) by the scalar c use the matrix E obtained from I by multiplying
j th row of I by c.
2. To add (c)(rowj (A)) to rowk (A), use the identity matrix with its k th row replaced by
(. . . , c, . . . , 1, . . .). Here c is in position j and the 1 is in position k. All other entries
are 0
3. To interchange rows j and k, use the identity matrix with rows j and k interchanged.
4.1
E=
1 0
2 1
which adds (2)(row1 (A)) to row2 (A). You should check that the product of these
two is I2 .
If E multiplies the second row of a 2 2 matrix by 12 , then
1 0
1
E =
.
0 2
If E interchanges two rows, then E = E 1 . For instance
0 1
0 1
=I
1 0
1 0
Exercise:
1. If A is 3 4, what is the elementary matrix that (a) subtracts (7)(row3 (A)) from
row2 (A)?, (b) interchanges the first and third rows? (c) multiplies row1 (A) by 2?
2. What are the inverses of the matrices in exercise 1?
3. (*)Do elementary matrices commute? That is, does it matter in which order theyre
multiplied? Give an example or two to illustrate your answer.
4. (**) In a manner analogous to the above, define three elementary column operations
and show that they can be implemented by multiplying Amn on the right by elementary n n column matrices.
4.2
We can now formulate the algorithm which reduces any matrix first to row echelon form,
and then, if needed, to reduced echelon form:
1. Begin with the (1, 1) entry. If its some number a 6= 0, divide through row 1 by a to
get a 1 in the (1,1) position. If it is zero, then interchange row 1 with another row to
get a nonzero (1, 1) entry and proceed as above. If every entry in column 1 is zero,
go to the top of column 2 and, by multiplication and permuting rows if necessary, get
a 1 in the (1, 2) slot. If column 2 wont work, then go to column 3, etc. If you cant
arrange for a leading 1 somewhere in row 1, then your original matrix was the zero
matrix, and its already reduced.
2. You now have a leading 1 in some column. Use this leading 1 and operations of the
type (a)rowi (A) + rowk (A) rowk (A) to replace every entry in the column below the
location of the leading 1 by 0. When youre done, the column will look like
1
0
.. .
.
0
17
3. Now move one column to the right, and one row down and attempt to repeat the
process, getting a leading 1 in this location. You may need to permute this row with
a row below it. If its not possible to get a non-zero entry in this position, move right
one column and try again. At the end of this second procedure, your matrix might
look like
1
0 0 1 ,
0 0 0
where the second leading entry is in column 3. Notice that once a leading 1 has been
installed in the correct position and the column below this entry has been zeroed out,
none of the subsequent row operations will change any of the elements in the column.
For the matrix above, no subsequent row operations in our reduction process will
change any of the entries in the first 3 columns.
4. The process continues until there are no more positions for leading entries we either
run out of rows or columns or both because the matrix has only a finite number of
each. We have arrived at the row echelon form.
The three matrices below are all in row echelon
1
0
0 0 1 , or 0
0
0 0 0 1
0
form:
1
0 1
0 1
0 0
, or
0 0 1
0 0
0 0
1 2
3 4
5 6
7 8
4.3
0
4
3
2
1
4
,
, (3, 4),
7 2
2 5
2 6
Observations
(1) The leading entries progress strictly downward, from left to right. We could just as easily
have written an algorithm in which the leading entries progress downward as we move from
right to left, or upwards from left to right. Our choice is purely a matter of convention, but
this is the convention used by most people.
Definition: The matrix A is upper triangular if any entry aij with i > j satisfies aij = 0.
18
1 0 0
0 0 1 0
0 0 0 1
Of course, cleaning out the columns may lead to changes in the entries labelled with *.
4.4
Suppose we start with the system of equations Ax = y. The augmented matrix is (A|y),
where the coefficients of the variable x1 are the numbers in col1 (A), the equals sign is
represented by the vertical line, and the last column of the augmented matrix is the right
hand side of the system.
If we multiply the augmented matrix by the elementary matrix E, we get E(A|y). But this
can also be written as (EA|Ey).
Example: Suppose
(A|y) =
a b c
d e f
and we want to add two times the first row to the second, using the elementary matrix
1 0
.
E=
2 1
The result is
E(A|y) =
a
b
c
2a + d 2b + e 2c + f
But, as you can easily see, the first two columns of E(A|y) are just the entries of EA, and the
last column is Ey, so E(A|y) = (EA|Ey), and this works in general. (See the appropriate
problem.)
So after multiplication by E, we have the new augmented matrix (EA|Ey), which corresponds to the system of equations EAx = Ey. Now suppose x is a solution to Ax = y.
Multiplication of this equation by E gives EAx = Ey, so x solves this new system. And
conversely, since E is invertible, if x solves the new system, EAx = Ey, multiplication by
E 1 gives Ax = y, so x solves the original system. We have just proven the
Theorem: Elementary row operations applied to either Ax = y or the corresponding augmented
matrix (A|y) dont change the set of solutions to the system.
19
The end result of all the row operations on Ax = y takes the form
Ek Ek1 E2 E1 Ax = Ek E1 y,
or equivalently, the augmented matrix becomes
(Ek Ek1 E2 E1 A|Ek Ek1 E1 y) = R,
where R is an echelon form of (A|y). And if R is in echelon form, we can easily work out
the solution.
4.5
20
If the system is consistent and there are no free variables, then the solution
is unique theres just one. Heres an example of this:
1
0 1
0 0 1
0 0 0 0
If the system is consistent and there
there are infinitely many solutions.
1
0 0
0 0
1
0 0
Here x2 is a free variable, and we get a different solution for each of the infinite number
of ways we could choose x2 .
Just because there are free variables does not mean that the system is
consistent. Suppose the reduced augmented matrix is
1
0 0 1
0 0 0
Here x2 is a free variable, but the system is inconsistent because of the leading 1 in
the last column. There are no solutions to this system.
Exercise: Reduce the augmented matrices for the following systems far enough so that you
can tell if the system is consistent, and if so, how many free variables exist. Dont do any
extra work.
1.
2x + 5y + z = 8
3x + y 2z = 7
4x + 10y + 2z = 20
2.
2x + 5y + z = 8
3x + y 2z = 7
4x + 10y + 2z = 16
21
3.
2x + 5y + z = 8
3x + y 2z = 7
2x + 10y + 2z = 16
4.
2x + 3y = 8
x 4y = 7
Definition: A matrix A is lower triangular if all the entries above the main diagonal
vanish, that is, if aij = 0 whenever i < j.
Exercise:
1. The elementary matrices which add k rowj (A) to rowi (A), j < i are lower triangular. Show that the product of any two 3 3 lower triangular matrices is again lower
triangular.
2. (**) Show that the product of any two n n lower triangular matrices is lower triangular.
22
Chapter 5
Homogeneous systems
Definition: A homogeneous (ho-mo-jeen -i-us) system of linear algebraic equations is one
in which all the numbers on the right hand side are equal to 0:
a11 x1 + . . . + a1n xn = 0
..
..
.
.
am1 x1 + . . . + amn xn = 0
In matrix form, this reads Ax = 0, where A is m n,
x1
,
x = ...
xn n1
and 0 is n 1.
5.1
The homogenous system Ax = 0 always has the solution x = 0. It follows that any
homogeneous system of equations is consistent
Definition: Any non-zero solutions to Ax = 0, if they exist, are called non-trivial solutions.
These may or may not exist. We can find out by row reducing the corresponding augmented
matrix (A|0).
Example: Given the augmented matrix
1
2 0 1 0
5 0 ,
(A|0) = 2 3 4
2
4 0 2 0
23
1
0
0
echelon form
2 0 1 0
1 4
3 0 .
0 0
0 0
Observe that nothing happened to the last column row operations do nothing to a column
of zeros. Equivalently, doing a row operation on a system of homogeneous equations doesnt
change the fact that its homogeneous. For this reason, when working with homogeneous
systems, well just use the matrix A, rather than the augmented matrix. The echelon form
of A is
1 2 0 1
0 1 4
3 .
0 0 0
0
Here, the leading variables are x1 and x2 , while x3 and x4 are the free variables, since there
are no leading entries in the third or fourth columns. Continuing along, we obtain the GaussJordan form (You should be working out the details on your scratch paper as we go along
. . . .)
1 0 8 7
0 1
4
3 .
0 0
0
0
No further simplification is possible because any new row operation will destroy the structure
of the columns with leading entries. The system of equations now reads
x1 8x3 7x4 = 0
x2 + 4x3 + 3x4 = 0,
In principle, were finished with the problem in the sense that we have the solution in hand.
But its customary to rewrite the solution in vector form so that its properties are more
evident. First, we solve for the leading variables; everything else goes on the right hand side:
x1 = 8x3 + 7x4
x2 = 4x3 3x4 .
Assigning any values we choose to the two free variables x3 and x4 gives us one the many
solutions to the original homogeneous system. This is, of course, why the variables are
called free. For example, taking x3 = 1, x4 = 0 gives the solution x1 = 8, x2 = 4. We
can distinguish the free variables from the leading variables by denoting them as s, t, u,
24
etc. This is not logically necessary; it just makes things more transparent. Thus, setting
x3 = s, x4 = t, we rewrite the solution in the form
x1
x2
x3
x4
=
=
=
=
8s + 7t
4s 3t
s
t
More compactly, the solution can also be written in matrix and set notation as
7
8
x1
3
4
x
2
: for all s, t R
+ t
= s
xH =
0
1
x3
1
0
x4
(5.1)
The curly brackets { } are standard notation for a set or collection of objects.
Notice that xH is an infinite set of objects (one for each possible choice of s and t) and not
a single vector. The notation is somewhat misleading, since the left hand side xH looks like
a single vector, while the right hand side clearly represents an infinite collection of objects
with 2 degrees of freedom. Well improve this later.
5.2
BUT . . .
What is invariant (i.e., independent of the computational details) is the number of free
variables (2) and the number of leading variables (also 2 here). No matter how you solve the
system, youll always wind up being able to express 2 of the variables in terms of the other
2! This is not obvious. Later well see that its a consequence of a general result called the
dimension or rank-nullity theorem.
The reason we use s and t as the parameters in the system above, and not x3 and x4 (or
some other pair) is because we dont want the notation to single out any particular variables
as free or otherwise theyre all to be on an equal footing.
5.3
If we were to carry out the above procedure on a general homogeneous system Amn x = 0,
wed establish the following facts:
The number of leading variables is min(m, n).
The number of non-zero equations in the echelon form of the system is equal to the
number of leading entries.
The number of free variables plus the number of leading variables = n, the number of
columns of A.
The homogenous system Ax = 0 has non-trivial solutions if and only if there are free
variables.
If there are more unknowns than equations, the homogeneous system always has nontrivial solutions. (Why?) This is one of the few cases in which we can tell something
about the solutions without doing any work.
A homogeneous system of equations is always consistent (i.e., always has at least one
solution).
Exercise:
1. What sort of geometric object does xH represent?
2. Suppose A is 4 7. How many leading variables can Ax = 0 have? How many free
variables?
3. (*) If the Gauss-Jordan form of A has a row of zeros, are there necessarily any free
variables? If there are free variables, is there necessarily a row of zeros?
26
5.4
2
2
+
.
x2 y 2
The differential operator has the same property as matrix multiplication, namely: if
(x, y) and (x, y) are two differentiable functions, and s and t are any two real numbers,
then
(s + t) = s + t.
27
Exercise: Verify this. That is, show that the two sides are equal by using properties of the
derivative. The functions and are, in fact, vectors, in an infinite-dimensional space called
Hilbert space.
It follows that if and are two solutions to Laplaces equation, then any linear combination
of and is also a solution. The principle of superposition also holds for solutions to the
wave equation, Maxwells equations in free space, and Schrodingers equation in quantum
mechanics. For those of you who know the language, these are all (systems of) homogeneous
linear differential equations.
Example: Start with white light (e.g., sunlight); its a collection of electromagnetic waves
which satisfy Maxwells equations. Pass the light through a prism, obtaining red, orange,
. . . , violet light; these are also solutions to Maxwells equations. The original solution (white
light) is seen to be a superposition of many other solutions, corresponding to the various
different colors (i.e. frequencies). The process can be reversed to obtain white light again
by passing the different colors of the spectrum through an inverted prism. This is one of the
experiments Isaac Newton did when he was your age.
Referring back to the example (see Eqn (5.1)), if we set
7
8
4
, and y = 3 ,
x=
0
1
1
0
then the susperposition principle tells us that any linear combination of x and y is also a
solution. In fact, these are all of the solutions to this system, as weve proven above.
28
Chapter 6
The Inhomogeneous system Ax = y, y 6= 0
Definition: The system Ax = y is inhomogeneous if its not homogeneous.
Mathematicians love definitions like this! It means of course that the vector y is not the zero
vector. And this means that at least one of the equations has a non-zero right hand side.
6.1
As an example, we can use the same system as in the previous lecture, except well change
the right hand side to something non-zero:
x1 + 2x2 x4 = 1
2x1 3x2 + 4x3 + 5x4 = 2 .
2x1 + 4x2 2x4 = 3
Those of you with sharp eyes should be able to tell at a glance that this system is inconsistent
that is, there are no solutions. Why? Were going to proceed anyway because this is hardly
an exceptional situation.
The augmented matrix is
1
2 0 1 1
5 2 .
(A|y) = 2 3 4
2
4 0 2 3
1
0
0
2 0 1 1
1 4
3 4 .
0 0
0 1
29
1 0 8 7 0
0 1
4
3 0 .
0 0
0
0 1
1 2 0 1 1
0 1 4
3 4
0 0 0
0 0
and the reduced echelon form is
1 0 8 7 7
0 1
4
3
4 .
0 0
0
0
0
Since this is consistent, we have, as in the homogeneous case, the leading variables x1 and x2 ,
and the free variables x3 and x4 . Renaming the free variables by s and t, and writing out
the equations solved for the leading variables gives us
x1
x2
x3
x4
=
=
=
=
8s + 7t 7
4s 3t + 4
.
s
t
30
This looks like the solution to the homogeneous equation found in the previous section except
for the additional scalars 7 and + 4 in the first two equations. If we rewrite this using
vector notation, we get
7
7
8
x1
4
3
4
x
2
: s, t R
+
+t
=s
xI =
0 0
1
x3
0
1
0
x4
(The symbol is mathematical shorthand for the words for all or, equivalently, for any, or
for each, or for every).
Definition: xI is called the general solution to the inhomogeneous equation.
Compare this with the general solution xH to the homogenous equation found before. Once
again, we have a 2-parameter family (or set) of solutions. We can get a particular solution
by making some specific choice for s and t. For example, taking s = t = 0, we get the
particular solution
7
4
xp =
0 .
0
We can get other particular solutions by making other choices. Observe that the general
solution to the inhomogeneous system worked out here can be written in the form xI =
xH + xp . In fact, this is true in general:
p be two solutions to Ax = y. Then their difference xp x
p is a solution
Theorem: Let xp and x
to the homogeneous equation Ax = 0. The general solution to Ax = y can be written as
xI = xp + xH where xH denotes the general solution to the homogeneous system.
p are solutions, we have A(xp x
p ) = Axp A
Proof: Since xp and x
xp = y y = 0. So
their difference solves the homogeneous equation. Conversely, given a particular solution
xp , then the entire set xp + xH consists of solutions to Ax = y: if z belongs to xH , then
A(xp + z) = Axp + Az = y + 0 = y and so xp + z is a solution to Ax = y.
6.2
Going back to the example, suppose we write the general solution to Ax = y in the vector
form
xI = {sv1 + tv2 + xp , s, t R} ,
where
31
7
7
8
4
, v2 = 3 , and xp = 4
v1 =
0
0
1
0
1
0
8
3
p =
x
1 .
1
We can rewrite the general solution as
xI = (s 1 + 1)v1 + (t 1 + 1)v2 + xp
p
= (s 1)v1 + (t 1)v2 + x
.
p
= sv1 + tv2 + x
As s and t run over all possible pairs of real numbers we get exactly the same set of solutions
p + xH as well as xp + xH ! This is a bit
as before. So the general solution can be written as x
confusing unless you recall that these are sets of solutions, rather than single solutions; (
s, t)
and (s, t) are just different sets of coordinates. But running through either set of coordinates
(or parameters) produces the same set.
Remarks
Those of you taking a course in differential equations will encounter a similar situation:
the general solution to a linear differential equation has the form y = yp + yh , where
yp is any particular solution to the DE, and yh denotes the set of all solutions to the
homogeneous DE.
We can visualize the general solutions to the homogeneous and inhomogeneous equations weve worked out in detail as follows. The set xH is a 2-plane in R4 which goes
through the origin since x = 0 is a solution. The general solution to Ax = y is obtained by adding the vector xp to every point in this 2-plane. Geometrically, this gives
another 2-plane parallel to the first, but not containing the origin (since x = 0 is not
a solution to Ax = y unless y = 0). Now pick any point in this parallel 2-plane and
add to it all the vectors in the 2-plane corresponding to xH . What do you get? You
p + xH .
get the same parallel 2-plane! This is why xp + xH = x
p be the solution obtained by taking s = 2, t =
Exercise: Using the same example above, let x
p and x
p x
p are solutions to the homogeneous equation.
1. Verify that both xp x
32
xp + z
xH
xp
z
33
Chapter 7
Square matrices, inverses and related matters
7.1
Square matrices are the only matrices that can have inverses, and for this reason, they are
a bit special.
In a system of linear algebraic equations, if the number of equations equals the number of
unknowns, then the associated coefficient matrix A is square. If we row reduce A to its
Gauss-Jordan form, there are two possible outcomes:
1. The Gauss-Jordan form for Ann is the n n identity matrix In (commonly written
as just I).
2. The Gauss-Jordan form for A has at least one row of zeros.
The second case is clear: The GJ form of Ann can have at most n leading entries. If the
GJ form of A is not I, then the GJ form has n 1 or fewer leading entries, and therefore
has at least one row of zeros.
In the first case, we can show that A is invertible. To see this, remember that A is reduced
to GJ form by multiplication on the left by a finite number of elementary matrices. If the
GJ form is I, then when all the dust settles, we have an expression like
Ek Ek1 . . . E2 E1 A = I,
where Ek is the matrix corresponding to the k th row operation used in the reduction. If we
set B = Ek Ek1 . . . E2 E1 , then clearly BA = I and so B = A1 .
1
Furthermore, multiplying BA on the left by (note the order!!!) Ek1 , then by Ek1
, and
continuing to E11 , we undo all the row operations that brought A to GJ form, and we get
back A. In detail, we get
1
1
Ek1 )I or
Ek1 )BA = (E11 E21 . . . Ek1
(E11 E21 . . . Ek1
1
1
(E11 E21 . . . Ek1
Ek1 )(Ek Ek1 . . . E2 E1 )A = E11 E21 . . . Ek1
Ek1
1
A = E11 E21 . . . Ek1
Ek1
34
We summarize this in a
Theorem: The following are equivalent (i.e., each of the statements below implies and is implied
by any of the others)
The square matrix A is invertible.
The Gauss-Jordan or reduced echelon form of A is the identity matrix.
A can be written as a product of elementary matrices.
Example: - (fill in the details on your scratch paper)
We start with
A=
2 1
1 2
1
2
3
2
1
2
3
2
1 12
0 1
1
= E4 E3 E2 E1 =
3
2 1
1
2
Exercise:
Check the last expression by multiplying the elementary matrices together.
Write A as the product of elementary matrices.
The individual factors in the product of A1 are not unique. They depend on how we
do the row reduction. Find another factorization of A1 . (Hint: Start things out a
different way, for example by adding -(row 2) to row 1.)
Let
A=
1 1
2 3
7.2
If A is invertible, then the equation Ax = y has the unique solution A1 y for any right
hand side y. For,
Ax = y A1 Ax = A1 y x = A1 y.
In this case, the solution to the homogeneous equation is also unique - its the trivial
solution x = 0.
If A is not invertible, then there is at least one free variable (why?). So there are nontrivial solutions to Ax = 0. If y 6= 0, then either Ax = y is inconsistent (the most
likely case) or solutions to the system exist, but there are infinitely many.
Exercise: * If the square matrix A is not invertible, why is it likely that the inhomogeneous equation is inconsistent? Likely, in this context, means that the system should be
inconsistent for a y chosen at random.
7.3
The work weve just done leads immediately to an algorithm for constructing the inverse
of A. (Youve probably seen this before, but now you know why it works!). Its based on
the following observation: suppose Bnp is another matrix with the same number of rows as
Ann , and Enn is an elementary matrix which can multiply A on the left. Then E can also
multiply B on the left, and if we form the partitioned matrix
C = (A|B)n(n+p),
Then, in what should be an obvious notation, we have
EC = (EA|EB)nn+p ,
where EA is n n and EB is n p.
Exercise: Check this for yourself with a simple example. (*) Better yet, prove it in general.
The algorithm consists of forming the partitioned matrix C = (A|I), and doing the row
operations that reduce A to Gauss-Jordan form on the larger matrix C. If A is invertible,
well end up with
Ek . . . E1 (A|I) = (Ek . . . E1 A|Ek . . . E1 I)
.
= (I|A1 )
In words: the same sequence of row operations that reduces A to I will convert I to A1 .
The advantage to doing things this way is that we dont have to write down the elementary
matrices. Theyre working away in the background, as we know from the theory, but if all
we want is A1 , then we dont need them explicitly; we just do the row operations.
36
Example:
1 2
3
Let A = 1 0 1 .
2 3
1
1 2
3 1 0 0
1 0 1 0 1 0
2 3
1 0 0 1
r1 r2
1 0 1 0 1 0
1 2
3 1 0 0
2 3
1 0 0 1
1 0 1 0
1 0
0 2
4 1 1 0
0 3
3 0 2 1
do col 1
do column 2
So,
and column 3
1 0 1
0
1 0
1
1
0 1
2
0
2
2
1
3
1
0 0 3
2
2
1
1
7
1 0 0
2
6
3
5
2
1
0 1 0
2
6
3
1
1
1
0 0 1
2
6
3
A1
1
1
7
2
6
3
5
2
1
2
6
3
1
1
1
2
6
3
Exercise: Write down a 2 2 matrix and do this yourself. Same with a 3 3 matrix.
37
Chapter 8
Square matrices continued: Determinants
8.1
Introduction
Determinants give us important information about square matrices, and, as well soon see, are
essential for the computation of eigenvalues. You have seen determinants in your precalculus
courses. For a 2 2 matrix
a b
A=
,
c d
For a 3 3 matrix
det(A) = ad bc.
det(A) = a11 a22 a33 + a13 a21 a32 + a12 a23 a31 a12 a21 a33 a11 a23 a32 a13 a22 a31 .
Things get worse quickly as the dimension increases. For an n n matrix A, the expression
for det(A) has n factorial = n! = 1 2 . . . (n 1) n terms, each of which is a product of n
matrix entries. Even on a computer, calculating the determinant of a 10 10 matrix using
this sort of formula would be unnecessarily time-consuming, and doing a 1000 1000 matrix
would take years!
8.2
It is often the case that the simple algorithms and definitions we use in class turn out to be
cumbersone, inaccurate, and impossibly time-consuming when implemented on a computer.
There are a number of reasons for this:
38
1. Floating point arithmetic, used on computers, is not at all the same thing as working
with real numbers. On a computer, numbers are represented (approximately!) in the
form
x = (d1 d2 dn ) 2a1 a2 am ,
where n and m might be of the order 50, and d1 . . . am are binary digits (either 0 or1).
This is called the floating point representation (Its the decimal point that floats you can represent the number 8 as 1000 20 , as 10 22 , etc.) As a simple example of
what goes wrong, suppose that n = 5. Then 19 = 1 24 + 0 23 + 0 22 + 1 21 + 1 20 , and
therefore has the binary representation 10011. Since it has 5 digits, its represented
correctly in our system. So is the number 9, represented by 1001. But the product
19 9 = 171 has the binary representation 10101011, which has 8 digits. We can only
keep 5 significant digits in our (admittedly primitive) representation. So we have to
decide what to do with the trailing 011 (which is 3 in decimal). We can round up
or down: If we round up we get 10111000 = 10110 23 = 176, while rounding down
gives 10101 23 = 168. Neither is a very good approximation to 171. Certainly a
modern computer does a better job than this, and uses much better algorithms, but
the problem, which is called roundoff error still remains. When we do a calculation
on a computer, we almost never get the right answer. We rely on something called
the IEEE standard to prevent the computer from making truly silly mistakes, but this
doesnt always work.
2. Most people know that computer arithmetic is approximate, but they imagine that
the representable numbers are somehow distributed evenly along the line, like the
rationals. But this is not true: suppose that n = m = 5 in our little floating point
system. Then there are 25 = 32 floating point numbers between 1 = 20 and 2 = 21 .
They have binary representations of the form 1.00000 to 1.11111. (Note that changing
the exponent of 2 doesnt change the number of significant digits; it just moves the
decimal point.) Similarly, there are precisely 32 floating point numbers between 2 and
4. And between 211110 = 230 (approximately 1 billion) and 211111 = 231 (approximately
2 billion)! The floating point numbers are distributed logarithmically which is quite
different from the even distribution of the rationals. Any number 231 or 231 cant
be represented at all. Again, the numbers are lots bigger on modern machines, but the
problem still remains.
3. A frequent and fundamental problem is that many computations dont scale the way
wed like them to. If it takes 2 msec to compute a 2 2 determinant, wed like it to
take 3 msec to do a 33 one, . . . , and n seconds to do an nn determinant. In fact, as
you can see from the above definitions, it takes 3 operations (2 multiplications and one
addition) to compute the 2 2 determinant, but 17 operations (12 multiplications and
5 additions) to do the 3 3 one. (Multiplying 3 numbers together, like xyz requires 2
operations: we multiply x by y, and the result by z.) In the 4 4 case (whose formula
is not given above), we need 95 operations (72 multiplications and 23 additions). The
evaluation of a determinant according to the above rules is an excellent example of
something we dont want to do. Similarly, we never solve systems of linear equations
using Cramers rule (except in some math textbooks!).
39
4. The study of all this (i.e., how to do mathematics correctly on a computer) is an active
area of current mathematical research known as numerical analysis.
Fortunately, as well see below, computing the determinant is easy if the matrix happens to
be in echelon form. You just need to do a little bookkeepping on the side as you reduce the
matrix to echelon form.
8.3
Let A be n n, and write r1 for the first row, r2 for the second row, etc.
8.4
det(. . . , ri + crj , . . . , rj , . . .)
det(. . . , ri , . . . , rj , . . .) + det(. . . , crj , . . . , rj , . . .)
det(A) + c det(. . . , rj , . . . , rj , . . .)
det(A) + 0
The second determinant vanishes because both the ith and j th rows are equal to rj .
These properties, together with the definition, tell us exactly what happens to det(A) when
we perform row operations on A.
Theorem: The determinant of an upper or lower triangular matrix is equal to the product of the
entries on the main diagonal.
Proof: Suppose A is upper triangular and that none of the entries on the main diagonal is
0. This means all the entries beneath the main diagonal are zero. This means we can clean
out each column above the diagonal by using a row operation of the type just considered
above. The end result is a matrix with the original non zero entries on the main diagonal
and zeros elsewhere. Then repeated use of property 1 gives the result. A similar proof works
for lower triangular matrices. For the case that one or more of the diagonal entries is 0, see
the exercise below.
Remark: This is the property we use to compute determinants, because, as we know, row
reduction leads to an upper triangular matrix.
Exercise: ** If A is an upper triangular matrix with one or more 0s on the main diagonal,
then det(A) = 0. (Hint: show that the GJ form has a row of zeros.)
8.5
Examples:
1. Let
A=
41
2
1
3 4
1
1
2
det(A) = 2 det
.
3 4
1
1
2 .
And by proposition 3, this = 2 det
11
0
2
1
11
1 2
Using property 1 again gives = (2)( ) det
,
2
0 1
and by the theorem, this = 11
Exercise: Evaluate det(A) for
A=
Justify all your steps.
2 1
3
4
2. We can derive the formula for a 2 2 determinant in the same way: Let
a b
A=
c d
And suppose that a 6= 0. Then
b
1 a
det(A) = a det
c d
b
1
a
= det
bc
0 d
a
bc
= a(d ) = ad bc
a
Exercise:
(*)Suppose a = 0 in the matrix A. Then we cant divide by a and the above computation wont work. Show that its still true that det(A) = ad bc.
Show that the three types of elementary matrices all have nonzero determinants.
42
1 2 3 4
1 3 0 2
A=
2 0 1 4
0 3 1 2
(*) Suppose that rowk (A) is a linear combination of rows i and j, where i 6= j 6= k: So
rk = ari + brj . Show that det(A) = 0.
8.6
There are two other important properties of the determinant, which we wont prove here.
The determinant of A is the same as that of its transpose At .
Exercise: *** Prove this. Begin by showing that for elementary matrices, det(E1 E2 ) =
det(E1 ) det(E2 ). There are lots of details here.
From the second of these, it follows that if A is invertible, then det(AA1 ) = det(I) = 1 =
det(A) det(A1 ), so det(A1 ) = 1/ det(A).
Definition: If the (square) matrix A is invertible, then A is said to be non-singular.
Otherwise, A is singular.
Exercise:
(**)Show that A is invertible det(A) 6= 0. (Hint: use the properties of determinants together with the theorem on GJ form and existence of the inverse.)
(*) A is singular the homogeneous equation Ax = 0 has nontrivial solutions.
(Hint: If you dont want to do this directly, make an argument that this statement is
logically equivalent to: A is non-singular the homogeneous equation has only
the trivial solution.)
43
Compute the determinants of the following matrices using the properties of the determinant; justify your work:
1 2 3 0
1 2
3
1 0 0
2 6
0 1
1 0 1 ,
, and 4 0
1 4
3 1
2 3
1
3 7 5
2 4
6 8
(*) Suppose
a=
a1
a2
b1
b2
a1 b1
a2 b2
and b =
A = (a|b) =
Show that det(A) equals the area of the parallelogram spanned by the two vectors.
When is the sign plus ?
44
Chapter 9
The derivative as a matrix
9.1
Matrices appear in many situations in mathematics, not just when we need to solve a system
of linear equations. An important instance is linear approximation. Recall from your calculus
course that a differentiable function f can be expanded about any point a in its domain using
Taylors theorem. We can write
f (x) = f (a) + f (a)(x a) +
f (c)
(x a)2 ,
2!
f (c)
(x
2!
where
lim
xa
(x, a)
= 0.
xa
Remark: the error term = f 2(c) (x a)2 just depends on the two variables x and a. Once
these are known, the number c is determined.
Theorem: This is equivalent to the usual calculus definition.
Proof: If the new definition holds and we compute f (x) in the usual way, we find
lim
xa
f (x) f (a)
(x, a)
= A + lim
= A + 0 = A,
xa x a
xa
and A = f (a) according to the standard definition. Conversely, if the standard definition of differentiability holds, then we can define (x, a) to be the error made in the linear
approximation:
(x, a) = f (x) f (a) f (a)(x a).
Then
(x, a)
f (x) f (a)
= lim
f (a) = f (a) f (a) = 0,
xa x a
xa
xa
so f can be written in the new form, with A = f (a).
lim
Example: Let f (x) = 4 + 2x x2 , and let a = 2. So f (a) = f (2) = 4, and f (a) = f (2) =
2 2a = 2.. Now subtract f (2) + f (2)(x 2) from f (x) to get
4 + 2x x2 (4 2(x 2)) = 4 + 4x x2 = (x 2)2 .
This is the error term, which is quadratic in x 2, as advertised. So 8 2x ( = f (2) +
f (2)(x 2)) is the correct linear approximation to f at x = 2.
Suppose we try some other linear approximation - for example, we could try f (2)4(x2) =
12 4x. Subtracting this from f (x) gives 8 + 6x x2 = 2(x 2) (x 2)2 , which is our
new error term. But this wont work, since
2(x 2) (x 2)2
lim
= 2,
x2
(x 2)
which is clearly not 0. The only linear approximation that leaves a purely quadratic
remainder as the error term is the one formed in the usual way, using the derivative.
Exercise: Interpret this geometrically in terms of the slope of various lines passing through
the point (2, f (2)).
9.2
Our new definition of derivative is the one which generalizes to higher dimensions. We start
with an
46
x + 4y
x + 2y
1 4
1 2
x
y
u
x
A=
v
x
u
y
(0, 0).
v
y
(x, a)
= 0.
xa ||x a||
lim
u1(x)
..
f(x) =
,
.
um (x)
47
u1
x1
.
Df(a) =
..
um
x1
u1
xn
..
..
.
.
(a).
um
xn
mn
Conversely, if all the indicated partial derivatives exist and are continuous at x = a, then
the approximation
f(x) f(a) + Df(a)(x a)
is accurate to the second order in x a.
Exercise: Find the derivative of the function f : R2 R3 at a = (1, 2)t , where
(x + y)3
f(x) = x2 y 3
y/x
Exercise: * What goes wrong if we try to generalize the ordinary definition of the derivative
(as a difference quotient) to higher dimensions?
48
Chapter 10
Subspaces
Now, we are ready to start the course. From this point on, the material will be new to
most of you. This means that most of you will not get it at first. You may have to read
each lecture a number of times before it makes sense; fortunately the chapters are short!
Your intuition is often a good guide: if you have a nagging suspicion that you dont quite
understand something, then youre probably right and should ask a question. If you sort
of think you understand it, thats the same thing as having a nagging suspicion that you
dont. And NO ONE understands mathematics who doesnt know the definitions! With this
cheerful, uplifting message, lets get started.
Definition: A linear combination of the vectors v1 , v2 , . . . , vm is any vector of the form
c1 v1 + c2 v2 + . . . + cm vm , where c1 , . . . , cm are any two scalars.
Definition: A subset V of Rn is a subspace if, whenever v1 , v2 belong to V , and c1 , and c2
are any real numbers, the linear combination c1 v1 + c2 v2 also belongs to V .
Remark: Suppose that V is a subspace, and that x1 , x2 , . . . , xm all belong to V . Then
c1 x1 + c2 x2 V . Therefore, (c1 x1 + c2 x2 ) + c3 x3 V . Similarly, (c1 x1 + . . . cm1 xm1 ) +
cm xm V . We say that a subspace is closed under linear combinations. So an alternative
definition of a subspace is
Definition: A subspace V of Rn is a subset of Rn which is closed under linear combinations.
Examples:
1. For an m n matrix A, the set of all solutions to the homogeneous equation Ax = 0
is a subspace of Rn .
Proof: Suppose x1 and x2 are solutions; we need to show that c1 x1 + c2 x2 is also a
solution. Because x1 is a solution, Ax1 = 0. Similarly, Ax2 = 0. Then for any scalars
c1 , c2 , A(c1 x1 +c2 x2 ) = c1 Ax1 +c2 Ax2 = c1 0+c2 0 = 0. So c1 x1 +c2 x2 is also a solution.
The set of solutions is closed under linear combinations and so its a subspace.
Definition: This important subspace is called the null space of A, and is denoted
Null(A).
49
For example, if A = (1, 1, 3), then the null space of A consists of all solutions to
Ax = 0. If
x
y ,
x=
z
1
3
0 , where s, t R .
Null(A) = s 1
+t
0
1
2. The set consisting of the single vector 0 is a subspace of Rn for any n: any linear
combination of elements of this set is a multiple of 0, and hence equal to 0 which is in
the set.
3. Rn is a subspace of itself since any linear combination of vectors in the set is again in
the set.
4. Take any finite or infinite set S Rn
Definition: The span of S is the set of all finite linear combinations of elements of S:
span(S) = {x : x =
n
X
i=1
Definition: If V = span(S), then the vectors in S are said to span the subspace V .
(So the word span is used in 2 ways, as a noun and a verb.)
Example: Referring back to the example above, suppose we put
1
3
v1 = 1 , and v2 = 0 .
0
1
Then
50
Example:
in the span of
1
Is v = 2
3
2
1
0 , 1 = {x1 , x2 }?
1
2
1
v = 2 = c1
3
In matrix form, this reads
1
2
0 + c2 1 .
1
2
1
2
1
0 1 c1 = 2
c2
1
2
3
As you can (and should!) verify, this system is inconsistent. No such c1 , c2 exist. So
v is not in the span of these two vectors.
5. The set of all solutions to the inhomogeneous system Ax = y, y 6= 0 is not a subspace.
To see this, suppose that x1 and x2 are two solutions. Well have a subspace if any
linear combination of these two vectors is again a solution. So we compute
A(c1 x1 + c2 x2 ) = c1 Ax1 + c2 Ax2
= c1 y + c2 y
= (c1 + c2 )y,
Since for general c1 , c2 the right hand side is not equal to y, this is not a subspace.
NOTE: To determine whether V is a subspace does not, as a general rule, require any
prodigious intellectual effort. Just assume that x1 , x2 V , and see if c1 x1 + c2 x2 V
for arbitrary scalars c1 , c2 . If so, its a subspace, otherwise no. The scalars must be
arbitrary, and x1 , x2 must be arbitrary elements of V . (So you cant pick two of your
favorite vectors and two of your favorite scalars for this proof - thats why we always
use generic elements like x1 , and c1 .)
6. In addition to the null space, there are two other subspaces determined by the m n
matrix A:
Definition: The m rows of A form a subset of Rn ; the span of these vectors is called
the row space of the matrix A.
Definition: Similarly, the n columns of A form a set of vectors in Rm , and the space
they span is called the column space of the matrix A.
51
1 0 1
2
6 1 ,
A= 3 4
2 5 9
7
the row space of A is span{(1, 0, 1, 2)t, (3, 4, 6, 1)t, (2, 5, 9, 7)t}1 , and the column
space is
0
1
2
1
span 3 , 4 , 6 , 1
2
5
9
7
Exercise:
A plane through 0 in R3 is a subspace of R3 . A plane which does not contain the origin
is not a subspace. (Hint: what are the equations for these planes?)
Which lines in R2 are subspaces of R2 ?
Show that any subspace must contain the vector 0. It follows that if 0
/ V , then V
cannot be a subspace.
** Let be a fixed real number, A a square n n matrix, and define
E = {x Rn : Ax = x}.
Show that E is a subspace of Rn . (E is called the eigenspace corresponding to the
eigenvalue . Well learn more about this later.)
In many texts, vectors are written as row vectors for typographical reasons (it takes up less space). But
for computations the vectors should always be written as colums, which is why the symbols for the transpose
appear here
52
Chapter 11
Linearly dependent and independent sets
11.1
Linear dependence
1
1
3
1 , x2 =
1 , and x3 =
1
x1 =
1
2
4
2. Any set containing the vector 0 is linearly dependent, because for any c 6= 0, c0 = 0.
3. In the definition, we require that not all of the scalars c1 , . . . , cn are 0. The reason for
this is that otherwise, any set of vectors would be linearly dependent.
4. If a set of vectors is linearly dependent, then one of them can be written as a linear
combination of the others: (We just do this for 3 vectors, but it is true for any number).
Suppose {x1 , x2 , x3 } are linearly dependent. Then there exist scalars c1 , c2 , c3 such
that c1 x1 + c2 x2 + c3 x3 = 0, where at least one of the ci 6= 0 If, say, c2 6= 0, then we
can solve for x2 :
x2 = (1/c2 )(c1 x1 + c3 x3 ).
So x2 can be written as a linear combination of x1 and x3 . And similarly if some other
coefficient is not zero.
5. In principle, it is an easy matter to determine whether a finite set S is linearly dependent: We write down a system of linear algebraic equations and see if there are
53
solutions. (You may be getting the idea that many questions in linear algebra are
answered in this way!) For instance, suppose
1
1
1
S = 2 , 0 , 1 = {x1 , x2 , x3 }.
1
1
1
By the definition, S is linearly dependent we can find scalars c1 , c2 , and c3 , not
all 0, such that
c1 x1 + c2 x2 + c3 x3 = 0.
We write this equation out in matrix form:
1
1 1
c1
0
2
0 1
c2
0
=
1 1 1
c3
0
Evidently, the set S is linearly dependent if and only if there is a non-trivial solution
to this homogeneous equation. Row reduction of the matrix leads quickly to
1 1 1
0 1 1 .
2
0 0 1
This matrix is non-singular, so the only solution to the homogeneous equation is the
trivial one with c1 = c2 = c3 = 0. So the vectors are not linearly dependent.
11.2
Linear independence
3
2 1
4
0
2
3 .
A= 1
2 2
3 1
3. Are the columns of A (above) linearly independent in R3 ? Why? Are the rows of A
linearly independent in R4 ? Why?
11.3
We can show that elementary row operations performed on a matrix A dont change the row
space. We just give the proof for one of the operations; the other two are left as exercises.
Suppose that, in the matrix A, rowi (A) is replaced by rowi (A)+crowj (A). Call the resulting
matrix B. If x belongs to the row space of A, then
x = c1 row1 (A) + . . . + ci rowi (A) + . . . + cj rowj (A) + cm rowm (A).
Now add and subtract c ci rowj (A) to get
x = c1 row1 (A) + . . . + ci rowi (A) + c ci rowj (A) + . . . + (cj ci c)rowj (A) + cm rowm (A)
= c1 row1 (B) + . . . + ci rowi (B) + . . . + (cj ci c)rowj (B) + . . . + cm rowm (B).
This shows that x can also be written as a linear combination of the rows of B. So any
element in the row space of A is contained in the row space of B.
Exercise: Show the converse - that any element in the row space of B is contained in the row
space of A.
Definition: Two sets X and Y are equal if X Y and Y X.
This is what weve just shown for the two row spaces.
Exercise:
1. Show that the other two elementary row operations dont change the row space of A.
2. **Show that when we multiply any matrix A by another matrix B on the left, the rows
of the product BA are linear combinations of the rows of A.
3. **Show that when we multiply A on the right by B, that the columns of AB are linear
combinations of the columns of A
55
Chapter 12
Basis and dimension of subspaces
12.1
1
2
0
2
,
,
.
1
1
Exercise: span(S) = R2 . In fact, you can show that any two of the elements of S span R2 .
So we can throw out any single vector in S, for example, the second one, obtaining the set
2
1
.
,
Sb =
1
2
And this smaller set Sb also spans R2 . (There are two other possibilities for subsets of S that
also span R2 .) But we cant discard an element of Sb and still span R2 with the remaining
one vector.
b leaving us with the set
Why not? Suppose we discard the second vector of S,
1
.
S =
2
consists of all scalar multiples of this single vector (a line through 0). But
Now span(S)
anything not on this line, for instance the vector
1
v=
0
is not in the span. So S does not span R2 .
Whats going on here is simple: in the first instance, the three vectors in S are linearly
dependent, and any one of them can be expressed as a linear combination of the remaining
56
This gives us a way, starting with a more general set S, to discard redundant vectors one
by one until were left with a set of linearly independent vectors which still spans the original
set: If S = {e1 , . . . , em } spans the subspace V but is linearly dependent, we can express one
of the elements in S as a linear combination of the others. By relabeling if necessary, we
suppose that em can be written as a linear combination of the others. Then
span(S) = span(e1 , . . . , em1 ). Why?
If the remaining m1 vectors are still linearly dependent, we can repeat the process, writing
one of them as a linear combination of the remaining m 2, relabeling, and then
span(S) = span(e1 , . . . , em2 ).
We continue this until we arrive at a minimal spanning set, say {e1 , . . . , ek } which is
linearly independent. No more vectors can be removed from S without changing the span.
Such a set will be called a basis for V :
is a basis..
0
0
1
0 ,
1 ,
0 = {e1 , e2 , e3 }
B=
0
0
1
a
v= b
c
c1
0
c2 = 0 ,
c3
0
57
S=
1
2
1
3
,
,
1
1
is linearly dependent. Any two elements of S are linearly dependent and form a basis
for R2 . Verify this!
Exercise:
1. The vector 0 is never part of a basis.
2. Any 4 vectors in R3 are linearly dependent and therefore do not form a basis. You
should be able to supply the argument, which amounts to showing that a certain
homogeneous system of equations has a nontrivial solution.
3. No 2 vectors can span R3 . Why not?
4. If a set B is a basis for R3 , then it contains exactly 3 elements. This has mostly been
done in the first two parts, but put it all together.
5. (**) Prove that any basis for Rn has precisely n elements.
Example: Find a basis for the null space of the matrix
1 0 0 3
2
A = 0 1 0 1 1 .
0 0 1 2
3
Solution: Since A is already in Gauss-Jordan form, we can just write down the general
solution to the homogeneous equation. These vectors are precisely the elements of the null
space of A. We have, setting x4 = s, and x5 = t,
x1
x2
x3
x4
x5
= 3s 2t
=
s + t
= 2s 3t ,
=
s
=
t
2
3
1
1
, and v2 = 3 .
2
v1 =
0
1
1
0
58
It is obvious1 by inspection of the last two entries in each that the set B = {v1 , v2 } is linearly
independent. Furthermore, by construction, the set B spans the null space. So B is a basis.
12.2
Dimension
As weve seen above, any basis for Rn has precisely n elements. Although were not going to
prove it here, the same property holds for any subspace of Rn : the number of elements
in any basis for the subspace is the same. Given this, we make the following
Definition: Let V 6= {0} be a subspace of Rn for some n. The dimension of V , written
dim(V ), is the number of elements in any basis of V .
Examples:
dim(Rn ) = n. Why?
For the matrix A above, the dimension of the null space of A is 2.
The subspace V = {0} is a bit peculiar: it doesnt have a basis according to our
definition, since any subset of V is linearly independent. We extend the definition of
dimension to this case by defining dim(V ) = 0.
Exercise:
1. (***) Show that the dimension of the null space of any matrix A is equal to the number
of free variables in the echelon form.
2. Show that the dimension of the set
{(x, y, z) such that 2x 3y + z = 0}
is two by exhibiting a basis for the null space.
When we say its obvious or that something is clear, we mean that it can easily be proven; if you
can do the proof in your head, fine. Otherwise, write it out.
59
Chapter 13
The rank-nullity (dimension) theorem
13.1
Definition: The rank of the matrix A is the dimension of the row space of A, and is denoted
R(A)
Examples: The rank of Inn is n; the rank of 0mn is 0. The rank of the 3 5 matrix
considered above is 3.
Theorem: The rank of a matrix in Gauss-Jordan form is equal to the number of leading variables.
Proof: In the GJ form of a matrix, every non-zero row has a leading 1, which is the only
non-zero entry in its column. No elementary row operation can zero out a leading 1, so these
non-zero rows are linearly independent. Since all the other rows are zero, the dimension of
the row space of the GJ form is equal to the number of leading 1s, which is the same as the
number of leading variables.
Definition: The nullity of the matrix A is the dimension of the null space of A, and is
denoted by N(A). (This is to be distinguished from Null(A), which is a subspace; the nullity
is a number.)
Examples: The nullity of I is 0. The nullity of the 3 5 matrix considered above (Chapter
12) is 2. The nullity of 0mn is n.
Theorem: The nullity of a matrix in Gauss-Jordan form is equal to the number of free variables.
Proof: Suppose A is m n, and that the GJ form has j leading variables and k free
variables, where j+k = n. Then, when computing the solution to the homogeneous equation,
we solve for the first j (leading) variables in terms of the remaining k free variables which
well call s1 , s2 , . . . , sk . Then the general solution to the homogeneous equation, as we know,
60
..
..
.
.
v1 = 1 , . . . , vk = 0 ,
.
..
0
.
0
..
0
1
and where, in v1 , the 1 appears in position j + 1, and so on. The vectors {v1 , . . . , vk } are
linearly independent and form a basis for the null space of A. And there are k of them, the
same as the number of free variables.
Exercise: What are the rank and nullity of the following matrices?
1 0
0 1
1
0
3
7
A=
3 4 , B = 0 1 4 9
7 9
We now have to address the question: how are the rank and nullity of the matrix A related
to those of its Gauss-Jordan form?
Summarizing these results: Row operations change neither the row space nor the null space of
A.
Corollary 1: If R is the Gauss-Jordan form of A, then R has the same null space and row
space as A.
Corollary 2: If B A, then R(B) = R(A), and N(B) = N(A).
Proof: If B A, then both A and B have the same GJ form, and hence the same rank
(equal to the number of leading ones) and nullity (equal to the number of free variables).
The following result may be somewhat surprising:
Theorem: The number of linearly independent rows of the matrix A is equal to the number of
linearly independent columns of A. In particular, the rank of A is also equal to the number of
linearly independent columns, and hence to the dimension of the column space of A
Proof (sketch): As an example, consider the matrix
3 1 1
0
A= 4 2
2 3
4
13.2
This is also known as the dimension theorem, and version 1 (well see another later in the
course) goes as follows:
Theorem: Let A be m n. Then
n = N(A) + R(A),
62
1
0 0 1 .
0 0 0 1
Then its clear (why?) that the dimension of the row space is 3, or equivalently, that the
dimension of the column space is 3. Since there are 5 columns altogether, the dimension
theorem says that n = 5 = 3 + N(A), so N(A) = 2. We can therefore expect to find two
linearly independent solutions to the homogeneous equation Ax = 0.
Alternatively, inspection of the echelon form of A reveals that there are precisely 2 free
variables, x2 and x5 . So we know that N(A) = 2 (why?), and therefore, rank(A) = 52 = 3.
Proof of the theorem: This is, at this point, almost trivial. We have shown above that the
rank of A is the same as the rank of the Gauss-Jordan form of A which is equal to the
number of leading entries in the Gauss-Jordan form. We also know that the dimension of
the null space is equal to the number of free variables in the reduced echelon (GJ) form of A.
And we know further that the number of free variables plus the number of leading entries is
exactly the number of columns. So
n = N(A) + R(A),
as claimed.
Exercise:
Find the rank and nullity of the following - do the absolute minimum (zero!) amount
of computation possible:
3
1
2 5 3
,
6 2
1 4
2
(T/F) For any matrix A, R(A) = R(At ). Give a proof or counterexample.
(T/F) For any matrix A, N(A) = N(At ). Give a proof or counterexample.
63
Chapter 14
Change of basis
When we first set up a problem in mathematics, we normally use the most familiar coordinates. In R3 , this means using the Cartesian coordinates x, y, and z. In vector terms, this
is equivalent to using what weve called the standard basis in R3 ; that is, we write
x
1
0
0
y = x 0 + y 1 + z 0 = xe1 + ye2 + ze3 ,
z
0
0
1
where {e1 , e2 , e3 } is the standard basis.
But, as you know, for any particular problem, there is often another coordinate system that
simplifies the problem. For example, to study the motion of a planet around the sun, we put
the sun at the origin, and use polar or spherical coordinates. This happens in linear algebra
as well.
Example: Lets look at a simple system of two first order linear differential equations
dx1
= 3x1 + x2
dt
dx2
= x1 + 3x2 .
dt
(14.1)
To solve this, we need to find two functions x1 (t), and x2 (t) such that both equations hold
simultaneously. Now theres no problem solving a single differential equation like
dx/dt = 3x.
In fact, we can see by inspection that x(t) = ce3t is a solution for any scalar c. The difficulty
with the system (1) is that x1 and x2 are coupled, and the two equations must be solved
simulataneously. There are a number of straightforward ways to solve this system which
youll learn when you take a course in differential equations, and we wont worry about that
here.
64
But theres also a sneaky way to solve (1) by changing coordinates. Well do this at the end
of the lecture. First, we need to see what happens in general when we change the basis.
For simplicity, were just going to work in R2 ; generalization to higher dimensions is (really!)
straightforward.
14.1
Suppose we have a basis {e1 , e2 } for R2 . It doesnt have to be the standard basis. Then, by
the definition of basis, any vector v R2 can be written as a linear combination of e1 and e2 .
That is, there exist scalars c1 , c2 such that v = c1 e1 + c2 e2 .
Definition: The numbers c1 and c2 are called the coordinates of v in the basis {e1 , e2 }.
And
c1
ve =
c2
is called the coordinate vector of v in the basis {e1 , e2 }.
Theorem: The coordinates of the vector v are unique.
Proof: Suppose there are two sets of coordinates for v. That is, suppose that v = c1 e1 +c2 e2 ,
and also that v = d1 e1 + d2 e2 . Subtracting the two expressions for v gives
0 = (c1 d1 )e1 + (c2 d2 )e2 .
But {e1 , e2 } is linearly independent, so the coefficients in this expression must vanish: c1
d1 = c2 d2 = 0. That is, c1 = d1 and c2 = d2 , and the coordinates are unique, as claimed.
Example: Let us use the basis
{e1 , e2 } =
1
2
2
,
,
3
v=
3
5
and suppose
Then we can find the coordinate vector ve in this basis in the usual way, by solving a system
of linear equations. We are looking for numbers c1 and c2 (the coordinates of v in this basis)
such that
1
2
3
c1
+ c2
=
.
2
3
5
Ave = v,
where
A=
1 2
2
3
, v=
3
5
65
, and ve =
c1
c2
ve = A v = (1/7)
3 2
2 1
3
5
= (1/7)
19
1
19/7
1/7
Exercise: Find the coordinates of the vector v = (2, 4)t in this basis.
14.2
Notation
In this section, well develop a compact notation for the above computation that is easy to
remember. Start with an arbitrary basis {e1 , e2 } and an arbitrary vector v. We know that
v = c1 e1 + c2 e2 ,
where
c1
c2
= ve
is the coordinate vector. We see that the expression for v is a linear combination of two
column vectors. And we know that such a thing can be obtained by writing down a certain
matrix product:
If we define the 2 2 matrix E = (e1 |e2 ) then the expression for v can be simply written as
v = E ve .
Moreover, the coordinate vector ve can be obtained from
ve = E 1 v.
Suppose that {f1 , f2 } is another basis for R2 . Then the same vector v can also be written
uniquely as a linear combination of these vectors. Of course it will have different coordinates,
and a different coordinate vector vf . In matrix form, well have
v = F vf .
Exercise: Let {f1 , f2 } be given by
1
1
,
If
v=
3
5
1
1
Continuing along with our examples, since E is a basis, the vectors f1 and f2 can each be
written as linear combinations of e1 and e2 . So there exist scalars a, b, c, d such that
1
1
2
f1 =
= a
+b
3
2
1
2
1
1
+d
= c
f2 =
3
2
1
We wont worry now about the precise values of a, b, c, d, since you can easily solve for them.
Definition: The change of basis matrix from E to F is
a c
P =
.
b d
Note that this is the transpose of what you might think it should be; this is because were
doing column operations, and its the first column of P which takes linear combinations of
the columns of E and replaces the first column of E with the first column of F , and so on.
In matrix form, we have
F =EP
and, of course, E = F P 1.
Warning: Some texts use P 1 instead of P for the change of basis matrix. This is a convention, but
you need to check.
67
Remark: When we change from the standard basis to the basis {e1 , e2 }, the corresponding matrices are I (for the standard basis) and E. So according to whats just
been shown, the change of basis matrix will be the matrix P which satisfies
E = I P.
In other words, the change of basis matrix in this case is just the matrix E.
Exercise: Let E = (e1 |e2 ), and F = (f1 |f2 ), where
2 1
1 1
.
, and F =
E=
2 1
2
1
1. Using the technique described in the notes, find the change of basis matrix P from E
to F by expressing {f1 , f2 } as linear combinations of e1 and e2 .
2. Now that you know the correct theology, observe that F = EE 1 F , and therefore the
change of basis matrix must, in fact, be given by P = E 1 F . Compute P this way
and compare with (1)
First example, contd:
We can write the system of differential equations in matrix form as
dv
1 3
=
v = Av.
3 1
dt
We change from the standard basis to F via the matrix
1
1
.
F =
1 1
Then, according to what weve just worked out, well have
vf = F 1 v, and taking derivatives,
dv
dvf
= F 1 .
dt
dt
dvf
dvf
= AF vf , or
= F 1 AF vf .
dt
dt
68
= 4vf 1
= 2vf 2
In the new coordinates, the system is now decoupled and easily solved to give
vf1 = c1 e4t
vf2 = c2 e2t ,
where c1 , c2 are arbitrary constants of integration. We can now transform back to the original
(standard) basis to get the solution in the original coordinates:
c1 e4t + c2 e2t
c1 e4t
1
1
v1
.
=
=
v = F vf =
c1 e4t c2 e2t
c2 e2t
1 1
v2
A reasonable question at this point is: How does one come up with this new basis F ?
Evidently it was not chosen at random. The answer has to do with the eigenvalues and
eigenvectors of the coefficient matrix of the differential equation, namely the matrix
1 3
.
A=
3 1
All of which brings us to the subject of the next lecture.
69
Chapter 15
Matrices and Linear transformations
15.1
We have been thinking of matrices in connection with solutions to linear systems of equations
like Ax = y. It is time to broaden our horizons a bit and start thinking of matrices as
functions.
In general, a function f whose domain is Rn and which takes values in Rm is a rule or
recipe that associates to each x Rn a vector y Rm . We can write either
y = f(x) or, equivalently f : Rn Rm .
The first expression is more familiar, but the second is more useful: it tells us something
about the domain and range of the function f (namely that f maps points of Rn to points
of Rm ).
Examples:
f : R R is a real-valued function of one real variable - the sort of thing you studied
in calculus. f (x) = sin(x) + xex is an example.
f : R R3 defined by
x(t)
t
f(t) = y(t) = 3t2 + 1
z(t)
sin(t)
assigns to each real number t the point f(t) R3 ; this sort of function is called a
parametric curve. Depending on the context, it could represent the position or the
velocity of a mass point.
f : R3 R defined by
x
f y = (x2 + 3xyz)/z 2 .
z
70
x+y
x
f
= cos(xy)
y
x2 y 2
In this course, were primarily interested in functions that can be defined using matrices. In
particular, if A is m n, we can use A to define a function which well call fA from Rn to
Rm : fA sends x Rn to Ax Rm . That is, fA (x) = Ax.
Example: Let
A23 =
If
1 2 3
4 5 6
x
x = y R3 ,
z
then we define
fA (x) = Ax =
1 2 3
4 5 6
x
x
+
2y
+
3z
y =
.
4x + 5y + 6z
z
This function maps each vector x R3 to the vector fA (x) = Ax R2 . Notice that if the
function goes from R3 to R2 , then the matrix is 2 3 (not 3 2).
x
f y = 3x 2y + z.
z
71
we have
x1
x2
x1 = y1 , and x2 = y2 ,
z1
z2
x1 + x2
f (x1 + x2 ) = f y1 + y2 = 3(x1 + x2 ) 2(y1 + y2 ) + (z1 + z2 ).
z1 + z2
And the right hand side can be rewritten as (3x1 2y1 + z1 ) + (3x2 2y2 + z2 ), which
is the same as f (x1 ) + f (x2 . So the first property holds. So does the second, since
f (cx) = 3cx 2cy + cz = c(3x 2y + z) = cf (x).
Notice that the function f is actually fA for the right A: if A13 = (3, 2, 1), then
f (x) = Ax.
If Amn is a matrix, then fA : Rn Rm is a linear transformation because fA (x1 +x2 ) =
A(x1 + x2 ) = Ax1 + Ax2 = fA (x1 ) + fA (x2 ). And A(cx) = cAx fA (cx) = cfA (x).
(These are two fundamental properties of matrix multiplication.)
It can be shown(next section) that any linear transformation on a finite-dimensional
space can be written as fA for a suitable matrix A.
The derivative (see Chapter 9) is a linear transformation. Df(a) is the linear approximation to f(x) f(a).
There are many other examples of linear transformations; some of the most interesting
ones do not go from Rn to Rm :
1. If f and g are differentiable functions, then
df
dg
d
df
d
(f + g) =
+ , and
(cf ) = c .
dx
dx dx
dx
dx
Thus the function D(f ) = df /dx is linear.
If (x) =
f (s) ds,
Linear transformations acting on functions, like the above, are generally known as linear operators. Theyre a bit more complicated than matrix multiplication operators,
but they have the same essential property of linearity.
Exercise:
1. Give an example of a function from R2 to itself which is not linear.
2. Which of the functions on the first two pages of this chapter are linear? Answer: none.
Be sure you understand why!
3. Identify all the linear transformations from R to R.
Definition: If f : Rn Rm is linear then the kernel of f is defined by
Ker(f) := {v Rn such that f(v) = 0}.
Definition: If f : Rn Rm , then the range of f is defined by
Range(f) = {y Rm such that y = f(x) for some x Rn }
Exercise: If f : Rn Rm is linear then
1. Ker(f) is a subspace of Rn .
2. Range(f) is a subspace of Rm
15.2
In this section, well show that if f : Rn Rm is linear, then there exists an m n matrix
A such that f(x) = Ax for all x.
Let
e1 =
1
0
..
.
0
n1
, e2 =
0
1
..
.
0
n1
n
, , en =
0
0
..
.
1
x1
x2
x = .. = x1 e1 + x2 e2 + + xn en .
.
xn
73
n1
If f : Rn Rm is linear, then
f(x) = f(x1 e1 + x2 e2 + + xn en )
= x1 f(e1 ) + x2 f(e2 ) + + xn f(en )
This is a linear combination of {f(e1 ), . . . , f(en )}.
Now think of f(e1 ), . . . , f(en ) as n column vectors, and form the matrix
A = (f(e1 )|f(e2 )| |f(en ))mn .
(Its m n because each vector f(ei ) is a vector in Rm , and there are n of these vectors
making up the columns.) To get a linear combination of the vectors f(e1 ), . . . , f(en ), all we
have to do is to multiply the matrix A on the right by a vector. And, in fact, its apparent
that
f(x) = x1 f(e1 ) + x2 f(e2 ) + + xn f(en ) = (f(e1 )| |f(en ))x = Ax.
So, given the linear transformation f, we now know how to assemble a matrix A such that
f(x) = Ax. And of course the converse holds: given a matrix Amn , the function fA : Rn
Rm defined by fA (x) = Ax is a linear transformation.
Definition: The matrix A defined above for the function f is called the matrix of f in the
standard basis.
Exercise: * Show that Range(f) is the column space of the matrix A defined above, and that
Ker(f) is the null space of A.
Exercise: After all the above theory, you will be happy to learn that its almost trivial to
write down the matrix A if f is given explicitly: If
find the matrix of f in the standard basis by computing f(e1 ), . . .. Also, find a basis for
Range(f) and Ker(f).
15.3
Recall that for Amn , we have n = N(A)+R(A). Now think of A as the linear transformation
fA : Rn Rm . The domain of fA is Rn ; Ker(fA ) is the null space of A, and Range(fA ) is the
column space of A. Since any linear transformation can be written as fA for some matrix A,
we can restate the rank-nullity theorem as the
Dimension theorem: Let f : Rn Rm be linear. Then
dim(domain(f)) = dim(Range(f)) + dim(Ker(f)).
74
Exercise: Show that the number of free variables in the system Ax = 0 is equal to the
dimension of Ker(fA ). This is another way of saying that while the particular choice of free
variables may depend on how you solve the system, their number is an invariant.
15.4
Example:
A=
4
0
0 3
is diagonal. Given this diagonal matrix, we can (partially) visualize the linear transformation
corresponding to multiplication by A: a vector v lying along the first coordinate axis is
mapped to 4v, a multiple of itself. A vector w lying along the second coordinate axis is
also mapped to a multiple of itself: Aw = 3w. Its length is tripled, and its direction is
reversed. An arbitrary vector (a, b)t is a linear combination of the basis vectors, and its
mapped to (4a, 3b)t .
It turns out that we can find vectors like v and w, which are mapped to multiples of themselves, without first finding the matrix V . This is the subject of the next lecture.
76
Chapter 16
Eigenvalues and eigenvectors
16.1
2 3
3 2
Ax =
, and x =
5
5
1
1
= 5x.
1. Show that
1
1
1
1
1 1
3 3
.
3. Eigenvectors are not unique. Show that if v is an eigenvector for A, then so is cv, for
any real number c 6= 0.
Definition: Suppose is an eigenvalue of A.
E = {v Rn such that Av = v}
is called the eigenspace of A corresponding to the eigenvalue .
Exercise: Show that E is a subspace of Rn . (N.b: the definition of E does not require
v 6= 0. E consists of all the eigenvectors plus the zero vector; otherwise, it wouldnt be a
subspace.) What is E0 ?
Example: The matrix
A=
0 1
1
0
cos(/2) sin(/2)
sin(/2)
cos(/2)
represents a counterclockwise rotation through the angle /2. Apart from 0, there is no
vector which is mapped by A to a multiple of itself. So not every matrix has real eigenvectors.
Exercise: What are the eigenvalues of this matrix?
16.2
real number such that det(A I) = 0, this means exactly that theres a nontrivial solution
v to (A I)v = 0. So is an eigenvalue, and v =
6 0 is an eigenvector. Summarizing, we
have the
Theorem: is an eigenvalue of A if and only if det(A I) = 0. . If is real, then theres an
eigenvector corresponding to .
(If is complex, then theres a complex eigenvector, but not a real one. See below.)
How do we find the eigenvalues? For a 2 2 matrix
a b
,
A=
c d
we compute
det(A I) = det
a
b
c
d
= 2 (a + d) + (ad bc).
1
3
3
1
1 3
3 1
, and pA () = (1 )2 9 = 2 2 8.
Notice that, as long as c 6= 0, this is an eigenvector. The set of all eigenvectors is a line with
the origin missing. The one-dimensional subspace of R2 obtained by allowing c = 0 as well
is what we called E4 in the last section.
We get an eigenvector by choosing any nonzero element of E4 . Taking c = 1 gives the
eigenvector
1
v1 =
1
Exercise:
1. Find the subspace E2 and show that
v2 =
1
1
is an eigenvector corresponding to 2 = 2.
2. Find the eigenvalues and corresponding eigenvectors of the matrix
1 2
.
A=
3 0
3. Same question for the matrix
A=
16.3
1 1
0 1
Some observations
What are the possibilities for the characteristic polynomial pA ? For a 2 2 matrix A, its a
polynomial of degree 2, so there are 3 cases:
1. The two roots are real and distinct: 1 6= 2 , 1 , 2 R. We just worked out an
example of this.
2. The roots are complex conjugates of one another: 1 = a + ib, 2 = a ib.
Example:
2 3
.
A=
3 2
1 1
0 1
as you saw in the exercise above, we have pA () = (1 )2 . In this case, though, there
is just a one-dimensional eigenspace.
16.4
Diagonalizable matrices
1
1
1 1
AE =
4
0
0 2
which is diagonal.
Definition: Let A be n n. We say that A is diagonalizable if there exists a basis
{e1 , . . . , en } of Rn , with corresponding change of basis matrix E = (e1 | |en ) such that
Ae = E 1 AE
is diagonal.
81
In the example, our matrix E has the form E = (e1 |e2 ), where the two columns are two
eigenvectors of A corresponding to the eigenvalues = 4, and = 2. In fact, this is the
general recipe:
Theorem: The matrix A is diagonalizable there is a basis for Rn consisting of eigenvectors
of A.
Proof: Suppose {e1 , . . . , en } is a basis for Rn with the property that Aej = j ej , 1 j n.
Form the matrix E = (e1 |e2 | |en ). We have
AE = (Ae1 |Ae2 | |Aen )
= (1 e1 |2 e2 | |n en )
= ED,
where D = Diag(1 , 2 , . . . , n ). Evidently, Ae = D and A is diagonalizable. Conversely, if
A is diagonalizable, then the columns of the matrix which diagonalizes A are the required
basis of eigenvectors.
Definition: To diagonalize a matrix A means to find a matrix E such that E 1 AE is
diagonal.
So, in R2 , a matrix A can be diagonalized we can find two linearly independent
eigenvectors.
Examples:
Diagonalize the matrix
A=
1 2
3 0
E = (v1 |v2 ) =
1 2
1
3
, with E
= (1/5)
3 2
1 1
and check that E 1 AE = Diag(3, 2). Of course, we dont really need to check: the
result is guaranteed by the theorem above!
The matrix
A=
1 1
0 1
1 2
2
1
Show that the eigenvalues of this matrix are 1+2i and 12i. Find a complex eigenvector
for each of these eigenvalues. The two eigenvectors are linearly independent and form
a basis for C2 .
83
Chapter 17
Inner products
17.1
Up until now, we have only examined the properties of vectors and matrices in Rn . But
normally, when we think of Rn , were really thinking of n-dimensional Euclidean space - that
is, Rn together with the dot product. Once we have the dot product, or more generally an
inner product on Rn , we can talk about angles, lengths, distances, etc.
Definition: An inner product on Rn is a function
( , ) : Rn Rn R
with the following properties:
1. It is bilinear, meaning its linear in each argument: that is
(c1 x1 + c2 x2 , y) = c1 (x1 , y) + c2 (x2 , y), x1 , x2 , y, c1 , c2 . and
(x, c1 y1 + c2 y2 ) = c1 (x, y1 ) + c2 (x, y2 ), x, y1 , y2 , c1 , c2 .
Remark: Non-degeneracy (the third property), has the following meaning: the only vector
x which is orthogonal to everything is the zero vector 0.
Examples of inner products
The dot product in Rn is defined in the standard basis by
(x, y) = xy = x1 y1 + x2 y2 + + xn yn
Exercise: The dot product is positive definite - all four of the properties above hold.
1
v = 2 ,
2
It is not difficult to verify that this satisfies the properties in the definition. For example,
if (x, y)G = xt Gy = 0 y, then xt G = 0, because if we write xt G as the row vector
(a1 , a2 , . . . , an ), then xt Ge1 = 0 a1 = 0, xt Ge2 = 0 a2 = 0, etc. So all the components
of xt G are 0 and hence xt G = 0. Now taking transposes, we find that Gt x = Gx = 0. Since
G is nonsingular by definition, this means that x = 0, (otherwise the homogeneous system
Gx = 0 would have non-trivial solutions and G would be singular) and the inner product is
non-degenerate. You should verify that the other two properties hold as well.
In fact, any inner product on Rn can be written in this form for a suitable matrix G.
Although we dont give the proof, its along the same lines as the proof showing that any
linear transformation can be written as x Ax for some matrix A.
Examples:
85
3
1
x = 2 , and y = 2 ,
1
4
then
1
xy = xt Iy = xt y = (3, 2, 1) 2 = 3 + 4 + 4 = 5
4
1 0
0
0
0 1 0
0
(t1 , x1 , y1 , z1 )
0 0 1 0
0 0
0 1
t2
t2
x2
= (t1 , x1 , y1 , z1 ) x2 = t1 t2 x1 x2 y1 y2 z1 z2 .
y2
y2
z2
z2
Exercise: ** Show that under a change of basis given by the matrix E, the matrix G of the
inner product becomes Ge = E t GE. This is different from the way in which an ordinary matrix (which can be viewed as a linear transformation) behaves. Thus the matrix representing
an inner product is a different sort of object from that representing a linear transformation.
(Hint: We must have xt Gy = xte Ge ye . Since you know what xe and ye are, plug them in
and solve for Ge .)
For instance, if G = I, so that xy = xt Iy, and
10
4
1 3
t
.
E=
, then xy = xE GE yE , with GE =
4 10
3 1
Exercise: *** A matrix E is said to preserve the inner product if Ge = E t GE = G. This
means that the recipe or formula for computing the inner product doesnt change when
you pass to the new coordinate system. In E2 , find the set of all 2 2 matrices that preserve
the dot product.
17.2
Euclidean space
From now on, well restrict our attention to Euclidean space En . The inner product will
always be the dot product.
Definition: The norm of the vector x is defined by
||x|| = xx.
In the standard coordinates, this is equal to
||x|| =
n
X
i=1
86
x2i
!1/2
Example:
Proposition:
2
p
||x|| > 0 if x 6= 0.
||cx|| = |c|||x||, c R.
Exercise: Give the proof of this proposition.
As you know, ||x|| is the distance from the origin 0 to the point x. Or its the length of the
vector x. (Same thing.) The next few properties all follow from the law of cosines, which
we assume without proof:
For a triangle with sides a, b, and c, and angles opposite these sides of A, B, and C,
c2 = a2 + b2 2ab cos(C).
This reduces to Pythagoras theorem if C is a right angle, of course. In the present context,
we imagine two vectors x and y with their tails located at 0. The vector going from the tip
of y to the tip of x is x y. If is the angle between x and y, then the law of cosines reads
||x y||2 = ||x||2 + ||y||2 2||x||||y|| cos .
(1)
(2)
xy
||x|| ||y||
(3)
(4)
88
Chapter 18
Orthonormal bases and related matters
18.1
Recall that two vectors x and y are said to be orthogonal if xy = 0. (This is the Greek
version of perpendicular.)
Example: The two vectors
1
2
1 and 2
0
4
89
1
1
1
b =
w
w = 2 .
||w||
14
3
Definition: The process of replacing a vector w by a unit vector in its direction is called
normalizing the vector.
For an arbitrary nonzero vector in R3
x
y ,
z
x
1
y
p
x2 + y 2 + z 2
z
In physics and engineering courses, this particular vector is often denoted by b
r. For instance,
the gravitational force on a particle of mass m sitting at (x, y, z)t due to a particle of mass
M sitting at the origin is
GMm
b
r,
F=
r2
where r 2 = x2 + y 2 + z 2 .
18.2
Orthonormal bases
Although we know that any set of n linearly independent vectors in Rn can be used as a
basis, there is a particularly nice collection of bases that we can use in Euclidean space.
Definition: A basis {v1 , v2 , . . . , vn } of En is said to be orthonormal if
1. vi vj = 0, whenever i 6= j the vectors are mutually orthogonal, and
2. vi vi = 1 for all i and they are all unit vectors.
Examples: The standard basis is orthonormal. The basis
1
1
,
1
1
is orthogonal, but not orthonormal. We can normalize these vectors to get the orthonormal
basis
1/2
1/2
,
1/ 2
1/ 2
90
You may recall that it can be tedious to compute the coordinates of a vector w in an arbitrary
basis. An important benefit of using an orthonormal basis is the following:
Theorem: Let {v1 , . . . , vn } be an orthonormal basis in En . Let w En . Then
w = (wv1 )v1 + (wv2 )v2 + + (wvn )vn .
That is, the ith coordinate of w in this basis is given by wvi , the dot product of w with the
ith basis vector. Alternatively, the coordinate vector of w in this orthonormal basis is
wv1
wv2
wv =
.
wvn
Proof: Since we have a basis, we know there are unique numbers c1 , . . . , cn (the coordinates
of w in this basis) such that
w = c1 v1 + c2 v2 + + cn vn .
Take the dot product of both sides of this equation with v1 : using the linearity of the dot
product, we get
v1 w = c1 (v1 v1 ) + c2 (v1 v2 ) + + cn (v1 vn ).
Since the basis is orthonormal, all the dot products vanish except for the first, and we have
(v1 w) = c1 (v1 v1 ) = c1 . An identical argument holds for the general vi .
2
3
1/2
1/2
,
.
1/ 2
1/ 2
.
5
2
Exercise:
1. In E2 , let
{e1 (), e2 ()} =
cos
sin
sin
.
,
cos
Show that {e1 (), e2 ()} is an orthonormal basis of E2 for any value of . Whats the
relation between {e1 (), e2 ()} and {i, j} = {e1 (0), e2 (0)}?
91
2. Let
v=
2
3
92
Chapter 19
Orthogonal projections and orthogonal matrices
19.1
We often want to decompose a given vector, for example, a force, into the sum of two
orthogonal vectors.
Example: Suppose a mass m is at the end of a rigid, massless rod (an ideal pendulum),
and the rod makes an angle with the vertical. The force acting on the pendulum is the
gravitational force mge2 . Since the pendulum is rigid, the component of the force parallel
mg sin()
mg
to the rod doesnt do anything (i.e., doesnt cause the pendulum to move). Only the force
orthogonal to the rod produces motion.
The magnitude of the force parallel to the pendulum is mg cos ; the orthogonal force has
the magnitude mg sin . If the pendulum has length l, then Newtons second law (F = ma)
93
reads
ml = mg sin ,
or
g
+ sin = 0.
l
This is the differential equation for the motion of the pendulum. For small angles, we have,
approximately, sin , and the equation can be linearized to give
r
g
2
+ = 0, where =
,
l
which is identical to the equation of the harmonic oscillator.
19.2
Given the fixed vector w, and another vector v, we want to decompose v as the sum v =
v|| + v , where v|| is parallel to w, and v is orthogonal to w. See the figure. Suppose is
the angle between w and v. We assume for the moment that 0 /2. Then
If the angle between v and w
is , then the magnitude of the
projection of v onto w
is ||v|| cos().
||v|| cos()
v||
v w
||v|| || = ||v|| cos = ||v||
||v|| ||w||
vw
,
||w||
or
||v|| || = v a unit vector in the direction of w
And v|| is this number times a unit vector in the direction of w:
v w
v w w
w.
v|| =
=
||w|| ||w||
ww
b w.
b This is worth remembering.
b = (1/||w||)w, then v|| = (vw)
In other words, if w
b w
b is called the orthogonal projection of v onto w.
Definition: The vector v|| = (vw)
94
1
1
v = 1 , and w = 0 .
2
1
3/2
b w
b = 0 .
(vw)
3/2
Then
1
3/2
1/2
v = v v|| = 1 0 = 1 .
2
3/2
1/2
Remark: Suppose that, in the above, /2 < , so the angle is not acute. In this case,
cos is negative, and ||v|| cos is not the length of v|| (since its negative, it cant be a
length). It is interpreted as a signed length, and the correct projection points in the opposite
direction from that of w. In other words, the formula is correct, no matter what the value
of .
Exercise:
1. Find the orthogonal projection of
onto
2
v = 2
0
1
w = 4 .
2
95
3. This refers to the pendulum figure. Suppose the mass is located at (x, y) R2 . Find
the unit vector parallel to the direction of the rod, say b
r, and a unit vector orthogonal
b
to b
r, say , obtained by rotating b
r counterclockwise through an angle /2. Express
these orthonormal vectors in terms of the angle . And show that Fb = mg sin as
claimed above.
4. (For those with some knowledge of differential equations) Explain (physically) why the
linearized pendulum equation is only valid for small angles. (Hint: if you give a real
pendulum a large initial velocity, what happens? Is this consistent with the behavior
of the harmonic oscillator?)
19.3
Orthogonal matrices
Suppose we take an orthonormal (o.n.) basis {e1 , e2 , . . . , en } of Rn and form the nn matrix
E = (e1 | |en ). Then
et1
et
2
t
E E = .. (e1 | |en ) = In ,
.
etn
because
(E t E)ij = eti ej = ei ej = ij ,
where ij are the components of the identity matrix:
ij =
1
0
if
if
i=j
i 6= j
1/2
1/2
,
1/ 2
1/ 2
1
1
E = (1/ 2)
1 1
cos
sin
sin
,
.
cos
If E and F are the two orthogonal matrices corresponding to two o.n. bases, then
F = EP , where P is the change of basis matrix from E to F . Show that P is also
orthogonal.
19.4
2
3
, and y =
So xy = x1 y1 + x2 y2 = (2)(3) + (3)(1) = 3.
In the o.n. basis
{e1 , e2 } =
we have
xe1
xe2
y e1
y e2
=
=
=
=
1
1
1
,
2
3
1
1
1
xe1 = 1/ 2
xe2 = 5/ 2 and
ye1 = 4/ 2
ye2 = 2/ 2.
97
And
xe1 ye1 + xe2 ye2 = 4/2 + 10/2 = 3.
This is the same result as we got using the standard basis! This means that, as long as
were operating in an orthonormal basis, we get to use all the same formulas we use in the
standard basis. For instance, the length of x is the square root of the sum of the squares of
the components, the cosine of the angle between x and y is computed with the same formula
as in the standard basis, and so on. We can summarize this by saying that Euclidean
geometry is invariant under orthogonal transformations.
Exercise: ** Heres another way to get at the same result. Suppose A is an orthogonal matrix,
and fA : Rn Rn the corresponding linear transformation. Show that fA preserves the dot
product: AxAy = xy for all vectors x, y. (Hint: use the fact that xy = xt y.) Since the
dot product is preserved, so are lengths (i.e. ||Ax|| = ||x||) and so are angles, since these are
both defined in terms of the dot product.
98
Chapter 20
Projections onto subspaces and the
Gram-Schmidt algorithm
20.1
It is not obvious that any subspace V of Rn has an orthonormal basis, but its true. In this
chapter, we give an algorithm for constructing such a basis, starting from an arbitrary basis.
This is called the Gram-Schmidt procedure. Well do it first for a 2-dimensional subspace
of R3 , and then do it in general at the end:
Let V be a 2-dimensional subspace of R31 , and let {f1 , f2 } be a basis for V . The project is
to construct an o.n. basis {e1 , e2 } for V , using f1 , f2 .
The first step is easy. We normalize f1 and define e1 =
in our basis.
1
f.
||f1 || 1
We now need a vector orthogonal to e1 which lies in the plane spanned by f1 and f2 .
We get this by decomposing f2 into vectors which are parallel to and orthogonal to e1 :
we have f2|| = (f2 e1 )e1 , and f2 = f2 f2|| .
We now normalize this to get e2 = fc
2 = (1/||f2 ||)f2 .
Since f2 is orthogonal to e1 , so is e2 . Moreover
f2 f1
f2 = f2
f1 ,
||f1 ||2
so f2 and hence e2 are linear combinations of f1 and f2 . Therefore, e1 and e2 span the
same space and give an orthonormal basis for V .
1
Well revert to the more customary notation of Rn for the remainder of the text, it being understood
that were really in Euclidean space.
99
{v1 , v2 } =
1 ,
2 .
1
0
Then ||v1 || = 6, so
2
e1 = (1/ 6) 1 .
1
And
v2
1
2
1
= v2 (v2 e1 )e1 = 2 (2/3) 1 = (1/3) 4 .
0
1
2
Normalizing, we find
e2 = (1/ 21) 4 .
2
So {e1 , e2 } is an orthonormal basis for V. Exercise: Let E32 = (e1 |e2 ), where the columns
are the orthonormal basis vectors found above. What is E t E? What is EE t ? Is E an
orthogonal matrix?
Exercise: Find an orthonormal basis for the null space of the 1 3 matrix A = (1, 2, 4).
Exercise: ** Let {v1 , v2 , . . . , vk } be a set of (non-zero) orthogonal vectors. Prove that the
set is linearly independent. (Hint: suppose, as usual, that c1 v1 + + ck vk = 0, and take
the dot product of this with vi .)
20.2
since x is orthogonal to V and hence orthogonal to e1 . Applying the same reasoning to the
other coefficient, our expression for the orthogonal projection now becomes
V (x) = (xe1 )e1 + (xe2 )e2 .
The advantage of this last expression is that the projection does not appear explicitly on the
left hand side; in fact, we can use this as the definition of orthogonal projection:
Definition: Suppose V Rn is a subspace, with {e1 , e2 , . . . , , ek } an orthonormal basis for
V . For any vector x Rn , let
k
X
V (x) =
(xei )ei .
i=1
This is the natural generalization to higher dimensions of the projection of x onto a onedimensional space considered before. Notice what we do: we project x onto each of the
1-dimensional spaces determined by the basis vectors and then add up these projections.
The orthogonal projection is a function: V : Rn V ; it maps x Rn to V (x) V . In
the exercises below, youll see that its a linear transformation.
Example: Let V R3 be the span of the two orthonormal vectors
1
2
2
1
This is a 2-dimensional subspace of R3 and {e1 , e2 } is an o.n. basis for the subspace. So if
x = (1, 2, 3)t ,
V (x) = (xe1 )e1 + (xe2)e2
= (7/ 6)e
1 +(1/ 21)e2
2
1
= (7/6) 1 + (1/21) 4
1
2
Exercise:
Orthogonal complements
20.3
Then
V
1
V = span 1 .
1
x
1
y
=0 =
= v R such that v
such that x + y + z = 0
1
z
This is the same as the null space of the matrix A = (1, 1, 1). (Isnt it?). So writing
s = y, t = z, we have
1
1
s t
= s 1 + t 0 , s, t R .
s
V =
t
0
1
A basis for V is clearly given by the two indicated vectors; of course, its not orthonormal,
but we could remedy that if we wanted.
Exercise:
1. Let {w1 , w2 , . . . , wk } be a basis for W . Show that v W vwi = 0, i.
2. Let
1
1
W = span 2 , 1
1
2
Find a basis for W . Hint: Use the result of exercise 1 to get a system of two equations
in two unknowns and solve it.
3. (**) We know from a previous exercise that any orthogonal matrix A has det(A) = 1.
Show that any 2 2 orthogonal matrix A with det(A) = 1 can be written uniquely in
the form
cos() sin()
, for some [0, 2).
A=
sin()
cos()
(Hint: If
A=
102
a b
c d
assume first that a and c are known. Use the determinant and the fact that the matrix
is orthogonal to write down (and solve) a system of two linear equations for b and c.
Then use the fact that a2 + c2 = 1 to get the result.)
What about the case det(A) = 1? It can be shown that this corresponds to a rotation
followed by a reflection in one of the coordinate axes (e.g., x x, y y.)
4. (***) Let A be a 3 3 orthogonal matrix with determinant 1.
(a) Show that A has at least one real eigenvalue, say , and that || = 1.
(c) Choose an orthonormal basis {e2 , e3 } for e so that det(e|e2 |e3 ) = 1. (Note: For
any o.n. basis {e2 , e3 }, the matrix (e|e2 |e3 ) is an orthogonal matrix, so it must
have determinant 1. If the determinant is 1, then interchange the vectors e2
and e3 to get the desired form.) Then the matrix of A in this basis has the form
1 0 0
Ae = 0 a b ,
0 c d
where
a b
c d
20.4
2
v= 1
1
1 .
v3 =
1
104
Chapter 21
Symmetric and skew-symmetric matrices
21.1
1 2 3
C = 4 5 6 .
7 8 9
Then
1 4 7
1 4 7
1 2 3
1 2 3
C = (1/2) 4 5 6 + 2 5 8 +(1/2) 4 5 6 2 5 8 ,
7 8 9
3 6 9
7 8 9
3 6 9
and
2 6 10
0 2 4
1 3 5
0 1 2
C = (1/2) 6 10 14 +(1/2) 2
0 2 = 3 5 7 + 1
0 1 .
10 14 18
4
2
0
5 7 9
2
1
0
Let f : Rn Rn be any differentiable function. Fix an x0 Rn and use Taylors
theorem to write
f(x) = f(x0 ) + Df(x0 )x + higher order terms.
105
Neglecting the higher order terms, we get whats called the first-order (or infinitessimal)
approximation to f at x0 . We can decompose the derivative Df(x0 ) into its symmetric
and skew-symmetric parts, and write
f(x) f(x0 ) + A(x0 )x + B(x0 )x,
where A = (1/2)(Df(x0 ) + (Df(x0 )t ), and B is the difference of these two matrices.
This decomposition corresponds to the
Theorem of Helmholtz: The most general motion of a sufficiently small
non-rigid body can be represented as the sum of
1. A translation (f(x0 ))
2. A rotation (the skew-symmetric part of the derivative acting on x), and
3. An expansion (or contraction) in three mutually orthogonal directions (the
symmetric part).
Parts (2) and (3) of the theorem are not obvious; they are the subject of this chapter.
21.2
Note: If you look back at Example 1, you can see that the skew-symmetric part of the
3 3 matrix has only 3 distinct entries: All the entries on the diagonal must vanish by
skew-symmetry, and the (1, 2) entry determines the (2, 1) entry, etc. The three components
above the diagonal, with a bit of fiddling, can be equated to the three components of a vector
R3 , called an axial vector since its not really a vector. If this is done correctly, one
can think of the direction of as the axis of rotation and the length of as the angle of
rotation. You might encounter this idea in a course on mechanics.
Exercise: What is the general form of a 2 2 skew-symmetric matrix? Show that such a
matrix always has pure imaginary eigenvalues.
21.3
(21.1)
z,
A
z =
where weve used the fact that A = A since all the entries of A are real. Now take the dot
product of both sides of this equation with z to obtain
zz.
A
zz =
Now use (21.1) on the left hand side to obtain
A
zz = zAz = zz =
zz.
Comparing the right hand sides of this equation and the one above leads to
zz = 0.
( )
(21.2)
Since z is an eigenvector, z 6= 0 and thus, as we saw above, zz > 0. In order for (21.2) to
so is real, and this completes the first part of the
hold, we must therefore have = ,
proof. For the second, suppose z is an eigenvector. Since we now know that is real, when
we take the complex conjugate of the equation
Az = z,
we get
A
z =
z.
Adding these two equations gives
A(z + z) = (z + z).
Thus z + z is also an eigenvector corresponding to , and its real. So were done.
Comment: For the matrix
A=
1 3
3 1
1 2
2 1
They are clearly orthogonal, as advertised. Moreover, normalizing them, we get the orb2 }. So the matrix
thonormal basis {b
v1 , v
P = (b
v1 |b
v2 )
AP = P AP =
3
0
0 1
109
110
Chapter 22
Approximations - the method of least squares
22.1
The problem
Suppose that for some y, the equation Ax = y has no solutions. It may happpen that this
is an important problem and we cant just forget about it. If we cant solve the system
exactly, we can try to find an approximate solution. But which one? Suppose we choose an
x at random. Then Ax 6= y. In choosing this x, well make an error given by the vector
e = Ax y. A plausible choice (not the only one) is to seek an x with the property that
||Ax y||, the magnitude of the error, is as small as possible. (If this error is 0, then we
have an exact solution, so it seems like a reasonable thing to try and minimize it.) Since
this is a bit abstract, we look at a familiar example:
Example: Suppose we have a bunch of data in the form of ordered pairs:
{(x1 , y1 ), (x2 , y2), . . . , (xn , yn )}.
These data might come from an experiment; for instance, xi might be the current through
some device and yi might be the temperature of the device while the given current flows
through it. The n data points then correspond to n different experimental observations.
The problem is to fit a straight line to this data. When we do this, well have a mathematical model of our physical device in the form y = mx + b. If the model is reasonably
accurate, then we dont need to do any more experiments in the following sense: if were
given a current x, then we can estimate the resulting temperature of the device when this
current flows through it by y = mx + b. So another way to put all this is: Find the linear
model that best predicts y, given x. Clearly, this is a problem which has (in general)
no exact solution. Unless all the data points are collinear, theres no single line which goes
through all the points. Our problem is to choose m and b so that y = mx + b gives us, in
some sense, the best possible fit to the data.
It may not be obvious, but this example is a special case (one of the simplest) of finding an
approximate solution to Ax = y:
111
Suppose we fix m and b. If the resulting line (y = mx + b) were a perfect fit to the data,
then all the data points would satisfy the equation, and wed have
y1 =
y2 =
..
.
mx1 + b
mx2 + b
yn = mxn + b.
If no line gives a perfect fit to the data, then this is a system of equations which has no exact
solution. Put
x1
1
y1
x2
y2
m
1
.
, and x =
, A=
y=
b
xn
1
yn
Then the linear system above takes the form y = Ax, where A and y are known, and the
problem is that there is no solution x = (m, b)t .
22.2
We can visualize the problem geometrically. Think of the matrix A as defining a linear
function fA : Rn Rm . The range of fA is a subspace of Rm , and the source of our problem
is that y
/ Range(fA ). If we pick an arbitrary point Ax Range(fA ), then the error weve
made is e = Ax y. We want to choose Ax so that ||e|| is as small as possible.
Exercise: ** This could be handled as a calculus problem. How? (Hint: Write down a
function depending on m and b whose critical point(s) minimize the total mean square error
||e||2.)
Instead of using calculus, we prefer to draw a picture. We decompose the error as e = e|| +e ,
where e|| Range(fA ) and e Range(fA ) . See the Figure.
Then ||e||2 = ||e||||2 + ||e ||2 (by Pythagoras theorem!). Changing our choice of Ax does
not change e , so the only variable at our disposal is e|| . We can make this 0 by choosing
Ax so that (y) = Ax, where is the orthogonal projection of Rm onto the range of fA .
And this is the answer to our question. Instead of solving Ax = y, which is impossible, we
solve for x in the equation Ax = (y), which is guaranteed to have a solution. So we have
minimized the squared length of the error e, thus the name least squares approximation. We
collect this information in a
is said to be a least squares solution to Ax = y if the error
Definition: The vector x
vector e = A
x y is orthogonal to the range of fA .
Example (contd.): Note: Were writing this down to demonstrate that we could, if we had
to, find the least squares solution by solving Ax = (y) directly. But this is not whats
done in practice, as well see in the next lecture. In particular, this is not an efficient way to
proceed.
112
y
e
e
0
Ax
e||
x1
1
x2
1
A=
.
xn
1
To do this, we need an orthonormal basis for the range of fA , which is the same as the column
space of the matrix A. We apply the Gram-Schmidt process to the columns of A, starting
with the easy one:
1
1 1
.
e1 =
n
1
x1 x
x2 x
v =
xn x
n
X
, where x = 1
xi
n i=1
113
x1 x
n
X
1 x2 x
, where 2 =
(xi x)2
e2 =
i=1
xn x
is the variance of the x-measurements. Its square root, , is called the standard deviation
of the measurements.
We can now compute
(y) = (ye1 )e1 + (ye2 )e2
= routine
computation
here . . .
1
x1 x
( n
)
X
1
x2 x
1
= y
xi yi n
xy
+ 2
i=1
1
xn x
1
= 2
n
X
i=1
xi yi n
xy .
= x1 + y
x
= x2 + y
x
mxn + b = xn + y
x,
and we know (why?) that the augmented matrix for this system has rank 2. So we can
solve for m and b just using the first two equations, assuming x1 6= x2 so these two are not
multiples of one another. Subtracting the second from the first gives
m(x1 x2 ) = (x1 x2 ), or m = .
Now substituting for m in either equation gives
b = y
x.
These are the formulas your graphing calculator uses to compute the slope and y-intercept
of the regression line.
This is also about the simplest possible least squares computation we can imagine, and its
much too complicated to be of any practical use. Fortunately, theres a much easier way to
do the computation, which is the subject of the next chapter.
114
Chapter 23
Least squares approximations - II
23.1
The transpose of A
In the next section well develop an equation, known as the normal equation, which is much
easier to solve than Ax = (y), and which also gives the correct x. We need a bit of
background first.
The transpose of a matrix, which we havent made much use of until now, begins to play a
more important role once the dot product has been introduced. If A is an mn matrix, then
as you know, it can be regarded as a linear transformation from Rn to Rm . Its transpose,
At then gives a linear transformation from Rm to Rn , since its n m. Note that there is no
implication here that At = A1 the matrices neednt be square, and even if they are, they
need not be invertible. But A and At are related by the dot product:
Theorem: xAt y = Axy
Proof: The same proof given for square matrices works here, although we should notice that
the dot product on the left is in Rn , while the one on the right is in Rm .
We can move A from one side of the dot product to the other by replacing it with At . So
for instance, if Axy = 0, then xAt y = 0, and conversely. In fact, pushing this a bit, we
get an important result:
Theorem: Ker(At ) = (Range(A)) . (In words, for the linear transformation determined by
the matrix A, the kernel of At is the same as the orthogonal complement of the range of A.)
Proof: Let y (Range(A)) . This means that for all x Rn , Axy = 0. But by the
previous theorem, this means that xAt y = 0 for all x Rn . But any vector in Rn which is
orthogonal to everything must be the zero vector (non-degenerate property of ). So At y = 0
and therefore y Ker(At ). Conversely, if y Ker(At ), then for any x Rn , xAt y = 0.
And again by the theorem, this means that Axy = 0 for all such x, which means that
y Range(A).
We have shown that (Range(A)) Ker(At ), and conversely, that Ker(At ) (Range(A)) .
115
23.2
Now were ready to take up the least squares problem again. We want to solve the system
Ax = (y). where y has been projected orthogonally onto the range of A. The problem with
solving this, as youll recall, is that finding the projection involves lots of computation.
And now well see that its not necessary.
We can decompose y in the form y = (y) + y , where y is orthogonal to the range of A.
Suppose that x is a solution to the least squares problem Ax = (y). Multiply this equation
by At to get At Ax = At (y). So x is certainly also a solution to this. But now we notice
that, in consequence of the previous theorem,
At y = At ((y) + y ) = At (y),
since At y = 0. (Its orthogonal to the range, so the theorem says its in Ker(At ).)
So x is also a solution to the normal equation
At Ax = At y.
Conversely, if x is a solution to the normal equation, then
At (Ax y) = 0,
and by the previous theorem, this means that Ax y is orthogonal to the range of A. But
Ax y is the error made using an approximate solution, and this shows that the error vector
is orthogonal to the range of A this is our definition of the least squares solution!
The reason for all this fooling around is simple: we can compute At y by doing a simple
matrix multiplication. We dont need to find an orthonormal basis for the range of A to
compute . We summarize the results:
is a least-squares solution to Ax = y x
is a solution to the normal equation
Theorem: x
At Ax = At y.
Example: Find the least squares regression line through the 4 points (1, 2), (2, 3), (1, 1), (0, 1).
Solution: Weve already set up this problem in the last lecture. We have
2
1 1
3
2 1
m
.
, y = , and x =
A=
b
1
1 1
1
0 1
We compute
AA=
6 2
2 4
, Ay=
116
7
7
4 2
2
6
7
7
7/10
7/5
a
x31 x21 x1 1
y1
b
..
..
y = ... =
.
.
c
x3n x2n xn 1
yn
d
This is a least squares problem just like the regression line problem, just a bit bigger. Its
solved the same way, using the normal equation.
Exercise:
1. Find a least squares solution to the system Ax = y, where
2 1
1
1 3 , and y =
2
A=
3 4
3
2. Suppose you want to model your data {(xi , yi) : 1 i n} with an exponential
function y = aebx . Show that this is the same as finding a regression line if you use
logarithms.
117
3. (*) For these problems, think of the row space as the column space of At . Show that
v is in the row space of A v = At y for some y. This means that the row space
of A is the range of fAt (analogous to the fact that the column space of A is the range
of fA ).
4. (**) Show that the null space of A is the orthogonal complement of the row space.
(Hint: use the above theorem with At instead of A.)
118
Chapter 24
Appendix: Mathematical implications and
notation
Implications
Most mathematical statements which require proof are implications of the form
ARightarrowB,
which is read A implies B. Here A and B can be any statements. The meaning: IF A is
true, THEN B is true. At the basic level, implications can be either true or false. Examples:
If is a horse, then is a mammal is true, while the converse implication,
If is a mammal, then is a horse is false.
We can also write B A - this is the same thing as A B. To show that an implication
is true, you have to prove it; to show that its false, you need only provide a counterexample
an instance in which A is true and B is false. For instance, the observation that cats are
mammals which are not horses suffices to disprove the second implication.
Sometimes, A B and B A are both true. In that case, we write, more compactly,
A B.
To prove this, you need to show that A B and B A. The symbol is read as
implies and is implied by, or if and only if, or (classically) is necessary and sufficient
for .
If you think about it, the statement A B is logically equivalent to the statement B
A, where the symbol is mathematical shorthand for not. Example: if is not a
mammal, then is not a horse.
119
Mathematical implications come in various flavors: there are propositions, lemmas, theorems, and corollaries. There is no hard and fast rule, but usually, a proposition is a simple
consequence of the preceding definition. A theorem is an important result; a corollary is an
immediate consequence (like a proposition) of a theorem, and a lemma is result needed in
the upcoming proof of a theorem.
Notation
Some expressions occur so frequently that mathematicians have developed a shorthand for
them:
: this is the symbol for membership in a set. For instance the statement that 2 is a
real number can be shortened to 2 R.
: this is the symbol for the words for all. Synonyms include for each, for every,
and for any. In English, these may, depending on the context, have slightly different
meanings. But in mathematics, they all mean exaclty the same thing. So it avoids
confusion to use the symbol.
: the symbol for there exists. Synonyms include there is, and for some.
, , : see above
: the symbol for subset. If A and B are subsets, then A B means that x A
x B. A = B in this context means A B and B A.
Sets are often (but not always) defined by giving a rule that lets you determine whether
or not something belongs to the set. The rule is generally set off by curly braces.
For instance, suppose is the graph of the function f (x) = sin x on the interval [0, ].
Then we could write
= (x, y) R2 : 0 x and y = sin x .
120