Sie sind auf Seite 1von 29

B3001/UNIT 9/1

UNIT 9

NUMERICAL METHODS

OBJECTIVES

General Objective

Specific Objectives :

Application of numerical methods to solve linear equation.

On completion of this unit, you should be able to:

solve simultaneous linear equation using LU


Method (Doolittle Method)

solve simultaneous linear equation using LU


Method (Crout Method)

B3001/UNIT 9/5

INPUT

9.0

INTRODUCTION
With Gaussian elimination and Gauss Jordan elimination, a linear system is

solved by operating systematically on the augmented matrix. In this section we shall


discuss a different approach, one based on factoring the coefficient matrix into a product
of lower and upper triangular matrices.

9.1

Solving linear systems by factorization (Doolittle Method)


If an n x n matrix A can be factored into a product of n x n matrices as A = LU

where L is lower triangular and U is upper triangular, then the linear system Ax = b can
be solved as follows
For matrix A, 3 x 3, LU can be shown as:
a11 a12

a 21 a 22
a
31 a32

and

a13 l11 0 0 u11 u12 u13


a 23 l21 l22 0 0 u22 u23


a33 l31 l32 l33 0
0 u33

For 3 system of linear equations.


a11x1 + a12x2 + a13x3 = b1
a21x1 + a22x2 + a23x3 = b2
a31x1 + a32x2 + a33x3 = b3

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 2

B3001/UNIT 9/5
Write in a matrix form:

a11 a12

a 21 a22
a
31 a32

a13 x1 b1

a23 x 2 = b2
a33 x3 b3

a11 a12

A = a 21 a22
a
31 a32

a13

a23 x =
a33

x1

x2
x
3

and

b1

b = b2
b
3

If A is written as LU, then:

a11 a12

a 21 a 22
a
31 a32

a13 l11 0 0 u11 u12 u13


a 23 l21 l22 0 0 u22 u23


a33 l31 l32 l33 0
0 u33

With Doolittle method, the diagonal L is given a value 1 as below

a11 a12 a13 1 0 0 u11 u12 u13

a21 a22 a23 l21 1 0 0 u22 u23


a

0 u33
31 a32 a33 l31 l32 1 0

Thus, matrices L and U can be derived

a11 a12

a 21 a 22
a
31 a 32

a13 u11
u12

a 23 = l 21u11 l 21u12 u 22
a 33 l 31u11 l 31u12 l 32u 22

l 21u13 u 23

l 31u13 l 32u 23 u 33
u13

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 3

B3001/UNIT 9/5
Compare with matrix A:

a11 u11

u11 a11

a12 u12

u12 a12

a13 u13

u13 a13

a 21 l 21u11

l 21

a 22 l 21u12 u 22

u 22 a 22 l 21u12

a 23 l 21u13 u 23

u 23 a 23 l 21u13

a 31 l 31u11

l 31

a 31
u11

a 32 l 31u12 l 32u 22

l 32

a 32 l 31u12
u 22

a 33 l 31u13 l 32u 23 u33

u33 a 33 l 31u13 l 32u 23

a 21
u11

To find lij and uij ;

l i1

a i1
u11

for i 2

a ij l i1u1 j l i 2 u 2 j l i , j 1u j 1,i
l ij

u jj

u1 j a1 j

for 2 j i

first row of u

uij aij li1u1 j l i 2 u 2 j l i ,i 1ui 1, j

for 2 i j

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 4

B3001/UNIT 9/5
From Ax = b:

a11 a12

a 21 a22
a
31 a32

then,

a13 x1 b1

a23 x 2 = b2
a33 x3 b3

1 0 0 u11 u12 u13 x1


l21 1 0 0 u22 u23 x 2 =
l

0 u33 x3
31 l32 1 0

b1

b2
b
3

u11 u12 u13 x1 y1


with substitution; 0 u22 u23 x 2 = y 2
0
0 u33 x3 y 3

1 0

For Ax = b then; l 21 1
l
31 l 32

0 y1 b1

0 y 2 = b2
1 y 3 b3

And the product will be:

y1

b1


l 21 y1 y 2

= b2
l y l y y b
3 3
31 1 32 2

From the matrix, you will find the values of y1, y2 and y3 from the equations

y1 b1
l 21 y1 y 2 b2

y 2 b2 l 21 y1

l 31 y1 l 32 y 2 y 3 b3

y 3 b3 l 31 y1 l 32 y 2

From matrix y, you will find the values of x


Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 5

B3001/UNIT 9/5

u11 u12 u13 x1 y1


