Gaussian Elimination = LU factorization
Contents
Gaussian Elimination
In Figure 1 we illustrate how Gaussian Elimination is used to transform a linear system of three equations in three unknowns into an upper triangular system by considering the problem

Figure 1: Gaussian Elimination on a linear system of three equations in three unknowns.
Step 1: A multiple of the first row is substracted from the second row to eliminate the
term. This multiple is computed from the coefficient of the term to be eliminated and the coefficient of the same term in the first equation. - Step 2: Similarly, a multiple of the first row is substracted from the third row.
Step 3: A multiple of the second row is substracted from the third row to eliminate the
term.
This leaves the upper triangular system
which is easier to solve, via backward substitution to be discussed later.
Gaussian elimination with an augmented matrix
In Figure 2 we show how it is not necessary to write down the entire linear equations: it suffices to perform Gaussian elimination on the matrix of coefficients, augmented by the right-hand side.

Figure 2: Gaussian Elimination with an augmented matrix of coefficients. ( Compare and contrast with Figure 1.)
LU factorization
Next, let us consider the computation of the LU factorization of a square matrix. We will ignore for now when this computation can be computed, and focus on the computation itself.
Given
, its LU factorization is given by
, where
is unit lower triangular (it has ones on the diagonal) and
is upper triangular. We will derive an algorithm for computing this operation by partitioning
where we use our usual notation that lower-case Greek letter denote scalars, lower-case Roman letters vectors, and upper-case Roman letters matrices.
Now,
implies
so that
or
This suggests the following steps for overwriting a matrix
with its LU factorization:
- Partition
Update
. Update
. Overwrite
with
and
by continuing recursively with
.
This will leave
in the upper triangular part of
and the strictly lower triangular part of
in the strictly lower triangular part of
. (Notice that the diagonal elements of
need not be stored, since they are known to equal one.)
This algorithm is presented as an iteration using our notation in
Figure 3: Algorithm for computing the LU factorization.
It is illustrated for the coefficient matrix from Figure 1 in Figure 4. Examination of the computations in Figure 2 and Figure 4 highlights how Gaussian elimination and LU factorization require the some computations on the coefficient matrix.

Figure 4: LU factorization of a
matrix. ( Compare and contrast with Figure 2.)
Forward Substitution
It is often the case that the coefficient matrix for the linear system is available {\em a priori} and the right-hand side becomes available later. In this case, one may want to perform Gaussian elimination or, equivalently, LU factorization on the coefficient matrix. In

Figure 5: Forward substitution with the multipliers computed for the linear system in Figure 2. ( Compare and contrast with Figure 2.)
we illustrate that if the multipliers are stored, typically over the elements that were zeroed when a multiplier was used, then the computations that were performed during Gaussian Elimination can be applied {\em a postiori}, once the right-hand side becomes available. This process is often referred to as {\em forward substitution}.
Next, we show how forward substitution is the same as solving the linear system
where
is the right-hand side and
is the matrix that resulted from the LU factorization (and is thus unit lower triangular, with the multipliers from Gaussian Elimination stored below the diagonal).
Given unit lower triangular matrix
and vectors
, consider the equation
where
and
are known and
is to be computed. Partition
Now,
implies
so that
or
This suggests the following steps for overwriting the vector
with the solution vector
:
- Partition
Update
. Continue recursively with
and
.
This algorithm is presented as an iteration using our notation in Figure 7. It is illustrated for the matrix
that results from Equation (\ref{eqn:example1}) in Figure 6. Examination of the computations in Figure 5 and Figure 6 highlights how forward substitution and the solution of
are related.

