This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
Problem 4
MATLAB Command Window
EDU>> HW5_Prob4
permutation matrix such that P*A=L*U
0
1
1
0
lower triangular matrix, L
1
0
0
1
upper triangular matrix, U
1
1
0
1
MATLAB m-file
HW5_Prob4.m
A = [0 1; 1 1];
[L,U,P] = lu(A) ;
disp(' '); disp(' ');
disp('permutation matrix such that P*A=L*U')
disp(P);
disp('lower triangular matrix, L')
disp(L);
disp('upper triangular matrix, U')
disp(U);
Note:
In this case, we cannot use [L, U] = lu(A) to get a lower triangular matrix and an upper
triangular matrix. The command [L, U] = lu(A) gives the result:
L
= [
0
1 ;
1
0 ]
U
= [
1
1 ;
0
1 ]
Although A = L*U, the L matrix obtained above is NOT a lower triangular matrix (L
should have nonzero diagonal elements as defined in the textbook).