# Did I write the steps of Gauss-Seidel's method correctly?

I want to solve this system of equations with Gauss-Seidel's method:

$${ \begin{cases} 2x_1&+x_2&&&&=3 \\ -x_1&+2x_2&+x_3&&&=2 \\ &-x_2&+2x_3&+x_4&&=2 \\ &&-x_3&+2x_4+x_5&&=2 \\ &&&-x_4+2x_5&&=1 \end{cases} }$$ I wrote equations as:

$$x_1=\frac12(3-x_2)$$

$$x_2=\frac12(2+x_1-x_3)$$

$$x_3=\frac12(2+x_2-x_4)$$

$$x_4=\frac12(2+x_3-x_5)$$

$$x_5=\frac12(1+x_4)$$

For this method if I want to use algorithm to solve the system is the following steps right ?

$$x_1^{(k+1)}=\frac12(3-x_2^{(k)})$$

$$x_2^{(k+1)}=\frac12(2+x_1^{(k+1)}-x_3^{(k)})$$

$$x_3^{(k+1)}=\frac12(2+x_2^{(k+1)}-x_4^{(k)})$$

$$x_4^{(k+1)}=\frac12(2+x_3^{(k+1)}-x_5^{(k)})$$

$$x_5^{(k+1)}=\frac12(1+x_4^{(k+1)})$$

• Yes that looks fine. I find it much easier to think about if I stick to matrices though.
– Paul
Jan 5, 2021 at 9:15
• Thank you. it is the way I am supposed to do to solve the system. Jan 5, 2021 at 9:16

Since the the condition is met, you can use Gauss-Seidel's recursion. The formulae you stated are right. I checked the iterations using Mathematica and found out that the convergence is a bit slow. I think the reason for that is the coefficients of the $$x_i$$ in the $$i$$th equation are not big enough in absolute value than the other in the same equation.