Lably
Skip to content

Gauss–Seidel method

Iterative method used to solve a linear system of equations

  • 10 min read
  • 4 chapters

Related on Lably

Through System of linear equations, Germany and Symmetric matrix

Description

Let Ax=b be a square system of n linear equations, where:

A=[a11a12⋯a1na21a22⋯a2n⋮⋮⋱⋮an1an2⋯ann],x=[x1x2⋮xn],b=[b1b2⋮bn].

When A and b are known, and x is unknown, the Gauss–Seidel method can be used to iteratively approximate x. The vector x(0) denotes the initial guess for x, often xi(0)=0 for i=1,2,...,n. Denote by x(k) the k-th approximation or iteration of x, and by x(k+1) the approximation of x at the next (or k+1-th) iteration.

Matrix-based formula

The solution is obtained iteratively via Lx(k+1)=b−Ux(k), where the matrix A is decomposed into a lower triangular component L, and a strictly upper triangular component U such that A=L+U. More specifically, the decomposition of A into L and U is given by:

A=[a110⋯0a21a22⋯0⋮⋮⋱⋮an1an2⋯ann]⏟L+[0a12⋯a1n00⋯a2n⋮⋮⋱⋮00⋯0]⏟U.

Why the matrix-based formula works

The system of linear equations may be rewritten as:

Ax=b(L+U)x=bLx+Ux=bLx=b−Ux

The Gauss–Seidel method now solves the left hand side of this expression for x, using the previous value for x on the right hand side. Analytically, this may be written as x(k+1)=L−1(b−Ux(k)).

Element-based formula

However, by taking advantage of the triangular form of L, the elements of x(k+1) can be computed sequentially for each row i using forward substitution: xi(k+1)=1aii(bi−∑j=1i−1aijxj(k+1)−∑j=i+1naijxj(k)),i=1,2,…,n.

Notice that the formula uses two summations per iteration which can be expressed as one summation ∑j≠iaijxj that uses the most recently calculated iteration of xj. 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 related to that of the (iterative) Jacobi method, with an important difference:

In Gauss-Seidel, 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)-th 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 are generally much harder to implement in parallel, since they can have a very long critical path, and are thus most feasible for sparse matrices. Furthermore, the values at each iteration are dependent on the order of the original equations.

Gauss-Seidel is the same as successive over-relaxation with ω=1.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Algebra