Figure 6: Triangular solve with unit lower triangular matrix computed in Figure 4. ( Compare and contrast with Figure 5.)
![\begin{center}
\resetsteps % Reset all the commands to create a blank worksheet
\resetsteps % Reset all the commands to create a blank worksheet
% Define the operation to be computed
\renewcommand{\routinename}{ \left[ b \right] := \mbox{\sc Ltrsv\_unb}( L, b ) }
% Step 3: Loop-guard
\renewcommand{\guard}{
m( L_{TL} ) < m( L )
}
% Step 4: Define Initialize
\renewcommand{\partitionings}{
$
L \rightarrow
\FlaTwoByTwo{L_{TL}}{L_{TR}}
{L_{BL}}{L_{BR}}
$
,
$
b \rightarrow
\FlaTwoByOne{b_{T}}
{b_{B}}
$
}
\renewcommand{\partitionsizes}{
$ L_{TL} $ is $ 0 \times 0 $,
$ b_{T} $ has $ 0 $ rows
}
% Step 5a: Repartition the operands
\renewcommand{\repartitionings}{
$
\FlaTwoByTwo{L_{TL}}{L_{TR}}
{L_{BL}}{L_{BR}}
\rightarrow
\FlaThreeByThreeBR{L_{00}}{l_{01}}{L_{02}}
{l_{10}^T}{\lambda_{11}}{l_{12}^T}
{L_{20}}{l_{21}}{L_{22}}
$,
$
\FlaTwoByOne{ b_T }
{ b_B }
\rightarrow
\FlaThreeByOneB{b_0}
{\beta_1}
{b_2}
$
}
\renewcommand{\repartitionsizes}{
$ \lambda_{11} $ is $ 1 \times 1 $
,
$ \beta_1 $ has $ 1 $ row}
% Step 5b: Move the double lines
\renewcommand{\moveboundaries}{
$
\FlaTwoByTwo{L_{TL}}{L_{TR}}
{L_{BL}}{L_{BR}}
\leftarrow
\FlaThreeByThreeTL{L_{00}}{l_{01}}{L_{02}}
{l_{10}^T}{\lambda_{11}}{l_{12}^T}
{L_{20}}{l_{21}}{L_{22}}
$,
$
\FlaTwoByOne{ b_T }
{ b_B }
\leftarrow
\FlaThreeByOneT{b_0}
{\beta_1}
{b_2}
$
}
% Step 8: Insert the updates required to change the
% state from that given in Step 6 to that given in Step 7
% Note: The below needs editing!!!
\renewcommand{\update}{
$
\begin{array}{l}
b_2 \becomes b_2 - l_{21} \beta_1
\end{array}
$
}
\FlaAlgorithm
\end{center} \begin{center}
\resetsteps % Reset all the commands to create a blank worksheet
\resetsteps % Reset all the commands to create a blank worksheet
% Define the operation to be computed
\renewcommand{\routinename}{ \left[ b \right] := \mbox{\sc Ltrsv\_unb}( L, b ) }
% Step 3: Loop-guard
\renewcommand{\guard}{
m( L_{TL} ) < m( L )
}
% Step 4: Define Initialize
\renewcommand{\partitionings}{
$
L \rightarrow
\FlaTwoByTwo{L_{TL}}{L_{TR}}
{L_{BL}}{L_{BR}}
$
,
$
b \rightarrow
\FlaTwoByOne{b_{T}}
{b_{B}}
$
}
\renewcommand{\partitionsizes}{
$ L_{TL} $ is $ 0 \times 0 $,
$ b_{T} $ has $ 0 $ rows
}
% Step 5a: Repartition the operands
\renewcommand{\repartitionings}{
$
\FlaTwoByTwo{L_{TL}}{L_{TR}}
{L_{BL}}{L_{BR}}
\rightarrow
\FlaThreeByThreeBR{L_{00}}{l_{01}}{L_{02}}
{l_{10}^T}{\lambda_{11}}{l_{12}^T}
{L_{20}}{l_{21}}{L_{22}}
$,
$
\FlaTwoByOne{ b_T }
{ b_B }
\rightarrow
\FlaThreeByOneB{b_0}
{\beta_1}
{b_2}
$
}
\renewcommand{\repartitionsizes}{
$ \lambda_{11} $ is $ 1 \times 1 $
,
$ \beta_1 $ has $ 1 $ row}
% Step 5b: Move the double lines
\renewcommand{\moveboundaries}{
$
\FlaTwoByTwo{L_{TL}}{L_{TR}}
{L_{BL}}{L_{BR}}
\leftarrow
\FlaThreeByThreeTL{L_{00}}{l_{01}}{L_{02}}
{l_{10}^T}{\lambda_{11}}{l_{12}^T}
{L_{20}}{l_{21}}{L_{22}}
$,
$
\FlaTwoByOne{ b_T }
{ b_B }
\leftarrow
\FlaThreeByOneT{b_0}
{\beta_1}
{b_2}
$
}
% Step 8: Insert the updates required to change the
% state from that given in Step 6 to that given in Step 7
% Note: The below needs editing!!!
\renewcommand{\update}{
$
\begin{array}{l}
b_2 \becomes b_2 - l_{21} \beta_1
\end{array}
$
}
\FlaAlgorithm
\end{center}](/wiki/LA.wiki/GEvsLU/LTrsvAlg?action=AttachFile&do=get&target=latex_6e2c68b6d08b760e44603923784f8d0c2b13397f_p1.png)
Figure 7: Algorithm for triangular solve with unit lower triangular matrix.
Solving the Linear System
What we have seen is that Gaussian Elimination can be used to convert a linear system into an upper triangular linear system, which can then be solved. We also showed that computing the LU factorization of a matrix is the same as performing Gaussian Elimination on the matrix of coefficient. Finally, we showed that forward substitution is equivalent to solving
, where
is the unit lower triangular matrix that results from the LU factorization. We can now show how the solution of the linear system can computed using the LU factorization.
Let
and assume that
, where
and
are given. Then
or
. Let us introduce a dummy vector
. Then
and
can be computed as described in the previous section. Once
has been computed,
can be computed by solving
where now
and
are known.


