Professional Documents
Culture Documents
Algebra
H. Ananthnarayan*
Department of Mathematics, I.I.T. Bombay
This set of slides is the material presented in my classes (Divisions 1 & 4) of MA106,
and the first half of MA110 in Spring 2024 at IIT Bombay. The primary content was
developed by me and my co-instructor, Prof. Rekha Santhanam using the reference:
Linear Algebra and its Applications by G. Strang, 4th Ed., Thomson.
The topics covered are:
2. V ECTOR S PACES
(a) Orthogonality
(b) Projection & Least Squares Method
(c) Gram-Schmidt Process & Applications
A PPENDIX I - D ETERMINANTS
N OTE : (i) The notation in these slides is the same as that discussed in class.
(ii) Work out as many examples as you can.
1
Chapter 1. L INEAR E QUATIONS & M ATRICES
An Example
Solve the system: (1) x + 2y = 3, (2) 3x + y = 4.
E LIMINATION OF VARIABLES :
Eliminate x by (2) − 3 × (1) to get y = 1.
1 3
3 4 4−9
C RAMER ’ S R ULE ( DETERMINANT ): y = = =1
1 2 1−6
3 1
In either case, back substitution gives x=1
We could also solve for x first and use back substitution for y.
P OINT TO P ONDER : Why is it possible?
C OMPARISON : For a large system, say 100 equations in 100 variables, elimination
method is preferred, since computing 101 determinants of size 100 × 100
is time-consuming.
represent lines in R2 passing through (0, 3/2) and (3, 0) and through
(0, 4) and (4/3, 0) respectively.
2
y
3x + y = 4
x + 2y = 3
x
The intersection of the two lines is the unique point (1, 1). Hence (x, y) = (1, 1)
is the (only) solution of above system of linear equations.
(2,1)
x
Here x = 1, y = 1 will work.
P OINT TO P ONDER : How do the pictures change
if the system is x + 2y = 5 and 3x + y = 5?
Equations in 3 variables
R OW METHOD : A linear equation in 3 variables represents
a plane in a 3 dimensional space R3 , e.g.,
P1: x+2y+3z=6 is a plane passing through: (0, 0, 2), (0, 3, 0), (6, 0, 0).
P2: x+2y+3z=0 is a plane passing through: (0, 0, 0), (−3, 0, 1), (−2, 1, 0).
N OTE : P2 consists of all (x, y, z) such that (x, y, z) · (1, 2, 3) = 0, i.e.,
P2 is the set of all vectors perpendicular to the vector (1,2,3).
P1 and P2 have the same normal vector (1,2,3), and hence are parallel.
3
The intersection is non-empty, i.e., the system has at least one solution. In fact,
the solution set is a line in R3 , passing through the origin.
E XERCISE : Find all the solutions in the second example.
3 equations in 3 variables
• If the line L does not intersect the plane P3 , then the linear system has no solution,
i.e., the system is inconsistent.
• If the line L is contained in the plane P3 , then the system has infinitely many solutions.
In this case, every point of L is a solution.
4
Gaussian Elimination
E XAMPLE : 2u + v + w = 5, 4u − 6v = −2, −2u + 7v + 2w = 9.
A LGORITHM : Eliminate u from last 2 equations by
4 −2
(2) − × (1), and (3) − × (1) to get the equivalent system:
2 2
2u + v + w = 5, − 8v − 2w = −12, 8v + 3w = 14
2u + v + w = 5, − 8v − 2w = −12, 1 · w = 2
Solve this triangular system by back substitution, to get the unique solution
w = 2, v = 1, u = 1.
5
Singular Case: Infinitely many solutions
E XAMPLE : 2u + v + w = 5, 4u − 6v = −2, −2u + 7v + w = 7.
Step 1 Eliminate u (using the 1st pivot 2) to get:
2u + v + w = 5, −8v − 2w = −12, 8v + 2w = 12
Step 2 : Eliminate v (using the 2nd pivot -8) to get:
2u + v + w = 5, −8v − 2w = −12, 0 · w = 0.
There are only two equations. For every value of w, values for u and v
are obtained by back-substitution,
e.g., w = 2 gives (1, 1, 2), and w = 0 gives 47 , 32 , 0
6
Choosing pivots: Two examples
E XAMPLE 2: 3 equations in 3 unknowns (u, v, w)
0u + 6v + 4w = −2, 0u + v + 2w = 1, 0u + 7v − 2w = −9.
0 1 2 | 1
[A|b] = 0 6 4 | −2
0 7 −2 | −9
Coefficient of u is 0 in every equation. Start by eliminating v. Solve for v and w
to get w = 1, and v = −1.
N OTE : (0, −1, 1) is a solution of the system. So is (1, −1, 1).
In fact, (∗, −1, 1) is a solution, for any real number ∗.
O BSERVE : ‘Unique solution’ is not an option!
Q: Does such a system always have infinitely many solutions?
A: Depends on the constant vector b.
E XERCISE : Find 3 vectors b for which the above system has
(i) no solutions (ii) infinitely many solutions.
Summary: Pivots
• If the first pivot (coefficient of 1st variable in 1st equation) is zero, then interchange it
with next equation so that you get a non-zero first pivot. Do the same for other pivots.
• If the coefficient of the 1st variable is zero in every equation, consider the 2nd variable
as 1st and repeat the previous step.
1.2 M ATRICES
What is a matrix?
A matrix is a collection of numbers arranged into a fixed number of
rows and columns.
If a matrix A has m rows and n columns, the size of A is m × n.
A1∗
A2∗
The rows of A are denoted A1∗ , A2∗ , . . . , Am∗ , i.e., A = . ,
..
Am∗
the columns are denoted A∗1 , A∗2 . . . , A∗n , i.e.,
A = A∗1 A∗2 · · · A∗n , and the (i, j)th entry is Aij (or aij ).
T HUS, an m×n matrix can be thought of as mn real numbers, n column vectors in Rm , or m row vecto
arranged in a particular order.
7
Operations on Matrices: Matrix Addition
E XAMPLE 1. We know how to add two row or column vectors.
1 2 3 + −3 −2 −1 = ? ? ? (component-wise)
We can add matrices if and only if they have the same size ,
and the addition is component-wise.
E XAMPLE 2.
1 2 3 −1 −4 −2 ? −2 ?
+ =
2 2 4 0 0 1 2 ? ?
T HUS
(A + B)i∗ = Ai∗ + Bi∗ and (A + B)∗j = A∗j + B∗j
An Example
2 1
1 3 −3 −1 1 0
Let A = 1 2 0 −2, x =
1, and e1 = 0 .
1 0 −2 0
2 0
A1∗ = 1 3 −3 −1 , A2∗ = 1 2 0 −2 A3∗ =?.
8
?
Then A1∗ · x =?, A2∗ · x = 0, A3∗ · x = 0, hence Ax = ? .
?
Q: What is Ae1 ? A: The first column A∗1 of A.
E XERCISE : What should e2 , e3 , e4 be so that Aej = A∗j , the jth column of A?
P OINTS TO P ONDER : Let A be m × n.
(i) For which x ∈ Rn is Ax = 0?
(ii) For which b ∈ Rm is Ax = b solvable?
(iii) Ae1 gives A∗1 . How can we get A1∗ , the first row of A?
R OW WISE : Write A row-wise, i.e., let A1∗ , . . . , Am∗ be the rows of A. Then
A1∗ A1∗ B
AB = ... B = ...
Am∗ Am∗ B
N OTE : Each Ai∗ is a row vector of size 1 × n. Hence, Ai∗ B is a row vector
of size 1 × r. So, the size of AB is m × r.
C OLUMN WISE : Write B column-wise, i.e., let B = B∗1 B∗2 · · · B∗r . Then
AB = AB∗1 AB∗2 · · · AB∗r
N OTE : (i) Each B∗j is a column vector of length n. Hence, AB∗j is a column vector
of length m. So, the size of AB is m × r.
(ii) Moreover, AB∗j is a linear combination of the columns of A
with the as weights.
T HUS, Columns of AB are a linear combination of Columns of A.
P OINT TO P ONDER : Each row of AB is a linear combination of .
W ORKING R ULE:
The entry in the ith row and jth column of AB is the dot product
of the ith row of A with the jth column of B, i.e., (AB)ij = Ai∗ · B∗j .
9
• (associativity) (AB)C = A(BC)
• (distributivity) A(B + C) = AB + AC
(B + C)D = BD + CD
Matrix Multiplication:
Examples
2 1 1 1 0 0
1 2 3
E XAMPLES : A = 4 −6 0 , B =
,I= 0 1 0 (Identity)
2 2 4
−2 7 2 0 0 1
0 1 0 1 0 0
(Permutation) P = 1 0 0 = e2 e1 e3 , E = −2 1 0
0 0 1 0 0 1
• AB = ??
• size of BA is ×
? 10 ?
• BA = ,
4 ? ?
• and IA = A = AI.
• AP = Ae2 Ae1 Ae3 = A∗2 A∗1 A∗3
E XERCISE : Find EA and P A.
P OINT TO P ONDER : Can you obtain EA and P A directly from A?
Transpose of a Matrix
D EFN . AT , the transpose of A, is defined as follows:
The i-th row of A is the i-th column of AT and vice-versa.
Hence if Aij = a, then (AT )ji = a.
1 0
1 2 3
E XAMPLE : If A = , then AT = 2 −2.
0 −2 1
3 1
• If A is m × n, then AT is n × m.
• If A is upper triangular, then AT is lower triangular.
• (AT )T = A, (A + B)T = AT + B T .
• (AB)T = B T AT .
Proof. Exercise.
10
Symmetric Matrix
D EFN . If AT = A, then A is called a symmetric matrix.
N OTE : A symmetric
matrix
is n × n.
always
1 2 0 1
E XAMPLES : A = ,B= are symmetric.
2 3 1 0
• If A, B are symmetric, then
may NOT be symmetric.
AB
2 1
In the above case, AB = .
3 2
• If A and B are symmetric, then so is A + B.
• If A is n × n, A + AT is symmetric.
• For any m × n matrix B, BB T and B T B are symmetric.
E XERCISE : If AT = −A, we say that A is skew-symmetric.
Verify if similar observations are true for skew-symmetric matrices.
Inverse of a Matrix
D EFN . Given A of size n × n, we say B is an inverse of A if AB = I = BA.
If this happens, we say A is invertible.
• An inverse may not exist. Find an example. Hint: n = 1.
• An inverse of A, if it exists, has size n × n.
• If the inverse of A exists, it is unique, and is denoted A−1 .
Proof. Let B and C be inverses of A.
⇒ BA = I by definition of inverse.
⇒ (BA)C = IC multiply both sides on the right by C.
⇒ B(AC) = IC by associativity.
⇒ BI = IC since C is an inverse of A.
⇒B=C by property of the identity matrix I.
11
E XERCISE :
1. A diagonal matrix A is invertible if and only if .
(Hint: When are the diagonal entries pivots?)
2. When is an upper triangular matrix invertible?
• Since AB = AB∗1 AB∗2 · · · AB∗n and I = e1 e2 · · · en ,
if B = A−1 , then B∗j is a solution of Ax = ej for all j.
• S TRATEGY TO FIND A−1 : Let A be an n × n invertible matrix.
Solve Ax = e1 , Ax = e2 , . . . , Ax = en .
Finding A−1
S TRATEGY: Let A be an invertible n × n matrix. If v1 , v2 , . . . , vn
are solutions of Ax = e1 , Ax = e2 , . . . , Ax = en respectively, then A−1 = v1 v2 · · ·
vn .
Solutions to Multiple
Systems
0 1 −1 −1 1
Q: Let A = 1 0 2 , B = 2 0 = b1 b2 .
1 2 0 0 2
Is there a matrix C such that AC = B,
i.e., such that AC∗1 = b1 , AC∗2 = b2 ?
Rephrased question: Are Ax = b1 and Ax = b2 simultaneously consistent?
0 1 −1 | −1 1 1 0 2 | 2 0
R1 ↔R2
[A|B] = 1
0 2 | 2 0 −−−−−→ 0 1 −1
| −1 1
1 2 0 | 0 2 1 2 0 | 0 2
1 0 2 | 2 0 1 0 2 | 2 0
R −R1 R −2R2
−−3−−→ 0 1 −1 | −1 1 −−3−−−→ 0 1 −1 | −1 1
0 2 −2 | −2 2 0 0 0 | 0 0
0 0
A solution to Ax = b1 is 0, and to Ax = b2 is 1. (Verify)!
1 0
So C = e3 e2 works! Is it unique?
0 1 −1
E XERCISE : Can you find the inverse of A = 1 0 2
−1 2 0
(if it exists), by using elimination as above?
12
Elementary and Permutation
Matrices
0 1 −1 −1
Let A = 1 0 2 , b = 2 .
1 2 0 0
In the process of solving Ax = b by elimination, we see that
0 1 −1 | −1 1 0 2 | 2
[A | b] = 1 0 2 | 2 −→ 0 1 −1 | −1
1 2 0 | 0 0 0 0 | 0
13
1 0 0
• If E21 (λ) = λ 1 0, what is your guess for E21 (λ)−1 ? Verify.
0 0 1
T
0 1 0 e2
• Let P12 = 1 0 0 = eT1 . What is P12 T ? P T P ? P −1 ?
12 12
12
0 0 1 eT3
14
Summary: Elementary and Permutation Matrices
E LEMENTARY M ATRIX Eij (λ): Obtained from In by Ri = Ri + λRj .
• Eij (λ)A has the same effect on A as the row operation Ri = Ri − (−λ)Rj .
• I NVERSE : Eij (λ)−1 = Eij (−λ).
P ERMUTATION M ATRIX : Obtained from In by row exchanges, e.g.,
• Pij : Obtained from In by Ri ↔ Rj
• Pij A has the same effect on A as the row operation Ri ↔ Rj .
• A permutation matrix P is a product of Pij ’s.
• I NVERSE : Pij−1 = Pij = PijT , and hence, P −1 = P T .
Q: Is P = P −1 ?
Triangular Factorization
Thus Ax = b is equivalent to Ux = c .
where
E32 (1) E31 (1) E21 (−2) A = U
Multiply both sides by E32 (−1) on the left: E31 (1) E21 (−2) A = E32 (−1) U
Multiply first by E31 (−1) and then E21 (2) on the left:
LU Decomposition
If A is an n × n matrix, with no row interchanges needed
in the Gaussian elimination of A, then A = L U , where
• U is an upper triangular matrix, which is obtained by forward elimination,
with non-zero diagonal entries as pivots.
• L is a lower triangular with diagonal entries 1 and with the multipliers needed
in the elimination algorithm below the diagonals.
Q: What happens if row exchanges are required?
15
LU Decomposition: with Row Exchanges
0 2
E XAMPLE : A = . A can not be factored as LU . (Check!)
3 4
The 1st step in the Gaussian elimination of A is a row exchange.
0 1 0 2 3 4
P12 A = =
1 0 3 4 0 2
Applications:
1. Linear Equations
1 2 3 1 0 0 1 2 3
Let A = −2 −12 −5 = −2 1 0 0 −8 1
1 −6 3 1 1 1 0 0 −1
To solve Ax = b, we can solve two triangular systems
Lc = b and U x = c . Then Ax = LU x = Lc = b.
1 1 0 0 c1 1
Take b = 2 . First solve −2 1 0
c2 = 2.
5 1 1 1 c3 5
We get c1 = 1, −2c1 + c2 = 2 ⇒ c2 = 4, and similarly c3 = 0.
1 2 3 u 1
Now solve 0 −8 1 v = 4.
0 0 −1 w 0
We get w = 0, v = −1/2, u = 2.
16
Computing the Inverse
K EY N OTE : A = L U ⇒ A−1 = U −1 L−1 .
(Replace A by P A if row exchanges are needed)
2 1 1
E XAMPLE : A = 4 −6 0 is invertible. Find A−1 .
−2 7 2
Recall: If A = x1 x2 x3 , where xi is the i-th column of A−1 ,
−1
Summary: LU Decomposition
If A is an n × n matrix, with no row interchanges needed
in the Gaussian elimination of A, then A = L U , where
• U is an upper triangular matrix, which is obtained by forward elimination,
with non-zero diagonal entries as pivots.
• L is a lower triangular with diagonal entries 1 and with the multipliers needed
17
in the elimination algorithm below the diagonals.
Q: What happens if row exchanges are required?
• If A is an n × n matrix, then there is a permutation matrix P
such that P A = LU , where L and U are as above.
Q: What happens when A is an m × n matrix?
Echelon Form
Q: What happens when A is not a square matrix?
1 2 3 5
E XAMPLE : Let A = 2 4 8 12. By elimination, we see:
3 6 7 13
1 2 3 5 1 2 3 5
R −2R1 R3 −(−1)R2
A −−2−−−→ 0 0 2 2 −−−−−−−→ 0 0 2 2 = U .
R3 −3R1
0 0 −2 −2 0 0 0 0
1 0 0
Thus A = LU , where L = E21 (2)E31 (3)E32 (−1) = 2 1 0 .
3 −1 1
Q: What are the pivots of A?
Echelon Form
If A is m × n, we can find P , L and U as before.
In this case, L and P will be m × m and U will be m × n.
U has the following properties:
1. Pivots are the 1st nonzero entries in their rows.
2. Entries below pivots are zero, by elimination.
3. Each pivot lies to the right of the pivot in the row above.
4. Zero rows are at the bottom of the matrix.
U is called an echelon form of A.
2 × 2
Possible echelon
forms:
Let •= pivot entry.
• ∗ • ∗ 0 • 0 0
, , , and .
0 • 0 0 0 0 0 0
18
1.4 N ULL S PACE & C OLUMN S PACE : I NTRODUCTION
Finding N(A)
K EY P OINT : Let U be the echelon form of A, and R be the reduced form of A,
then Ax = 0 has the same solutions as U x = 0,
which has the same solutions as Rx = 0, i.e.,
N (A) = N (U ) = N (R) .
R EASON : If A is m × n, and Q is an invertible m × m matrix, then N (A) = N (QA).
(Verify this)!
E XAMPLE :
t
1 2 3 5 1 2 0 2
u
For A = 2 4 8 12, we have Rx = 0 0 1 1 v .
3 6 7 13 0 0 0 0
w
R x = 0 gives t + 2u + 2w = 0 and v + w = 0.
i.e., t = −2u − 2w and v = −w.
t and v are dependent on the values of u and w.
u and w are free and independent,
i.e., we can choose any value for these two variables.
S PECIAL SOLUTIONS : T
u = 1 and w = 0, gives x = −2 1 0 0 .
T
u = 0 and w = 1, gives x = −2 0 −1 1 .
The null space contains:
19
t −2u − 2w −2 −2
u u 1 0
x= v = −w = u 0 + w −1 ,
w w 0 1
i.e., all possible linear combinations of the special solutions.
Rank of a matrix
Ax = 0 always has a solution: the trivial one, i.e., x = 0.
M AIN Q1: When does Ax = 0 have a non-zero solution?
A: When there is at least one free variable,
i.e., not every column of R contains a pivot.
To keep track of this, we define:
rank(A) = number of columns containing pivots in R .
If A is m × n and rank(A) = r, then
• rank(A) ≤ min{m, n}.
• no. of dependent variables = r.
• no. of free variables = n − r.
• Ax = 0 has only the 0 solution ⇔ r = n.
• m < n ⇒ Ax = 0 has non-zero solutions.
T RUE /F ALSE : Ifm ≥ n, then
Ax = 0 has only the 0 solution.
1 2 0 2 1 2 3 5
E XAMPLE : R = 0 0 1 1 when A = 2 4 8 12.
0 0 0 0 3 6 7 13
The number of columns containing pivots in R is 2. So, rank(A) = 2.
R contains a 2 × 2 identity matrix, namely the rows and columns
corresponding to the pivots.
1 3
This is the row reduced form of the corresponding submatrix of A,
2 8
which is invertible, since it has 2 pivots.
Thus, rank(A) = r ⇒ A has an r × r invertible submatrix.
Is the converse is true?
20
Solving Ax = b
C AUTION : If b ̸= 0, solving Ax = b may not be the same as
solving U x = b or Rx = b.
t
1 2 3 5 b
u 1
E XAMPLE : Ax = 2 4 8
12 = b2 = b.
v
3 6 7 13 b3
w
Convert
to U x = c and
then
Rx = d.
1 2 3 5 | b1 1 2 3 5 | b1
2 4 8 12 | b2 → 0 0 2 2 | b2 − 2b1
3 6 7 13 | b3 0 0 −2 −2 | b3 − 3b1
1 2 3 5 | b1
→ 0 0 2 2 | b2 − 2b1
0 0 0 0 | b3 + b2 − 5b1
System is consistent ⇔ b3 + b2 − 5b1 = 0, i.e., b3 = 5b1 − b2
Solving Ax = b or Ux = c or Rx = d
Ax = b has a solution ⇔ b3 = 5b1 − b2 .
T
e.g., there is no solution when b = 1 0 4 .
T
Suppose b = 1 0 5 . Then [A|b] →
1 2 3 5| b1 1 2 3 5| 1
0 0 2 2 | b2 − 2b1 = 0 0 2 2 | −2
0 0 0 0 | b3 + b2 − 5b1 0 0 0 0| 0
1 2 3 5| 1 1 2 0 2 | 4
→ 0 0 1 1 | −1 → 0 0 1 1 | −1
0 0 0 0| 0 0 0 0 0 | 0
T
Ax = b is reduced to solving U x = c = 1 −2 0 ,
T
which is further reduced to solving Rx = d = 4 −1 0 .
i.e., we want to solve
t
1 2 0 2 4
u
0 0 1 1
v = −1
0 0 0 0 0
w
i.e., t = 4 − 2u − 2w and v = −1 − w
Set the free variables u and w = 0 to get t = 4 and v = −1
T
A particular solution: x = 4 0 −1 0 .
E XERCISE : Check it is a solution i.e., check Ax = b.
O BSERVE : In Rx = d, the vector d gives values for the pivot variables,
when the free variables are 0.
General Solution of Ax = b
From Rx = d, we get t = 4 − 2u − 2w and v = −1 − w, where u and w are free.
Complete set of solutions to Ax = b:
t 4 − 2u − 2w 4 −2 −2
u u = 0 + u 1 + w 0 .
=
v −1 − w −1 0 −1
w w 0 0 1
21
To solve Ax = b completely, reduce to Rx = d. Then:
1. Find xNullSpace , i.e., N (A), by solving Rx = 0.
2. Set free variables = 0, solve Rx = d for pivot variables.
This is a particular solution: xparticular .
3. Complete solutions: xcomplete = xparticular + xNullSpace
E XERCISE : Verify geometrically for a 1 × 2 matrix, say A = 1 2 .
xn
i.e., b can be written as a linear combination of columns of A.
The column space of A, denoted C(A)
is the set of all linear combinations of the columns of A
= {b in Rm such that Ax = b is consistent}.
22
Summary: N(A) and C(A)
R EMARK : Let A be an m × n matrix.
• The null space of A, N (A) contains vectors from Rn .
• Ax = 0 ⇔ x is in N (A).
• The column space of A, C(A) contains vectors from Rm .
• If B is the nullspace matrix of A, then C(B) = N (A).
• Ax = b is consistent ⇔ b is in C(A) ⇔
b can be written as a linear combination of the columns of A.
This can be done in as many ways as the solutions of Ax = b.
• Let A be n × n.
A is invertible ⇔ N (A) = {0} ⇔ C(A) = Rn . Why?
• N (A) and C(A) are closed under linear combinations.
23
Chapter 2. V ECTOR S PACES
Vector Spaces: Rn
We begin with R1 , R2 , . . . , Rn , etc., where Rn consists of all column vectors
T
of length n, i.e., Rn = {x = x1 · · · xn , where x1 , . . . , xn are in R}.
We can add two vectors, and we can multiply vectors by scalars,
(i.e., real numbers). Thus, we can take linear combinations in Rn .
E XAMPLES :
R1 is the real line, R3 is the usual 3-dimensional space, and
R2 is represented by the x-y plane; the x and y co-ordinates
are given by the two components of the vector.
y
(−2, 1) (0, 1)
(−2, 0) (1, 0) x
i) x + y = y + x Commutativity of addition
iv) For each x, there is a unique −x such that x + (−x) = 0 Existence of additive inverse
v) 1 ∗ x = x Unit property
24
Vector Spaces: Examples
6. V = C[0, 1], the set of continuous real-valued functions on the closed interval [0, 1].
e.g., x2 , ex are vectors in V .
1 1
Q: Is x a vector in V ? How about x−2 ?
v) Let A be an m × n matrix.
The null space of A, N (A), is a subspace of .
The column space of A, C(A), is a subspace of .
R ECALL : They are both closed under linear combinations.
vii) The set of convergent sequences is a subspace of R∞ . What about the set of sequences
convergent to 1?
viii) The set of differentiable functions is a subspace of C[0, 1]. Is the same true for the set
of functions integrable on [0, 1]?
25
ix) - ? See the tutorial sheet for many more examples!
Subspaces of R2
What are the subspaces of R2 ?
T
• V ={ 0 0 }.
• V = R2 .
x
v
1.5v
26
2.2 L INEAR S PAN & I NDEPENDENCE
O BSERVE :
1. Span{v1 , . . . , vn } = C(A) Thus
v is in Span{v1 , . . . , vn } ⇔ Ax = v is consistent.
2. Span{v1 , . . . , vn } = Rm ⇔ Ax = v is solvable for every v ∈ Rm ⇔ A has m pivots.
In particular, m ≤ n.
3. Let m = n.
Then A is invertible ⇔ A has n pivots ⇔ Ax = v is consistent for every v in Rn ⇔
Span{v1 , . . . , vn } = Rn ⇔ C(A) = Rn .
E XAMPLE : Span{e1 , . . . , en } = Rn .
27
3
Is the span of two vectors
in R always
a plane?
2 4 6 4
7. Let v1 = 2, v2 = 5, v3 = 7 and v4 = 6.
2 3 5 2
T
Is v = 4 3 5 in Span{v1 , v2 , v3 , v4 }?
If yes, write v as a linear combination of v1 , v2 , v3 , v4 .
Let A = v1 · · · v4 . The question can be rephrased as:
Q: Is v in C(A), i.e., is Ax = v solvable? If yes, find a solution.
T
E XERCISE : Ax = a b c is consistent ⇔ 2a − b − c = 0.
O BSERVE : Span{v1 , v2 , v3 , v4 } = C(A) is a plane!
T
Verify v is in Span{v1 , v2 , v3 , v4 } (and w = 4 3 4 is not).
Solve Ax = v using the row reduced form of A to get
T
Particular solution: 4 −1 0 0 and v = 4v1 + (−1)v2 .
Linear Independence:
Example
2 4 6 4
With v1 = 2, v2 = 5, v3 = 7 and v4 = 6
2 3 5 2
Observe: v3 = v1 + v2 and v4 = −2v1 + 2v2 .
Hence v3 and v4 are in Span{v1 , v2 }.
Therefore, Span{v1 , v2 } = Span{v1 , v2 , v3 , v4 } = C(A) = the plane 2x − y − z = 0.
Q: Is the span of two vectors in R3 always a plane?
A: Not always. If v is a multiple of w, then Span{v, w} = Span{w}, which is a line through
the origin or zero.
Q: If v and w are not on the same line through the origin?
A: Yes. v, w are examples of linearly independent vectors.
28
• v, w are linearly dependent ⇔ one is a multiple of the other ⇔ (for V = Rm ) they lie on
the same line through the origin.
Basis: Introduction
1 2 3 5
Let v1 = 2 , v2 = 4 , v3 = 8 , v4 = 12, and A = v1 v2 v3 v4 .
3 6 7 13
Can C(A) =Span{v1 , v2 , v3 , v4 } be spanned by less than 4 vectors?
O BSERVE :
• v2 = 2v1 & v4 = 2v1 + v3 ⇒ C(A) = Span{v1 , v3 }.
Moreover, the span of only v1 or only v3 is a line.
29
Thus, {v1 , v3 } is a minimal spanning set for C(A).
• Clearly v1 is not on the line spanned by v3 or vice versa.
Hence, v1 and v3 are linearly independent vectors in C(A).
Moreover, v is in C(A) = Span{v1 , v3 }, ⇒ v1 , v3 , v are linearly dependent. Why?
Thus, {v1 , v3 } is a maximal linearly independent set in C(A).
Any such set of vectors gives a basis of C(A).
Basis: Definition
D EFN . A subset B of a vector space V , is said to be a basis of V ,
if it is linearly independent and Span(B) = V .
T HEOREM : For any subset S of a vector space V , the following are equivalent:
(i) S is a maximal linearly independent set in V
(ii) S is linearly independent and Span(S) = V .
(iii) S is a minimal spanning set of V .
R EMARK /E XAMPLES :
• Every vector space V has a basis.
• By convention, the empty set is a basis for V = {0}.
• {e1 , . . . , en } is a basis for Rn , called the standard basis.
•An basis of R is just {1}. Is this unique?
T T o
• −1 1 , 0 1 is a basis for R2 . So is {e1 , e2 },
as is the set consisting of columns of a 2 × 2 invertible matrix.
• Find a basis in all the examples seen so far.
30
3. E XERCISE : Show that B ′ = {1, (x − 1), (x − 1)2 , (x − 1)3 } is a basis of P3 .
H INT : Taylor expansion.
Let B be the standard basis of P3 . Then [x3 ]B = ( , , , )T , and [x3 ]B′ = ( , , , )T .
b = −1 b=5
v
b = −2 v2 b=4
b = −3 b=3
b = −4 v1 b=2
b = −5 b=1
b=0
a = −2 a = −1 a=0 a=1 a=2
Thus the lines a = 0 and b = 0 give a set of
axes for R2 , and v = v1 + 2v2 .
1
With this basis B = {v1 , v2 }, the coordinates of v will be [v]B = .
2
31
Basis & Dimension: Remarks
Let dim (V ) = n, S = {v1 , . . . , vk } ⊆ V .
R ECALL : A basis is a minimal spanning set.
In particular, if Span(S) = V , then k ≥ n, and S contains a basis of V ,
i.e., there exist {vi1 , . . . , vin } ⊆ S which is a basis of V .
E XAMPLE : The columns of a 3 × 4 matrix A with 3 pivots span R3 . Hence the columns
contain a basis of R3 .
R ECALL : A basis is a maximal linearly independent set.
In particular, if S is linear independent, then k ≤ n, and S can be extended
to a basis of V , i.e., there exist w1 , . . . , wn−k in V such that {v1 , . . . , vk , w1 , . . . , wn−k }
is a basis of V .
E XAMPLE : The columns of a 3 × 2 matrix A with 2 pivots
has linearly independent columns, and hence can be extended to a basis of R3 .
⇔ A = v1 · · · vn is invertible.
32
Subspaces Associated to a Matrix
Associated to an m × n matrix A, we have four subspaces:
• The column space of A: C(A) = Span{A∗1 , . . . A∗n }
= {v : Ax = v is consistent} ⊆ Rm .
• The null space of A: N (A) = {x : Ax = 0} ⊆ Rn .
• The row space of A = Span{A1∗ , . . . , Am∗ } = C(AT ) ⊆ Rn .
• The left null space of A = {x : xT A = 0} = N (AT ) ⊆ Rm .
Q: Why are the row space and the left null space subspaces?
R ECALL : Let U be the echelon form of A, and R its reduced form. Then
N (A) = N (U ) = N (R).
O BSERVE : The rows of U (and R) are linear combinations of the rows of A,
and vice versa ⇒ their row spaces are same, i.e., C(AT ) = C(U T ) = C(RT ).
We compute bases and dimensions of these special subspaces.
An Example
We illustrate how to find a basis and the dimension of the Null Space N (A), the
Column Space C(A), and the Row Space C(AT ) by using the following example.
2 4 6 4
Let A = 2 5 7 6 .
2 3 5 2
R ECALL :
1 0 1 −2
• The reduced form of A is R = 0 1 1 2 .
0 0 0 0
• The 1st and 2nd are pivot columns ⇒ rank(A) = 2.
T
• v = a b c is in C(A) ⇔ Ax = v is solvable ⇔ 2a − b − c = 0.
• We can compute special solutions to Ax = 0.
The number of special solutions to Ax = 0 is the number of free variables.
33
The Column Space: C(A)
2 4 6 4 1 0 1 −2
For A = 2 5 7 6, reduced form R = 0 1 1 2 .
2 3 5 2 0 0 0 0
Write A = v1 v2 v3 v4 and R = w1 w2 w3 w4 .
R ECALL : Relations between the column vectors of A are the same as the relations be-
tween column vectors of R, since N (A) = N (R).
⇒ Ax = v3 has a solution has the same solution as Rx = w3 , and Ax = v4 has a same
solution as Rx = w4 .
Particular solutions are (1, 1, 0, 0)T and (−2, 2, 0, 0)T respectively ⇒ v3 = v1 + v2 , v4 =
−2v1 + 2v2 .
O BSERVE :
• v1 and v2 correspond to the pivot columns of A.
• {v1 , v2 } are linearly independent. Why?
• C(A) = Span{v1 , . . . , v4 } = Span{v1 , v2 }.
Thus B = {v1 , v2 } is a basis of C(A). Q: What is [vi ]B ?
34
R ECALL : dim C(AT ) = rank(AT ). Thus,
0 0 0
Y
(2, 1)
(2, −1)
(−1, 0.5)
(0.5, −1)
35
How does B transform x? B reflects vectors across the line x1 = x2 .
Q: Do reflections preserve scalar multiples? Sums of vectors?
x1 +x2
1/2 1/2 x1 2
3. P = transforms x = to P x = x1 +x .
1/2 1/2 x2 2
2
y
(−1, 1)
e2
P e1 = P e2
(0, 0) e1 x
1/2 −1
P e1 = = P e2 , and P transforms the vector to the origin.
1/2 1
Geometrically, P transforms vectors in R2 by projecting onto the line x1 = x2 .
Q: What happens to sums of vectors when you project them? What about scalar
multiples?
1 0
E XERCISE : Understand the effect of P = on e1 and e2 and interpret what P
0 0
represents geometrically.
!
√1 − √1 cos(45◦ ) − sin(45◦ )
4. Let Q = √1 2 2 = .
2
√1
2
sin(45◦ ) cos(45◦ )
e1 X
x1
Q: What does the transformation x = 7→ Qx represent geometrically?
x2
Again note that rotations map sum of vectors to sum of their images and scalar
multiple of a vector to scalar multiple of its image.
Matrices as Transformations
• An m × n matrix A transforms a vector x in Rn into the vector Ax in Rm .
Thus T (x) = Ax defines a function T : Rn → Rm .
• The domain of T is . The codomain of T is .
• Let b ∈ Rm . Then b is in C(A) ⇔ Ax = b is consistent
⇔ T (x) = b, i.e., b is in the image (or range) of T .
Hence, the range of T is .
2 4 6 4
E XAMPLE : Let A = 2 5 7 6 . Then T (x) = Ax is a function with domain R4 ,
2 3 5 2
36
codomain R3 , and range equal to C(A) = {(a, b, c)T | 2a − b − c = 0} ⊆ R3 .
Q: How does T transform sums and scalar multiples of vectors?
A. Nicely! For scalars a and b, and vectors x and y,
T (ax + by) = A(ax + by) = aAx + bAy = aT (x) + bT (y). Thus
Linear Transformations
D EFN . Let V and W be vector spaces.
• A linear transformation from V to W is a function T : V → W such that
for x, y ∈ V , scalars a and b,
T (ax + by) = aT (x) + bT (y)
i.e., T takes linear combinations of vectors in V
to the linear combinations of their images in W .
• If T is also a bijection, we say T is a linear isomorphism.
• The image (or range) of T is defined to be
C(T ) = {y ∈ W | T (x) = y for some x ∈ V }.
• The kernel (or null space) of T is defined as
N (T ) = {x ∈ V | T (x) = 0}.
M AIN E XAMPLE : Let A be an m × n matrix. Define T (x) = Ax.
• This defines a linear transformation T : Rn → Rm .
• The image of T is the column space of A, i.e., C(T ) = C(A).
• The kernel of T is the null space of A, i.e., N (T ) = N (A).
37
• Let T : P2 → P1 be S(a0 + a1 x + a2 x2 ) = a1 + 4a2 x.
E XERCISE : Show that dim (N (T )) = 1, and find C(T ).
df
• Let D : C ∞ ([0, 1]) → C ∞ ([0, 1]) defined as Df = dx .
E XERCISE : Is D2 = D ◦ D linear? What about D3 ?
E XERCISE : What is N (D)? N (D2 )? N (Dk )?
P OINT TO P ONDER : Is integration linear?
O BSERVE : Images and null spaces are subspaces!
Of which vector space?
38
Linear Maps and Basis
4 a b
• Consider S : M2×2 → R given by S = (a, b, c, d)T .
c d
Recall that {e11, e12 , e
21 , e22 } is a basis of M2×2
a b
such that A = = ae11 + be12 + ce21 + de22 .
c d
Observe that S(e11 ) = e1 , S(e12 ) = e2 , S(e21 ) = e3 , S(e22 ) = e4 .
Thus, S(A) = aS(e11 ) + bS(e12 ) + cS(e21 ) + dS(e22 )= ae1 + be2 + ce3 + de4 = (a, b, c, d)T .
G ENERAL CASE :
If {v1 , . . . , vn } is a basis of V , T : V → W is linear, v ∈ V ,then v = a1 v1 + · · · an vn
⇒ T (v) = a1 T (v1 ) + · · · an T (vn ). Why? Thus, T is determined by its action on a basis,
i.e., for any n vectors w1 , . . . , wn in W (not necessarily distinct), there is
a unique linear transformation T : V → W such that T (v1 ) = w1 , . . . , T (vn ) = wn .
P OINT TO P ONDER : Can you imitate this if V and W are not Rn and Rm ?
39
Matrix Associated to a Linear Map: Example
S : P2 → P1 given by S(a0 + a1 x + a2 x2 ) = a1 + 4a2 x is linear.
Q: Is there a matrix associated to S?
Expected size: 2 × 3. Why?
I DEA : Construct an associated linear map R3 → R2 . Use coordinate vectors!
Fix bases B = {1, x, x2 } of P2 , and C = {1, x} of P1 to do this.
Identify f = a0 + a1 x + a2 x2 ∈ P2 with [f ]B = (a0 , a1 , a2 )T ∈ R3 ,
and S(f ) ∈ P1 with [S(f )]C = (a1 , 4a2 )T ∈ R2 .
The associated linear map S ′ : R3 → R2 is defined by S ′ (a0 , a1 , a2 )T = (a1 , 4a2 )T ,
i.e., S ′ ([f ]B ) = [S(f )]C , i.e.,
S ′ is defined by S ′ (e1 ) = (0, 0)T , S ′ (e2) = (1, 0)T ′
, S (e3 ) = (0, 4)
T
0 1 0
⇒ the standard matrix of S ′ is A = .
0 0 4
Q: How is A related to S?
O BSERVE : A∗1 =[S(1)]C , A∗2 = [S(x)]C , A∗3 = [S(x2 )]C .
40
Chapter 3. E IGENVALUES , E IGENVECTORS , & D IAGONALIZABILITY
41
• det(A − λI) is called the characteristic polynomial of A.
• If λ is an eigenvalue of A, then the nullspace of A − λI is called the
eigenspace of A associated to eigenvalue λ.
P OINT TO P ONDER : When is 0 an eigenvalue of A?
42
Finding Eigenvalues: Diagonal Matrices
It is easy to find the
eigenvalues, and associated eigenvectors for diagonal matrices.
3 0
E XAMPLE : A = .
0 2
Characteristic polynomial: (3 − λ)(2 − λ). Eigenvalues: λ1 = 3, λ2 = 2.
Eigenvectors: A∗1 = Ae1 = 3e1 ⇒ we can take v1 = e1 .
Similarly, an eigenvector associated to λ2 = 2 is v2 = e2 .
Note: R2 has a basis consisting of eigenvectors of A: {e1 , e2 }.
G ENERAL CASE : If A is a diagonal matrix with diagonal entries λ1 , · · · , λn , then
Characteristic Polynomial: (λ1 − λ) · · · (λn − λ) Eigenvalues: λ1 , · · · , λn &
n
Eigenvectors: e1 , · · · , en , which form a basis for R .
1. The characteristic polynomial of A is det(A − λI) (of degree n) and its (real) roots are
the eigenvalues of A.
43
2. For each eigenvalue λ, the associated eigenspace is N (A − λI). To find it, solve (A −
λI)v = 0. Any non-zero vector in N (A − λI) is an eigenvector associated to λ.
3.2 D IAGONALIZABLITY
Diagonizability: Introduction
N OTE : Finding roots of polynomials (and hence eigenvalues) is difficult in general.
For n ≥ 5, no formula exists for roots. (Abel, Galois)
For n = 3, 4, formulae for root exist, but not easy to use.
D EFN . An n × n matrix A is diagonalizable if A is similar to a diagonal matrix Λ,
i.e., there is an invertible matrix P and a diagonal matrix Λ such that P −1 AP = Λ.
I MPOR TANCE OF D IAGONALIZABILITY :
Let the n × n matrix A be diagonalizable, i.e., P −1 AP = Λ, where P is invertible and Λ
is diagonal. If this happens,
• The eigenvalues of A are the diagonal entries of Λ,
• det(A) is the product of the diagonal entries of Λ, and
• Trace(A) = sum of the diagonal entries of Λ.
• O THER I NFORMATION : e.g., what is Trace(An )?
Diagonalization: Example
1 5 6
E XAMPLE : A = 0 2 −4 is triangular.
0 0 3
det(A − λI) = (1 − λ)(2 − λ)(3 − λ) Eigenvalues: λ1 = 1, λ2 = 2, λ3 = 3.
N OTE : If A is triangular, its eigenvalues are on the diagonal
T T
Eigenvectors: v1 = e1 , v2 = 5, 1, 0 , v3 = −7, −4, 1 . (V ERIFY !)
3
Further, {v1 , v2 , v3 } is a
basis of R .
Hence P = v1 v2 v3 is invertible , and AP = Av1 Av2 Av3 = v1 2v2 3v3 = P Λ,
1
where Λ = 2 . Thus P −1 AP = Λ, i.e., A is diagonalizable.
3
E XERCISE : If B = {v1 , v2 , v3 }, and T (v) = Av, then [T ]B
B = .
44
Eigenvalue Decomposition (EVD)
Let A be an n×n matrix with n eigenvectors v1 , . . . , vn , associated to eigenvalues λ1 , . . . , λn .
If B = {v1 , . . . , vn } is a basis of Rn , then the matrix P = v1 · · · vn is invertible.
N OTE : P Λ = λ1 v1 · · · λn vn . (T RUE / F ALSE : ΛP = P Λ).
T HUS :
λ1
AP =A v1 · · · vn = Av1 · · · Avn = λ1 v1 · · · λn vn = P Λ, where Λ =
.. .
.
λn
Summary: Diagonalizability
T HUS : If an n × n matrix A has n linearly independent eigenvectors v1 , . . . , vn , then A is
diagonalizable. Moreover, if λ1 , . . . , λn are the corresponding eigenvalues, then
P −1 AP = Λ, where the diagonalizing matrix is P = v1 · · · vn , and the diagonal matrix
λ1
is Λ =
.. , i.e., P −1 AP = Λ
, where
.
λn
The diagonal entries of Λ are eigenvalues of A and
The columns of P are corresponding eigenvectors of A.
−1
The EVD of A is A = P ΛP .
45
When is A Diagonalizable?
A: When A has n linearly independent eigenvectors!
Q: When does this happen?
• If v1 , . . . , vr are eigenvectors of A associated to distinct eigenvalues λ1 , . . . , λr ,
then v1 , . . . , vr are linearly independent.
Proof. Suppose v1 , . . . , vr are linearly dependent.
Choose a linear relation involving minimum number of vi ’s, say
(1) a1 v1 + · · · + at vt = 0. (1 < t ≤ r, t is minimal, ai ̸= 0)
Apply A to get a1 λ1 v1 + · · · + at λt vt = 0 (2)
λ1 (1) − (2) gives a2 (λ1 − λ2 )v2 + · · · + at (λ1 − λt )vt = 0,
which contradicts the minimality of t. □
• If A has n distinct eigenvalues, then A is diagonalizable.
Proof. If v1 , . . . , vn are eigenvectors associated to distinct eigenvalues
λ1 , . . . , λn , then
{v1 , . . . , vn } is linearly independent. Then P = v1 . . . vn is invertible, and
P −1 AP = Λ as seen earlier. Hence A is diagonalizable. □
46
Eigenvalues of Ak
• If Av = λv, then A2 v = A(Av) = A(λv) = λ(Av) = λ2 v. Similarly Ak v = λk v for any k ≥ 0.
Thus if v is an eigenvector of A with associated eigenvalue λ, then v is also an eigenvector
of Ak with associated eigenvalue λk for k ≥ 0. If A is invertible, then λ ̸= 0. Hence,
the same also holds for k < 0 since A−1 v = λ−1 v.
• If A is diagonalizable , then P −1 AP = Λ is diagonal where columns of P are
eigenvectors of A. Since (P −1 Ak P ) = Λk , which is diagonal, we see that Ak is
diagonalizable, and the eigenvectors of Ak are same as eigenvectors of A.
Similarly, the same also holds for k < 0 if A is invertible.
Q: What is the EVD of Ak ?
47
An Application: Steady State
Suppose we have a system where the current state uk depends on the previous one uk−1
linearly, i.e., uk = Auk−1 . Then observe that uk = Ak u0 . The steady state of
the system is u∞ = limk→∞ (uk ). How do we find this?
• If u0 is an eigenvector of A associated to λ, then uk = λk u0 .
• Let v1 , . . . , vr be eigenvectors of A associated respectively to λ1 , . . . , λr .
If u0 ∈ Span{v1 , . . . , vr }, i.e., u0 = c1 v1 + · · · + cr vr for scalars c1 , . . . , cr , then
uk = Ak u0 = c1 Ak v1 +· · ·+cr Ak vr = c1 λk1 v1 +· · ·+cr λkr vr . In particular, if A is diagonalizable,
then there is a basis of Rn of eigenvectors of A. Hence, this is applicable to every u0 ∈ Rn .
Let A be diagonalizable, and uk represent population.
• Under what conditions will there be a population explosion?
• What conditions will force the population to become extinct?
• When does it stabilise (to a non-zero value)?
H INT : Depends on |λi |.
48
Chapter 4. O R THOGONALITY & P ROJECTIONS
4.1 O R THOGONALITY
Inner product on Rn
D EFN . Define the inner product (dot product) of two vectors v, w ∈ Rn as v · w = v T w
This satisfies the following properties:
For v = (a1 , . . . , an )T , w = (b1 , . . . , bn )T in Rn and c in R
• v · w = a1 b1 + · · · + an bn = w · v (Commutativity) .
• (Bilinearity)
(v + w) · z = v · z + w · z
cv · w = c (v · w) = v · cw.
• v · v ≥ 0 and v · v = 0 if and only if v = 0.
√
Define length (or norm) of v in Rn to be ∥v∥ = v · v.
(0, 0, 2)
(2, 3, 2)
(0, 0, 2)
(0, 3, 0)
(2, 3, 0)
(2, 0, 0)
Orthogonal vectors in Rn
Vectors v and w in R3 are orthogonal (perpendicular)
if they satisfy the Pythagoras theorem ⇔ ||v||2 + ||w||2 = ||v − w||2
v−w
49
⇔ ∥v∥2 + ∥w∥2 = (v − w)T (v − w)
= (v T − wT )(v − w)
= v T v − wT v − v T w + wT w
= ∥v∥2 − 2 v T w + ∥w∥2 (since wT v = v T w )
a1 v1 + a2 v2 + · · · + ak vk = 0
⇒ (a1 v1 + a2 v2 + · · · + ak vk )T v1 = 0 · v1 = 0
⇒ (a1 v1T + a2 v2T + · · · + ak vkT ) v1 = 0
⇒ a1 v1T v1 + a2 v2T v1 + · · · + ak vkT v1 = 0
⇒ a1 ||v1 ||2 = 0
⇒ a1 = 0 since v1 ̸= 0
50
• QT Q = Ip= QQT Why? p √
• ∥Qv∥ = (Qv)T (Qv) = v T QT Qv = v T x = ∥v∥.
⇒ the only (real) eigenvalues of Q, if they exist, are ±1.
• Row vectors of T
Q are orthonormal
since QQ
= I.
cos θ − sin θ 1 1 1
E XAMPLES : 1. . 2. √ .
sin θ cos θ 2 1 −1
1 −1 −1 1
2 1 −2
1 1
1 1 1 1
3. 2 −2 1 . 4. .
3 2 −1 −1 1 1
1 2 2
−1 1 −1 1
Orthogonal Basis
D EFN . A basis B = {v1 , . . . , vk } of a subspace V of Rn is an orthogonal basis
if it is an orthogonal set, i.e., viT vj = 0 for i ̸= j.
Furthermore, if ||vi || = 1 for each i, then B is an orthonormal basis (or o.n.b.) of V .
E XAMPLE : Consider the basesof R2 : B1 = {w1 = (8, 0)T , w T
2 = (6, 3) },
T T
B2 = {(8, 0)T , (0, 3)T } and B3 = √ 8 , 0 , 0, √023+32 .
82 +02
θ
v1
projv (v2 )
1
51
Orthogonal Projections in Rn
If v(̸= 0), w ∈ Rn , then projv (w), is a multiple of v and w − projv (w) is orthogonal to v.
Thus
vT w
Therefore projv (w) = v.
vT v
T T
E XAMPLE . If w = 1 1 1 and v = 1 2 3 , then the orthogonal projection
T
v w 6
of w on Span{v} is given by projv (w) = T
v = v.
v v 14
A PPLICATION : This can be used to “solve” an inconsistent system of equations.
b̂
C(A)
52
Linear Least Squares: Example
E XAMPLE : Find the least square solution to the system
−1 2 4
2 −3 x = 1 (Ax = b)
−1 3 2
T T T −4 T 6 −11
We need to solve A A x̂ = A b. Now A b = and A A = .
11 −11 22
6 −11 | −4 6 −11 | −4
[AT A | AT b] = → . Therefore xˆ2 = 2, and xˆ1 = 3.
−11 22 | 11 0 11/6 | 11/3
1 2 0
Find the least square solution by solving AT A x̂ = AT b.
Q: Find the best quadratic curve y = C + Dx + Ex2 which fits the above data
and gives least square error.
H INT. The first row of the matrix A in this case will be [1 − 2 4].
53
4.3 G RAM -S CHMIDT P ROCESS & A PPLICATIONS
Gram-Schmidt Process
If the set of vectors v1 , . . . , vr in Rn are linearly independent, then we can find an
orthonormal set of vectors q1 , . . . , qr such that Span{v1 , . . . , vr } = Span{q1 , . . . , qr }.
First find an orthogonal set.
Let w1 = v1 , w2 = v2 − projw1 (v2 ). Then w1 ⊥ w2 and Span{v1 , v2 } = Span{w1 , w2 }.
Let c1 w1 + c2 w2 be the projection of v3 on Span{w1 , w2 }.
Then (v3 − c1 w1 − c2 w2 ) ⊥ w1 and (v3 − c1 w1 − c2 w2 ) ⊥ w2 . ⇒ w1T (v3 − c1 w1 − c2 w2 ) = 0
⇒ c1 w1 = projw1 (v3 ) and similarly c2 w2 = projw2 (v3 ). Therefore,
T T
w1 v 3 w2 v 3
w3 = v3 − projSpan{w1 ,w2 } (v3 ) = v3 − 2
w1 − w2 .
∥w1 ∥ ∥w2 ∥2
Span{v1 , v2 , v3 } = Span{w1 , w2 , w3 } and w1T w3 = 0, w2T w3 = 0.
By induction,
Gram-Schmidt Method:
Example
3 −5 1
1 1 1
Q: Let S = v1 = , v2 = , v3 = and W = Span(S).
−1 5 −2
3 −7 8
8 3 −1 3
54
Check w1T w3 = 0 = w2T w3 and Span{v1 , v2 , v3 } = Span{w1 , w2 , w3 }. Hence {w1 , w2 , w3 } is an
1 1 1
orthogonal basis of W . An orthonormal basis for W is √ w1 , √ w2 , √ w3 .
20 20 20
QR Factorization
Let A = v1 · · · vr be an n × r matrix of rank r. Then v1 , . . . , vr are linearly independent
vectors in Rn . By the Gram-Schmidt method, we get an orthonormal basis
wi
{q1 , . . . , qr } of C(A), where qi = and w1 = v1 , and for k > 1,
∥wi ∥
!
T T v
wk−1
w1 v k k
wk = v k − w1 − · · · − wk−1 .
∥w1 ∥2 ∥wk−1 ∥2
Let Q = q1 . . . qr . How are A and Q related?
Note that Span{v1 , . . . , vk } = Span{w1 , . . . , wk } = Span{q1 , . . . , qk } for all k.
If vk = c1 q1 + . . . + ck qk , then c1 = q1T vk , c2 = q2T vk , . . . , ck = qkT vk . Thus
Hence vk = (q1T vk )q1 + . . . + (qkT vk )qk for each k.
Therefore
T
q1 v1 q1T v2 q1T vr
55
Diagonalizing Symmetric Matrices
Let A be a symmetric matrix, which is diagonalizable. Then there is an orthogonal
matrix Q, and a diagonal matrix Λ such that A = QΛQT .
O BSERVE : Eignevectors corresponding to distinct eigenvalues are orthogonal.
Proof. Let λ and µ be distinct eigenvalues of A with associated eigenvectors v and w
repectively. Now, λ(v T w) = (λv)T w = (Av)T w = v T (AT w) = v T (Aw) = µ(v T w).
Since λ ̸= µ, this imples v T w = 0, proving the result.
Step 1: Find the eigenvalues and the respective eigenvectors.
Step 2: Use Gram-Schmidt process to get an orthogonal basis for each eignespace.
T HEOREM : (Real Spectral Theorem)
Every symmetric matrix (with real entries) is diagonalizable, and hence
decomposes as above.
56
Appendix I - D ETERMINANTS
• det(AB) = det(A)det(B).
• det(A) = det(AT ).
• A is invertible ⇔ det(A) ̸= 0.
If this happens, then det(A−1 ) =
3. If A is n × n, and its row echelon form U is obtained without row exchanges, then
det(U ) = det(A).
Q: What happens if there are row exchanges? Exercise!
57
4. If A has a zero row, then det(A) = 0.
Proof: Let the ith row of A be zero, i.e., Ai∗ = 0.
Let B be obtained from A by Ri = Ri + Rj , i.e., B = Eij (1)A. Then Bi∗ = Bj∗ .
If at least one diagonal entry is zero, then elimination will produce a zero row ⇒
det(A) = 0.
a 0 0 b 0 b c 0 a b
= 0, = 0, =− = −bc ⇒ = ad − bc
c 0 0 d c 0 0 b c d
58
Reading Slide: Cofactors: 3 × 3 Case
where M1j is obtained from A by deleting the 1st row and j th column.
7.
det(AB) = det(A) det(B)
d(A) = det(AB)/det(B)
(a) d(I) = 1.
(b) If we interchange two rows of A, then d changes its sign.
(c) d is a linear function in each row of A.
Then d is the unique determinant function det and det(AB) = det(A) det(B). □
59
Extra Reading: Determinants of Transposes (Proof)
8.
det(A) = det(AT )
60
Extra Reading: Determinant: Geometric Interpretation
• Test for invertibility: An n × n matrix A is invertible ⇔ det(A) ̸= 0.
• n-dimensional volume: If A is n × n, then |det(A)| = the volume of the box
(in n-dimensional space Rn ) with edges as rows of A.
Examples: (1) The volume (area) of a line in R2 = 0.
1 2
(2) The determinant of the matrix A = is −4 .
1 −2
(3) Let’s compute the volume of the box (parallelogram) with edges as
rows of A or columns of A.
y
y
=4
x x
61
1
R EMARK . If A is invertible, then A−1 = CT .
det(A)
For n ≥ 4, this is not a good formula to find A−1 . Use elimination to find A−1 for n ≥ 4.
This formula is of theoretical importance.
Since the edges of the box spanned by rows of A are at right angles, the volume of the
box
= the product of lengths of edges = |det(A)|
.
• det(A
e1 ) = a11 = d1
• det(A
e2 ) = d1 d2 = det(A1 ) d2
• det(A
e3 ) = d1 d2 d3 = det(A2 ) d3 etc.,
• If det(A
ek ) = 0, then we need a row exchange in elimination.
62