Professional Documents
Culture Documents
Linear Algebra 2
Morris Alper
● Matrices
● Matrix Multiplication
● Nullspace
● Determinants
● Matrix Inverse
● Eigenvectors and Eigenvalues
● Diagonalization
● Bonus: Vector Calculus
Matrices
Matrices
𝑎1,1 ⋯ 𝑎1,𝑛
𝐴= ⋮ ⋱ ⋮
𝑎𝑚,1 ⋯ 𝑎𝑚,𝑛
1 2 −2 3
The coefficient matrix is the 4 × 4 matrix 𝐴 = −1 2 −1 7 .
3 3 0 1
−1 −1 5 5
Matrices
Example 1:
1 2 5 𝑥
1
𝑥 + 2𝑦 + 5𝑧 = 1 𝐴 = 2 −1 0 𝒗= 𝑦 𝒃=
2 𝑧 3
1
2𝑥 − 𝑦 = 3
2
Matrices
Example 2: 1 2 −2 3
𝑥1 + 2𝑥2 − 2𝑥3 + 3𝑥4 = 4 𝐴 = −1 2 −1 7
3 3 0 1
−𝑥1 + 2𝑥2 − 𝑥3 + 7𝑥4 = 3
−1 −1 5 5
3𝑥1 + 3𝑥2 + 𝑥4 = 2
−𝑥1 − 𝑥2 + 5𝑥3 + 5𝑥4 = 1 𝑥1 4
𝑥2
𝒗= 𝑥 𝒃= 3
3 2
𝑥4 1
Matrices
4
𝑇 = 3
4 3 −1
−1
𝑇
1 2 −2 3 1 −1 3 −1
−1 2 −1 7 = 2 2 3 −1
3 3 0 1 −2 −1 0 5
−1 −1 5 5 3 7 1 5
Matrix Multiplication
Matrix Multiplication
1 2 5 𝑥
1
𝑥 + 2𝑦 + 5𝑧 = 1 𝐴 = 2 −1 0 𝒗= 𝑦 𝒃=
2 𝑧 3
1
2𝑥 − 𝑦 = 3
2
1 2 5 𝑥
𝐴 = 2 −1 0 𝒗= 𝑦
2 𝑧
?
𝐴𝒗 =
?
Matrix Multiplication
1 2 5 𝑥
𝐴 = 2 −1 0 𝒗= 𝑦
2 𝑧
1𝑥 + 2𝑦 + 5𝑧
𝐴𝒗 =
?
Matrix Multiplication
1 2 5 𝑥
𝐴 = 2 −1 0 𝒗= 𝑦
2 𝑧
𝑥 + 2𝑦 + 5𝑧
𝐴𝒗 = 1
2𝑥 − 𝑦 + 0𝑧
2
Matrix Multiplication
1 2 5 𝑥
𝐴 = 2 −1 0 𝒗= 𝑦
2 𝑧
𝑥 + 2𝑦 + 5𝑧
𝐴𝒗 = 1
2𝑥 − 𝑦
2
Matrix Multiplication
So letting
1 2 5 𝑥
1
𝐴 = 2 −1 0 𝒗= 𝑦 𝒃=
2 𝑧 3
𝐴𝒗 = 𝒃
Matrix Multiplication
Example 1:
1 3 0 1 ? ?
=
−1 2 1 2 ? ?
Matrix Multiplication
Example 1:
1 3 0 1 1⋅0+3⋅1 ?
=
−1 2 1 2 ? ?
Matrix Multiplication
Example 1:
1 3 0 1 𝟑 ?
=
−1 2 1 2 ? ?
Matrix Multiplication
Example 1:
1 3 0 1 3 1⋅1+3⋅2
=
−1 2 1 2 ? ?
Matrix Multiplication
Example 1:
1 3 0 1 3 𝟕
=
−1 2 1 2 ? ?
Matrix Multiplication
Example 1:
1 3 0 1 3 7
=
−1 2 1 2 −1 ⋅ 0 + 2 ⋅ 1 ?
Matrix Multiplication
Example 1:
1 3 0 1 3 7
=
−1 2 1 2 𝟐 ?
Matrix Multiplication
Example 1:
1 3 0 1 3 7
=
−1 2 1 2 2 −1 ⋅ 1 + 2 ⋅ 2
Matrix Multiplication
Example 1:
1 3 0 1 3 7
=
−1 2 1 2 2 𝟑
Matrix Multiplication
Example 2:
1 0
Q: For vectors 𝒗 = −2 , 𝒘 = 1 , what is 𝒗𝑻 𝒘?
1 2
Matrix Multiplication
Example 2:
1 0
Q: For vectors 𝒗 = −2 , 𝒘 = 1 , what is 𝒗𝑻 𝒘?
1 2
0
A: 𝒗𝑻 𝒘 = 1 −2 1 1 = 1 ⋅ 0 + −2 ⋅ 1 + 1 ⋅ 2 = 0
2
Matrix Multiplication
Example 2:
1 0
Q: For vectors 𝒗 = −2 , 𝒘 = 1 , what is 𝒗𝑻 𝒘?
1 2
0
A: 𝒗𝑻 𝒘 = 1 −2 1 1 = 1 ⋅ 0 + −2 ⋅ 1 + 1 ⋅ 2 = 0
2
This is another way to write the dot product 𝒗 ⋅ 𝒘.
Matrix Multiplication
● Linearity: 𝐴 𝐵 + 𝐶 = 𝐴𝐵 + 𝐴𝐶, 𝐴 + 𝐶 𝐵 = 𝐴𝐵 + 𝐶𝐵
● Associativity*: 𝐴 𝐵𝐶 = 𝐴𝐵 𝐶
● Transpose: 𝐴𝐵 𝑇 = 𝐵𝑇 𝐴𝑇
The n × n identity matrix 𝐼𝑛 (or simply 𝐼 for short) is the matrix with 1’s along
the diagonal and 0’s elsewhere:
1 0 0 ⋯
𝐼𝑛 = 0 1 0 ⋯
0 0 1 ⋯
⋯ ⋯ ⋯ ⋯
1 0 0
1 0
For example, 𝐼2 = and 𝐼3 = 0 1 0.
0 1
0 0 1
In general, 𝐼𝐴 = 𝐴 and 𝐴𝐼 = 𝐴 for any matrix 𝐴 of compatible size.
Nullspace
Nullspace
𝐴𝒗 = 𝟎
𝑎1,1 ⋯ 𝑎1,𝑛 𝑥1 0
𝐴= ⋮ ⋱ ⋮ 𝒗= ⋯ 𝟎= ⋯
𝑎𝑚,1 ⋯ 𝑎𝑚,𝑛 𝑥𝑛 0
Nullspace
Example:
4 2 2 −2
𝐴= 3 1 1 −3
3 2 2 0
Nullspace
Example:
4 2 2 −2
𝐴= 3 1 1 −3
3 2 2 0
1 0 0 −2
Applying row reduction: 𝐴′ = 0 1 1 3
0 0 0 0
Nullspace
Example:
1 0 0 −2
𝐴′ = 0 1 1 3
0 0 0 0
2𝑥4
′ −𝑥3 − 3𝑥4
The general solution for 𝐴 𝒗 = 𝟎 is 𝒗 = .
𝑥3
𝑥4
Nullspace
Example:
2𝑥4 0 2
−𝑥3 − 3𝑥4 −1 −3
𝒗= = 𝑥3 + 𝑥4
𝑥3 1 0
𝑥4 0 1
0 2
−1 −3
So the nullspace of 𝐴 has basis { , }.
1 0
0 1
Determinants
Determinants
𝑎1,1 ⋯ 𝑎1,𝑛
For n × n matrix 𝐴 = ⋮ ⋱ ⋮ , we write the determinant
𝑎𝑚,1 ⋯ 𝑎𝑚,𝑛
as |𝐴| or 𝑑𝑒𝑡 𝐴 .
Determinants
𝑎 𝑏 𝑐
𝑑 𝑓 𝑑 𝑒
𝑑 𝑒 𝑓 =𝑎 𝑒 𝑓
−𝑏 +𝑐
ℎ 𝑖 𝑔 𝑖 𝑔 ℎ
𝑔 ℎ 𝑖
(A similar definition holds for larger matrices; see the Wikipedia article on
the Laplace expansion for more information.)
Determinants
𝑎 𝑏 𝑐
𝑑 𝑓 𝑑 𝑒
𝑑 𝑒 𝑓 =𝑎 𝑒 𝑓
−𝑏 +𝑐
ℎ 𝑖 𝑔 𝑖 𝑔 ℎ
𝑔 ℎ 𝑖
(A similar definition holds for larger matrices; see the Wikipedia article on
the Laplace expansion for more information.)
Determinants
𝑎 𝑏 𝑐
𝑑 𝑓 𝑑 𝑒
𝑑 𝑒 𝑓 =𝑎 𝑒 𝑓
−𝑏 +𝑐
ℎ 𝑖 𝑔 𝑖 𝑔 ℎ
𝑔 ℎ 𝑖
(A similar definition holds for larger matrices; see the Wikipedia article on
the Laplace expansion for more information.)
Determinants
𝑎 𝑏 𝑐
𝑑 𝑓 𝑑 𝑒
𝑑 𝑒 𝑓 =𝑎 𝑒 𝑓
−𝑏 +𝑐
ℎ 𝑖 𝑔 𝑖 𝑔 ℎ
𝑔 ℎ 𝑖
(A similar definition holds for larger matrices; see the Wikipedia article on
the Laplace expansion for more information.)
Determinants
Example:
2 1 −1
−2 4 4
3 1 1
Determinants
Example:
2 1 −1
4 4 −2 4 −2 4
−2 4 4 = 2 − 1 + −1
1 1 3 1 3 1
3 1 1
Determinants
Example:
2 1 −1
4 4 −2 4 −2 4
−2 4 4 = 2 − 1 + −1
1 1 3 1 3 1
3 1 1
= 2 4 ⋅ 1 − 4 ⋅ 1 − 1 −2 ⋅ 1 − 4 ⋅ 3 + −1 ⋅ −2 ⋅ 1 − 4 ⋅ 3
Determinants
Example:
2 1 −1
4 4 −2 4 −2 4
−2 4 4 = 2 − 1 + −1
1 1 3 1 3 1
3 1 1
= 2 4 ⋅ 1 − 4 ⋅ 1 − 1 −2 ⋅ 1 − 4 ⋅ 3 + −1 ⋅ −2 ⋅ 1 − 4 ⋅ 3
= 2 ⋅ 0 − 1 ⋅ −14 + −1 ⋅ −14
Determinants
Example:
2 1 −1
4 4 −2 4 −2 4
−2 4 4 = 2 − 1 + −1
1 1 3 1 3 1
3 1 1
= 2 4 ⋅ 1 − 4 ⋅ 1 − 1 −2 ⋅ 1 − 4 ⋅ 3 + −1 ⋅ −2 ⋅ 1 − 4 ⋅ 3
= 2 ⋅ 0 − 1 ⋅ −14 + −1 ⋅ −14
= 28
Determinants
● det 𝐼 = 1
● det 𝐴𝐵 = det 𝐴 det 𝐵
● If 𝐴’ equals 𝐴 with all elements of one row multiplied by 𝑐, then det 𝐴′ =
𝑐 det(𝐴) .
Special case:
𝑎 𝑏
For 2 × 2 invertible matrix 𝐴 = ,
𝑐 𝑑
1 𝑑 −𝑏
𝐴−1 =
det(𝐴) −𝑐 𝑎
Example:
7
𝑥 −1
2 1 5 1 2 −1 5 5
we calculate 𝑦 = = = 11 .
−1 2 3 5 1 2 3
5
Matrix Inverse
0 −3 −2 | 1 0 0 1 0 0 | 4 −5 −2
1 −4 −2 |0 1 0 ⇒(row reduction)⇒ 0 1 0 | 5 −6 −2
−3 4 1 |0 0 1 0 0 1 | −8 9 3
Matrix Inverse
4 −5 −2
𝐴−1 = 5 −6 −2
−8 9 3
Matrix Inverse
● (𝐴−1 )−1 = 𝐴
1
● 𝑐𝐴 −1
= 𝐴−1
𝑐
● 𝐴𝐵 −1
= 𝐵−1 𝐴−1
Example:
6 −7 1 6
𝐴= 𝒗= 𝐴𝒗 = = 6𝒗
0 3 0 0
1
𝐴 has eigenvector 𝒗 = with eigenvalue 𝜆 = 6.
0
Eigenvectors and Eigenvalues
Geometrically, eigenvectors
represent directions of
stretching/squishing space, and
their eigenvalues are the ratios of
stretching/squishing.
Example:
6 −7
𝐴=
0 3
6−𝜆 −7
det(𝐴 − 𝜆𝐼) =
0 3−𝜆
= 6 − 𝜆 3 − 𝜆 − −7 ⋅ 0
= 𝜆−6 𝜆−3
Example:
𝐴 − 3𝐼 𝒗 = 𝟎
3 −7 7 7
𝐴 − 3𝐼 = has nullspace 𝑠𝑝𝑎𝑛( ), so (or any
0 0 3 3
multiple) is an eigenvector with eigenvalue 3.
Eigenvectors and Eigenvalues
Diagonalization
Diagonalization
1 2
Consider the matrix 𝐴 = .
2 1
1−𝜆 2 2
det(𝐴 − 𝜆𝐼) = = 1−𝜆 − 2 ⋅ 2 = (𝜆 − 3)(𝜆 + 1)
2 1−𝜆
So 𝐴 has eigenvalues 𝜆1 = 3 and 𝜆1 = −1.
1
Solving for eigenvectors as shown before gives 𝒗𝟏 = (eigenvalue 3) and
1
−1
𝒗𝟐 = (eigenvalue -1).
1
Diagonalization
1 2 1 −1
Eigenvectors of 𝐴 = : 𝒗𝟏 = (𝜆 = 3) 𝒗𝟐 = (𝜆2 = −1)
2 1 1 1 1
Any vector 𝒘 ∈ ℝ2 can be written as 𝒘 = 𝑎𝒗𝟏 + 𝑏𝒗𝟐 . In other words 𝒘 has
coordinates (𝑎, 𝑏) in the basis 𝒗𝟏 , 𝒗𝟐 .
1 2 1 −1
Eigenvectors of 𝐴 = : 𝒗𝟏 = (𝜆 = 3) 𝒗𝟐 = (𝜆2 = −1)
2 1 1 1 1
𝐴 = 𝑄Λ𝑄 −1
where Q = 𝒗𝟏 𝒗𝟐 = 1 −1
1 1
𝜆1 0 3 0
and Λ = =
0 𝜆2 0 −1
Diagonalization
Example:
−1 0 2
Q: Find a general formula for 𝑀𝑛 , where 𝑀 = 0 2 1 and n is a positive
2 1 3
integer.
Diagonalization
2 1 0
A: 𝑀= 1 2 1 has eigenvectors:
0 1 2
1 0 1
𝒗𝟏 = 1 (𝜆1 = 3), 𝒗𝟐 = 0 (𝜆2 = 2), 𝒗𝟑 = −1 (𝜆3 = 1)
1 1 1
Diagonalization
2 1 0
A: 𝑀= 1 2 1 has eigenvectors:
0 1 2
1 0 1
𝒗𝟏 = 1 (𝜆1 = 3), 𝒗𝟐 = 0 (𝜆2 = 2), 𝒗𝟑 = −1 (𝜆3 = 1)
1 1 1
1 0 1 𝜆1 0 0 3 0 0
Let 𝑄 = 𝒗𝟏 𝒗𝟐 𝒗𝟑 = 1 0 −1 Λ= 0 𝜆2 0 = 0 2 0
1 1 1 0 0 𝜆3 0 0 1
Diagonalization
2 1 0 1 0 1 3 0 0
A: 𝑀= 1 2 1 𝑄= 1 0 −1 Λ= 0 2 0
0 1 2 1 1 1 0 0 1
1 0 1 3 0 0 1/2 1/2 0
𝑀 = 𝑄Λ𝑄 −1 = 1 0 −1 0 2 0 −1 0 1
1 1 1 0 0 1 1/2 −1/2 0
Diagonalization
2 1 0 1 0 1 3 0 0
A: 𝑀= 1 2 1 𝑄= 1 0 −1 Λ= 0 2 0
0 1 2 1 1 1 0 0 1
1 0 1 3𝑛 0 0 1/2 1/2 0
𝑀𝑛 = 𝑄Λ𝑛 𝑄 −1 = 1 0 −1 0 2𝑛 0 −1 0 1
1 1 1 0 0 1 1/2 −1/2 0
Diagonalization
2 1 0 1 0 1 3 0 0
A: 𝑀= 1 2 1 𝑄= 1 0 −1 Λ= 0 2 0
0 1 2 1 1 1 0 0 1
1 0 1 3𝑛 0 0 1/2 1/2 0
𝑀𝑛 = 𝑄Λ𝑛 𝑄 −1 = 1 0 −1 0 2𝑛 0 −1 0 1
1 1 1 0 0 1 1/2 −1/2 0
1 3𝑛 + 1 3𝑛 − 1 0
= 3𝑛 − 1 3𝑛 + 1 0
2
−2𝑛+1 + 3𝑛 + 1 3𝑛 − 1 2𝑛+1
Bonus: Vector Calculus
Bonus: Vector Calculus
𝑓 𝑥, 𝑦 = 𝑥 2 + 𝑦 2 − 𝑥
𝜕𝑓
(𝑥, 𝑦)
𝜕𝑥
Define the gradient ∇𝑓 𝑥, 𝑦 = 𝜕𝑓
(𝑥, 𝑦)
𝜕𝑦
2𝑥 − 1 0
In our case, = gives critical
2𝑦 0 (0.5, 0)
point 𝑥, 𝑦 = (0.5, 0).
𝜕2 𝑓 𝜕2 𝑓
𝜕𝑥 2 𝜕𝑥𝜕𝑦 2 0
𝐇𝑓 = =
𝜕2 𝑓 𝜕2 𝑓 0 2
𝜕𝑥𝜕𝑦 𝜕𝑦 2
Because all of the eigenvalues of 𝐇𝑓 are positive at the critical point 0.5, 0 ,
it is a (local) minimum; this is similar to the second derivative test for
univariate functions.
Further Reading
Further Reading
● https://www.mathsisfun.com/algebra/matrix-multiplying.html
● https://textbooks.math.gatech.edu/ila/determinants-definitions-
properties.html
● https://www.purplemath.com/modules/mtrxinvr.htm
● https://lpsa.swarthmore.edu/MtrxVibe/EigMat/MatrixEigen.html
● https://yutsumura.com/how-to-diagonalize-a-matrix-step-by-step-
explanation/