0% found this document useful (0 votes)
39 views8 pages

Example 4. Determine The Inverse of Matrix A

This document provides examples of solving matrix inverse and linear systems problems. For the matrix inverse problem, it shows the step-by-step process of finding the inverse of a 3x3 matrix A using LU decomposition and back/forward substitution. The inverse is verified by checking that A(A^-1) equals the identity matrix. For the linear systems problem, it presents three methods - Jacobi, Gauss-Seidel, and SOR - for solving a system of 3 equations with 3 unknowns. It provides the iterative computations and error calculations for each method until convergence within 5% error is achieved.

Uploaded by

Sirilak Klakwong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views8 pages

Example 4. Determine The Inverse of Matrix A

This document provides examples of solving matrix inverse and linear systems problems. For the matrix inverse problem, it shows the step-by-step process of finding the inverse of a 3x3 matrix A using LU decomposition and back/forward substitution. The inverse is verified by checking that A(A^-1) equals the identity matrix. For the linear systems problem, it presents three methods - Jacobi, Gauss-Seidel, and SOR - for solving a system of 3 equations with 3 unknowns. It provides the iterative computations and error calculations for each method until convergence within 5% error is achieved.

Uploaded by

Sirilak Klakwong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

i

Example 4. Determine the inverse of matrix A


10 2 1
A 3 6 2
1 1 5
Solution.

1st step The LU decomposition is

1 0 0 10 2 1

LU 0.3 1
0 0 5.4 1.7
0.1 0.148148 1 0 0 5.351852
1

2 nd
step The first column of the matrix inverse can be found by use b 0 .
0

Thus the lower-triangular system, Ld b, can be setup as

1 0 0 d1 1
0.3
1 0 d 2 0
0.1 0.148148 1 d 3 0
1

Solved with forward substitution for d 0.3 .
0.055556

Use this vector as the right-hand side of the upper-triangular system

10 2 1 x1 1
0 5.4
1.7 x 2 0.3
0 0 5.351852 x3 0.055556

0.110727

Solved by back substitution for x 0.058824
0.010381

0.110727 0 0
A 0.058824 0 0
1
Therefore
0.010381 0 0
0
3rd step Determine the second column by use b 1
0

1 0 0 d1 0
0.3
1 0 d 2 1
0.1 0.148148 1 d 3 0

By S. TACHASOMBOONSUK
ii

0

Solved with forward substitution for d 1 and use
0.148148

10 2 1 x1 0
0 5.4
1.7 x 2 1
0 0 5.351852 x3 0.148148

0.038062

determine x 0.176471 by back substitution.
0.027682

0.110727 0.038062 0
Therefore A 0.058824 0.176471 0
1

0.010381 0.027682 0
0

4th step Determine the third column by use b 0
1

0 0.00692

Solved with forward substitution for d 0 and determine x 0.058824 by
1 0.186851

back substitution.
0.110727 0.038062 0.00692
A 0.058824 0.176471 0.058824

1
Therefore Ans.
0.010381 0.027682 0.186851

Check the answer AA1 must be equal I

10 2 1 0.110727 0.038062 0.00692 1.000003 0.000004 0.000003


3 6 2 0.058824 0.176471 0.058824 0.000001 1.000004 0.000002

1 1 5 0.010381 0.027682 0.186851 0.000002 0.000001 0.999999

By S. TACHASOMBOONSUK
iii

Example 5. Solve the following linear systems


4 x1 x2 x3 5
x1 3x2 x3 4
2 x1 2 x2 5 x3 1
a) Use the Jacobi method.
b) Use the Gauss-Seidel method.
c) Use the SOR method with = 1.1.
Perform the computation until a is less than s = 5 %.
Solution. Solve each of the equations for its unknown on the diagonal:
5 x2 x3
x1
4
4 x1 x3
x2
3
1 2 x1 2 x2
x3
5
a) the Jacobi method: The initial values are x1 0, x2 0 and x3 0 .
500
x1 1.25
4
400
1st iteration: x2 43 1.3333
3
1 20 20
x3 0.2
5