![\[
\begin{array}{r @{\hspace{1pt}} c @{} r @{\hspace{1pt}} c @{} r @{=} r}
-2 x & - & y & + & z & ~~ 6 \\
& - & 3 y & - & 2 z & ~~ 9 \\
& & & & z & 3
\end{array}
\] \[
\begin{array}{r @{\hspace{1pt}} c @{} r @{\hspace{1pt}} c @{} r @{=} r}
-2 x & - & y & + & z & ~~ 6 \\
& - & 3 y & - & 2 z & ~~ 9 \\
& & & & z & 3
\end{array}
\]](/wiki/LA.wiki/GEvsLU?action=AttachFile&do=get&target=latex_1a19ad90a4d42b8ab8bbe9d6f021698c48e10f46_p1.png)
![\[
A \rightarrow
\FlaTwoByTwoSingleLine
{ \alpha_{11} }{ a_{12}^T }
{ a_{21} }{ A_{22} },
\quad
L \rightarrow
\FlaTwoByTwoSingleLine
{ 1 }{ 0 }
{ l_{21} }{ L_{22} },
\quad
\mbox{and}
\quad
U \rightarrow
\FlaTwoByTwoSingleLine
{ \upsilon_{11} }{ u_{12}^T }
{ 0 }{ U_{22} },
\] \[
A \rightarrow
\FlaTwoByTwoSingleLine
{ \alpha_{11} }{ a_{12}^T }
{ a_{21} }{ A_{22} },
\quad
L \rightarrow
\FlaTwoByTwoSingleLine
{ 1 }{ 0 }
{ l_{21} }{ L_{22} },
\quad
\mbox{and}
\quad
U \rightarrow
\FlaTwoByTwoSingleLine
{ \upsilon_{11} }{ u_{12}^T }
{ 0 }{ U_{22} },
\]](/wiki/LA.wiki/GEvsLU?action=AttachFile&do=get&target=latex_e203acbc3e1526c8da756b1c3368c0273219f974_p1.png)