0 u22 u23 x 2 = y 2
0
0 u33 x3 y 3

thus

u11 x1 u12 x 2 u13 x 3 y1


u 22 x 2 u 23 x 3

= y2

y
u 33 x 3

then, xn ,
u33 x 3 y 3

x3

y3
u 33

u 22 x 2 u 23 x 3 y 2

x2

y 2 u 23 x 3
u 22

u11 x1 u12 x 2 u13 x 3 y1

x1

y1 u12 x 2 u13 x 3
u11

Example 9.1:
Solve the following system of linear equation:
x1 + 3x2 + 3x3 = 4
2x1 3x2 2x3 = 2
3x1 + x2 + 2x3 = 5

Solution:
Writing in an LU format,

3 x1 4
1 3


2 3 2 x2 = 2
3 1
2 x 3 5

3
1 3

for A = 2 3 2
3 1
2

x1

x = x2
x
3

4

and b = 2
5

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 6

B3001/UNIT 9/5
If A = LU, then,

3 l11 0
1 3


2 3 2 l 21 l 22
3 1
2 l 31 l 32

0 u11 u12

0 0 u 22
l 33 0
0

u13

u 23
u 33

By Doolittle method, the diagonal for matrix L is given a value of 1


3 1 0 0 u11 u12 u13
1 3

2 3 2 l21 1 0 0 u22 u23


3 1
2 l31 l32 1 0
0 u33

By multiplying the two matrices on the right

3 u11
u12
1 3


2 3 2 = l 21u11 l 21u12 u 22
3 1
2 l 31u11 l 31u12 l 32u 22

l 21u13 u 23

l 31u13 l 32u 23 u 33
u13

You will find the values of un

1 u11

u11 1

3 u12

u12 3

3 u13

u13 3

2 l 21u11

2 2
2
u11 1

l 21

3 l 21u12 u 22

u22 3 l 21u12 3 2(3) 9

2 l 21u13 u 23

u 23 2 l 21u13 2 2(3) 8

l 31

3 l 31u11

3 3
3
u11 1

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 7

B3001/UNIT 9/5
1 l 31u12 l 32u 22

2 l 31u13 l 32u 23 u33

l 32

1 l 31u12 1 (3)(3)

0.889
u 22
9
u33 2 l 31u13 l 32u 23
2 (3)(3) (0.889)(8) 0.111

0
0
1

Then matrix L = 2
1
0 and U =
3 0.889 1

3
1 3

0 9 8
0 0 0.111

You will then find the values of yn.

1 0

l 21 1
l
31 l 32

0 y1 4

0 y2 = 2
1 y 3 5

0
0 y1 4
1


1
0 y2 = 2
2
3 0.889 1 y 5

y1


2 y1 y 2

=2
3 y 0.889 y y 5
2
3
1

Therefore,

y1 4
2 y1 y 2 2

3 y1 0.889 y 2 y 3 5

y 2 2 (2)(4) 6
y 3 5 (3)(4) (0.889)( 6) 1.667

Next, you find the values of x:

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 8

B3001/UNIT 9/5
u11 u12 u13 x1 y1


0 u22 u23 x 2 = y 2
0
0 u33 x3 y 3

3
1 3

0 9 8
0 0 0.111

x1 4

x2 = 6
x 1.667

x1 3 x 2 3 x 3 4

9 x2 8x3 = 6
0.111x
1.667
3

The values of x can be calculated through back substitution.


0.111x 3 1.667

x3

1.667
15
0.111

9 x 2 8x 3 6

x2

6 ( 8)( 15)
14
9

x1 3x 2 3x 3 4

x1 4 3(14) 3(15) 7

Then , x1 = 7, x2 = 14 and x3 = -15.

Example 9.2:
Solve the linear equation below:
6x1 + 3x2 + x3 = 4
4x1 2x2 3x3 = 2
3x1 7x2 + 3x3 = 5

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 9

B3001/UNIT 9/5
Solution:
As e.g. 9.1, you write the equation in a matrix form:

1 x1 13
6 3


4 2 3 x 2 = 28
3 7 3 x 27

where A =

1
6 3

4 2 3
3 7 3

13

and b = 28
27

Next, you have to find matrices for L, U, y and x.

For L and U, using A = LU, then

1 0 0 u11 u12 u13 a11 a12 a13

l21 1 0 0 u22 u23 a21 a22 a23


l

0 u33 a31 a32 a33


31 l32 1 0

u12
u11

l 21u11 l 21u12 u 22
l u
31 11 l 31u12 l 32u 22

u11 6

1
6 3


