Download Inverse of Elementary Matrix

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Capelli's identity wikipedia , lookup

Matrix completion wikipedia , lookup

Symmetric cone wikipedia , lookup

Linear least squares (mathematics) wikipedia , lookup

Rotation matrix wikipedia , lookup

Eigenvalues and eigenvectors wikipedia , lookup

System of linear equations wikipedia , lookup

Principal component analysis wikipedia , lookup

Determinant wikipedia , lookup

Jordan normal form wikipedia , lookup

Four-vector wikipedia , lookup

Singular-value decomposition wikipedia , lookup

Matrix (mathematics) wikipedia , lookup

Non-negative matrix factorization wikipedia , lookup

Perron–Frobenius theorem wikipedia , lookup

Orthogonal matrix wikipedia , lookup

Cayley–Hamilton theorem wikipedia , lookup

Matrix calculus wikipedia , lookup

Matrix multiplication wikipedia , lookup

Gaussian elimination wikipedia , lookup

Transcript
Inverse of a Matrix
Hung-yi Lee
Inverse of a Matrix
• What is the inverse of a matrix?
• Elementary matrix
• What kinds of matrices are invertible
• Find the inverse of a general invertible matrix
Inverse of a Matrix
What is the inverse
of a matrix?
Inverse of Function
• Two function f and g are inverse of each other (f=g-1,
g=f-1) if ……
For 𝑎𝑛𝑦 𝑣
𝑦=𝑔 𝑥
g
𝑥=𝑓 𝑣
f
𝑣
f
𝑥=𝑔 𝑣
g
𝑣
𝑦=𝑣
𝑦=𝑓 𝑥
𝑦=𝑣
Inverse of Matrix
• If B is an inverse of A, then A is an inverse of B, i.e.,
A and B are inverses to each other.
𝐴𝐵 = 𝐼
For 𝑎𝑛𝑦 𝑣
𝑦=𝑔 𝑥
A
𝑥=𝑓 𝑣
B
𝑣
B
𝑥=𝑔 𝑣
A
𝑣
𝑦=𝑣
𝑦=𝑓 𝑥
𝑦=𝑣
𝐵𝐴 = 𝐼
Inverse of Matrix
• If B is an inverse of A, then A is an inverse of B, i.e.,
A and B are inverses to each other.
A is called invertible if there is a matrix B
such that 𝐴𝐵 = 𝐼 and 𝐵𝐴 = 𝐼
B is an inverse of A
𝐴=
1
3
2
5
𝐵=
−5
3
𝐵 = 𝐴−1 𝐴−1 = B
2
−1
𝐴𝐵 =
1
0
0
1
𝐵𝐴 =
1 0
0 1
Inverse of Matrix
• If B is an inverse of A, then A is an inverse of B, i.e.,
A and B are inverses to each other.
A is called invertible if there is an matrix B
n x n?
such that 𝐴𝐵 = 𝐼 and 𝐵𝐴 = 𝐼
B is an inverse of A
𝐵 = 𝐴−1 𝐴−1 = B
Non-square matrix cannot be invertible
Inverse of Matrix
• Not all the square matrix is invertible
• Unique
𝐴𝐵 = 𝐼
𝐵𝐴 = 𝐼
𝐴𝐶 = 𝐼
𝐶𝐴 = 𝐼
𝐵 = 𝐵𝐼 = 𝐵 𝐴𝐶 = 𝐵𝐴 𝐶 = 𝐼𝐶 = 𝐶
Solving Linear Equations
• The inverse can be used to solve system of linear
equations.
If A is invertible.
𝐴𝑥 = 𝑏
However, this method is computationally inefficient.
Input-output Model
• 假設世界上只有食物、黃金、木材三種資源
生產一單位食物
生產一單位黃金
生產一單位木材
需要食物
0.1
0.2
0.1
需要黃金
0.2
0.4
0.2
Cx
0.1𝑥1 + 0.2𝑥2 + 0.1𝑥3
0.1
0.2𝑥1 + 0.4𝑥2 + 0.2𝑥3 = 0.2
0.3𝑥1 + 0.1𝑥2 + 0.1𝑥3
0.3
須投入
需要木材˙
0.3
0.1
0.1
C
0.2 0.1
0.4 0.2
0.1 0.1
Consumption
matrix
x
𝑥1
𝑥2
𝑥3
想生產
Input-output Model
Cx
48
96
53
須投入
0.1
= 0.2
0.3
C
0.2 0.1
0.4 0.2
0.1 0.1
Consumption
matrix
x
100
150
80
想生產
須考慮成本:
淨收益
𝑥 − 𝐶𝑥 =
52
100
48
Demand
=
54
150 − 96
Vector d
27
80
53
Input-output Model
0.1
𝐶 = 0.2
0.3
0.2 0.1
0.4 0.2
0.1 0.1
90
𝑑 = 80
60
Demand
Vector d
生產目標 x 應該訂為多少?
𝑥 − 𝐶𝑥 = 𝑑
𝐼𝑥 − 𝐶𝑥 = 𝑑
𝐼−𝐶 𝑥 =𝑑
Ax=b
0.9
A = 𝐼 − C = −0.2
−0.3
90
𝑏 = 80
60
−0.2
0.6
−0.1
170
𝑥 = 240
150
−0.1
−0.2
0.9
Input-output Model
• 提升一單位食物的淨產值,需要多生產多少資源?
Ans: The first column of 𝐼 − 𝐶
𝑥 = 𝐼−𝐶
𝐼−𝐶 𝑥 =𝑑
𝑑
1
𝑑 + 0 = 𝑑 + 𝑒1
0
𝐼−𝐶
−1
𝑥′ = 𝐼 − 𝐶
= 𝐼−𝐶
−1
−1
𝑑
𝑑 + 𝑒1
−1 𝑑
1.3 0.475 0.25
= 0.6 1.950 0.50
0.5 0.375 1.25
食物 黃金 木材
−1
+ 𝐼−𝐶
−1 𝑒
1
Inverse for matrix product
• A and B are invertible nxn matrices, is AB invertible?
𝐴𝐵
𝐵−1 𝐴−1 𝐴𝐵
−1
yes
= 𝐵−1 𝐴−1
= 𝐵−1 𝐴−1 𝐴 𝐵 = 𝐵−1 𝐵 = 𝐼
𝐴𝐵 𝐵−1 𝐴−1 = 𝐴 𝐵𝐵−1 𝐴−1 = 𝐴 𝐴−1 = 𝐼
• Let 𝐴1 , 𝐴2 , ⋯ , 𝐴𝑘 be nxn invertible matrices. The product
𝐴1 𝐴2 ⋯ 𝐴𝑘 is invertible, and
𝐴1 𝐴2 ⋯ 𝐴𝑘
−1
= 𝐴𝑘
−1
𝐴𝑘−1
−1 ⋯
𝐴1
−1
Inverse for matrix transpose
• If A is invertible, is AT invertible?
𝐴𝑇
𝐴𝐵
𝑇
−1
=?
𝐴−1
𝑇
= 𝐵𝑇 𝐴𝑇
𝐴−1 𝐴 = 𝐼
𝐴−1 𝐴
𝑇
=𝐼
𝐴𝐴−1 = 𝐼
𝐴𝐴−1
𝑇
=𝐼
𝐴𝑇 𝐴−1
𝑇
=𝐼
𝐴−1 𝑇 𝐴𝑇 = 𝐼
Inverse of a Matrix
Inverse of
elementary matrices
Elementary Row Operation
 Every elementary row operation can be performed by
