Lecture 16 20
Lecture 16 20
Q: Given v ∈ Mm,1 (F ), find w0 ∈ Mn,1 (F ) called least square solution, such that
∥Aw0 − v∥ is minimum.
A projection approach
We may try to find an orthonormal basis of Col(A) using Gram–Schmidt orthonormalisation and
use the above formula computing PCol(A) (v). Now we can solve the equation
to find w0 .
This discussion shows such a w0 always exists. However it need not be unique. Moreover, one
may use the following more efficient method, which requires fewer steps.
Normal equations
Hence,
where v − PCol(A) (v) ∈ N (AT ).
v = PCol(A) (v) + v − PCol(A) (v) ,
Therefore,
AT v − PC(A) (v) = 0.
AT (v − Aw0 ) = 0,
1
Suppose we satisfy AT Aw0 = AT v. Then
is the decomposition of v into a vector in Col(A) plus a vector in N (AT ). Comparing with
v = PCol(A) (v) + v − PCol(A) (v) ,
We have proved:
Example 1: A 2 × 2 matrix
Let ! !
1 1 1
A= , v= .
1 1 0
We wish to find w0 ∈ R2 such that ∥Aw0 − v∥ is minimal.
2
Normal equations. We compute
! !
2 2 1
AT A = , AT v = .
2 2 1
reduce again to
1
x+y = ,
2
which agrees with the projection approach.
Example 2: A 3 × 3 matrix
Let
1 0 0 1
A=
0 1 0 ,
v=
1 .
1 1 0 0
The columns of A are
1 0 0
c1 =
0 ,
c2 =
1 ,
c3 =
0 ,
1 1 0
so
Col(A) = span{c1 , c2 }.
give
2x + y = 1,
x + 2y = 1,
0 = 0.
Solving, we obtain
1
x=y= , z free.
3
A least-squares solution is therefore
1
3
w0 = 13 .
0
3
Verification via projection. We compute
1
3
Aw0 = 1
3 .
2
3
Then
2
3
∈ N (AT ),
v − Aw0 = 2
3
− 23
and hence
Aw0 = PCol(A) (v),
y
ℓi = (axi + b) − yi is the vertical distance to the line
y = ax + b
(x3 , y3 )
(x1 , y1 )
ℓ1
(xn , yn )
(x2 , y2 )
That is,
n
X
i.e. | axi + b − yi |2 is minimum.
i=1
Equivalently,
i.e. ∥Ax − b∥2 is minimum,
where
1 x1 y1 " #
. . . b
. . .
. . ,
A= . ,
b= x=
a
.
1 xn yn
Find x?
4
Explicit example: least square line fitting
Step 3: Solving,
3b + 6a = 8,
6b + 14a = 18.
2a = 2 ⇒ a = 1.
Substituting back,
2
3b + 6 = 8 ⇒ b= .
3
Least squares solution. The best-fit line is
2
y =x+ .
3
5
is the orthogonal projection of b onto Col(A), and the residual
1
3
T
b − Ax = 2
− 3 ∈ N (A ).
1
3
Hence the normal equations guarantee that the vertical errors are minimized.
AX = B.
If A is of the form
λ1 0 · · · 0
0 λ2 · · ·
b1
0 .
and B = .
A= . .. . . .. . ,
.. .
. .
bn
0 0 ··· λn
then the system is diagonal and we can solve it componentwise:
λi xi = bi (i = 1, . . . , n).
bi
Hence, if λi ̸= 0, then xi = ; and if λi = 0, then a solution exists only if bi = 0, in which case xi
λi
can be any element of F .
Such matrices are called diagonal matrices. Even if A is not diagonal, sometimes there exists
an invertible matrix P such that
P −1 AP = D,
AX = B ⇐⇒ P DP −1 X = B.
DP −1 X = P −1 B.
DY = C,
which is diagonal, i.e. it splits into independent scalar equations λi yi = ci . After solving for Y , we
recover
X = P Y.
6
Definition 1 (Diagonalizable matrix). A matrix A ∈ Mn (F ) is called diagonalizable if there
exists an invertible matrix P such that P −1 AP is diagonal.
Next we introduce the notion of eigenvalues and eigenvectors, which plays an important role in
the process of diagonalization.
Av = λv.
• (Geometric meaning, when F = R) The vectors v and Av lie on the same line through the
origin.
Finding eigenvalues
Eigenspaces
Null(A − λIn )
7
Examples
(1) If A = In , then 1 ∈ F is the only eigenvalue of A, and every non-zero vector in Mn,1 (F ) is an
eigenvector corresponding to 1. In this case,
χA (x) = (−x)n .
(7) (Exercise) Let A be an upper triangular matrix with diagonal entries a11 , a22 , . . . , ann . Then
the eigenvalues of A are a11 , a22 , . . . , ann .
8
Algebraic and Geometric Multiplicity and Diagonalization
Algebraic Multiplicity
The algebraic multiplicity (AM) of λ is the number of times λ appears as a root of the charac-
teristic polynomial
det(A − λI).
Geometric Multiplicity
Fundamental Inequality
LA (x) = Ax.
Step 1: 1 ≤ GM(λ).
If λ is an eigenvalue, then there exists v ̸= 0 such that
LA (v) = λv,
i.e.
(LA − λI)(v) = 0.
Choose a basis
B = {v1 , . . . , vg , vg+1 , . . . , vn }
of Fn such that
{v1 , . . . , vg }
9
is a basis of ker(LA − λI).
Since LA (vi ) = λvi for 1 ≤ i ≤ g, the subspace
W = ker(LA − λI)
is LA –invariant.
If P is the change–of–basis matrix whose columns are the vectors v1 , . . . , vn , then the matrix of
LA in the basis B is
[LA ]B = P −1 AP.
where B is an (n − g) × (n − g) matrix.
AM(λ) ≥ g = GM(λ).
Example
Consider !
2 1
A= .
0 2
The characteristic polynomial is
10
so λ = 2 has algebraic multiplicity AM = 2.
Solving (A − 2I)x = 0 gives !
0 1
x = 0,
0 0
which yields only one linearly independent eigenvector. Hence,
GM = 1.
Relation to Diagonalization
GM(λ) = AM(λ).
Summary
• A matrix is diagonalizable exactly when these two quantities agree for every eigenvalue.
Fact. A degree n polynomial over C has n roots (counted with multiplicity). Hence, if A ∈ Mn (R)
or A ∈ Mn (C), then A has n eigenvalues in C (counted with multiplicity).
Multiplicity example
Example. Let
χA (x) = (x − 1)2 (x − 2)(x − 3).
Then we say A has 4 eigenvalues 1, 1, 2, 3, with algebraic multiplicity of 1 equal to 2, and algebraic
multiplicity of 2 and 3 equal to 1 each.
Triangularization over C
Theorem 1 (Triangularization Theorem). For every matrix A ∈ Mn (C), there exists an invertible
matrix P ∈ Mn (C) such that
P −1 AP
11
Proof. Let λ1 be an eigenvalue of A. (Note that eigenvalues of A are precisely the roots of the
characteristic polynomial charA (x), and over C all roots exist.)
Choose a nonzero vector
v1 ∈ WA (λ1 ),
so that
Av1 = λ1 v1 .
of Mn,1 (C).
Let
P = [v1 v2 · · · vn ] ∈ Mn (C).
Then
P −1 AP (e1 ) = P −1 Av1 = P −1 (λ1 v1 ) = λ1 e1 .
Hence
λ1 ∗ · · · ∗
0
−1
P AP = . ,
.. A1
0
where A1 ∈ Mn−1 (C).
By the induction hypothesis, there exists Q ∈ Mn−1 (C) invertible such that
Q−1 A1 Q
is upper triangular.
Define !
1 0
Q1 = .
0 Q
Then
Q−1
1 P
−1
AP Q1
Definition 5 (Similarity). Two matrices A, B ∈ Mn (F) are said to be similar if there exists an
invertible matrix P ∈ Mn (F) such that
P −1 AP = B.
A ∼ B ⇐⇒ A is similar to B.
12
Proof. • Reflexive: A = I −1 AI.
• Symmetric: If P −1 AP = B, then A = P BP −1 .
Theorem 3. If A ∼ B, then
charA (x) = charB (x).
Proof. Exercise.
Corollary 1. If A ∼ B, then A and B have the same eigenvalues, counted with multiplicity.
Theorem 4. Let A ∈ Mn (C) and let λ1 , . . . , λn be the eigenvalues of A in C (counted with multi-
plicity). Then
(i) det(A) = λ1 λ2 · · · λn ,
(ii) trace(A) = λ1 + λ2 + · · · + λn .
Proof. Exercise.
Diagonalization
P −1 AP
is a diagonal matrix.
Eigenvector Criterion
P = [v1 v2 · · · vn ]
such that
λ1 0 ··· 0
−1
0 λ2 · · · 0
P AP = D = . .. . . .. .
.. . . .
0 0 ··· λn
Then
AP = P D.
13
Applying both sides to ei ,
Avi = λi vi .
Theorem 5. Let A ∈ Mn (F). Then A is diagonalizable if and only if A has n linearly independent
eigenvectors.
Theorem 6. Let A ∈ Mn (F). Then A is diagonalizable if and only if A has n linearly independent
eigenvectors.
Proof. (⇒) Assume A is diagonalizable. Then there exists an invertible matrix P ∈ Mn (F) and a
diagonal matrix D such that
A = P DP −1 .
AP = P DP −1 P = P D.
Avi = λi vi (i = 1, . . . , n).
Thus each vi is an eigenvector of A, and since the columns of P are linearly independent, A has n
linearly independent eigenvectors.
Let
P = v1 · · · vn , D = diag(λ1 , . . . , λn ).
P −1 AP = D,
14
Algorithm to Check Diagonalizability
5. If
X
dim WA (λi ) = n,
i
then A is diagonalizable.
Consider
2 1 0
0 2 0 ∈ M3 (R).
A=
0 0 3
x2 = 0, x3 = 0, x1 free.
So
1
WA (2) = ker(A − 2I) = span 0 ,
dim WA (2) = 1.
0
15
A basis is
1
B1 = 0 .
0
(ii) For λ = 3:
−1 1 0
A − 3I =
0 −1 0 .
0 0 0
Solve (A − 3I)x = 0. From the second row, −x2 = 0 ⇒ x2 = 0. Then the first row gives
−x1 + x2 = 0 ⇒ x1 = 0. Thus x3 is free, and
0
WA (3) = ker(A − 3I) = span 0 ,
dim WA (3) = 1.
1
A basis is
0
B2 = 0 .
1
5. Conclusion.
Since the total number of linearly independent eigenvectors is 2 < 3, the matrix A is
not diagonalizable.
Example 2
Consider
2 1 0
1 2 0 ∈ M3 (R).
A=
0 0 3
Clearly A is not diagonal (it has nonzero off-diagonal entries). We use the algorithm to check that
it is diagonalizable.
16
Now !
x−2 −1
det = (x − 2)2 − 1 = (x − 1)(x − 3).
−1 x−2
Hence
charA (x) = (x − 3)(x − 1)(x − 3) = (x − 1)(x − 3)2 .
So
1
WA (1) = ker(A − I) = span
−1 ,
dim WA (1) = 1.
0
A basis is
1
B1 =
−1 .
0
(ii) For λ = 3:
−1 1 0
A − 3I =
1 −1 0 .
0 0 0
Then (A − 3I)x = 0 gives
−x1 + x2 = 0 ⇐⇒ x2 = x1 ,
A basis is
1 0
B2 =
1 0 .
,
0 1
17
4. Check the sum of dimensions.
We have
dim WA (1) + dim WA (3) = 1 + 2 = 3 = n.
5. Conclusion.
Since the total dimension of the eigenspaces is 3, the matrix A has 3 linearly independent
eigenvectors and is therefore diagonalizable.
we have A = P DP −1 .
By induction, all ci = 0.
is invertible and
P −1 AP = diag(λ1 , . . . , λn ).
Hence A is diagonalizable.
18
Its characteristic polynomial is
χA (x) = x2 + 1.
Hence the eigenvalues of A are ±i, which are distinct and lie in C. Therefore, A is diagonalizable
over C, but not diagonalizable over R.
However, if we assume that A is a symmetric matrix over R, then we will show that A is always
diagonalizable over R.
Before proving this, we first discuss orthogonal matrices.
Orthogonal Matrices
AAT = I = AT A.
2. AT A = In .
3. AT = A−1 .
4. AAT = In .
Proof. (Exercise.)
Theorem 9. Let A ∈ Mn (R) be symmetric, i.e. AT = A. Then all eigenvalues of A are real.
Then
uT AT = λuT .
Since AT = A,
uT A = λuT .
Multiplying by u,
uT Au = λ uT u.
19
On the other hand,
uT Au = λ uT u.
Hence
λ∥u∥2 = λ∥u∥2 .
Since u ̸= 0, we conclude λ = λ, so λ ∈ R.
Orthogonal Diagonalization
Theorem 10 (Spectral Theorem for Symmetric Matrices). Let A ∈ Mn (R) be symmetric. Then
there exists an orthogonal matrix P ∈ Mn (R) such that
P −1 AP = P T AP
is diagonal.
B = {v1 , v2 , . . . , vn }
Q1 = [ v1 v2 · · · vn ].
Then Q1 is orthogonal.
Since
(Q−1 T −1
1 AQ1 ) = Q1 AQ1 ,
Q−1
1 AQ1 e1 = λ1 e1 .
Hence !
λ1 0
Q−1
1 AQ1 = ,
0 A1
where A1 ∈ Mn−1 (R) is symmetric.
By the induction hypothesis, there exists an orthogonal matrix Q2 ∈ Mn−1 (R) such that
Q−1
2 A1 Q2
is diagonal.
Define !
1 0
Q3 = .
0 Q2
20
Then Q3 is orthogonal and ! !
λ1 0 λ1 0
Q−1
3 Q3 = ,
0 A1 0 D
where D is diagonal.
Finally, set
P = Q 1 Q3 .
is diagonal.
For λ1 = 1, !
1
(A − I)v = 0 ⇒ v1 = .
−1
For λ2 = 3, !
1
(A − 3I)v = 0 ⇒ v2 = .
1
Normalize the eigenvectors:
! !
1 1 1 1
u1 = √ , u2 = √ .
2 −1 2 1
Define the orthogonal matrix !
√1 √1
P = 2 2 .
− √12 √1
2
Then P T P = I, and !
T 1 0
P AP = .
0 3
Thus A is diagonalized by an orthogonal matrix, illustrating the Spectral Theorem for real
symmetric matrices.
Conclusion
21
Cayley–Hamilton Theorem
Theorem 11. Let A be an n × n matrix and let its characteristic polynomial be
p(A) = 0,
Proof of the above theorem is beyond the scope of this course. However, we state and prove it
below for an optional reading.
Proof. (optional reading) First note that over C, A can be conjugated to an upper triangular matrix.
Since the identity p(A) = 0 is preserved under similarity, we may assume without loss of generality
that A is upper triangular.
So assume
λ1 ∗ · · · ∗
0 λ2 · · · ∗
A= . .
. . . . . ...
.
..
0 · · · 0 λn
For an upper triangular matrix, det(λI − A) = ni=1 (λ − λi ), hence
Q
n
Y
p(λ) = (λ − λi ).
i=1
Thus
n
Y
p(A) = (A − λi I).
i=1
Induction step. Assume the statement holds for (n − 1) × (n − 1) upper triangular matrices. Write
A in block form: !
λ1 u
A= ,
0 A1
where u is a 1 × (n − 1) row vector and A1 ∈ Mn−1 (C) is upper triangular with diagonal entries
λ2 , . . . , λ n .
Let
n
Y
q(λ) = (λ − λi ), so that p(λ) = (λ − λ1 )q(λ).
i=2
Then
p(A) = (A − λ1 I) q(A).
22
Claim 1: q(A) has the block form
!
q(λ1 ) w
q(A) = for some 1 × (n − 1) row vector w.
0 q(A1 )
Pn−1
Indeed, since q(λ) = k=0 ck λ
k for some scalars ck ,
n−1
X
q(A) = ck Ak .
k=0
hence summing gives the stated block form, with top-left entry ck λk1 = q(λ1 ) and bottom-right
P
Claim 2: q(A1 ) = 0. This follows from the induction hypothesis applied to the (n − 1) × (n − 1)
upper triangular matrix A1 , since q(λ) = det(λI − A1 ) is its characteristic polynomial.
Therefore, !
q(λ1 ) w
q(A) = .
0 0
Also, !
0 u
A − λ1 I = .
0 A1 − λ1 I
Multiplying these two block matrices gives
! ! !
0 u q(λ1 ) w 0 0
(A − λ1 I) q(A) = = .
0 A1 − λ1 I 0 0 0 0
Let !
2 0
A= .
0 3
The characteristic polynomial is
p(λ) = (λ − 2)(λ − 3) = λ2 − 5λ + 6.
Substituting A,
p(A) = A2 − 5A + 6I = 0.
23
Example 2 (Non-Diagonal Matrix)
Let !
1 2
A= .
3 4
The characteristic polynomial is
p(λ) = λ2 − 5λ − 2.
A2 − 5A − 2I = 0.
Let !
2 1
A= .
0 2
The characteristic polynomial is
p(λ) = (λ − 2)2 .
Hence,
(A − 2I)2 = 0.
From Example 2,
A2 = 5A + 2I.
Thus,
A3 = A(5A + 2I) = 5A2 + 2A = 27A + 10I.
Hence,
A−1 = 12 (A − 5I).
24
3. Simplifying Matrix Polynomials
4. Nilpotent Matrices
then by Cayley–Hamilton,
Ak = 0.
Summary
25