LU Decomposition

Part 1.  The basic LU decomposition

First we load the package containing the LUMatrices command.

<< LinearAlgebra`MatrixManipulation`

A = {{1, -3, 1}, {2, -4, 2}, {2, 
            2, -3}};
A // MatrixForm

Recall that elementary matrices are created by applying a single row operation to an identity matrix.  Complete steps 1-4 below.

I3 = DiagonalMatrix[{1, 1, 1}];
E1  =  I3;
E1[[2]]  =  
      E1[[1]] * (-2)  +  E1[[2]];   E1  //  
      MatrixForm

The following command computes an LU decomposition of the specified matrix and assigns names to the lower and upper triangular factors.  To see both factors,use Print.  (Unfortunately, this command only works for invertible square matrices, even though you can find the LU decomposition of matrices of any size m×n, invertible or not.)

{L2,  U2} = LUMatrices[LUDecomposition[A][[1]]]; 
    Print[L2 // MatrixForm]; Print[U2 // MatrixForm];

Part 2. More examples

B = {{4, 2, 2, -2}, {2, 0, 5, 1}, {-2, -3, 5, 4}}; 
    B // MatrixForm

Answer steps 1-3 here.

Use the following matrix, which is called C on the web page, for step 4.  (C is a Mathematica function, so we can't use it as a variable.)

C0 = {{1, 2, 3}, {-2, -1, -5}, {-1, 4, -3}, {2, 1, 
          1}}; C0 // MatrixForm

Part 3. Solving Equations using LU decompositions

A = {{1, -3, 1}, {2, -4, 2}, {2, 2, -3}}; 
    A // MatrixForm
b = {-10, 4, 1}

Note that multiplying Row 1 by-2 and adding it to Row 2 requires 8 flops (4 multiplications and 4 additions).
Answer steps 1-3 here.

Use the following vector in step 4.

c = {1, 4, 0}

Part 4. A modified decomposition

Enter R and use it for steps 1-4.

R = {{0, 3, -2}, {-1, 3, 0}, {2, 
            3, -5}};
R // MatrixForm

For step 5, enter S and use the given commands to find U.Then explain how to find L.

S = {{1, 1, -1, 0,  0}, {-1, -1, 1, -1,  
          0}, {-1, -1, 0, 0,  -1}, {1, 0, -1, 
          1,  -1}, {-1, 0, 1, -1,  -1}}; 
    S // MatrixForm

S2 = S;
S2[[2]]  = 
        S2[[1]] * (1)  +  
          S2[[2]];
S2[[3]]  = 
        S2[[1]] * (1)  +  
          S2[[3]];
S2[[4]]  = 
        S2[[1]] * (-1)  +  
          S2[[4]];
S2[[5]]  = S2[[1]] * (1)  +  S2[[5]];   S2 // 
      MatrixForm

S3 = S2;
temp  = S3[[2]];    S3[[2]]  = 
      S3[[4]];      S3[[4]]  =  temp;
S3  //  MatrixForm

S4 = S3;
S4[[5]]  = 
        S4[[2]] * (1)  +  
          S4[[5]];
S4 //  MatrixForm

Part 5. Summary

Answer the summary questions here.