Chapter 11 Matrix Inverse and Condition
zHow do we get inverse [A] 1 ? zOne way is through LU decomposition and back- substitution zSolve [A]{x i } = {b i } with zPut together x’s to get [A] -1 ={x 1, x 2,x 3,x 4 } Matrix Inverse Sequentially!
z[A] [A] 1 = [ I ] zUse LU factorization to find [X] = [A] 1 zLU decomposition: [A] = [L][U] zForward substitution: [L][Y] = [ I ] zBack substitution: [U][X] = [Y]
Matrix Inverse zForward Substitution [L][Y] = [ I ]
Matrix Inverse zback Substitution [U][X] = [ Y ]
function x = LU_Solve_Gen(L, U, B) % Function to solve the equation L U x = B % L --> Lower triangular matrix (1's on diagonal) % U --> Upper triangular matrix % B --> Right-hand-side matrix [n n2] = size(L); [m1 m] = size(B); % Solve L d = B using forward substitution for j = 1 : m d(1,j) = B(1,j); for i = 2 : n d(i,j) = B(i,j) - L(i, 1:i-1) * d(1:i-1,j); end % SOlve U x = d using back substitution for j = 1 : m x(n,j) = d(n,j) / U(n,n); for i = n-1 : -1 : 1 x(i,j) = (d(i,j) - U(i,i+1:n) * x(i+1:n,j)) / U(i,i); end
» B=eye(3) B = » x=LU_solve_gen(L,U,B) x = » inv(A) ans = » A=[ ; ; ] A = » [L,U]=LU_factor(A); L = U = Example: Matrix Inverse MATLAB function
Error Analysis and System Condition zThe matrix inverse provides a means to discern whether a system is ill-conditioned 1.Normalize rows of matrix [A] to 1. If the elements of [A] 1 are >> 1, the matrix is likely ill-conditioned 2.If [A] 1 [A] is not close to [ I ], the matrix is probably ill-conditioned 3.If ([A] 1 ) 1 is not close to [A], the matrix is ill- conditioned
Vector and Matrix Norms Norm: provide a measure of the size or “length” of multi- component mathematical entities such as vectors and matrices Euclidean norm of a vector (3D space)
Matrix Norm zFor n n matrix, the Frobenius norm zFrobenius norm provides a single value to quantify the size of matrix [A] zOther alternatives – p norms for vectors p = 2 : Euclidean norm
Vector and Matrix Norms zVector norms ( p-norms) zMatrix norms Column-sum norm Row-sum norm Sum of absolute values Maximum-magnitude or uniform-vector norm
Condition number defined in terms of matrix norms Cond[A] is great than or equal to 1 Matrix A is ill-conditioned if Cond[A] >> 1 If [A] has 10 7 rounding error and Cond[A] = 10 5, then the solution [X] may be valid to only 10 2 Matrix Condition Number Relative error of the norm
Matrix Condition Evaluation zHilbert matrix – notoriously ill-conditioned zRow-sum norm (last row has the largest sum) Normalization
Matrix Condition Evaluation z5 5 Hilbert matrix zCondition number
MATLAB Norms and Condition Numbers >> A=[1 1/2 1/3 1/4 1/5; 1 2/3 2/4 2/5 2/6; 1 3/4 3/5 3/6 3/7; 1 4/5 4/6 4/7 4/8; 1 5/6 5/7 5/8 5/9]; >> Ainv = inv(A) Ainv = >> norm(A,inf) ans = >> norm(Ainv,inf) ans = e+005 >> cond(A,inf) ans = e+005 >> cond(A,'fro') ans = e+005 >> cond(A) ans = e+005 >> norm(X,p) >> cond(X,p) >> Cond(A,’fro’) >> cond(A) p-norm Frobenius norm Spectral norm
CVEN Homework No. 7 zChapter 10 zProb. 10.4(20), 10.5(20) both using LU decomposition (hand calculation only, hand partial pivoting if necessary), Prob a)&b) (20). zChapter 11 zProb (15), 11.3 a) & b) (20) (Hand Calculations) zProb (25) (Hand Calculations; Check your solutions using MATLAB) zDue Monday 10/13/08 at the beginning of the period