Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
31 views

X X X X X X: Example 3. Given The Equations

This document provides an example of solving a system of 3 equations with 3 unknowns using Gaussian elimination and LU decomposition, both with and without partial pivoting. It first checks that the system has a unique solution. It then solves the system using: 1) Gaussian elimination without partial pivoting, obtaining the solution x1=4.21883, x2=8.05598, x3=-1.89822. 2) Gaussian elimination with partial pivoting, obtaining the same solution. 3) LU decomposition without partial pivoting, again obtaining the same solution. 4) LU decomposition with partial pivoting is described but not shown.

Uploaded by

Sirilak Klakwong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

X X X X X X: Example 3. Given The Equations

This document provides an example of solving a system of 3 equations with 3 unknowns using Gaussian elimination and LU decomposition, both with and without partial pivoting. It first checks that the system has a unique solution. It then solves the system using: 1) Gaussian elimination without partial pivoting, obtaining the solution x1=4.21883, x2=8.05598, x3=-1.89822. 2) Gaussian elimination with partial pivoting, obtaining the same solution. 3) LU decomposition without partial pivoting, again obtaining the same solution. 4) LU decomposition with partial pivoting is described but not shown.

Uploaded by

Sirilak Klakwong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

i

Example 3. Given the equations


2 x1 6 x2 x3 38
3x1 x2 34 7 x3
x2 3x3 20 8 x1
a) Check this system of equations has a unique solution.
b) Solve by Gauss elimination without/with partial pivoting.
c) Solve by LU decomposition without/with partial pivoting.

Solution. Rearrangement the system of equation yields

2 x1 6 x2 x3 38
3x1 x2 7 x3 34
8 x1 x2 3x3 20
2 6 1 x1 38
3 1 7 x 34
2
8 1 3 x3 20


A
x b
2 6 1
a) D A 3 1 7 393 since D 0,so this system has a unique solution
8 1 3
b) 1. Gauss elimination without partial pivoting

2 6 1 38 ...(a)
3 1 7 34 ...(b)

8 1 3 20 ...(c)