l 21u13 u 23
= 4 2 3
l 31u13 l 32u 23 u 33 3 7 3
u13

u12 3

l 21u11 4
4
4
l 21
0.667
u11 6

u13 1

l 21u12 u 22 2
u 22 2 l 21u12 3 (0.667)(3) 4

l 21u13 u 23 3
u 23 3 l 21u13 3 (0.667)(1) 3.667

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 10

B3001/UNIT 9/5
l31u11 3
l31

3
3
0.5
u11 6

l31u12 l32u22 7
l32

7 l31u12 7 (0.5)(3)

2.125
u22
4

l31u13 l32u 23 u 33 3
u33 3 l31u13 l32u 23 3 (0.5)(1) (2.125)(3.667) 10.292

0
0
1

1
0
Then, L = 0.667
0.5 2.125 1

and

1
6 3

U = 0 4 3.667
0 0 10.292

Calculating for y, from Ly = b


0
0 y1 13
1


1
0 y 2 = 28
0.667
0.5 2.125 1 y 27

y1

13


0.667 y1 y 2

= 28
0.5 y 2.125 y y 27
1
2
3

y1 13
0.667 y1 y 2 28
y 2 28 0.667(13) 19.333

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 11

B3001/UNIT 9/5

0.5 y1 2.125 y 2 y3 27
y3 27 0.5(13) 2.125(19.333) 20.583

13

If y = 19.333 , x can be find by using Ux = y, :


20.583

1 x1
6 3


0 4 3.667 x 2 =
0 0 10.292 x

13

19.333
20.583

6 x1 3x 2 x3 13

4 x 2 3.667 x3 = 19.333
10.292 x
20.583
3

Using back substitution


10.292 x3 20.583
x3

20.583
2
10.292

4 x 2 3.667 x3 19.333
x2

19.333 3.667(2)
3
4

6 x1 3x2 x3 13
x1 13 3(3) (2) 4

Then x1 = 4, x2 = -3 and x3 = -2.

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 12

B3001/UNIT 9/5
Example 9.3:
Solve the linear equation below:
2x1 x2 4x3 = 8
x1 5x2 9x3

= -9

7x1 2x2 + 3x3 = 3

Solution:
As example 9.2, write in the form of augmented matrices, and simplified
calculation
For l and u :

u11 a11 2
u12 a12 1
u13 a13 4
l 21

a 21 1
0.5
u11 2

u 22 a22 l 21u12 5 (0.5)(1) 4.5


u 23 a23 l 21u13 9 (0.5)(4) 7

l31

a31 7
3.5
u11 2

l32

a32 l31u12 2 (3.5)(1)

0.333
u 22
4.5

u33 a33 l31u13 l32u 23 3 (3.5)(4) (0.333)(7) 14.667

Formulae for y;

y1 b1 8
y2 b2 l 21 y1 9 (0.5)(8) 13
y3 b3 l31 y1 l32 y 2 3 (3.5)(8) (0.333)(13) 29.333

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 13

B3001/UNIT 9/5
Then x:

x3

y3 29.333

2
u 33
14.667

x2

y 2 u 23 x3 13 (7)(2)

6
u 22
4.5

x1

y1 u12 x2 u13 x3 8 (1)(6) (4)(2)

3
u11
2

This method is well suited for digital computers and is the basis for many practical
computer programs.

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 14

B3001/UNIT 9/5

ACTIVITY 9a

1.

Using Doolittle method, find matrices for L and U .

a)

2.

1 5 4

2 2 5
5 8 3

b)

2 5 1

5 0 4
1 9 2

Solve the system below by using Doolittle method and LU-decomposition:


a)

3x1 2x2 + 3x3 = 23


x1 + 4x2 + x3 = 17
2x1 + x2 + 3x3 = 25

b)

7x + 4y + 3z = 26
6x + 11y = 60
4x + 6y +12z = 68

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 15

B3001/UNIT 9/5

FEEDBACK 9a

1.

2.

a)

0
0
1

L = 2
1
0
5 2.75 0

4
1 5

U = 0 12 13
0 0 12.75

b)

0
0
1

1
0
L = 2.5
0.5 0.52 0

5
1
2

U = 0 12.5 1.5
0
0
1.72

a)

x1 = 4

x2 = 2

x3 = 5

b)

x = -1

y=6

z=3

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 16

B3001/UNIT 9/5

INPUT
9.2

CROUT METHOD
Like Doolittle, Crout method is another method of LU decomposition using
numerical analysis. Using Ax = b as the augmented matrices, you decompose L
and U for A.
Therefore,
LU = A

