CSC 445/545 Notes 4.1: Computing LU-factorizations

I used Matlab to do the computations required for making these notes.

We want to LU-factorize a matrix A0.

A0 =

2 -1 2
2 3 1
-1 1 -2

1. The first step is to multiply the first row by 1/2. [ M1(1/2)].
This is equivalent to premultiplying by B1.

B1 =

0.5 0 0
0 1 0
0 0 1
A1 = B1 * A0 =
1 -0.5 1
2 3 1
-1 1 -2


Notes 4.1: Page 2

2. Next, -2 times row 1 is added to row 2 [A1,2(-2)]
and 1 times row 1 is added to row 3. [A1,3(1)].
This is equivalent to premultiplying by B2.

B2 =

     1     0     0
    -2     1     0
     1     0     1

A2 = B3 * A1 =

    1.0000   -0.5000    1.0000
         0    4.0000   -1.0000
         0    0.5000   -1.0000

Notes 4.1: Page 3

3. Now multiply row 2 by 1/4 [M2(1/4)].
This is equivalent to premultiplying by B2.

B3 =

    1.0000         0         0
         0    0.2500         0
         0         0    1.0000

A3 = B3 * A2 =

    1.0000   -0.5000    1.0000
         0    1.0000   -0.2500
         0    0.5000   -1.0000

Notes 4.1: Page 4

4. Next, -1/2 times row 2 is added to row 3 [A2,3(-1/2)].
This is equivalent to premultiplying by B4.

B4 =

    1.0000         0         0
         0    1.0000         0
         0   -0.5000    1.0000

A4 = B4 * A3 =

    1.0000   -0.5000    1.0000
         0    1.0000   -0.2500
         0         0   -0.8750

Notes 4.1: Page 5

5. Finally, premultiply row 3 by -8/7 [M3(-1.1429)].
This is equivalent to premultiplying by B5.


B5 =

    1.0000         0         0
         0    1.0000         0
         0         0   -1.1429

A5 = B5 * A4

    1.0000   -0.5000    1.0000
         0    1.0000   -0.2500
         0         0    1.0000


Notes 4.1: Page 6

L1inv = B2 * B1 0.5000 0 0 -1.0000 1.0000 0 0.5000 0 1.0000

 
L2inv = B4 * B3

    1.0000         0         0
         0    0.2500         0
         0   -0.1250    1.0000

 
L3inv = B5

    1.0000         0         0
         0    1.0000         0
         0         0   -1.1429


Notes 4.1: Page 7

 
L1 =  inv(L1inv)

     2     0     0
     2     1     0
    -1     0     1

 
L2 =  inv(L2inv)

    1.0000         0         0
         0    4.0000         0
         0    0.5000    1.0000

 
L3 =  inv(L3inv)

    1.0000         0         0
         0    1.0000         0
         0         0   -0.8750


Notes 4.1: Page 8

 
L = L1 * L2 * L3

    2.0000         0         0
    2.0000    4.0000         0
   -1.0000    0.5000   -0.8750

 
U =  A5

    1.0000   -0.5000    1.0000
         0    1.0000   -0.2500
         0         0    1.0000

 
TESTA = L * U

     2    -1     2
     2     3     1
    -1     1    -2