Docsity

LU Decomposition - Numerical Methods - Lecture Slides, Slides of Mathematical Methods for Numerical Analysis and Optimization

Partial preview of the text

Download LU Decomposition - Numerical Methods - Lecture Slides and more Slides Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

LU Decomposition

LU Decomposition

LU Decomposition is another method to solve a set of

simultaneous linear equations

Which is better, Gauss Elimination or LU Decomposition?

To answer this, a closer look at LU decomposition is

needed.

How does LU Decomposition work?

If solving a set of linear equations If [ A ] = [ L ][ U ] then Multiply by Which gives Remember [ L ] -1^ [ L ] = [ I ] which leads to Now, if [ I ][ U ] = [ U ] then Now, let Which ends with and

[ A ][ X ] = [ C ] [ L ][ U ][ X ] = [ C ] [ L ] - [ L ] -1^ [ L ][ U ][ X ] = [ L ] -1^ [ C ] [ I ][ U ][ X ] = [ L ] -1^ [ C ] [ U ][ X ] = [ L ] -1^ [ C ] [ L ] -1^ [ C ]=[ Z ] [ L ][ Z ] = [ C ] (1) [ U ][ X ] = [ Z ] (2)

LU Decomposition

How can this be used?

Given [ A ][ X ] = [ C ]

  1. Decompose [ A ] into [ L ] and [ U ]
  2. Solve [ L ][ Z ] = [ C ] for [ Z ]
  3. Solve [ U ][ X ] = [ Z ] for [ X ]

To find inverse of [A]

Time taken by Gaussian Elimination Time taken by LU Decomposition ( ) = ^ + + 

= + 3 12 4 3

8

| | 2 T n^4 n^3 n

n CT FE CT BS = ^ + + 

= + × + × 3 12 20 3

32

| | | T n^3 n^2 n

CT (^) LU n CT FS n CT BS

n 10 100 1000 10000 CT|inverse GE / CT|inverse LU 3.28 25.83 250.8 2501

Table 1 LU decomposition and Gaussian elimination. Comparing computational times of finding inverse of a matrix using

Method: [A] Decompose to [L] and [U]

[ ] [ ][ ] 

 

 

 

 

 = = 33

22 23

11 12 13

31 32

21 0 0

0 1

1 0

1 0 0

u

u u

u u u A L U  

[elimination step. U ] is the same as the coefficient matrix at the end of the forward [elimination process L ] is obtained using the multipliers that were used in the forward

Finding the [U] Matrix

Step 2:



 

 

 

 − −

− − 0 16. 8 4. 76

0 4. 8 1. 56

25 5 1

( ) 0 0 0. 7

−− (^) = Row − Row = − −

[ ]

U

Matrix after Step 1:

Finding the [ L ] matrix

Using the multipliers used during the Forward Elimination Procedure

31 32

21

 21 = aa 1121 =^6425 = 2. 56  31 = aa 1131 =^14425 = 5. 76

From the first stepof forward elimination 144 12 1

64 8 1

25 5 1



 

 

 

Does [L][U] = [A]?

[ ][ ] =

 

 

 − − 

 

 

0 0 0. 7

0 4. 8 1. 56

25 5 1

  1. 76 3. 5 1

  2. 56 1 0

1 0 0

L U?

Using LU Decomposition to solve SLEs

Solve the following set oflinear equations using LU Decomposition (^) 

3

2

1 .

x

x

x

Using the procedure for finding the [ L ] and [ U ] matrices

[ ] [ ][ ]

A L U

Example

Complete the forward substitution to solve for [ Z ]

( )

( ) ( )

  1. 735

  2. 2 5. 76106. 8 3. 5 96. 21

  3. 2 5. 76 3. 5

  4. 2

  5. 2 2. 56106. 8

  6. 2 2. 56

  7. 8

3 1 2

2 1

1

=

= − − −

= − −

=−

= −

= −

=

z z z

z z

z

[ ] 

 

 

 = − 

 

 

  1. 735

  2. 21

  3. 8

3

2

1

z

z

z Z

Example

Set [ U ][ X ] = [ Z ]

Solve for [ X ] The 3 equations become

 

 

 = − 

 

 

 

 

 − − 0735

9621

1068

0 0 0. 7

0 4. 8 1. 56

25 5 1

3

2

1 .

.

.

x

x

x

  1. 7 0. 735

  2. 8 1. 56 96. 21

25 5 106. 8

3

2 3

1 2 3

=

− − = −

    • =

a

a a

a a a

Example

Substituting in athe first equation 3 and a 2 using

25 a 1 (^) + 5 a 2 + a 3 = 106_._ 8

Hence the Solution Vector is:

 

 

 

 

  1. 050

  2. 70

  3. 2900

3

2

1

a

a

a

( ) 02900

25

1068 51970 1050

25 1 106 8 5 2 3

.

...

a. a a

=

= − −

= − −

Finding the inverse of a square matrix

The inverse [B] of a square matrix [ A ] is defined as

[ A ][ B ] = [ I ] = [ B ][ A ]