<< numerical_analysis
Linear Equations Solving
1. Linear Equation Solving by Elimination
We’ve kown that the equations with -variables
can be written in matrix form
where is coefficient matrix, is constant vector, and is solution vector.
Cramer’s rule guarantees that for coefficient matrix with , the solution exists and is unique:
where can be generated by replacing the -th column of coefficient matrix with constant vector .
Although Cramer’s rule plays an important role in thoery of linear equations, the time complexity of computing determinant makes it not acceptable to apply Cramer’s rule in large scale of linear systems.
# Gaussian Elimination
Gaussian elimination, instead, applies elementary row operation to augmented matrix . It converts the matrix into an upper triangular matrix, after these operations, the equation can be easily solved by substituting (bottom-up). The time complexity of this approach is .
The Gaussian elimination requires
for any . While the solution exists only requires . This indicates that Gaussian elimination cannot be applied to some solvable functions with during the elimination. Besides, the round-off error will increase for small .
# Gaussian Elimination with Column Pivoting
To overcome the flaw of Gaussian elimination, the column pivoting operation for each iteration in elimination is proposed. Formally, for each , we search for the element with maximal absolute value within , then we swap row before elimination.
We can solve any linear equations with with column pivoting. Since the total time complexity of comparison is , the time complexity of Gaussian elimination with column pivoting is still .
# Gauss-Jordan Elimination
Gaussian elimination execute substitution process right after the matrix is converted to upper triangular matrix, while we can do further elimination to convert it into a diagonal matrix, which is called Gauss-Jordan elimination.
2. Linear Equation Solving by Matrix Decomposition
# Relation between Line Operation and Matrix Decomposition
An elementary line operation is equivalent to multiply a elementary matrix. The process of Gaussian elimination is equivalent to multiply a matrix to , results in a upper triangular matrix:
Multiply on both sides: where can be proved to be a lower triangular matrix. The form indicates that we devide the matrix into the multiplication of two matrixes , . where and are lower and upper triangular matrix respectively. Equivalently, we can also decompose as .
Since you can move the coefficients from one matrix to another, there are infinite decompositions of form . If is contrainted to be the unit lower triangular matrix, that unique decomposition is called Doolittle decomposition. If is contrainted to be the unit upper triangle matrix, that unique decomposition is called Crout decomposition.
Besides, there are other forms of decomposition such as , where the is lower triangular matrix (hence is upper triangular matrix), and is diagonal matrix. Specially, if is a positive definite matrix, we have , , this is what we called decomposition or refined Cholesky decomposition. Let we have , which is called Cholesky decomposition.
The matrix is decomposed into two or three triangular/diagonal matrixes after decomposition, which can be easily solved by substitution. Note that decomposition process is independent of . Hence if there are multiple equations with same but various , this approach reduces the time complexity by cancelling the repetative processing of .
# LU Decomposition
Compare elements to determine the matrix after Doolittle decomposition:
Hence , .
Now we have the algorithm for Doolittle decomposition:

Refer to https://github.com/revectores/revector for the C++ implementation of Doolittle decomposition.
Refer to https://github.com/revectores/LU-decomposition-impls for some parallelized Doolittle decomposition implemented in C.
Similarly, the algorithm of Crout decomposition:

Refer to https://github.com/revectores/revector for the C++ implementation of Crout decomposition.
# Decomposition of Positive Definite Matrix
As mentioned above, we have Cholesky decomposition for positive definitive matrix

In practice we often decompose as form instaed to remove square root computation.

Proof. To prove the existence of decomposition, we first apply Doolittle decomposition to matrix and extract the diagonal line of :
Since is symmetric positive definite matrix, we have . We can prove since That is,
# Condition Number of Matrix
For the non-singular matrix , we define as the condition number of matrix . Due to the equivalence of different norms, the condition numbers with different norms are also equivalent.
How the error is influenced by small disturbance in coefficient matrix is represented as How the error is influenced by small disturbance in constant vector is represented as We call the matrix with large ill-conditioned, which states “the small disturbance causes a huge difference in solution”.
3. Linear Equation Solving by Iteration
Transform the equations into , for any , construct the iteration if the iteration series converges, the limit of iteration series is the solution of equations .
In practice, the iteration is terminated once we have for some pre-chosen error bound , and pick as the approximation of solution.
The convergence of iteration is determined by spectral radius of iteration matrix . Specifically, the iteration converges if and only if the spectral radius .
Proof. If is the solution of equation , then
if and only if . Hence we define the matrix with spectral radius less than 1 convergent matrix.
That is, whether the linear equations converges depends on the property of iteration matrix, regardless of the solution and .
By definition, we have to compute all the eigenvalues to get the spectral radius of matrix. We may simplify this work by computing the norm . Note that , if , the iteration matrix must be convergent.
# Jacobi Iteration
The iteration form The matrix form of Jacobi iteration is
where .
There is a shortcut to judge whether Jacobi iteration converges: if the coefficient matrix meets one of following condition:
The Jacobi iteration must converge. This can be proved by showing the spectral radius of iteration matrix is less than 1.
==TODO: Add the proofs.==
# Gauss-Seidel Iteration
The Gauss-Seidel iteration use those new values computed in current iteration instead of last one: Denote We have That is, Hence Denote , the Gauss-Seidel iteration can be expressed by
# Successive Over-Relaxation
The SOR method is a variant of Gauss-Seidel method resulting in faster convergence: where is relaxation factor.
The matrix form of SOR is , where
Proof. where .
The necessary condition that SOR converges is . Specially, if is the positive determined matrix, is also the sufficient condition.
The iteration is called
- Under-relaxation iteration if .
- Gauss-Seidel iteration if .
- Over-relaxation iteration if .
The best (with fastest convergence speed) is hard to determine for specific equation.