5 43 0.2
x1 1.6333
4
4 1.25 0.2
2nd iteration: x2 0.9833
3
1 21.25 2 1.3333
x3 0.2333
5
1.6333 1.25
a, x 100% 23.4694%
1
1.6333
0.9833 1.3333
a, x 100% 35.5932%
2
0.9833
0.2333 0.2
a, x 100% 14.2857%
3
0.2333
a, max 35.5932%
The computation proceeds until all error fall below 5%.
i x1 x2 x3 a ,x
1
a ,x 2
a ,x 3 a ,max
0 0 0 0
1 1.25 -1.3333 0.2 100 100 100 100
2 1.6333 -0.9833 0.2333 23.4694 35.5932 14.2857 35.5932
3 1.5542 -0.8667 -0.0600 5.0938 13.4615 488.8889 488.8889
4 1.4517 -0.7953 -0.0750 7.0608 8.9766 20.0000 20.0000
5 1.4301 -0.8244 -0.0626 1.5102 3.5377 19.8934 19.8934
6 1.4405 -0.8358 -0.0423 0.7222 1.3577 48.0605 48.0605
7 1.4484 -0.8391 -0.0419 0.5463 0.3934 0.9022 0.9022

By S. TACHASOMBOONSUK
iv

b) the Gauss-Seidel method: The initial values are x1 0, x2 0 and x3 0 .


500
x1 1.25
4
4 1.25 0
1st iteration: x2 0.9167
3
1 21.25 2 0.9167
x3 0.0667
5

5 0.9167 0.0667
x1 1.4958
4
4 1.4958 0.0667
2nd iteration: x2 0.8569
3
1 21.4958 2 0.8569
x3 0.0556
5
1.4958 1.25
a, x 100% 16.4345%
1
1.4958
0.8569 0.9167
a, x 100% 6.9692%
2
0.8569
0.0556 0.0667
a, x 100% 220%
3
0.0556
a, max 220%
The computation proceeds until all error fall below 5%.

i x1 x2 x3 a ,x
1
a ,x 2
a ,x 3 a ,max
0 0 0 0
1 1.25 -0.9167 0.0667 100 100 100 100
2 1.4958 -0.8569 -0.0556 16.4345 6.9692 220.0000 220.0000
3 1.4503 -0.8314 -0.0476 3.1362 3.0767 16.7315 16.7315
4 1.4459 -0.8355 -0.0442 0.3046 0.4934 7.7192 7.7192
5 1.4478 -0.8360 -0.0447 0.1301 0.0609 1.2287 1.2287

c) the SOR method: The initial values are x1 0, x2 0 and x3 0 .


x new
i x new
i 1 xiold

1st iteration:

500
x1 1.25
4
Relaxation yields : x1 1.1(1.25) (1 1.1)(0) 1.3750
4 1.3750 0
x2 0.8750
3
Relaxation yields : x2 1.1(0.8750) (1 1.1)(0) 0.9625
1 21.3750 2 0.9625
x3 0.0350
5

By S. TACHASOMBOONSUK
v

Relaxation yields : x3 1.1(0.0350) (1 1.1)(0) 0.0385

2nd iteration:

5 0.9625 0.0385
x1 1.5003
4
Relaxation yields : x1 1.1(1.5003) (1 1.1)(1.3750) 1.5128
4 1.5128 0.0385
x2 0.8419
3
Relaxation yields : x2 1.1(0.8419) (1 1.1)(0.9625) 0.8298
1 21.5128 2 0.8298
x3 0.0732
5
Relaxation yields : x3 1.1(0.0732) (1 1.1)(0.0385) 0.0843

1.5128 1.3750
a,x 100% 9.1074%
1
1.5128
0.8298 0.9625
a,x 100% 15.9849%
2
0.8298
0.0843 0.0385
a,x 100% 145.6500%
3
0.0843
a,max 145.65%

The computation proceeds until all error fall below 5%.

i x1, relaxation x2,relaxation x3,ralaxation a ,x a ,x a ,x 3 a ,max


x1 x2 x3 1 2

0 0 0 0 0 0 0
1 1.25 1.3750 -0.8750 -0.9625 0.0350 0.0385 100 100 100 100
2 1.5003 1.5128 -0.8419 -0.8298 -0.0732 -0.0843 9.1074 15.9849 145.6500 145.6500
3 1.4364 1.4287 -0.8290 -0.8289 -0.0399 -0.0355 5.8819 0.1160 137.5657 137.5657
4 1.4483 1.4503 -0.8381 -0.8390 -0.0445 -0.0454 1.4872 1.2032 21.8621 21.8621
5 1.4484 1.4482 -0.8355 -0.8351 -0.0452 -0.0452 0.1459 0.4642 0.4798 0.4798

