Gauss-Seidel linear system solver - cases when it is unstable
I have a Gauss-Seidel linear system solver that has always been able to solve many kinds of linear systems. However, it struggles when solving this very simple system: $$ 22.7986\,x_1 + 4981.2903 \,x_2 = 25.48488 \\ 10047.4775\,x_1 -4981.2903\,x_2 = 6.05489 $$
My initial guess is $(0.01,0.01)$ but I have tried changing it to other values and it's still is not converging.
Basically the new guess that the algorithm computes in each iteration consistently becomes larger, and so is the error. I was checking the Burden book to see if there are special cases in which Gauss-Seidel does not converge but there is little on that.
I know that there exists a solution to the above system because I have solved it using Excel's functionality to invert matrices and then use matrix multiplication. Particularly, the solution to the system is $(0.003131967,0.005101786)$.
Any help would be welcome.
$\endgroup$ 21 Answer
$\begingroup$The problem can be solved by rewriting the equations in the following way 4981.2903X2+22.7986X1=25.48488
-4981.2903X2+10047.4775X1 = 6.05489
Step 1: Assume X1 = 0 in the first equation and calculate X2 = 0.005116
Step 2: Taking X2 = 0.005116, calculate X1 from the second equation X1 = 0.003136
Step 3: Taking X1 = 0.003136, calculate X2 from the first equation X2 = 0.0051018
Step 4: Taking X2 = 0.0051018, calculate X1 from the second equation X1 = 0.003131
So the final answer is X1 = 0.003131 and x2 = 0.0051018
$\endgroup$