Forward elimination:
Pivot element = 2 and pivot equation is equation (a).
2 6 1 38 ...(a)
(b) a 0 10 5.5 91 ...(b' )
3
2

c a 0 23 7 172 ...(c' )
8
2
Pivot element = -10 and pivot equation is equation (b).

2 6 1 38 ...(a)
0 10 5.5 91 ...(b)

c 1023 b 0 0 19.65 37.3 ...(c)
Back substitution:
37.3
x3 1.89822
19.65
91 5.5(1.89822)
x2 8.05598 Ans.
10
38 6 1.70750 1 1.89822
x1 4.21883
2

By S. TACHASOMBOONSUK
ii

2. Gauss elimination with partial pivoting

2 6 1 38 ...(a)
3 1 7 34 ...(b)

8 1 3 20 ...(c)

Forward elimination:
Interchange between equation (a) and (c) to raise the maximum absolute
value of pivot element. Pivot element = -8 and pivot equation is equation
(a).

8 1 3 20 ...(a)
3 1 7 34 ...(b)

2 6 1 38 ...(c)
8 1 3 20 ...(a)

8

(b) 3 a 0 1.375 8.125 26.5 ...(b' )
c 2 a 0 5.75 1.75 43
...(c' )
8
Interchange between equation (b) and (c)
8 1 3 20 ...(a)
0 5.75 1.75 43 ...(b' )

0 1.375 8.125 26.5 ...(c' )
Pivot element = -5.75 and pivot equation is equation (b).
8 1 3 20 ...(a)
0 5.75 1.75 43 ...(b)

c 15.375
.75 b 0
0 8.54348 16.21739 ...(c)

Back substitution:

16.21739
x3 1.89822
8.54348
43 1.75(1.89822)
x2 8.05598 Ans.
5.75
20 18.05598 3 1.89822
x1 4.21883
8
c) 1. LU decomposition without partial pivoting

Decomposition:

A

2 6 1 ...(a)
3 1 7 ...(b)

8 1 3 ...(c)

By S. TACHASOMBOONSUK
iii

2 6 1 ...(a)
f 21 3
2
(b) a 0 10 5.5 ...(b' )
3
2

f 31 8
2
c a 0 23 7 ...(c' )
8
2

2 6 1 ...(a)
0 10 5.5 ...(b' )

f 32 23
10
c 1023 b 0 0
19.65 ...(c' )

U
Therefore
1 0 0 1 0 0 2 6 1 38

L f 21 1 0 23 1 0
, U 0 10
5.5 and b 34
f 31 f32 1 28 23
1 0 0 19.65 20
10

Forward substitution: Ld b
1 0 0 d1 38
3
2 1 0 d 2 34
28 23
10
1 d3 20
d1 38
d 2 34 23 38 91
d3 20 28 38 10
23
91 37.3

Back substitution: U x d
2 6 1 x1 38
0 10 x 91
5.5 2
0 0 19.65 x3 37.3

37.3
x3 1.89822
19.65
91 5.5(1.89822)
x2 8.05598 Ans.
10
38 6 1.70750 1 1.89822
x1 4.21883
2
2. LU decomposition with partial pivoting

Decomposition:
A
2 6 1 ...(a)
3 1 7 ...(b)

8 1 3 ...(c)

By S. TACHASOMBOONSUK
iv

interchang e (a ) (c)
8 1 3 ...(a)
3 1 7 ...(b)

2 6 1 ...(c)
8 1 3 ...(a)
f 21 3
8
(b) 8 a 0 1.375 8.125
3 ...(b)
f 31 2
8
c 28 a 0 5.75 1.75 ...(c)

interchang e (b) (c)


8 1 3 ...(a)
f 21 2 0 5.75 1.75 ...(b)
8
f31 3
8
0 1.375 8.125 ...(c)

8 1 3 ...(a)
0 5.75 1.75 ...(b)

f 32 1.375
5.75 c 15.375
.75 b
0 0 8.54348 ...(c)

Therefore
1 0 0 1 0 0 8 1 3

Lpivoting f 21 1 0 28 1 0 and U pivoting 0 5.75 1.75

f 31 f32 1 83 1.375
5.75
1 0 0 8.54348

38 20 20

b 34 interchange (a)and (c) b 34 interchange (b)and (c) bpivoting 38
20 38 34

Forward substitution: Ld b
1 0 0 d1 20
2
8 1 0 d 2 38
83 1.375
5.75
1 d3 34
d1 20
d 2 38 28 20 43
d3 34 83 20 15.375
.75
43 16.21739
Back substitution: U x d
8 1 3 x1 20
0 5.75 1.75 x 43
2
0 0 8.54348 x3 16.21739

By S. TACHASOMBOONSUK
v

16.21739
x3 1.89822
8.54348
43 1.75(1.89822)
x2 8.05598 Ans.
5.75
20 18.05598 3 1.89822
x1 4.21883
8

Exercise

Solve the following linear systems


1)
2.11x2 10.1x3 1.12
14.2 x1 0.122 x2 12.2 x3 3.44
15.3x1 0.110 x2 13.1x3 4.16

2)
6 x1 2.2 x2 3x3 20
3x1 x2 1.1x3 8.1
x1 3x2 0.9 x3 6

3)
4 x 12 y 8 z 4w 4
1x 7 y 18 z 9w 5
2 x 9 y 20 z 20w 25
3x 11y 15 z 14w 18

a) Use gauss elimination with partial pivoting.


b) Use LU method with partial pivoting.

Using three-digit rounding arithmetic.

Ans. 1) x1 0.257 x2 0.469 x3 0.013


2) x1 0.744 x2 0.891 x3 4.525
3) x 2.000 y 1.000 z 1.000 w 2.000

By S. TACHASOMBOONSUK

You might also like