Example 1. Use Cramer's Rule To Solve
Example 1. Use Cramer's Rule To Solve
10 + +4 = 1
2 7 = 3
2 + +5 =0
10 1 4
| |= 1 2 7
2 1 5
2 7 1 7 1 2
det[ ] = 10(1) + (1) + 4(1) = 29
1 5 2 5 2 1
| |
Applying = | |
obtain the solution:
1 1 4
3 2 7
= 0 1 5 = 0
29
10 1 4
1 3 7
= 2 0 5 = 5
29
10 1 1
1 2 3
= 2 1 0 = 1
29
Example 2. Let
2 1 0 1
= 1 6 2 , = 3
4 3 8 9
Carry out a number of iterations of the Jacobi iteration, starting with the zero initial vector.
Rewriting the equations, we have the Jacobi method:
( ) 1 ( ) 1
= +
2 2
( ) 1 ( ) 1 ( ) 1
= + +
6 3 2
( ) 1 ( ) 3 ( ) 9
= + +
2 8 8
4 8 + = 21
4 + =7
2 + + 5 = 15
To meet the convergence condition
| |> , = 1,
4 + =7
4 8 + = 21
2 + + 5 = 15
( )
1 ( )
1 ( )
7
= +
4 4 4
( )
1 ( )
1 ( )
21
= + +
2 8 8
( )
2 ( )
1 ( )
= +3
5 5
k
0 1 1 1
1 1.75 3.25 3.2
2 1.7625 3.9 3.05
3 1.9625 3.8875 2.925
4 1.9906 3.9719 3.0075
5 1.9911 3.9962 3.0019
2 4 3
17 2 3 = 500
5 + 21 2 = 200
5 5 + 22 = 30
Consider the vector c=(0 0 0) as initial and use it to recomputed each element of c, always using
the latest available values of vector components.
( ) 2 ( ) 3 ( ) 500
= + +
17 17 17
( ) 5 ( ) 2 ( ) 200
= + +
21 21 21
( ) 5 ( ) 5 ( ) 30
= + +
22 22 22
Iterations give us
k
0 0 0 0
1 29.4118 16.5266 11.8042
2 33.4392 18.6097 13.1929
3 33.9293 18.8587 13.3609
( ) ( )
= ( )
100% <
33.9293 33.4392
= 100% = 1.4%
33.9293
10 +2 =6
+ 11 +3 = 25
2 + 10 = 11
3 +8 = 15
Starting with the zero initial vector ( = 5%).
( ) 1 ( ) 1 ( ) 3
= +
10 5 5
( ) 1 ( ) 1 ( ) 3 ( ) 25
= + +
11 11 11 11
( ) 1 ( ) 1 ( ) 1 ( ) 11
= + +
5 10 10 10
( ) 3 ( ) 1 ( ) 15
= + +
8 8 8
( ) ( ) ( ) ( )
k
1 0.6 2.3273 -0.9873 0.8789
2 1.030 2.037 -1.014 0.984
3 1.0065 2.0036 -1.0025 0.9983
= 2.3% = 1.7% = 1.1% = 1.4%
1.0065
After 3 iterations the maximum error is 2.3% and we obtain the result = 2.0036
1.0025
0.9983
Example 6. Of the following three sets of linear equations, identify the set that you could not
solve using an iterative method such as Gauss-Seidel. Show using any number of iterations that
is necessary that your solution does not converge. Clearly state your convergence criteria (how
you know it is not converging).
If rearrange rows of the Set 1 and 3 and make them diagonally dominant they will converge
| |> , = 1,
is not satisfied.
Using the Gauss-Seidel method show that the solution does not converge
2 + 2 3 = 3
2 = 1
+4 +5 = 8
The results of iterations are shown in Table
k x y z
0 0 0 0
1 1.5 0.5 1.5
2 -0.25 1.25 0.55
3 1.925 0.775 1.365
4 0.2275 1.1825 0.6995
5 1.6333 0.8498 1.2468
As we can see iterations oscillate about the true solution x=(1 1 1)T.
Example 7. Solve the problem using the SOR iteration with relaxation factor = 0.90 and
= 5%.
5 + 12 = 80
4 = 2
6 +8 = 45
After reordering rows obtain:
4 = 2
6 +8 = 45
5 + 12 = 80
Initially guessing = = = 0 apply relaxation to results
( ) ( ) ( ) ( )
= + + (1 )
( )
( ) 3 ( ) 45 ( )
= + + (1 )
4 8
( ) 5 ( ) 20 ( )
= + + (1 )
12 3
k
0 0 0 0
1 -0.45 5.3663 5.8313
2 2.0245 4.2326 7.3423
3 2.3568 3.8949 7.6180
4 2.3761 3.8481 7.6528
Example 8. Solve the non-convergent system from Ex.6 using relaxation ( = 0.5)
2 + 2 3 = 3
2 = 1
+4 +5 = 8
The results of computations are summarized in Table
k x y z
0 0 0 0
1 0.75 0.25 0.775
2 0.6688 0.5688 1.0269
6 0.8561 0.9826 0.9955
7 0.9228 0.9902 0.9939
= 7.3% = 0.8% = 0.2%
From solution we can be verified that under-relaxation (0 < < 1) makes a non-convergent
system converge.