Everipedia is now IQ.wiki - Join the IQ Brainlist and our Discord for early access to editing on the new platform and to participate in the beta testing.

# Gauss–Seidel method

In numerical linear algebra, the Gauss–Seidel method, also known as the Liebmann method or the method of successive displacement, is an iterative method used to solve a linear system of equations. It is named after the German mathematicians Carl Friedrich Gauss and Philipp Ludwig von Seidel, and is similar to the Jacobi method. Though it can be applied to any matrix with non-zero elements on the diagonals, convergence is only guaranteed if the matrix is either diagonally dominant, or symmetric and positive definite. It was only mentioned in a private letter from Gauss to his student Gerling in 1823.[1] A publication was not delivered before 1874 by Seidel.

## Description

The Gauss–Seidel method is an iterative technique for solving a square system of n linear equations with unknown x:

.

It is defined by the iteration

whereis the kth approximation or iteration ofis the next or k + 1 iteration of, and the matrix A is decomposed into alower triangularcomponent, and astrictly upper triangularcomponent U:.[2]

In more detail, write out A, x and b in their components:

Then the decomposition of A into its lower triangular component and its strictly upper triangular component is given by:

The system of linear equations may be rewritten as:

The Gauss–Seidel method now solves the left hand side of this expression for x, using previous value for x on the right hand side. Analytically, this may be written as:

However, by taking advantage of the triangular form of, the elements of x(k+1)can be computed sequentially usingforward substitution:

The procedure is generally continued until the changes made by an iteration are below some tolerance, such as a sufficiently small residual.

### Discussion

The element-wise formula for the Gauss–Seidel method is extremely similar to that of the Jacobi method.

The computation of x(k+1) uses the elements of x(k+1) that have already been computed, and only the elements of x(k) that have not been computed in the k+1 iteration. This means that, unlike the Jacobi method, only one storage vector is required as elements can be overwritten as they are computed, which can be advantageous for very large problems.

However, unlike the Jacobi method, the computations for each element cannot be done in parallel. Furthermore, the values at each iteration are dependent on the order of the original equations.

Gauss-Seidel is the same asSOR (successive over-relaxation)with.

## Convergence

The convergence properties of the Gauss–Seidel method are dependent on the matrix A. Namely, the procedure is known to converge if either:

• A is symmetric positive-definite,[4] or

• A is strictly or irreducibly diagonally dominant.

The Gauss–Seidel method sometimes converges even if these conditions are not satisfied.

## Algorithm

Since elements can be overwritten as they are computed in this algorithm, only one storage vector is needed, and vector indexing is omitted. The algorithm goes as follows:

## Examples

### An example for the matrix version

A linear system shown asis given by:
and

We want to use the equation

in the form

where:

and
We must decomposeinto the sum of a lower triangular componentand a strict upper triangular component:
and
The inverse ofis:
.

Now we can find:

Now we haveandand we can use them to obtain the vectorsiteratively.
First of all, we have to choose: we can only guess. The better the guess, the quicker the algorithm will perform.

We suppose:

We can then calculate:

As expected, the algorithm converges to the exact solution:

In fact, the matrix A is strictly diagonally dominant (but not positive definite).

### Another example for the matrix version

Another linear system shown asis given by:
and

We want to use the equation

in the form

where:

and
We must decomposeinto the sum of a lower triangular componentand a strict upper triangular component:
and
The inverse ofis:
.

Now we can find:

Now we haveandand we can use them to obtain the vectorsiteratively.
First of all, we have to choose: we can only guess. The better the guess, the quicker will perform the algorithm.

We suppose:

We can then calculate:

If we test for convergence we'll find that the algorithm diverges. In fact, the matrix A is neither diagonally dominant nor positive definite. Then, convergence to the exact solution

is not guaranteed and, in this case, will not occur.

### An example for the equation version

Suppose given k equations where xnare vectors of these equations and starting point x0. From the first equation solve for x1in terms ofFor the next equations substitute the previous values of xs.

To make it clear consider an example.

Solving forandgives:

Suppose we choose (0, 0, 0, 0) as the initial approximation, then the first approximate solution is given by

Using the approximations obtained, the iterative procedure is repeated until the desired accuracy has been reached. The following are the approximated solutions after four iterations.

The exact solution of the system is (1, 2, −1, 1).

### An example using Python and NumPy

The following numerical procedure simply iterates to produce the solution vector.

Produces the output:

### Program to solve arbitrary no. of equations using Matlab

The following code uses the formula

• Successive over-relaxation

• Kaczmarz method (a "row-oriented" method, whereas Gauss-Seidel is "column-oriented." See e.g. this paper [15] .)

• Iterative method. Linear systems

• Gaussian belief propagation

• Matrix splitting

• Richardson iteration

## References

[1]
Citation Linkgdz.sub.uni-goettingen.deGauss, Carl Friedrich (1903), Werke (in German), 9, Göttingen: Köninglichen Gesellschaft der Wissenschaften, p. 279; direct link.
Sep 21, 2019, 5:19 AM
[2]
Citation Linkopenlibrary.orgGolub, Gene H.; Van Loan, Charles F. (1996), Matrix Computations (3rd ed.), Baltimore: Johns Hopkins, ISBN 978-0-8018-5414-9, p. 511.
Sep 21, 2019, 5:19 AM
[3]
Sep 21, 2019, 5:19 AM
[4]
Sep 21, 2019, 5:19 AM
[5]
Sep 21, 2019, 5:19 AM
[6]
Sep 21, 2019, 5:19 AM
[7]
Sep 21, 2019, 5:19 AM
[8]
Sep 21, 2019, 5:19 AM
[9]
Sep 21, 2019, 5:19 AM
[10]
Citation Linkwww.webcitation.orgGauss Siedel Iteration from www.geocities.com
Sep 21, 2019, 5:19 AM
[11]
Sep 21, 2019, 5:19 AM
[12]
Sep 21, 2019, 5:19 AM
[13]
Sep 21, 2019, 5:19 AM
[14]
Sep 21, 2019, 5:19 AM
[15]
Sep 21, 2019, 5:19 AM
[16]