es 240: scientific and engineering computation. matrix inverse chapter 11: matrix inverse uchechukwu...
TRANSCRIPT
ES 240: Scientific and Engineering Computation. Matrix Inverse
Chapter 11: Matrix Inverse
Uchechukwu Ofoegbu
Temple University
ES 240: Scientific and Engineering Computation. Matrix Inverse
Gaussian Jordan MethodGaussian Jordan Method
Involves complete pivoting so that the coefficient matrix becomes diagonal
Eliminates the need for substitution Also used in finding inverses
ES 240: Scientific and Engineering Computation. Matrix Inverse
Gaussian Jordan MethodGaussian Jordan Method
Steps
1. Write down the matrix corresponding to the linear system.2. Make sure that the first entry in the first column is nonzero. Do
this by interchanging the first row with one of the rows below it, if necessary.
3. Pivot the matrix about the first entry in the first column.• Pivoting in this case also involves normalizing the diagonal entry
4. Make sure that the second entry in the second column is nonzero. Do this by interchanging the second row with one of the rows below it, if necessary.
5. Pivot the matrix about the second entry in the second column.6. Continue in this manner until you have the identity matrix on
the left hand side
ES 240: Scientific and Engineering Computation. Matrix Inverse
Example – System of EquationsExample – System of Equations
Using the Gauss-Jordan method, solve the following system of equations– Using Matlab colon operations– Check with Matlab’s back slash operation
9321
124
2132
zyx
zyx
zyx
ES 240: Scientific and Engineering Computation. Matrix Inverse
Infinitely Many SolutionsInfinitely Many Solutions
When a linear system cannot be completely diagonalized,
– Apply the Gaussian elimination method to as many columns as possible. Proceed from left to right, but do not disturb columns that have already been put into proper form.
– Variables corresponding to columns not in proper form can assume any value.
– The other variables can be expressed in terms of the variables of step 2.
– 4. This will give the general form of the solution.
ES 240: Scientific and Engineering Computation. Matrix Inverse
Example Infinitely Many SolutionsExample Infinitely Many Solutions
Find all solutions of 2 2 4 8
2 2
5 2 2.
x y z
x y z
x y z
General Solution
z = any real number
x = 3 - 2z
y = 1
1 [1]2[2] ( 1)[1][3] 1 [1]
2 2 4 8 1 1 2 4
1 1 2 2 0 2 0 2
1 5 2 2 0 6 0 6
1 [2]2[1] ( 1)[2][3] 6 [2]
1 0 2 3
0 1 0 1
0 0 0 0
ES 240: Scientific and Engineering Computation. Matrix Inverse
Inconsistent SystemInconsistent System
When using the Gaussian elimination method:
if a row of zeros occurs to the left of the vertical line and a nonzero number is to the right of the vertical line in the same row, then the system
has no solution and is said to be inconsistent.
ES 240: Scientific and Engineering Computation. Matrix Inverse
Example Inconsistent SystemExample Inconsistent System
Find all solutions of 3
5
2 4 4 1.
x y z
x y z
x y z
Because of the last row, the system is inconsistent.
[2] ( 1)[1][3] 2 [1]
1 1 1 3 1 1 1 3
1 1 1 5 0 2 2 2
2 4 4 1 0 2 2 7
1 [2]2[1] (1)[2]
[3] 2 [2]
1 0 0 4
0 1 1 1
0 0 0 5
ES 240: Scientific and Engineering Computation. Matrix Inverse
Gauss-Jordan Method for InversesGauss-Jordan Method for Inverses
Step 1: Write down the matrix A, and on its right write an identity matrix of the same size.
Step 2: Perform elementary row operations on the left-hand matrix so as to transform it into an identity matrix. These same operations are performed on the right-hand matrix.
Step 3: When the matrix on the left becomes an identity matrix, the matrix on the right is the desired inverse.
ES 240: Scientific and Engineering Computation. Matrix Inverse
Example InversesExample Inverses
Find the inverse of
4 2 3
8 3 5 .
7 2 4
A
Step 1:
31 11 0 02 4 40 1 1 2 1 0
3 5 70 0 12 4 4
Step 2:
4 2 3 1 0 0
8 3 5 0 1 0
7 2 4 0 0 1
ES 240: Scientific and Engineering Computation. Matrix Inverse
31 11 0 04 4 20 1 1 2 1 0
1 5 30 0 14 4 2
Example Inverses (2)Example Inverses (2)
1 0 0 2 2 1
0 1 0 3 5 4
0 0 1 5 6 4
1
2 2 1
3 5 4
5 6 4
A
Step 3:
ES 240: Scientific and Engineering Computation. Matrix Inverse
Vector and Matrix NormsVector and Matrix Norms
A norm is a real-valued function that provides a measure of the size or “length” of multi-component mathematical entities such as vectors and matrices.
Vector norms and matrix norms may be computed differently.
ES 240: Scientific and Engineering Computation. Matrix Inverse
Vector NormsVector Norms
For a vector {X} of size n, the p-norm is:
Important examples of vector p-norms include:
p 1:sum of the absolute values X1 xi
i1
n
p 2 :Euclidian norm (length) X2 X
e xi
2
i1
n
p :maximum magnitude X
1inmax xi
Xp x i
p
i1
n
1/ p
ES 240: Scientific and Engineering Computation. Matrix Inverse
Matrix NormsMatrix Norms
Common matrix norms for a matrix [A] include:
n
jij
ni
n
i
n
jijf
n
iij
nj
aA
aA
aA
11
1 1
2
111
maxnorm sum-row
norm Frobenius
maxnorm sum-column
ES 240: Scientific and Engineering Computation. Matrix Inverse
ExampleExample
Find the norms of the following:
54321A
43
21B
ES 240: Scientific and Engineering Computation. Matrix Inverse
Ill-Conditioned ProblemsIll-Conditioned Problems
Linear equations that are solvable but solutions become inaccurate because of rounding errors
Small changes in coefficient matrix that will make big changes in solutions
Ill-conditioned problem is the nature of the problem itself
Use format long ( quad precision) for mild ill-condition problems
ES 240: Scientific and Engineering Computation. Matrix Inverse
Ill-Conditioned ProblemsIll-Conditioned Problems
ill-conditioned problem will have– det(A) very small– cond(A) large
Check ill-conditioned– det(A)*det(inv(A) deviates from 1– inv(inv(A)) deviates from A
A*inv(A) deviates from I cond(A*inv(A)) deviates from 1
ES 240: Scientific and Engineering Computation. Matrix Inverse
MATLAB CommandsMATLAB Commands
MATLAB has built-in functions to compute both norms and condition numbers:– norm(X,p)
• Compute the p norm of vector X, where p can be any number, inf, or ‘fro’ (for the Euclidean norm)
– norm(A,p)• Compute a norm of matrix A, where p can be 1, 2, inf, or ‘fro’ (for the
Frobenius norm)
– cond(X,p) or cond(A,p)• Calculate the condition number of vector X or matrix A using the norm
specified by p.
ES 240: Scientific and Engineering Computation. Matrix Inverse
LabLab
Ex 11.2a) Determine the inverse of the coefficient matrix using the
Gauss-Jordan method step-by-step in Matlab
b) Solve the system of equations using the Gauss-Jordan method step-by-step in Matlab
c) Compare your answers to a and b with Matlab’s built-in functions (inv, back slash)
d) Determine the Frobenius norm of the coefficient matrixa) By handb) Using Matlab’s built-in ‘norm’ functionc) Compare your answers