![\[
\FlaTwoByTwoSingleLineNoPar
{ \alpha_{11} = \upsilon_{11}}{ a_{12}^T = u_{12}^T }
{ a_{21} = l_{21} \upsilon_{11} }{ A_{22} = l_{21} u_{12}^T + L_{22} U_{22} }
\] \[
\FlaTwoByTwoSingleLineNoPar
{ \alpha_{11} = \upsilon_{11}}{ a_{12}^T = u_{12}^T }
{ a_{21} = l_{21} \upsilon_{11} }{ A_{22} = l_{21} u_{12}^T + L_{22} U_{22} }
\]](/wiki/LA.wiki/GEvsLU?action=AttachFile&do=get&target=latex_f8a95f93402544cbdae0aa8b3cf6de3af7e63987_p1.png)
![\[
\FlaTwoByTwoSingleLineNoPar
{ \upsilon_{11} = \alpha_{11} }{ u_{12}^T = a_{12}^T }
{ l_{21} = a_{21} / \upsilon_{11} }{ L_{22} U_{22} = A_{22} - l_{21} u_{12}^T }.
\] \[
\FlaTwoByTwoSingleLineNoPar
{ \upsilon_{11} = \alpha_{11} }{ u_{12}^T = a_{12}^T }
{ l_{21} = a_{21} / \upsilon_{11} }{ L_{22} U_{22} = A_{22} - l_{21} u_{12}^T }.
\]](/wiki/LA.wiki/GEvsLU?action=AttachFile&do=get&target=latex_2fddad3003443d52af7601bfd359ed961e2f437e_p1.png)
![\[
A \rightarrow
\FlaTwoByTwoSingleLine
{ \alpha_{11} }{ a_{12}^T }
{ a_{21} }{ A_{22} }.
\] \[
A \rightarrow
\FlaTwoByTwoSingleLine
{ \alpha_{11} }{ a_{12}^T }
{ a_{21} }{ A_{22} }.
\]](/wiki/LA.wiki/GEvsLU?action=AttachFile&do=get&target=latex_c7c030455b0e8452c78d16f146d39379803a42d0_p1.png)

![\[
L \rightarrow
\FlaTwoByTwoSingleLine
{ 1 }{ 0 }
{ l_{21} }{ L_{22} },
\quad
z \rightarrow
\FlaTwoByOneSingleLine
{ \zeta_1 }
{ z_2 }
\quad
\mbox{and}
\quad
b \rightarrow
\FlaTwoByOneSingleLine
{ \beta_1 }
{ b_2 }.
\] \[
L \rightarrow
\FlaTwoByTwoSingleLine
{ 1 }{ 0 }
{ l_{21} }{ L_{22} },
\quad
z \rightarrow
\FlaTwoByOneSingleLine
{ \zeta_1 }
{ z_2 }
\quad
\mbox{and}
\quad
b \rightarrow
\FlaTwoByOneSingleLine
{ \beta_1 }
{ b_2 }.
\]](/wiki/LA.wiki/GEvsLU?action=AttachFile&do=get&target=latex_7202939db69879ce0f71230ff15aced0e1c48d07_p1.png)

![\[
\FlaTwoByOneSingleLineNoPar
{ \beta_1 = \zeta_1 }
{ b_2 = l_{21} \zeta_1 + L_{22} z_2 }
\] \[
\FlaTwoByOneSingleLineNoPar
{ \beta_1 = \zeta_1 }
{ b_2 = l_{21} \zeta_1 + L_{22} z_2 }
\]](/wiki/LA.wiki/GEvsLU?action=AttachFile&do=get&target=latex_b103ab9e119901b3a4ac95dd27867c7dd78ce782_p1.png)
![\[
\FlaTwoByOneSingleLineNoPar
{ \zeta_1 = \beta_1 }
{ z_2 = b_2 - l_{21} \zeta_1}.
\] \[
\FlaTwoByOneSingleLineNoPar
{ \zeta_1 = \beta_1 }
{ z_2 = b_2 - l_{21} \zeta_1}.
\]](/wiki/LA.wiki/GEvsLU?action=AttachFile&do=get&target=latex_65fa48f13b11bdbbadf9444b906bd50a265e7e4d_p1.png)
![\[
L \rightarrow
\FlaTwoByTwoSingleLine
{ 1 }{ 0 }
{ l_{21} }{ L_{22} }
\quad
\mbox{and}
\quad
b \rightarrow
\FlaTwoByOneSingleLine
{ \beta_1 }
{ b_2 }
\] \[
L \rightarrow
\FlaTwoByTwoSingleLine
{ 1 }{ 0 }
{ l_{21} }{ L_{22} }
\quad
\mbox{and}
\quad
b \rightarrow
\FlaTwoByOneSingleLine
{ \beta_1 }
{ b_2 }
\]](/wiki/LA.wiki/GEvsLU?action=AttachFile&do=get&target=latex_5388925e2d308d29b7b267328d3f866b5c9c1563_p1.png)