# Successive over-relaxation method - SOR

## Introduction

We seek the solution to set of linear equations

$A \phi = b.$

In matrix terms, the successive over-relaxation (SOR) iteration can be expressed as

$\phi^{(k+1)} = \left( {D - \omega L} \right)^{ - 1} \left( {\omega U + \left( {1 - \omega } \right)D} \right)\phi^{(k)} + \omega \left( {D - \omega L} \right)^{ - 1} b$

where $D$, $L$, and $U$ represent the diagonal, lower triangular, and upper triangular parts of the coefficient matrix $A$, $k$ is the iteration count, and $\omega$ is a relaxation factor. This matrix expression is not usually used to program the method, and an element-based expression is used:

$\phi^{(k+1)}_i = (1-\omega)\phi^{(k)}_i+\frac{\omega}{a_{ii}} \left(b_i - \sum_{ji}a_{ij}\phi^{(k)}_j\right),\, i=1,2,\ldots,n.$

Note that for $\omega = 1$ that the iteration reduces to the Gauss-Seidel iteration. As with the Gauss-Seidel method, the computation may be done in place, and the iteration is continued until the changes made by an iteration are below some tolerance.

The choice of relaxation factor is not necessarily easy, and depends upon the properties of the coefficient matrix. For symmetric, positive definite matrices it can be proven that $0<\omega<2$ will lead to convergence, but we are generally interested in faster convergence rather than just convergence.

## Algorithm

Chose an initial guess $\phi^{0}$ to the solution

for k := 1 step 1 until convergence do
for i := 1 step until n do
$\sigma = 0$
for j := 1 step until i-1 do
$\sigma = \sigma + a_{ij} \phi_j^{(k)}$
end (j-loop)
for j := i+1 step until n do
$\sigma = \sigma + a_{ij} \phi_j^{(k-1)}$
end (j-loop)
$\sigma = {{\left( {b_i - \sigma } \right)} \over {a_{ii} }}$
$\phi_i^{(k)} = \phi_i^{(k - 1)} + \omega \left( {\sigma - \phi_i^{k - 1} } \right)$
end (i-loop)
check if convergence is reached
end (k-loop)