matrix multiplication.
 1. Interchange
elementary matrix
0
1
1
0
1
0
0
k
 2. Scaling
 3. Adding k times row i to row j:
1
k
0
1
Elementary Matrix
 Every elementary row operation can be performed by
matrix multiplication.
 How to find elementary matrix?
elementary matrix
E.g. the elementary matrix that exchange the 1st and 2nd
rows
1
𝐸 2
3
4
2 5
5 = 1 4
6
3 6
1
𝐸 0
0
0 0
0 1 0
1 0 = 1 0 0
0 1
0 0 1
0 1 0
𝐸= 1 0 0
0 0 1
Elementary Matrix
• How to find elementary matrix?
• Apply the desired elementary row operation on
Identity matrix
Exchange the
and 3rd rows
2nd
Multiply the 2nd
row by -4
Adding 2 times
row 1 to row 3
1
0
0
1
0
0
1
0
0
0
1
0
0
1
0
0
1
0
0
0
1
0
0
1
0
0
1
1
𝐸1 = 0
0
1
𝐸2 = 0
0
1
𝐸3 = 0
2
0 0
0 1
1 0
0 0
−4 0
0 1
0 0
1 0
0 1
Elementary Matrix
• How to find elementary matrix?
• Apply the desired elementary row operation on
Identity matrix
1 4
𝐴= 2 5
3 6
1 4
𝐸1 𝐴 = 3 6
2 5
1
4
𝐸2 𝐴 = −8 −20
3
6
1 4
𝐸3 𝐴 = 2 5
5 14
1
𝐸1 = 0
0
1
𝐸2 = 0
0
1
𝐸3 = 0
2
0 0
0 1
1 0
0 0
−4 0
0 1
0 0
1 0
0 1
Inverse of Elementary Matrix
Reverse elementary row
operation
Exchange the 2nd and 3rd rows
1 0 0
𝐸1 = 0 0 1
0 1 0
Exchange the 2nd and 3rd rows
1 0 0
𝐸1−1 = 0 0 1
0 1 0
Multiply the 2nd row by -4
1 0
𝐸2 = 0 −4
0 0
0
0
1
Adding 2 times row 1 to row 3
1 0 0
𝐸3 = 0 1 0
2 0 1
Multiply the 2nd row by -1/4
𝐸2−1
1
0
0
= 0 −1/4 0
0
0
1
Adding -2 times row 1 to row 3
𝐸3−1
1
= 0
−2
0 0
1 0
0 1
RREF v.s. Elementary Matrix
• Let A be an mxn matrix with reduced row echelon
form R.
𝐸𝑘 ⋯ 𝐸2 𝐸1 𝐴 = 𝑅
• There exists an invertible m x m matrix P such that
PA=R
𝑃 = 𝐸𝑘 ⋯ 𝐸2 𝐸1
𝑃−1 = 𝐸1−1 𝐸2−1 ⋯ 𝐸𝑘−1
Inverse of a Matrix
Invertible
Summary
• Let A be an n x n matrix. A is invertible if and only if
• The columns of A span Rn
• For every b in Rn, the system Ax=b is consistent
• The rank of A is n
• The columns of A are linear independent
• The only solution to Ax=0 is the zero vector
• The nullity of A is zero
• The reduced row echelon form of A is In
• A is a product of elementary matrices
• There exists an n x n matrix B such that BA = In
• There exists an n x n matrix C such that AC = In
http://goo.gl/z3J5Rb
Review
Range (值域)
• Given a function f
𝑣1
𝑓 𝑣1
𝑣2
𝑓 𝑣2 = 𝑓 𝑣3
𝑣3
Domain (定義域)
Co-domain (對應域)
Given a linear function corresponding to a mxn matrix A
Domain=Rn
Co-domain=Rm
Range=?
One-to-one
• A function f is one-to-one
𝑣1
𝑣2
𝑣3
𝑓 𝑣1
𝑓 𝑣2
𝑓 𝑣3
𝑓 𝑥 = 𝑏 has one solution
𝑓 𝑥 = 𝑏 has at most one solution
If co-domain is “smaller”
than the domain, f
cannot be one-to-one.
If a matrix A is 矮胖, it
cannot be one-to-one.
The reverse is not true.
If a matrix A is one-toone, its columns are
independent.
Onto
• A function f is onto
𝑣1
𝑣2
𝑣3
If co-domain is “larger”
than the domain, f
cannot be onto.
𝑓 𝑣1
𝑓 𝑣2
= 𝑓 𝑣3
Co-domain = range
𝑓 𝑥 = 𝑏 always have solution
If a matrix A is 高瘦, it
cannot be onto.
The reverse is not true.
If a matrix A is onto,
rank A = no. of rows.
One-to-one and onto
• A function f is one-to-one and onto
𝑣1
𝑓 𝑣1
𝑣2
𝑓 𝑣2
𝑣3
𝑓 𝑣3
One-to-one
The domain and codomain must have “the
same size”.
The corresponding matrix
A is square.
Onto
在滿足 Square 的前提下,要就都成立,要就都不成立
An invertible matrix A
is always square.
Invertible
• A is called invertible if there is a matrix B such that
𝐴𝐵 = 𝐼 and 𝐵𝐴 = 𝐼 (𝐵 = 𝐴−1 )
𝐴
𝐴𝑣
𝐴
𝑣
𝐴−1 𝑣
𝑣
𝐴−1
𝐴−1
A must be one-to-one
A must be onto
(不然 𝐴−1 的 input 就會有限制)
Invertible
• Let A be an n x n matrix.
• Onto → One-to-one → invertible
• The columns of A span Rn
• For every b in Rn, the system Ax=b is consistent
• The rank of A is the number of rows
• One-to-one → Onto → invertible
Rank A = n
• The columns of A are linear independent
• The rank of A is the number of columns
• The nullity of A is zero
• The only solution to Ax=0 is the zero vector
• The reduced row echelon form of A is In
Invertible
• Let A be an n x n matrix. A is invertible if and only if
• The reduced row echelon form of A is In
RREF
In
Invertible
RREF
Not Invertible
Summary
=
• Let A be an n x n matrix. A is invertible if and only if
• The columns of A span Rn
onto • For every b in Rn, the system Ax=b is consistent
• The rank of A is n
• The columns of A are linear independent
One-to- • The only solution to Ax=0 is the zero vector
one
• The nullity of A is zero
• The reduced row echelon form of A is In
• A is a product of elementary matrices
• There exists an n x n matrix B such that BA = In
• There exists an n x n matrix C such that AC = In
square
matrix
Invertible
An n x n matrix A is
invertible.
The reduced row
echelon form of A is In
A is a product of
elementary matrices
R=RREF(A)=In
𝐸𝑘 ⋯ 𝐸2 𝐸1 𝐴 = 𝐼𝑛
𝐴 = 𝐸1−1 𝐸2−1 ⋯ 𝐸𝑘−1 𝐼𝑛
= 𝐸1−1 𝐸2−1 ⋯ 𝐸𝑘−1
Invertible
An n x n matrix A is
invertible.
There exists an n x n
matrix B such that BA = In
?
The only solution to
Ax=0 is the zero vector
If 𝐴𝑣 = 0, then ….
𝐵𝐴 = 𝐼𝑛
𝐵𝐴𝑣 = 0
𝐼𝑛 𝑣 = 𝑣
𝑣=0
Invertible
An n x n matrix A is
invertible.
?
There exists an n x n
matrix C such that AC = In
For every b in Rn, Ax=b
is consistent
For any vector b,
𝐴𝐶 = 𝐼𝑛
𝐴𝐶𝑏
𝐼𝑛 𝑏 = b
𝐶𝑏 is always a solution for 𝑏
Summary
=
• Let A be an n x n matrix. A is invertible if and only if
• The columns of A span Rn
onto • For every b in Rn, the system Ax=b is consistent
• The rank of A is n
• The columns of A are linear independent
One-to- • The only solution to Ax=0 is the zero vector
one
• The nullity of A is zero
• The reduced row echelon form of A is In
• A is a product of elementary matrices
• There exists an n x n matrix B such that BA = In
• There exists an n x n matrix C such that AC = In
square
matrix
Questions
• If A and B are matrices such that AB=In for some n,
then both A and B are invertible.
• For any two n by n matrices A and B, if AB=In, then
both A and B are invertible.
Inverse of a Matrix
Inverse of
General invertible matrices
2 X 2 Matrix
𝑎
𝐴=
𝑐
𝑏
𝑑
𝐴−1
𝑎
𝑐
−1
𝐴
𝑒
=
𝑔
𝑏 𝑒
𝑑 𝑔
𝑓
ℎ
𝑓
1
=
ℎ
0
1
𝑑
=
𝑎𝑑 − 𝑏𝑐 −𝑐
Find 𝑒, 𝑓, 𝑔, ℎ
0
1
−𝑏
𝑎
If 𝑎𝑑 − 𝑏𝑐 = 0, A is not invertible.
Algorithm for Matrix Inversion
• Let A be an n x n matrix. A is invertible if and only if
• The reduced row echelon form of A is In
𝐸𝑘 ⋯ 𝐸2 𝐸1 𝐴 = 𝑅 = 𝐼𝑛
𝐴−1
𝐴−1 = 𝐸𝑘 ⋯ 𝐸2 𝐸1
Algorithm for Matrix Inversion
• Let A be an n x n matrix. Transform [ A In ] into its
RREF [ R B ]
• R is the RREF of A
• B is an nxn matrix (not RREF)
• If R = In, then A is invertible
• B = A-1
𝐸𝑘 ⋯ 𝐸2 𝐸1 𝐴 𝐼𝑛
= 𝑅
𝐼𝑛
𝐸𝑘 ⋯ 𝐸2 𝐸1
𝐴−1
Algorithm for Matrix Inversion
RREF
In
Invertible
Algorithm for Matrix Inversion
• Let A be an n x n matrix. Transform [ A In ] into its
RREF [ R B ]
• R is the RREF of A
• B is a nxn matrix (not RREF)
• If R = In, then A is invertible
• B = A-1
• To find A-1C, transform [ A C ] into its RREF [ R C’ ]
• C’ = A-1C
𝐴−1 𝐶
𝐸𝑘 ⋯ 𝐸2 𝐸1 𝐴
𝐶 = 𝑅
𝐼𝑛
𝐸𝑘 ⋯ 𝐸2 𝐸1 𝐶
𝐴−1
P139 - 140
Acknowledgement
• 感謝 周昀 同學發現投影片上的錯誤
Appendix
2 X 2 Matrix
𝑎
𝐴=
𝑐
𝑎 𝑐
≠
𝑏 𝑑
𝑎
𝑏
≠𝑘
𝑐
𝑑
𝑏
𝑑
𝑎𝑑 − 𝑏𝑐 ≠ 0
𝑎𝑑 ≠ 𝑏𝑐
𝐴−1
𝑒
=
𝑔
𝑓
𝑓
𝑎
𝑐
𝑏 𝑒
𝑑 𝑔
𝑓
1
=
𝑓
0
Find 𝑒, 𝑓, 𝑔, ℎ
0
1
𝐴−1
1
𝑑
=
𝑎𝑑 − 𝑏𝑐 −𝑐
−𝑏
𝑎