





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Probably the best known method for solving a square system Ax = b is Gaussian elimi-
nation. It represents, as well as the QR method, a direct way of solving such systems.
The aim of Gaussian elimination is also to reduce a linear system of equations Ax = b to
an upper triangular system, U x = c by applying very simple linear transformations to it,
which do not change the solution.
Suppose we have a linear system of the form
a 11
x 1
x 2
+... + a 1 n
x n
= b 1
a 21
x 1
x 2
+... + a 2 n
x n
= b 2
a n 1
x 1
x 2
+... + a nn
x n
= b n
then, assuming that a 11
= 0, we can multiply the first row by
a 21
a 11
and subtract the resulting
row from the second row, which cancels the factor in front of x 1 in that row. Then, we
can multiply the original first row by
a 31
a 11
and subtract it from the third row, which, again,
cancels the factor in front of x 1 in that row.
Continuing like this all the way down, we end up with an equivalent linear system of the
form
a 11
x 1
x 2
+... + a 1 n
x n
= b 1
a
(2)
22
x 2 +... + a
(2)
2 n
xn = b
(2)
2
a
(2)
n 2
x 2 +... + a
(2)
nn xn =^ b
(2)
n.
Assuming now that a
(2)
22
= 0, we can repeat the whole process using the second row now to
eliminate x 2
from row three to n, and so on. Hence, after k − 1, k ≥ 2, steps the system
can be written in matrix form as
(k)
x =
a 11 ∗ ∗... ∗
0 a
(2)
22
0 0 a
(k)
kk
... a
(k)
kn
0 0 a
(k)
nk
... a
(k)
nn
x =
b
(1)
1
b
(2)
2
b
(k)
k
b
(3)
n
If in each step a
(k)
kk
is different from zero, Gaussian elimination produces an upper triangular
matrix.
For theoretical (not numerical) reasons, it is useful to rewrite this process using matrices.
Definition 9.1 For 1 ≤ i ≤ n, let x ∈ R
n such that ej x = 0 for j ≤ i, that is
x = (0, 0 ,... , 0 , x i+
,... , x n
T .
An elementary lower triangular matrix is given by
i
(x) := I − xe
T
i
0 0... −xi+1 1... 0
0 0... −xn 0... 1
Remark 9.2 An elementary lower triangular matrix has the following properties:
(a) det Li(x) = 1,
(b) L i
(x)
− 1 = L i
(−x),
(c) multiplying a matrix A with Li(x) from the left leaves the first i rows unchanged and,
starting from row i + 1, subtracts the row vector x j
(a i 1
,... , a in
) from row j of A.
Naturally, Gaussian elimination is not realised by matrix multiplication, but by program-
ming the corresponding operations directly. This leads to an O(n
3 ) complexity. In addition,
we have an O(n
2 ) complexity for solving the final linear system by back substitution.
However, there is another way of looking at the process.
Suppose we may construct a sequence of n − 1 elementary lower triangular matrices Lj =
j
(m j
) such that
Ln− 1 Ln− 2 · · · L 2 L 1 A = U
is an upper triangular matrix.
Since L i
(m i
− 1 = L i
(−m i
) (exercise), we have
A = L 1 (−m 1 )L 2 (−m 2 ) · · · Ln− 2 (−mn− 2 )Ln− 1 (−mn− 1 )U
= (I + m 1 e
T
1
)(I + m 2 e
T
2
) · · · (I + mn− 2 e
T
n− 2
)(I + mn− 1 e
T
n− 1
= (I + m n− 1
e
T
n− 1
e
T
n− 2
e
T
2
e
T
1
where L is lower triangular with unit diagonal elements.
Rearranging these equations, and using the fact that !ii = 1 for all 1 ≤ i ≤ n, we find that
ij
u jj
a ij
j− 1 ∑
k=
ik
u kj
, 2 ≤ i ≤ n, 1 ≤ j ≤ i − 1 , (9)
u ij
= a ij
i− 1 ∑
k=
ik
u kj
, 1 ≤ i ≤ n, i ≤ j ≤ n. (10)
Thus, the elements of U in the first row are u 1 j = a 1 j , 1 ≤ j ≤ n and the elements of L in
the first column are! 11
= 1 and! i 1
= a i 1
/u 11
, 2 ≤ i ≤ n.
The equations (9) and (10) can now be used for the calculation of the elements !ij and uij.
For each value of i, starting with i = 2, we calculate first! ij
for 1 ≤ j ≤ i − 1 in order,
and then the values of u ij
for i ≤ j ≤ n, again in increasing order. We then move on to
the same calculation for i + 1 and so on until i = n.
The complexity of this procedure is O(n
3 ).
Remark 9.7 If A = LU then the linear system Ax = b = LU x can be solved in two steps.
First, we solve Ly = b by forward substitution and then U x = y by back substitution. Both
is possible in O(n
2 ) time.
Consider the matrix
This matrix is non-singular and is well-conditioned, κ(A) = (3+
5)/2, in the 2-norm. But
Gauss elimination fails at the first step, since a 11
= 0. Note that, a simple interchanging
of the rows will give an upper triangular matrix. Furthermore, a simple interchanging
of columns leads to a lower triangular matrix. The first corresponds to rearranging the
equations in the linear system, the latter corresponds to rearranging the unknowns.
Furthermore, consider the slightly perturbed matrix
− 20 1
Using Gauss elimination on this matrix, gives the factors
20 1
− 20 1
20
However, if we are using floating point arithmetic with machine precision ≈ 10
− 16
. The
number 1 − 10
20 will not be represented exactly, but by its nearest floating point, let us
say that this is the number − 10
20
. Using this number produces the factorisation
20 1
− 20 1
20
The matrix
U is relatively close to the correct U with respect to ‖U ‖. But on calculating
the product we obtain
− 20 1
We see that this matrix is not close to A, since a 1 has been replaced by a 0. Suppose we
wish to solve Ax = b with b = (1, 0)
T using floating point arithmetic we would obtain
x^ ˜ = (0, 1)
T while the true answer is approximately (− 1 , 1)
T
. The explanation for this is
that LU factorisation is not backward stable.
The exchange of rows or columns during the Gaussian elimination process is referred to as
Pivoting. Assume we have performed k − 1 steps and now have a matrix of the form
(k)
=
a 11
0 a
(2)
22
0 0 a
(k)
kk
... a
(k)
kn
0 0 a
(k)
nk
... a
(k)
nn
Now, if det A = det A
(k) ! = 0, not all the entries in the column vector (a
(k)
kk
,... a
(k)
nk
T can
be zero. Hence, we can pick one entry and swap the corresponding row with the kth row.
This is usually referred to as partial (row) pivoting. For numerical reasons it is reasonable
to pick a row! with
|a !k
| = max
k≤i≤n
|a
(k)
ik
In a similar way, partial column pivoting can be defined. Finally, we could use total pivoting,
i.e. we could pick indices !, m ∈ {k, k + 1,... n} such that
|a!m| = max
k≤i,j≤n
|a
(k)
ij
Usually, partial row pivoting is implemented.
To understand the process of pivoting in an abstract form, it is useful to introduce permu-
tation matrices.
Definition 9.8 An n × n elementary permutation matrix is any matrix of the form
ij
= I − (e i
− e j
)(e i
− e j
T .
That is P ij
is an identity matrix with rows i and j (columns) interchanged. A permutation
matrix is the (finite) product of elementary permutations matrices.
function [U,L,P] = par_piv_gauss(A)
n = size(A,1);
L = eye(n);
P = eye(n);
for i = 1:n-
u = U(i,:);
l = L(i,1:i-1);
p = P(i,:);
r = find(max(abs(U(i:n,i))));
r =r+i-1;
U(i,:) = U(r,:);
U(r,:) = u;
L(i,1:i-1) = L(r,1:i-1);
L(r,1:i-1) = l;
P(i,:) = P(r,:);
P(r,:) = p;
for j = i+1:n
L(j,i) = U(j,i)/U(i,i);
U(j,i:n) = U(j,i:n) - L(j,i)*U(i,i:n);
end
end
Let us assume that A has an LU factorisation A = LU and that A is symmetric, i.e.
T = A. Then we have
T
= U
T
L
T
.
Since U
T is a lower triangular matrix and L
T is an upper triangular matrix, we would
like to use the uniqueness of the LU factorisation to conclude that L = U
T and U = L
T .
Unfortunately, this is not possible since the uniqueness requires the lower triangular matrix
to be normalised, i.e. to have only ones as diagonal entries, and this may not be the case
for U
T .
But if A is invertible, we can write
with a diagonal matrix D = diag(d 11
,... , d nn
) and a normalised upper triangular matrix
U. Then, we can conclude that A = LD
U and hence A
T DL
T = LD
U , so that
we can now apply the uniqueness result to derive L =
T and U = DL
T , which gives
T
.
Let us finally make the assumption that all diagonal entries of D are positive. Then, we
can define the square root of D by setting D
1 / 2 = diag(
d 11
d nn
), which leads to
the decomposition
1 / 2
)(LD
1 / 2
)
T
=
T
.
Definition 9.12 A decomposition of a matrix A of the form A = LL
T with a lower trian-
gular matrix L is called a Cholesky factorisation of A.
It remains to verify for what kind of matrices a Cholesky factorisation exists.
Theorem 9.13 Suppose A = A
T is positive definite. Then, A possesses a Cholesky fac-
torisation.
Proof: A matrix A is positive definite if and only if the determinant of every upper
principal sub-matrix Ap is positive. From Theorem 9.4 we can therefore conclude that A =
LU is possible. Since a positive definite matrix is also invertible, our previous derivation
shows that A = LDL
T
. Finally, A being positive definite also means that
d ii
= e
T
i
De i
= e
T
i
− 1 AL
−T )e i
−T e i
T A(L
−T e i
where we use the short notation L
−T for (L
− 1 )
T
.!
For the numerical algorithm, it is again useful to write A = LL
T component-wise taking
into account that L is lower triangular. For i ≥ j we have
aij =
j ∑
k=
!ik!jk =
j− 1 ∑
k=
!ik!jk + !ij !jj.
This can first be resolved for i = j:
jj
a jj
j− 1 ∑
k=
2
jk
1 / 2
With this, we can successively compute the other coefficients. For i > j we have
ij
!jj
a ij
j− 1 ∑
k=
ik
jk
It can be shown that the computational complexity is approximately n
3 /6 + O(n
2 ), which
is about half the complexity of the standard Gauss elimination process. However, here, we
also have to take n roots.