By S. TACHASOMBOONSUK
vi

Exercise

1. Find the matrix inverse of A. Use 4 decimal digit for all computation.
3 1 1
a) A 3 6 2
3 3 7
3 6 1
b) A 7 1 2
3 3 7

0.3158 0.0877 0.0702


Ans. a) A
1
0.1316 0.1579 0.0263
0.0790 0.1053 0.1842
0.0336 0.1163 0.0284
b) A
1
0.1421 0.0465 0.0336
0.0465 0.0698 0.1163

2. Find the first two iterations of the following methods for this linear
system:
3x y z 1
3x 6 y 2 z 0
3x 3 y 7 z 4
a) The Jacobi method.
b) The Gauss-seidel method.
c) The SOR method with 1.1 .
Use 4 decimal digit.

Ans. a) x = 0.1429 y = -0.3574 z = 0.4285


b) x = 0.1111 y = -0.2222 z = 0.6190
c) x = 0.0541 y = -0.2115 z = 0.6477

3. Determine the solution for a below linear system:

3x1 6 x 2 x3 5
7 x1 x 2 2 x3 10
3x1 3x 2 7 x3 4
a) The Jacobi method.
b) The Gauss-seidel method.
c) The SOR method with 1.1 .
Use s = 10 % and 6 decimal digit.

Ans. a) x1 = -0.912325 x2 = -1.061933 x3 = 1.379650


b) x1 = -0.890142 x2 = -1.049245 x3 = 1.402594
c) x1 = -0.854114 x2 = -1.012850 x3 = 1.364218

By S. TACHASOMBOONSUK
vii

Example 6. Use Newtons method, with initial guesses are x1 = 0 and x2 = 3, to


solve this nonlinear system.
x1 1 x1 4 x2 12
x1 22 2 x2 32 25
The allowable percent relative error is s = 1%.
Solution. Rearrange the system of nonlinear equations as
f1 x1 , x2 x1 1 x1 4 x 2 12
f 2 x1 , x2 x1 2 2 x2 3 25
2 2

The Jacobian matrix is evaluated.

f1 f1
1 2 x1
Z xf 1 xf 2
4

2 2 2x1 2 42 x 2 3
x1 x 2
The corrector vector, x, can be found by solving following system of
linear equation:

Z xi f
1st iteration: Initial guesses are x1,0 0 and x2,0 3
1 20
Z 1 4
4
The Jacobian matrix:
20 2 423 3 4 12
01 0 43 12 0
The matrix of function: f
0 2 20 3 25 12
2 2

Substituted the two matrixes into Z xi f to give

1 4 x1,1 0
4 12 x 12
2,1
Solve this system of linear equation to find the corrector.
x1,1 1.71429 x2,1 0.42857
Add old value with the corrector, yields
x1,1 x1,0 x1,1 0 1.71429 1.71429
x2,1 x2,0 x2,1 3 0.42857 3.42857
2nd iteration:
1 2 1.71429
Z 4.42857
4 4

2 1.71429 2 423.42857 3 7.42857 15.42857
1.714291 1.71429 43.42857 12 2.93878
f
1.71429 2 23.42857 3 25 3.67347
2 2

Substituted the two matrixes into Z xi f to give

4.42857 4 x1, 2 2.93878



7.42857 15.42857 x
2, 2 3.67347
Solve this system of linear equation, give x1, 2 0.61235 x2, 2 0.05674 .
Correct the xs value yields

By S. TACHASOMBOONSUK
viii

x1, 2 x1,1 x1, 2 1.71429 0.61235 1.10194


x2, 2 x2,1 x2, 2 3.42857 0.05674 3.48531

The approximated relative error can compute as


1.10194 1.71429
a ,1 100% 55.57%
1.10194
3.48531 3.42857
a,2 100% 1.63%
3.48531
a ,max 55.57%
The computation proceed until the all error less than s =1%.

Follow by yourself.

By S. TACHASOMBOONSUK

You might also like