l11 0 0 u11 u12 u13 a11 a12 a13

l21 l22 0 0 u22 u23 a21 a22 a23


l

0 u33 a31 a32 a33


31 l32 l33 0
Using Crouts Method, main diagonal of matrix U is given a value of 1, where

l11 0 0 1 u12 u13 a11 a12 a13

l21 l22 0 0 1 u23 a21 a22 a23


l

1 a31 a32 a33


31 l32 l33 0 0

By multiplying L and U,

l11u12
l11

l 21 l 21u12 l 22
l
31 l31u12 l32

a11 a12

l 21u13 l 22u 23 = a 21 a 22
l31u13 l32u 23 l33 a31 a32
l11u13

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

a13

a 23
a33

Page 17

B3001/UNIT 9/5
You can find the values for l and u by comparing the corresponding entries.
l11 a11
l11u12 a12 u12

a12
l11

l11u13 a13 u13

a13
l11

l 21 a 21
l 21u12 l 22 a 22 l 22 a 22 l 21u12
l 21u13 l 22u 23 a 23 u 23

a 23 l 21u13
l 22

l31 a31
l31u12 l32 a32 l32 a32 l31u12
l31u13 l32u 23 l33 a33 l33 a33 l31u13 l32u 23

Using corresponding step, then:

li1 ai1
u1 j

a1 j
l11

for i = 1,2,,n
for j = 2,3,,n

lij aij li1u1 j li 2 u 2 j li , j 1u j 1,i


u ij

aij li1u1 j li 2 u 2 j li ,i 1u i 1, j n
l jj

for 2 j n-1
for 2 j n

After solving for matrices L and U, use Ly = b to find matrix y


Ly = b

l11 0 0 y1 b1


l21 l22 0 y2 b2
l

31 l32 l33 y3 b3

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 18

B3001/UNIT 9/5
l11 y1

l 21 y1 l 22 y 2

l y l y l y
31 1 32 2 33 3

b1

b2
b
3

l11 y1 b1 y1

b1
l11

l 21 y1 l 22 y 2 b2 y 2

Where,

b2 l 21 y1
l 22

l31 y1 l32 y 2 l33 y 3 b3 y 3

b3 l31 y1 l32 y 2
l33

From Ux = y, you will find the variables of x.


Ux = y
1 u12 u13 x1 y1


0 1 u23 x2 y 2
0 0
1 x3 y 3

x1 u12 x 2 u13 x3 y1


x 2 u 23 x3

y2

y
x3

Through back substitution and comparing the entries, find the values of x
x3 y 3
x 2 u 23 x3 y 2 x 2 y 2 u 23 x3
x1 u12 x 2 u13 x3 y1 x1 y1 u12 x 2 u13 x3

Like Doolittle, your main task is to find matrices of L and U.

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 19

B3001/UNIT 9/5
Example 9.4:
Solve the system of linear equation below:
x1 3x2 + 2x3 = 8
4x1 x2 x3 = 9
3x1 + 2x2 + x3 = 21

Solution:
Write in the form of Ax = b

1 3 2 x1 8


4 1 1 x 2 = 9
3 2
1 x 3 21

Find L and U,
LU = A

l11 0

l 21 l 22
l
31 l32

0 1 u12

0 0 1
l33 0 0

l11u12
l11

l 21 l 21u12 l 22
l
31 l31u12 l32

u13 1 3 2

u 23 4 1 1
1 3 2
1

1 3 2

l 21u13 l 22u 23 4 1 1
l31u13 l32u 23 l33 3 2
1
l11u13

l11 1
l11u12 3
u12

3 3

3
l11
1

l11u13 2
u13

2
22
l11

l 21 4
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 20

B3001/UNIT 9/5

l21u12 l22 1

l22 1 l21u12 1 4 3 11

l 21u13 l 22u 23 1
u 23

1 l 21u13 1 42

0.818
l 22
11

l31 3
l31u12 l32 2

l32 2 l31u12 2 3 3 11

l31u13 l32u 23 l33 1

l33 1 l31u13 l32u 23 1 32 11 0.818 4

Therefore,

1 0 0

L = 4 11 0
3 11 4

and

2
1 3

U = 0 1 0.818
0 0
1

By using Ly = b, find the matrix of y


Ly = b
1 0 0 y1 8


4 11 0 y 2 9
3 11 4 y 21

3
y1


4 y1 11y 2 9
3 y 11y 4 y 21
2
3
1

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 21

B3001/UNIT 9/5

y1 8
l 21 y1 l 22 y 2 9
y2

