We have studied in the last article that, the preceding methods of solving simultaneous linear equations are known as direct methods as they yield the exact solution. On the other hand, an iterative method is that in which we start from an approximation to the true solution and obtain better and better approximation from a computation cycle repeated as often as may be necessary for achieving the desired accuracy. Simple iteration methods can be devised for systems in which the coefficient of leading diagonal is large compared to others.

In the last article about solving roots of given simultaneous equations, we have studied Jacobiâ€™s iterative method. Similarly, there is another method for solving roots of simultaneous equations which is called as Gauss-Seidel Iterative Method. After that, we will see MATLAB program on how to find roots of simultaneous equations using Gauss-Seidel Method.

Let us consider set of simultaneous equations as follows:

- a1x+b1y+c1z=d1â€¦â€¦â€¦â€¦â€¦â€¦â€¦1)
- a2x+b2y+c2z=d2â€¦â€¦â€¦â€¦â€¦â€¦â€¦1)
- a3x+b3y+c3z=d3â€¦â€¦â€¦â€¦â€¦â€¦â€¦1)

We then solve above equation for x, y and z respectively. Then the system can be written in the form:

- x = (k1) â€“ (l1)y â€“ (m1)zâ€¦â€¦â€¦â€¦..2)
- y = (k2) â€“ (l2)x â€“ (m2)zâ€¦â€¦â€¦â€¦â€¦.2)
- z = (k3) â€“ (l3)x â€“ (m3)yâ€¦â€¦â€¦â€¦â€¦.2)

Gauss-Seidel Method is a modification of Jacobiâ€™s iteration method as before we starts with initial approximations, i.e. x0=y0=z0=0 for x, y and z respectively.

Substituting y=y0, z=z0 in the equation x1=k1, then putting x=x1, z=z0 in the second of equation (2) i.e.

- (y1) = (k2) â€“ (l2)x1 â€“ (m2)z0

Substituting x=x1, y=y1 in the third of equation (2)Â i.e.

- (z1) = (k3) – (l3)x1 â€“ (m3)y1Â and so on.

As soon as a new approximation for an unknown is found it is immediately used in the next step. This process is then repeated till the desired degree of accuracy is obtained.

Let us discuss Gauss-Seidel method by solving one simple example.

## Example

Find the roots of following simultaneous equations using the Gauss-Seidel method.

20x+y-2z=17â€¦â€¦â€¦â€¦..1)

3x+20y-z=-18â€¦â€¦â€¦â€¦..1)

2x-3y+20z=25â€¦â€¦â€¦â€¦..1)

## Solution

Let us write the given equation in the form as:

x = (1/20)(17-y+2z)â€¦â€¦â€¦â€¦â€¦..2)

y = (1/20)(-18-3x+z)â€¦â€¦â€¦â€¦â€¦.2)

z = (1/20)(25-2x+3y)â€¦â€¦â€¦â€¦â€¦2)

we start approximation by x0=y0=z0=0.

Substituting y=y0 and z=z0 in right hand side of first of equation (2)

X1 = 17/20=0.85

In second of equation second put x=x1 and z=z0

Y1 = (1/20)(-18-3*0.85) = -1.0275

Put x=x1, y=y1 in third of equation (2)

Z1 = (1/20)(25-2*0.85+3*-1.0275) = 1.011

Similarly we get,

x2=1.002; y2 =-0.9998; z2 =0.9998

x3 =1.0000; y3 =-1.0000; z3 =1.0000

x4 =1.0000; y4 =-1.0000; z4 =1.0000

Now it is sufficient. If you observe above two sets of roots, they are almost same.

Hence the roots of given simultaneous equations using Gauss-Seidel Method are:

x=1;Â y = -1;Â z=1

## MATLAB program for Gauss-Seidel Method

If you like this article, please share it with your friends and like or facebook page for future updates. Subscribe to our newsletter to get notifications about our updates via email. If you have any queries, feel free to ask in the comments section below. Have a nice day!

Can you make a program for solving the same problem by using Newton Raphson method?