Ch02 SolvingLinSys v6 Nomark (69) - Done
Ch02 SolvingLinSys v6 Nomark (69) - Done
MANAGEMENT
MATHEMATICS
Solving Linear Systems
盧信銘
台大資管
Spring, 2020 Solving Linear Systems 2
Topics
• Preliminaries
• Echelon Form of a Matrix
• Elementary Matrices; Finding A-1
• LU-Factorization
Key Terms:
Row echelon form 階梯矩陣
Reduced row echelon form 簡化階梯矩陣
Spring, 2020 Solving Linear Systems 3
Topics
• Preliminaries
• Echelon Form of a Matrix
• Elementary Matrices; Finding A-1
• LU-Factorization
Key Terms:
Row echelon form 階梯矩陣
Reduced row echelon form 簡化階梯矩陣
Spring, 2020 Solving Linear Systems 4
Preliminaries
• The goal of this lecture:
• Develop systematic procedure for solving linear systems that
works directly with the matrix form
• Establish conditions for a solution to a linear system to exist
• Establish conditions for a unique solution to a linear system
• Re-examine solutions to homogeneous systems
• Develop a systematic procedure for computing A–1
• Discover equivalent conditions to nonsingularity
☼
Spring, 2020 Solving Linear Systems 5
Topics
• Preliminaries
• Echelon Form of a Matrix
• Elementary Matrices; Finding A-1
• LU-Factorization
Key Terms:
Row echelon form 階梯矩陣
Reduced row echelon form 簡化階梯矩陣
Spring, 2020 Solving Linear Systems
1 1 2 𝑥1 −1
1 −2 1 𝑥2 = −5
3 1 1 𝑥3 3
6 ☼
Spring, 2020 Solving Linear Systems 7
Pivots (主元)
1 1 2 −1 1 0 0 1
0 1 1 3 4 3 0 1 0 2
☼
0 0 1 −2 0 0 1 −2
Spring, 2020 Solving Linear Systems 8
1 5 0 2 −2 4
1 0 0 0
0 1 0 3 4 8
0 1 0 0
0 0 0 1 7 −2 0 0 1 0
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0
0 0 1 3 5 7 9
0 0 0 0 1 −2 3
0 0 0 0 0 1 2
0 0 0 0 0 0 1
0 0 0 0 0 0 0 ☼
Spring, 2020 Solving Linear Systems 10
1 0 0 0 1 0 0 0 −2 4
0 1 0 0 4 8
0 1 0 0
0 0 0 1 7 −2
0 0 1 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
1 2 0 0 1
0 0 1 2 3
0 0 0 0 0
☼
Spring, 2020 Solving Linear Systems 11
Your Turn
• True or false: the following matrices are in reduced row
echelon form
• (1) (2)
1 2 0 4 1 0 3 4
0 0 0 0 0 2 −2 5
0 0 1 −3 0 0 1 2
• (3) (4)
0 0 0 1 0 0 1 2 3 4
0 0 0 0 1 0 0 1 −2 5
0 0 0 0 0 1 0 0 1 2
0 0 0 0 0 0 0 0 0 1
☼
Spring, 2020 Solving Linear Systems 12
☼
Spring, 2020 Solving Linear Systems 13
Row Equivalence
Your Turn
• True or false: If A and C are row equivalent m x n
matrices, then the homogeneous systems AX = 0 and
CX = 0 are equivalent.
Discussion
QED
Spring, 2020 Solving Linear Systems 19
Back substitution
• If Gauss-Jordan reduction is used, the solution is just read
off. If Gaussian elimination is used, the solution must be
found by back substitution
Example
1 2 3 4 5
𝐂:𝐃 = 0 1 2 3 6
0 0 0 0 1
☼
Spring, 2020 Solving Linear Systems 21
Homogeneous Systems
• Proof (continue): Let z be the number of nonzero rows of B.
Then z ≤ m. Since m < n, then z < n. So, we are solving z
equations in n unknowns and can solve for z of the unknowns
in terms of the remaining n - z unknowns, which can take any
values. So, BX = 0 and thus AX = 0 have nontrivial solutions.
A B
𝑎11 𝑎12 ⋯ 𝑎1𝑛 0 1 𝑏12 0 ⋯ 0 0
𝑎2𝑛 𝑎22 ⋯ 𝑎2𝑛 0 0 0 1 ⋯ 0 0
➔
⋱ ⋮ ⋱ ⋮
𝑎𝑚1 𝑎𝑚2 ⋯ 𝑎𝑚𝑛 0 0 0 0 ⋯ 1 0
QED
Spring, 2020 Solving Linear Systems 24
Topics
• Preliminaries
• Echelon Form of a Matrix
• Elementary Matrices; Finding A-1
• LU-Factorization
Spring, 2020 Solving Linear Systems 25
Elementary Matrices
• Defn - An n x n elementary matrix of Type I, Type II or
Type III is a matrix obtained from the identity matrix In
by performing a single elementary row operation of
Type I, Type II or Type III, respectively
☼
Spring, 2020 Solving Linear Systems 26
Your Turn
Which of these are elementary matrices and nonelementary matrices?
1 0 0 1 0 0
(𝑎) 0 3 0 1 0 0
(𝑏) (𝑐) 0 1 0
0 0 1 0 1 0
0 0 0
1 0 0
1 0 1 0 0
(𝑑) 0 0 1 (𝑒)
2 1 (𝑓) 0 2 0
0 1 0 0 0 −1
☼
Spring, 2020 Solving Linear Systems 27
Elementary Matrices
• Have defined three elementary row operations
• Type I - exchange two rows
• Type II - multiply a row by a nonzero constant
• Type III - add a multiple of one row to another
☼
E is a special case of a permutation matrix
Spring, 2020 Solving Linear Systems 29
Comments
• The appropriate elementary matrix E may be obtained by
performing the desired operation on the rows of the m x m
identity matrix Im
• Can define elementary matrices F to perform elementary
column operations by doing the corresponding operations
on the columns of the identity matrix. The matrices F are
applied by post multiplying, i.e. AF
☼
Spring, 2020 Solving Linear Systems 32
Your Turn
(Using elementary matrices)
Find a sequence of elementary matrices that can be used to write
the matrix A in row-echelon form.
0 1 3 5
𝐴 = 1 −3 0 2
2 −6 2 0
☼
Spring, 2020 Solving Linear Systems 35
Your Turn
☼
Spring, 2020 Solving Linear Systems 36
Ex:
Elementary Matrix Inverse Matrix
0 1 0 0 1 0
𝐸1 = 1 0 0 = 𝑅12 (𝑅12 )−1 = 𝐸1−1 = 1 0 0 = 𝑅12 (Elementary Matrix)
0 0 1 0 0 1
1 0 0 1 0 0
(−2) (−2)
𝐸2 = 0 1 0 = 𝑅13 (𝑅13 )−1 = 𝐸2−1 = 0 1 0 (2)
= 𝑅13 (Elementary Matrix)
−2 0 1 2 0 1
1 0 0 1
(2)
1 0 0
1
0 1 0 (2 ) (𝑅3 )−1 = 𝐸3−1 = 0 1 0 = 𝑅3
(2)
𝐸3 = 1 = 𝑅3 (Elementary Matrix)
0 0 2
0 0
2
☼
Spring, 2020 Solving Linear Systems 37
Your Turn
1 0 0 0 0
0 1 0 0 0
• What is the inverse of 0 0 1 0 0?
0 71 0 1 0
0 0 0 0 1
Spring, 2020 Solving Linear Systems 39
−1 −2
𝐴=
3 8
Sol:
(−1) (−3)
−1 −2 𝑟1 1 2 𝑟12 1 2
𝐴=
3 8 3 8 0 2
1
(2) (−2)
𝑟2 1 2 𝑟21 1 0
=𝐼
0 1 0 1
1
(−2) (2) (−3) (−1)
Therefore 𝑅21 𝑅2 𝑅12 𝑅1 𝐴 =𝐼
☼
Spring, 2020 Solving Linear Systems 40
1
(−2) (2) (−3) (−1)
𝑅21 𝑅2 𝑅12 𝑅1 𝐴 =𝐼
1
(−1) −1 (−3) −1 (2) (−2)
Thus 𝐴 = (𝑅1 ) (𝑅12 ) (𝑅2 )−1 (𝑅21 )−1
−1 0 1 0 1 0 1 2
=
0 1 3 1 0 2 0 1
☼
Spring, 2020 Solving Linear Systems 41
Computing A-1
• Have shown that if A is nonsingular, then it is row equivalent to In . Also,
have shown that it can be expressed as the product of elementary
matrices.
−1 −1
𝐈𝑛 = 𝐄𝑘 𝐄𝑘−1 ⋯ 𝐄2 𝐄1 𝐀 ⇒ 𝐀 = 𝐄1−1 𝐄2−1 ⋯ 𝐄𝑘−1 𝐄𝑘
−1 −1 −1
• Then 𝑨−1 = 𝑬1−1 𝑬−1
2 ⋯ 𝑬𝑘−1 𝑬𝑘 = 𝑬𝑘 𝑬𝑘−1 ⋯ 𝑬2 𝑬1 So, A-1 can
be represented as the product of the elementary matrices that reduce A
to In
• Create the partitioned matrix 𝑨 𝑰𝑛 and apply the operations that
reduce A to In
☼
𝐄𝑘 𝐄𝑘−1 ⋯ 𝐄2 𝐄1 𝐀 𝐈𝑛 = 𝐈𝑛 𝐀−1
Spring, 2020 Solving Linear Systems 42
Computing A-1
Example 1 1 3
• Compute inverse of 𝐀= 1 2 3
0 1 1
1 1 3 1 0 0 1 1 3 1 0 0
1 2 3 0 1 0 ⇒ 0 1 0 −1 1 0
0 1 1 0 0 1 0 1 1 0 0 1
1 1 3 1 0 0 1 1 0 −2 3 −3
⇒ 0 1 0 −1 1 0 ⇒ 0 1 0 −1 1 0
0 0 1 1 −1 1 0 0 1 1 −1 1
1 0 0 −1 2 −3 −1 2 −3
⇒ 0 1 0 −1 1 0 ⇒ 𝐀−1 = −1 1 0
☼
0 0 1 1 −1 1 1 −1 1
Spring, 2020 Solving Linear Systems 43
☼
Spring, 2020 Solving Linear Systems 44
• Proof (continued) -
[First show that B is singular]
The matrix B is singular since there does not exist a
matrix C such that BC = CB = In .
To see this, let the ith row of B consist of all zeros. The
ith row of BC is generated by taking the ith row of B
and multiplying each column of C by it. So, the ith row
of BC is all zeros, but BC = In . So, B must be singular.
𝑏11 𝑐11 1
1
0 0 ⋯ 0 ⋯ = 0 0 ⋯ 0
i-th row i-th row
𝑏𝑛𝑛 𝑐𝑛1 𝑐𝑛𝑛 0 1
☼
QED
Spring, 2020 Solving Linear Systems 48
• Proof (continued) -
[Show that B is singular → A is singular]
A is row equivalent to B, so 𝑩 = 𝑬𝒌 𝑬𝒌−𝟏 ⋯ 𝑬𝟐 𝑬𝟏 𝑨
QED
Spring, 2020 Solving Linear Systems 49
Watch Video:
Finding A-1 https://cool.ntu.edu.tw/courses/
1220/modules/items/34648
Topics
• Preliminaries
• Echelon Form of a Matrix
• Elementary Matrices; Finding A-1
• LU-Factorization
☼
Spring, 2020 Solving Linear Systems 52
LU-factorization
If the nn matrix A can be written as the product of a lower
triangular matrix L and an upper triangular matrix U, then A=LU
is an LU-factorization of A
LU-factorization
Ex: (LU-factorization)
1 2 (𝑏) 𝐴
(𝑎) 𝐴 = 1 −3 0
1 0
= 0 1 3
2 −10 2
Sol: (a)
𝑟
−1)(
1 2 12 1 2
𝐴= =𝑈
1 0 0 −2
(−1)
⇒ 𝑅12 𝐴 = 𝑈
(−1)
⇒ 𝐴 = (𝑅12 )−1 𝑈 = 𝐿𝑈
(−1) (1) 1 0
⇒ 𝐿 = (𝑅12 )−1 = 𝑅12 =
1 1
☼
Spring, 2020 Solving Linear Systems 54
LU-factorization
(b)
1 −3 0 𝑟13
(−2) 1 −3 0 (4)
𝑟23 1 −3 0
𝐴= 0 1 3 0 1 3 0 1 3 =𝑈
2 −10 2 0 −4 2 0 0 14
(4) (−2)
⇒ 𝑅23 𝑅13 𝐴 = 𝑈
(−2) (4)
⇒ 𝐴 = (𝑅13 )−1 (𝑅23 )−1 𝑈 = 𝐿𝑈
1 0 0 1 0 0 1 0 0
= 0 1 0 0 1 0 = 0 1 0
2 0 1 0 −4 1 2 −4 1
☼
Spring, 2020 Solving Linear Systems 55
LU-factorization
Solving Ax=b with an LU-factorization of A
𝐴𝑥 = 𝑏 If A = LU , then LUx = b
Let y = Ux, then Ly = b
Two steps:
☼
Spring, 2020 Solving Linear Systems 56
LU-factorization
Ex: (Solving a linear system using LU-factorization)
𝑥1 − 3𝑥2 = −5
𝑥2 + 3𝑥3 = −1
2𝑥1 − 10𝑥2 + 2𝑥3 = −20
Sol:
1 −3 0 1 0 0 1 −3 0
𝐴= 0 1 3 = 0 1 0 0 1 3 = 𝐿𝑈
2 −10 2 2 −4 1 0 0 14
LU-factorization
(2) Solve the following system 𝑈𝑥 = 𝑦
1 −3 0 𝑥1 −5
0 1 3 𝑥2 = −1
0 0 14 𝑥3 −14
So
𝑥3 = −1
𝑥2 = −1 − 3𝑥3 = −1 − (3)(−1) = 2
𝑥1 = −5 + 3𝑥2 = −5 + 3(2) = 1
1
𝐱= 2
−1
☼
Spring, 2020 Solving Linear Systems 58
0 1 2
• Example: Find the LU factorization of 𝐴 = 1 1 1.
2 3 5
• Sol:
(1)
We cannot do 𝑟21 because LU factorization required to perform only the
row operation of adding a multiple of one row to another row below it.
☼
Spring, 2020 Solving Linear Systems 60
Your Turn
Your Turn
1 1 1 1
1 2 3 4
𝐴= .
1 3 6 10
1 4 10 20
Spring, 2020 Solving Linear Systems 62
GPS (Cont’d.)
• Need very precise clock to be able to compute the
distance from the receiver to the satellites!
• This type of clock is very expensive.
• Need a cheap solution
• → Solve for distance using one additional satellite.
•
Satellite Position Time (from
midnight)
1 (1.11, 2.55, 2.14) 1.29
2 (2.87, 0.00, 1.43) 1.31
3 (0.00, 1.08, 2.29) 2.75
4 (1.54, 1.01, 1.23) 4.06
Spring, 2020 Solving Linear Systems 65
GPS (Cont’d.)
• Let (𝑥, 𝑦, 𝑧) be your position, and let 𝑡 be the signals arrive.
• What is the distance from you to the first satellite?
• 𝑑 = 0.47 (𝑡 − 1.29)
•𝑑= 𝑥 − 1.1 2 + 𝑦 − 2.55 2 + 𝑧 − 2.14 2
• Putting the two equations together and rearrange,
• 𝑥 − 1.11 2 + 𝑦 − 2.55 2 + 𝑧 − 2.14 2 = 0.472 𝑡 − 1.29 2
• ➔
• 2.22𝑥 + 5.10𝑦 + 4.28𝑧 − 0.57𝑡 = 𝑥 2 + 𝑦 2 + 𝑧 2 − 0.22𝑡 2 + 11.95
Equation (1)
Satellite Position Time (from
midnight)
1 (1.11, 2.55, 2.14) 1.29
2 (2.87, 0.00, 1.43) 1.31
Spring, 2020 Solving Linear Systems 66
GPS (Cont’d.)
• Repeat the process for all satellites
• 2.22𝑥 + 5.10𝑦 + 4.28𝑧 − 0.57𝑡 = 𝑥 2 + 𝑦 2 + 𝑧 2 − 0.22𝑡 2 + 11.95
• 5.74𝑥 + 2.86𝑧 − 0.58𝑡 = 𝑥 2 + 𝑦 2 + 𝑧 2 − 0.22𝑡 2 + 9.90
• 2.16𝑦 + 4.58𝑧 − 1.21𝑡 = 𝑥 2 + 𝑦 2 + 𝑧 2 − 0.22𝑡 2 + 4.74
• 3.08𝑥 + 2.02𝑦 + 2.46𝑧 − 1.79𝑡 = 𝑥 2 + 𝑦 2 + 𝑧 2 − 0.22𝑡 2 + 1.26
• Subtract the first equation from each of the other equations:
• 3.52𝑥 − 5.10𝑦 − 1.42𝑧 − 0.01𝑡 = −2.05
• −2.22𝑥 − 2.94𝑦 + 0.30𝑧 − 0.64𝑡 = −7.21
• 0.86𝑥 − 3.08𝑦 − 1.82𝑧 − 1.22𝑡 = −10.69
Spring, 2020 Solving Linear Systems 67
GPS (Cont’d.)
• The augmented matrix:
GPS (Cont’d.)
• 2.97 − 0.36𝑡 − 1.11 2 + 0.81 − 0.03𝑡 − 2.55 2 +
5.91 − 0.79𝑡 − 2.14 2 = 0.472 𝑡 − 1.29 2
• ➔ 0.54𝑡 2 − 6.65𝑡 + 20.32 = 0
• ➔ 𝑡 = 6.74 and 𝑡 = 5.56
• The first solution gives 𝑥, 𝑦, 𝑧 = (0.55, 0.61, 0.56)
• The second solution gives 𝑥, 𝑦, 𝑧 = 0.96, 0.65, 1.46 . (not
on surface, rejected)
• ➔ 𝑥, 𝑦, 𝑧 = (0.55, 0.61, 0.56)
Spring, 2020 Solving Linear Systems 69
Homework
• Watch Video:
https://cool.ntu.edu.tw/courses/1220/modules/items/3464
8
• 歡迎在影片中留言。
• 2.1: 5, 8
• 2.2: 13, 15, 28
• 2.3: 11, 26, 28
• 2.5: 9