9 48
2.09
11

l31 y1 l32 y 2 l33 y3 21


y3

21 38 11(2.09)
5
4

Therefore,

y = 2.09
5

You can find matrix x from Ux = y

Ux = y

2 x1 8
1 3

0 1 0.818 x 2 2.09
0 0
1 x3 5

x1 3x 2 2 x3 8

x 2 0.818 x3 2.09

5
x3

Using back substitution and comparing entries you will find the values of x ;
x3 5
x2 0.818 x3 2.09
x2 2.09 0.818(5) 2

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 22

B3001/UNIT 9/5

x1 3x2 2 x3 8
x1 8 (3)(2) (2)(5) 4

Therefore,
x1 = 4, x2 = 2 and x3 = 5.

Example 9.5:
Solve the system of linear equation below:
2x1 + x2 + 6x3 = 4
5x1 2x2 8x3 = 6
6x1 7x2 + 3x3 = 2

Solution:
Using numerical analysis, solve for lij, uij, y iand xi.
From example 9.2, find l and u,

l11 a11 2
u12

a12 1
0.5
l11 2

u13

a13 6
3
l11 2

l 21 a21 5

l 22 a22 l 21u12 (2) (5)(0.5) 4.5

u 23

a 23 l 21u13 8 (5)(3)

1.556
l 22
4.5

l31 a31 6
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 23

B3001/UNIT 9/5

l32 a32 l31u12 (7) (6)(0.5) 10


l33 a33 l31u13 l32u 23 3 (6)(3) (10)(1.556) 0.556

Then find yi and xi:

y1

b1 4
2
l11 2

y2

b2 l 21 y1 6 (5)(2)

0.89
l 22
4.5

y3

b3 l31 y1 l32 y 2 2 (6)(2) (10)(0.89)

2
l33
0.556

x3 y3 2
x2 y 2 u 23 x3 0.89 (1.556)(2) 4
x1 y1 u12 x2 u13 x3 2 (0.5)(4) (3)(2) 6

Therefore,
x1 = 6, x2 = 4 and x3 = -2.

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 24

B3001/UNIT 9/5

ACTIVITY 9b

1.

Using Crout method, find the decomposition of L and U for.

a)

2.

2 2 1

4
2 1
1 1 2

b)

4 1 7

8 6
1
3 2 4

Using Crouts Method, solve for system of linear equations below.

a)

4x1 x2 + 3x3 = 38
3x1 + 4x2 + 6x3 = 35
x1 5x2 + 3x3 = 21

b)

2x + 9y 3z = 5
4y 2z = 0
4z x 5y = 11

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 25

B3001/UNIT 9/5

FEEDBACK 9b

1.

2.

a)

0
2 0

L = 2 3
0
1 0 2.5

1 1 0.5

U = 0 1
1
0 0
1

b)

0
0
4

8.25
0
L= 1
3 2.75 10.667

1 0.25 1.75

1
0.515
U = 0
0
0
1

a)

x1 = 7

x2 = -1

x3 = 3

b)

x = -2

y=3

z=6

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 26

B3001/UNIT 9/5

SELF ASSESSMENT

Using Doolittle and Crouts Method, find matrices of L, U, y and x for system of
linear equations below:.

a.

2s 5t + u = 12
3s t u = -8
3s 4t + 2u = 16

b.

0.6v + 1.2I + 2.8R = 9816


3.2v 0.4I + 3.0R = 11770
1.5v 0.5I + 0.3R = 1200

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 27

B3001/UNIT 9/5

FEEDBACK

1.

a)

Doolittle Method

a-

0
0
1

1
0 U =
L = 1.5
1.5 0.538 1

12

y = 26
12

b-

x = 1 .5
6.5

0
0
1

1
0
L = 5.33
2.5 0.515 1

9816

y = 41272
2097.059

b)

1
2 5

0 6.5 2.5
0 0 1.846

2.8
0.6 1.2

U = 0 6.8 11.933
0
0
0.608

230

x = 15
3450

Crout Method

i-

0
2 0

0 U=
L = 3 6.5
3 3.5 1.846

6

y = 4
6 .5

0.5
1 2.5

1
0.385
0
0
0
1

x = 1 .5
6.5

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 28

B3001/UNIT 9/5

ii-

0
0
0.6

L = 3.2 6.8
0
1.5 3.5 0.608

16360

y = 6069.412
3450

1 2 4.667

U = 0 1 1.755
0 0
1

230

x = 15
3450

Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy

Page 29

Das könnte Ihnen auch gefallen