Professional Documents
Culture Documents
MITRES 18 010S20 LA Slides
MITRES 18 010S20 LA Slides
MITRES 18 010S20 LA Slides
Gilbert Strang
MIT
2020
1/30
A = CR = Independent columns in C
0
A = LU = Triangular matrices L and U
0
A = QR = q1 qn Orthogonal columns in Q
0
S = QQT QT = Q−1 Orthogonal eigenvectors Sq = q
2/30
1 3 2
A0 = 4 12 8
2 6 4
1 4 2
2 −1
A1 = 4 1 3 S2 =
−1 2
5 5 5
1 −1 0 2 −1 0
S3 = −1 2 −1 S4 = −1 2 −1
0 −1 1 0 −1 2
cos θ − sin θ 3 0
Q5 = A6 =
sin θ cos θ 4 5
3/30
Column space of A / All combinations of columns
1 4 5 x1 1 4 5
Ax = 3 2 5 x2 = 3 x1 + 2 x2 + 5 x3
2 1 3 x3 2 1 3
= linear combination of columns ofA
R3 ?
The column space of this example is plane ?
line ?
4/30
Column space of A / All combinations of columns
1 4 5 x1 1 4 5
Ax = 3 2 5 x2 = 3 x1 + 2 x2 + 5 x3
2 1 3 x3 2 1 3
= linear combination of columns ofA
R3 ?
The column space of this example is plane ?
line ?
4/30
Column space of A / All combinations of columns
1 4 5 x1 1 4 5
Ax = 3 2 5 x2 = 3 x1 + 2 x2 + 5 x3
2 1 3 x3 2 1 3
= linear combination of columns ofA
R3 ?
The column space of this example is plane ?
line ?
4/30
Basis for the column space / Basis for the row space
1 4
Include column 1 = 3 in C
Include column 2 = 2 in C
2 1
5 1 4
DO NOT INCLUDE COLUMN 3 = 5 = 3 + 2
IT IS NOT INDEPENDENT 3 2 1
1 4 1 0 1 Row rank =
A = CR = 3 2 0 1 1 column rank =
2 1 r=2
5/30
A = CR shows that column rank of A = row rank of A
Key facts
The r columns of C are a basis for the column space of A : dimension r
The r rows of R are a basis for the row space of A : dimension r
6/30
A = CR shows that column rank of A = row rank of A
Key facts
The r columns of C are a basis for the column space of A : dimension r
The r rows of R are a basis for the row space of A : dimension r
6/30
Basis for the column space / Basis for the row space
1 4
Include column 1 = 3
Include column 2 = 2
2 1
5 1 4
DO NOT INCLUDE COLUMN 3 = 5 = 3 + 2
IT IS NOT INDEPENDENT 3 2 1
7/30
Matrix A with rank 1
Proof using A = CR
One column v in C ⇒ one row w in R
w
A= v ⇒ all rows are multiples of w
8/30
A = CR is desirable + A = CR is undesirable −
9/30
row 1 0 x is orthogonal
If Ax = 0 then : x = :
row m 0 to every row of A
10/30
Big Picture of Linear Algebra
dimension dimension
=r =r
row column
space row space to column space space
of A of A
Axrow = b
Axnull = 0 90 ◦
Rn 90 ◦ Rm
nullspace to 0
nullspace
nullspace of AT
of A dimension
dimension
=m−r
=n−r
11/30
Multiplying Columns times Rows / Six Factorizations
−
− c∗1 −
−
| | |
− c∗2 −
− −
BC = b1 b2 ·· bn = b1 c∗1 + b2 c2∗ + · · · + bn cn∗
:
| | |
− cn −
− ∗ −
A = LU A = QR S = QQT A = XX −1 A = U V T A = CR
12/30
Elimination on Ax = b Triangular L and U
2x + 3y = 7 2x + 3y = 7 x=2
4x + 7y = 15 y=1 y=1
2 3 1 0 2 3
A= = = LU
4 7 2 1 0 1
13/30
Solve Ax = b by elimination : Factor A = LU
Lower triangular L times upper triangular U
Step 1 Subtract ℓi1 times row 1 from row i to produce zeros in column 1
1 row 1 of A 0 0 0 0
ℓ21 0
Result A = + A
· 0 2
ℓn1 0
14/30
Orthogonal Vectors – Matrices – Subspaces
xT y = 0 yT x = 0 (x + y)T (x + y) = xT x + y T y RIGHT
TRIANGLE
15/30
Orthogonal Vectors – Matrices – Subspaces
xT y = 0 yT x = 0 (x + y)T (x + y) = xT x + y T y RIGHT
TRIANGLE
16/30
“Orthogonal matrix”
−1 2 2
1
Q = 2 −1 2 is square. Then QQT = I and QT = Q−1
3
2 2 −1
17/30
“Orthogonal matrix”
−1 2 2
1
Q = 2 −1 2 is square. Then QQT = I and QT = Q−1
3
2 2 −1
17/30
Gram-Schmidt Orthogonalize the columns of A
A = QR r11 r12 · r1n
r22 · r2n
QT A = R a1 · · · an = q 1 · · · qn
· ·
qT
i ak = rik rnn
Columns a1 to an are independent Columns q1 to qn are
orthonormal !
a1
Column 1 of Q a1 = q 1 r11 r11 = ||a1 || q1 =
||a1 ||
Row 1 of R = QT A has r1k = qT
1 ak Subtract (column) (row)
" #" #
r22 · r2n
A − q1 r11 r12 · r1n = q2 · qn · ·
rnn
18/30
Gram-Schmidt Orthogonalize the columns of A
A = QR r11 r12 · r1n
r22 · r2n
QT A = R a1 · · · an = q 1 · · · qn
· ·
qT
i ak = rik rnn
Columns a1 to an are independent Columns q1 to qn are
orthonormal !
a1
Column 1 of Q a1 = q 1 r11 r11 = ||a1 || q1 =
||a1 ||
Row 1 of R = QT A has r1k = qT
1 ak Subtract (column) (row)
" #" #
r22 · r2n
A − q1 r11 r12 · r1n = q2 · qn · ·
rnn
18/30
Least Squares : Major Applications of A = QR
b : AT e = 0 or AT Ax
Normal equations for the best x b = AT b
If A = QR then RT QT QRx
b = RT QT b leads to Rx
b = QT b
b e = b − p = error vector
p = projection
of b
= Abx in the
column space
ace of A
C (A) = column sp
plan e
19/30
Least Squares : Major Applications of A = QR
b : AT e = 0 or AT Ax
Normal equations for the best x b = AT b
If A = QR then RT QT QRx
b = RT QT b leads to Rx
b = QT b
b e = b − p = error vector
p = projection
of b
= Axb in the
column space
ace of A
C (A) = column sp
plan e
19/30
Least Squares : Major Applications of A = QR
b : AT e = 0 or AT Ax
Normal equations for the best x b = AT b
If A = QR then RT QT QRx
b = RT QT b leads to Rx
b = QT b
b e = b − p = error vector
p = projection
of b
= Abx in the
column space
ace of A
C (A) = column sp
plan e
19/30
S = S T Real Eigenvalues and Orthogonal Eigenvectors
20/30
Eigenvectors of S go into Orthogonal Matrix Q
λ1
·
S q 1 · · q n = λ1 q 1 · · λn q n = q 1 · · qn ·
λn
S = QQT is a sum λ1 q 1 q 1T + · · · + λr q n q T
n of rank one matrices
A = U V T is a sum σ1 u1 v T T
1 + · · · + σr ur v r of rank one matrices
21/30
Eigenvalues and Eigenvectors of A : Not symmetric
A x1 ·· xn = λ1 x1 ·· λn xn AX = X
A2 x = A(λx) = λ(Ax) = λ2 x An x = λn x
� �
A2 = XX −1 XAX −1 = X2 X −1 An = Xn X −1
22/30
Eigenvalues and Eigenvectors of A : Not symmetric
A x1 ·· xn = λ1 x1 ·· λn xn AX = X
A2 x = A(λx) = λ(Ax) = λ2 x An x = λn x
� �
A2 = XX −1 XAX −1 = X2 X −1 An = Xn X −1
22/30
PROVE : AT A is square, symmetric, nonnegative definite
1. AT A = (n × m) (m × n) = n × n Square
3. S = S T is nonnegative definite IF
EIGENVALUE TEST 1 : All eigenvalues ≥ 0 Sx = λx
ENERGY TEST 2 : xT Sx ≥ 0 for every vector x
||Ax||2
TEST 1 IF AT Ax = λx THEN xT AT Ax = λxT x AND λ = ≥0
||x||2
TEST 2 applies to every x, not only eigenvectors
Energy xT Sx = xT AT Ax = (Ax)T (Ax) = ||Ax||2 ≥ 0
Positive definite would have λ > 0 and xT Ax > 0 for every x 6= 0
23/30
PROVE : AT A is square, symmetric, nonnegative definite
1. AT A = (n × m) (m × n) = n × n Square
3. S = S T is nonnegative definite IF
EIGENVALUE TEST 1 : All eigenvalues ≥ 0 Sx = λx
ENERGY TEST 2 : xT Sx ≥ 0 for every vector x
||Ax||2
TEST 1 IF AT Ax = λx THEN xT AT Ax = λxT x AND λ = ≥0
||x||2
TEST 2 applies to every x, not only eigenvectors
Energy xT Sx = xT AT Ax = (Ax)T (Ax) = ||Ax||2 ≥ 0
Positive definite would have λ > 0 and xT Ax > 0 for every x 6= 0
23/30
PROVE : AT A is square, symmetric, nonnegative definite
1. AT A = (n × m) (m × n) = n × n Square
3. S = S T is nonnegative definite IF
EIGENVALUE TEST 1 : All eigenvalues ≥ 0 Sx = λx
ENERGY TEST 2 : xT Sx ≥ 0 for every vector x
||Ax||2
TEST 1 IF AT Ax = λx THEN xT AT Ax = λxT x AND λ = ≥0
||x||2
TEST 2 applies to every x, not only eigenvectors
Energy xT Sx = xT AT Ax = (Ax)T (Ax) = ||Ax||2 ≥ 0
Positive definite would have λ > 0 and xT Ax > 0 for every x 6= 0
23/30
PROVE : AT A is square, symmetric, nonnegative definite
1. AT A = (n × m) (m × n) = n × n Square
3. S = S T is nonnegative definite IF
EIGENVALUE TEST 1 : All eigenvalues ≥ 0 Sx = λx
ENERGY TEST 2 : xT Sx ≥ 0 for every vector x
||Ax||2
TEST 1 IF AT Ax = λx THEN xT AT Ax = λxT x AND λ = ≥0
||x||2
TEST 2 applies to every x, not only eigenvectors
Energy xT Sx = xT AT Ax = (Ax)T (Ax) = ||Ax||2 ≥ 0
Positive definite would have λ > 0 and xT Ax > 0 for every x =
6 0
23/30
AAT is also symmetric positive semidefinite (or definite)
AAT
In applications can be the sample covariance matrix
n−1
24/30
SINGULAR VALUE DECOMPOSITION
A = U V T with U T U = I and V T V = I
AV = U means
σ1
..
A v1 · · · v r = u1 · · · ur . and Av i = σi ui
σr
SINGULAR VALUES σ1 ≥ σ2 ≥ . . . ≥ σr > 0 r = rank of A
A
x Ax
VT U
v2 ˙2
˙1 ˙2 u2
v1
V ˙1 u1
U and V are rotations and possible reflections. stretches circle to ellipse.
25/30
How to choose orthonormal v i in the row space of A ?
The v i are eigenvectors of AT A
AT Av i = λi v i = σi2 v i The v i are orthonormal. V TV = I
Av i
How to choose ui in the column space ? ui =
σi
The ui are orthonormal This is the important step U T U = I
Av j T Av i vT T
j A Av i v jT σi2 v i 1 i=j
= = =
σj σi σj σi σj σi 0 i 6= j
26/30
How to choose orthonormal v i in the row space of A ?
The v i are eigenvectors of AT A
AT Av i = λi v i = σi2 v i The v i are orthonormal. V TV = I
Av i
How to choose ui in the column space ? ui =
σi
The ui are orthonormal This is the important step U T U = I
Av j T Av i vT T
j A Av i v jT σi2 v i 1 i=j
= = =
σj σi σj σi σj σi 0 i=
6 j
26/30
How to choose orthonormal v i in the row space of A ?
The v i are eigenvectors of AT A
AT Av i = λi v i = σi2 v i The v i are orthonormal. V TV = I
Av i
How to choose ui in the column space ? ui =
σi
The ui are orthonormal This is the important step U T U = I
Av j T Av i vT T
j A Av i v jT σi2 v i 1 i=j
= = =
σj σi σj σi σj σi 0 i=
6 j
26/30
3 0 25 20 9 12
SVD of A = AT A = AAT =
4 5 20 25 12 41
√
1 −3 3 5 √ T 1 1
U= = V =
3 1 5 −1 1
√ √
10 2
3 1 1 1 3 −3 3 0
σ1 u1 v T
1 + σ2 u2 v T
2 = + =
2 3 3 2 −1 1 4 5
27/30
Low rank approximation to a big matrix
Start from the SVD A = U V T = σ1 u1 v 1T + · · · + σr ur v T
r
Norms p
||A|| = σmax ||A||F = σ12 + · · · + σr2 ||A||N = σ1 + · · · + σr
28/30
Randomized Numerical Linear Algebra
For very large matrices, randomization has brought a revolution
Example : Multiply AB with Column-row sampling (AS) (S T B)
" #
s11 0 s11 b1T
AS = a1 a2 a3 0 0 = s11 a1 s32 a3 and S B =
T
29/30
OCW.MIT.EDU and YouTube
Math 18.06 Linear Algebra for Everyone (New textbook expected in 2021 !!)
math.mit.edu/linearalgebra math.mit.edu/learningfromdata
30/30
MIT OpenCourseWare
https://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit:
https://ocw.mit.edu/terms.