



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




a 21 a 22
3 4 5
i =
→ x 1
a 31 a 32
1 2 3
Abstract —This document will review the fundamental ideas of linear algebra.
We will learn about matrices, matrix operations, linear transformations and
discuss both the theoretical and computational aspects of linear algebra. The
tools of linear algebra open the gateway to the study of more advanced
mathematics. A lot of knowledge buzz awaits you if you choose to follow the
path of understanding , instead of trying to memorize a bunch of formulas.
Linear algebra is the math of vectors and matrices. Let n be a positive
integer and let R denote the set of real numbers, then R
n is the set of all
n - tuples of real numbers. A vector →v R
n is an n - tuple of real numbers.
The notation “ S ” is read “element of S .” For example, consider a vector
that has three components:
B. Matrix operations
We denote by A the matrix as a whole and refer to its entries as a ij
The mathematical operations defined for matrices are the following:
- addition (denoted +)
C = A + B ⇔ c ij = a ij
- subtraction (the inverse of addition) - matrix product. The product of matrices A ∈ R
m×n and B ∈ R
nׯ
is another matrix C ∈ R
m × Æ given by the formula
n
C = AB ⇔ c ij = a ik b kj
k =
→v = ( v 1 , v 2 , v 3
3
A matrix A ∈ R
m × n is a rectangular array of real numbers with m rows
and n columns. For example, a 3 × 2 matrix looks like this:
a 11 a 12
a 31 a 32
b 11 b 12
b 21 b 22
a 11 b 11
= a 21 b 11
a 31 b 11
a 11 a 12
3 × 2
- matrix inverse (denoted A
− 1 )
- matrix transpose (denoted
T ):
A = a 21 a 22
a 31 a 32
α 1 α 2 α
T
α 1 β 1
The purpose of this document is to introduce you to the mathematical
operations that we can perform on vectors and matrices and to give you a
feel of the power of linear algebra. Many problems in science, business,
and technology can be described in terms of vectors and matrices so it is
β 1 β 2 β 3
- matrix trace: Tr[ A ] ≡
n
a ii
= α 2 β 2
α 3 β 3
important that you understand how to work with these.
Prerequisites
The only prerequisite for this tutorial is a basic understanding of high school
math concepts
1 like numbers, variables, equations, and the fundamental
arithmetic operations on real numbers: addition (denoted +), subtraction
(denoted −), multiplication (denoted implicitly), and division (fractions).
- determinant (denoted det( A ) or | A |)
Note that the matrix product is not a commutative operation: AB /= BA.
C. Matrix-vector product
The matrix-vector product is an important special case of the matrix-
matrix product. The product of a 3 × 2 matrix A and the 2 × 1 column
vector →x results in a 3 × 1 vector →y given by:
You should also be familiar with functions that take real numbers as
y 1
a 11 a 12
a 11 x 1
inputs and give real numbers as outputs, f : R R. Recall that, by
definition, the inverse function f
− 1 undoes the effect of f. If you are
→y = A→x ⇔
y 2
a 21 a 22
x 2
a 21 x 1
given f ( x ) and you want to find x , you can use the inverse function as
follows: f
− 1 ( f ( x )) = x. For example, the function f ( x ) = ln( x ) has the
y 3 a 31 a 32
a 11
a 12
a 31 x 1
inverse f
− 1 ( x ) = e
x , and the inverse of g ( x ) =
x is g
− 1 ( x ) = x
2 .
= x 1
a 21
a 22
A. Vector operations
( a 11 , a 12 ) · →x
( a 21 , a 22 ) · →x
We now define the math operations for vectors. The operations we can
perform on vectors →u = ( u 1 , u 2 , u 3 ) and →v = ( v 1 , v 2 , v 3 ) are: addition,
subtraction, scaling, norm (length), dot product, and cross product:
→u + →v = ( u 1
→u − →v = ( u 1 − v 1 , u 2 − v 2 , u 3 − v 3
α→u = ( αu 1 , αu 2 , αu 3
|| →u || =
q
u
2
2
2
→u · →v = u 1 v 1
→u × →v =( u 2 v 3 − u 3 v 2 , u 3 v 1 − u 1 v 3 , u 1 v 2 − u 2 v 1
The dot product and the cross product of two vectors can also be described
in terms of the angle θ between the two vectors. The formula for the dot
product of the vectors is →u · →v = →u →v cos θ. We say two vectors →u and
2 For more info see the video of Prof. Str
( a 31 , a 32 ) · →x
There are two
2 fundamentally different yet equivalent ways to interpret the
matrix-vector product. In the column picture, (C) , the multiplication of the
matrix A by the vector →x produces a linear combination of the columns
of the matrix : →y = A→x = x 1
[: , 1]
[: , 2] , where A [: , 1] and A [: , 2]
are the first and second columns of the matrix A.
In the row picture, (R) , multiplication of the matrix A by the vector
→x produces a column vector with coefficients equal to the dot products
of rows of the matrix with the vector →x.
D. Linear transformations
The matrix-vector product is used to define the notion of a linear
transformation , which is one of the key notions in the study of linear
algebra. Multiplication by a matrix A ∈ R
m × n can be thought of as
→v are orthogonal if the angle between them is 90
◦
. The dot product of
orthogonal vectors is zero: →u · →v = →u →v cos(
◦ ) = 0.
The norm of the cross product is given by →u × →v = →u →v sin θ. The
cross product is not commutative: →u × →v /= →v × →u , in fact →u × →v = − →v × →u.
1 A good textbook to (re)learn high school math is minireference.com
computing a linear transformation T A that takes n - vectors as inputs and
produces m - vectors as outputs:
n
m
ang’s MIT lecture: bit.ly/10vmKcL
3
2
to the vector 1 ∠(
π
1
1
3
1
3
1 1
β 1 β
1 0
is accomplished using the inverse matrix: B
B
B
B
− 1
.
1 2 3
1 0 3
In this section we’ll look at several different approaches for computing
the inverse of a matrix. The matrix inverse is unique so no matter which
method we use to find the inverse, we’ll always obtain the same answer.
A. Using row operations
One approach for computing the inverse is to use the Gauss–Jordan
elimination procedure. Start by creating an array containing the entries
of the matrix A on the left side and the identity matrix on the right side:
C. Using a computer
The last (and most practical) approach for finding the inverse of a matrix
is to use a computer algebra system like the one at live.sympy.org.
>>> A = Matrix( [[1,2],[3,9]] ) # define A
>>> A.inv() # calls the inv method on A
You can use sympy to “check” your answers on homework problems.
Now we perform the Gauss-Jordan elimination procedure on this array.
the second row: R 2
2
1
. We obtain:
We’ll now discuss a number of other important topics of linear algebra.
A. Basis
Intuitively, a basis is any set of vectors that can be used as a coordinate
system for a vector space. You are certainly familiar with the standard basis
2 3 2 for the xy - plane that is made up of two orthogonal axes: the x - axis and
the y - axis. A vector →v can be described as a coordinate pair ( v x , v y ) with
3
respect to these axes, or equivalently as →v = v x ˆ ı + v y ȷ ˆ, where ˆ ı ≡ (1 , 0)
1
2
2
3
The array is now in reduced row echelon form (RREF). The inverse matrix
appears on the right side of the array.
Observe that the sequence of row operations we used to solve the specific
system of equations in A→x =
b in the previous section are the same as the
row operations we used in this section to find the inverse matrix. Indeed,
in both cases the combined effect of the three row operations is to “undo”
the effects of A. The right side of the 2 4 array is simply a convenient
way to record this sequence of operations and thus obtain A
− 1 .
B. Using elementary matrices
Every row operation we perform on a matrix is equivalent to a left-
and ȷ ˆ (0 , 1) are unit vectors that point along the x - axis and y - axis
respectively. However, other coordinate systems are also possible.
Definition (Basis). A basis for a n-dimensional vector space S is any set
of n linearly independent vectors that are part of S_._
Any set of two linearly independent vectors e ˆ 1 , e ˆ 2 can serve as a basis
for R
2
. We can write any vector →v R
2 as a linear combination of these
basis vectors →v = v 1 e ˆ 1
Note the same vector →v corresponds to different coordinate pairs depend-
ing on the basis used: →v = ( v x , v y ) in the standard basis B s ˆ ı, ȷ ˆ , and
→v = ( v 1 , v 2 ) in the basis B e e ˆ 1 , e ˆ 2
. Therefore, it is important to keep
in mind the basis with respect to which the coefficients are taken, and if
necessary specify the basis as a subscript, e.g., ( v x , v y
Bs or ( v 1 , v 2
Be
Converting a coordinate vector from the basis B e to the basis B s is
performed as a multiplication by a change of basis matrix:
multiplication by an elementary matrix. There are three types of elementary »
→v
1
→v
v x
ˆ ı · e ˆ 1 ˆ ı · e ˆ 2
v 1
matrices in correspondence with the three types of row operations:
1 m
B s B s B e B e
v y ȷ ˆ· e ˆ 1 ȷ ˆ· e ˆ 2 v 2
α
1
1
α
Note the change of basis matrix is actually an identity transformation. The
vector →v remains unchanged—it is simply expressed with respect to a new
coordinate system. The change of basis from the B s
γ
1 ← mR 1
γ
m 0
Let’s revisit the row operations we used to find A
− 1 in the above section
representing each row operation as an elementary matrix multiplication.
2
1 corresponds to a multipli-
cation by the elementary matrix E 1
B. Matrix representations of linear transformations
Bases play an important role in the representation of linear transforma-
tions T : R
n R
m
. To fully describe the matrix that corresponds to some
linear transformation T , it is sufficient to know the effects of T to the n
vectors of the standard basis for the input space. For a linear transformation
2 → R
2 , the matrix representation corresponds to
1
2 × 2
T
T (ˆ ı ) T ( ȷ ˆ)
1 R 2 corresponds to a matrix E 2
2
1
As a first example, consider the transformation Π x which projects vectors
onto the x - axis. For any vector →v = ( v x , v y ), we have Π x ( →v ) = ( v x
The matrix representation of Π x is
1
2 , corresponds to the matrix E 3
Π x
x
0
x
1
3
2
1
As a second example, let’s find the matrix representation of R θ , the
Note that E 3
2
1 A = 1 , so the product E 3
2
1 must be equal to A
− 1 : counterclockwise rotation by the angle θ :
− 1 = E 3
2
1
2
R
θ
θ
cos θ − sin θ
3
3
θ 0 1 sin θ cos θ
The elementary matrix approach teaches us that every invertible matrix
can be decomposed as the product of elementary matrices. Since we know
The first column of M R θ
shows that R θ maps the vector ˆ ı 1 ∠ 0 to the
vector 1 ∠ θ = (cos θ, sin θ )
T
. The second column shows that R θ maps the
− 1 = E 3
2
1 then A = ( A
− 1 )
− 1 = ( E 3
2
1
− 1 = E
− 1 E
− 1 E
− 1 . vector ȷ ˆ= 1 ∠
π
T .
e s s e
3
3
2
2
4
B
and
a 31 a 32 a 33
T T T
s
4 5
free variable , which we will denote s. We are looking for a vector with three 6 .
7 6 7 − 1
1 3 0 0
1
0
If you’re interested in learning more about linear algebra, you can check
out my new book, the NO BULLSHIT GUIDE TO LINEAR ALGEBRA.
A pre-release version of the book is available here: gum.co/noBSLA
C. Dimension and bases for vector spaces
The dimension of a vector space is defined as the number of vectors
in a basis for that vector space. Consider the following vector space
= span (1 , 0 , 0) , (0 , 1 , 0) , (1 , 1 , 0). Seeing that the space is described
by three vectors, we might think that is 3 - dimensional. This is not the
case, however, since the three vectors are not linearly independent so they
don’t form a basis for S. Two vectors are sufficient to describe any vector
in S; we can write S = span{(1 , 0 , 0) , (0 , 1 , 0)}, and we see these two
vectors are linearly independent so they form a basis and dim(S) = 2.
There is a general procedure for finding a basis for a vector space.
Suppose you are given a description of a vector space in terms of m vectors
V = span{ →v 1 , →v 2 ,... , →v m } and you are asked to find a basis for V and the
dimension of V. To find a basis for V, you must find a set of linearly
independent vectors that span V. We can use the Gauss–Jordan elimination
E. Invertible matrix theorem
There is an important distinction between matrices that are invertible and
those that are not as formalized by the following theorem.
Theorem. For an n × n matrix A, the following statements are equivalent:
A is invertible
The RREF of A is the n n identity matrix
The rank of the matrix is n
The row space of A is R
n
n
For a given matrix A , the above statements are either all true or all false.
An invertible matrix A corresponds to a linear transformation T A which
procedure to accomplish this task. Write the vectors →v i as the rows of a
maps the n - dimensional input vector space R
n to the n - dimensional output
vector space R
n such that there exists an inverse transformation T
− 1 that
matrix M. The vector space corresponds to the row space of the matrix
M. Next, use row operations to find the reduced row echelon form (RREF) can faithfully undo the effects of
A
A
of the matrix M. Since row operations do not change the row space of the
matrix, the row space of reduced row echelon form of the matrix M is the
same as the row space of the original set of vectors. The nonzero rows in
the RREF of the matrix form a basis for vector space V and the numbers
of nonzero rows is the dimension of V.
D. Row space, columns space, and rank of a matrix
Recall the fundamental vector spaces for matrices that we defined in
Section II-E: the column space C( A ), the null space N( A ), and the row
On the other hand, an n n matrix B that is not invertible maps the
input vector space R
n to a subspace ( B ) Ç R
n and has a nonempty null
space. Once T B sends a vector w→ ( B ) to the zero vector, there is no
− 1 that can undo this operation.
F. Determinants
The determinant of a matrix, denoted det( A ) or A , is a special way to
combine the entries of a matrix that serves to check if a matrix is invertible
or not. The determinant formulas for 2 × 2 and 3 × 3 matrices are
a 11 a 12 = a 11 a 22 − a 12 a 21
space R( A ). A standard linear algebra exam question is to give you a ˛
a 21 a 22
certain matrix A and ask you to find the dimension and a basis for each a 11 a 12 a 13
a 22 a 23
a 21 a 23
a 21 a 22
of its fundamental spaces.
In the previous section we described a procedure based on Gauss–Jordan
elimination which can be used “distill” a set of linearly independent vectors
which form a basis for the row space ( A ). We will now illustrate this
procedure with an example, and also show how to use the RREF of the
matrix A to find bases for C( A ) and N( A ).
Consider the following matrix and its reduced row echelon form:
a 21 a 22 a 23 ˛
= a 11 ˛ a 32
a 33
− a 12 ˛ a 31
a 33
a 32
If the | A | = 0 then A is not invertible. If | A | /= 0 then A is invertible.
G. Eigenvalues and eigenvectors
The set of eigenvectors of a matrix is a special set of input vectors for
which the action of the matrix is described as a simple scaling. When
a matrix is multiplied by one of its eigenvectors the output is the same
eigenvector multiplied by a constant A→e λ = λ→e λ
. The constant λ is called
rref( A ) =
an eigenvalue of A.
The reduced row echelon form of the matrix A contains three pivots. The
locations of the pivots will play an important role in the following steps.
The vectors {(1 , 3 , 0 , 0) , (0 , 0 , 1 , 0) , (0 , 0 , 0 , 1)} form a basis for R( A ).
A→e λ = λ→e λ , insert the identity 1 , and rewrite it as a null-space problem:
A→e λ = λ 1 →e λ ⇒ ( A − λ 1 ) →e λ
This equation will have a solution whenever | A − λ | = 0. The eigenvalues
To find a basis for the column space ( A ) of the matrix A we need
to find which of the columns of A are linearly independent. We can
do this by identifying the columns which contain the leading ones in
rref( A ). The corresponding columns in the original matrix form a basis
for the column space of A. Looking at rref( A ) we see the first, third,
and fourth columns of the matrix are linearly independent so the vectors
{(1 , 2 , 3) , (3 , 7 , 9) , (3 , 6 , 10) } form a basis for C( A ).
1
of A R
n × n , denoted λ 1 , λ 2 ,... , λ n , are the roots of the characteristic
polynomial p ( λ ) = A λ 1. The eigenvectors associated with the
eigenvalue λ i are the vectors in the null space of the matrix ( A λ i
Certain matrices can be written entirely in terms of their eigenvectors
and their eigenvalues. Consider the matrix Λ that has the eigenvalues of
the matrix A on the diagonal, and the matrix Q constructed from the
Now let’s find a basis for the null space, ( A ) →x R
4 A→x =
The second column does not contain a pivot, therefore it corresponds to a
eigenvectors of A as columns:
2 λ 1
3 2
˛ |
3
unknowns and one free variable ( x , s, x , x )
T that obeys the conditions:
6 .
7
6 →e λ 1
· · · →e λ n
7 , then A = Q Λ Q.
1 3 4
2 3
2
x
3
2 3
6 4
0 0 λ n
7 5
6 4
6
7 5
4 0 0 1 0
4 0
5 ⇒ 1 x 3 = 0
0 0 0 1
x 3
0
x 4
Let’s express the unknowns x , x , and x
1 x 4 = 0
in terms of the free variable s.
The decomposition of a matrix into its eigenvalues and eigenvectors
gives valuable insights into the properties of the matrix. Google’s original
PageRank algorithm for ranking webpages by “importance” can be
1 3 4
We immediately see that x 3 = 0 and x 4 = 0 , and we can write x 1 = − 3 s.
Therefore, any vector of the form (− 3 s, s, 0 , 0), for any s ∈ R, is in the
null space of A. We write N( A ) = span{(− 3 , 1 , 0 , 0)
T }.
Observe that the dim( ( A )) = dim( ( A )) = 3 , this is known as the
rank of the matrix A. Also, dim( ( A )) + dim( ( A )) = 3 + 1 = 4 ,
which is the dimension of the input space of the linear transformation T A
formalized as an eigenvector calculation on the matrix of web hyperlinks.
To find the eigenvalues of a matrix we start from the eigenvalue equation
1 x 1