ce190 - lecture 5

19
NUMERICAL METHODS FOR ENGINEERS LECTURE 05 LU DECOMPOSITION AND MATRIX INVERSION SJSU, by Ngoc Pham + Udeme Ndon 1 Lecture Note 5

Upload: zettabytezz

Post on 16-Sep-2014

63 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CE190 - Lecture 5

NUMERICAL METHODSFOR ENGINEERS

LECTURE 05

LU DECOMPOSITION

AND

MATRIX INVERSION

SJSU, by Ngoc Pham + Udeme Ndon 1Lecture Note 5

Page 2: CE190 - Lecture 5

LU DECOMPOSITION

Definition:

A nonsingular matrix A has a triangular factorization if it can be expressed as the product of a lower triangular matrix L and an upper triangular matrix U.

• Solve A . X = B (system of linear equations)

• Decompose A = L . U

*

L : Lower Triangular Matrix U : Upper Triangular Matrix

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 2

00

Page 3: CE190 - Lecture 5

LU DECOMPOSITION

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 3

Solving Systems of equation by LU Decomposition:

Assume: [A]{X}={B}

[L][U]=[A] [L][U]{X}={B}

Consider [U]{X}={d}[L]{d}={B}

1.Solve [L]{d}={B} using forward substitution to get {d}

2.Use back substitution to solve [U]{X}={d} to get {X}

Page 4: CE190 - Lecture 5

LU DECOMPOSITION

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 4

BXA BXUL

333231

232221

131211

aaa

aaa

aaa

A

[ U ][ L ]

33

2322

131211

3231

21

00

0

1

01

001

u

uu

uuu

ll

l

Page 5: CE190 - Lecture 5

LU DECOMPOSITION

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 5

''

'

''

''

3

2

1

3

2

1

33

2322

131211

00

0

b

b

b

x

x

x

a

aa

aaa

3

2

1

3

2

1

333231

232221

131211

b

b

b

x

x

x

aaa

aaa

aaa

Gauss Elimination

BXA BXUL

1

01

001

3231

21

ll

lL

Coefficients used during the elimination step

[ U ]

Page 6: CE190 - Lecture 5

LU DECOMPOSITION

SJSU, by Ngoc Pham + Udeme Ndon

Lecture Note 5 6

''

''

33

2322

131211

3231

21

333231

232221

131211

00

0

1

01

001

a

aa

aaa

ll

l

aaa

aaa

aaa

A

[ L . U ]

?32

11

3131

11

2121

l

a

al

a

al

Page 7: CE190 - Lecture 5

LU DECOMPOSITION

Example 1: Solve the following system of equations using LU Decomposition.

2x - 3y + 4z = 5

X + 2y – 3z = 2

4x + y + 2z =1

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 7

Page 8: CE190 - Lecture 5

LU DECOMPOSITION

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 8

Page 9: CE190 - Lecture 5

LU DECOMPOSITION

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 9

Page 10: CE190 - Lecture 5

INVERSE MATRIX

Inverse of a Matrix:

–If A is a square nxn matrix, and if there exist an nxnmatrix A-1 such that.

AA-1 = I

A-1 is called the inverse of the matrix A

Not all square matrix has its inverse. – If there is an inverse for a matrix A, then A is said to be a

nonsingular matrix or to be non singular.

– If A has no inverse, it is said to be a singular matrix or to be singular.

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 10

Page 11: CE190 - Lecture 5

INVERSE MATRIX

For a matrix equation of the form:

AX = B

The following rules apply if A-1 exists:

• A-(AX) = A-B

• (A-A)X = A-B

• IX = A-B

• X = A-B

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 11

Page 12: CE190 - Lecture 5

INVERSE MATRIX

To find an inverse of a matrix A, if it exists, we:

1. Form the matrix [A|I] as an augmented matrix

2. Reduce matrix A to an identity matrix while I becomes a non-identity matrix

3. The new non-identity nxn matrix formed from I is inverse of A (A-)

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 12

Page 13: CE190 - Lecture 5

INVERSE MATRIX

Example 2: Find the inverse of matrix A

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 13

340

431

011

A

Page 14: CE190 - Lecture 5

INVERSE MATRIX

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 14

Page 15: CE190 - Lecture 5

INVERSE MATRIX

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 15

Page 16: CE190 - Lecture 5

INVERSE MATRIX

Example 3: Show that matrix A has no inverse

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 16

32

64A

Page 17: CE190 - Lecture 5

INVERSE MATRIX

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 17

Page 18: CE190 - Lecture 5

INVERSE MATRIX

Matrix Inverse Method for a 2x2 matrix:

For a 2x2 matrix A, the inverse A-1 is given by:

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 18

1121

1222

21122211

1

2221

1211

1

aa

aa

aaaaA

aa

aaA

Page 19: CE190 - Lecture 5

INVERSE MATRIX

Example: Find the inverse of matrix A

SJSU, by Ngoc Pham + Udeme Ndon Lecture Note 5 19

32

11

32

11

1

1

32

11

)2)(1()1)(3(

1

12

13

1

1

A

A

A