You are on page 1of 3

Chapter 10

Lu Decomposition and Matrix Inversion

THE MATRIX INVERSE

In the discussion of matrix operations, we introduced the notion that if a matrix [A] is square, there is another
matrix, [𝐴]−1 , called the inverse of [A], for which

[A] [𝐴−1 ] = [𝐴]−1 [𝐴] = [𝐼]

Now we will focus on how the inverse can be computed numerically. Then we will explore how it can be
used for engineering analysis.

Calculating the Inverse

The inverse can be computed in a column-by-column fashion by generating solutions with unit vectors as
the right-hand-side constants. For example, if the right-hand-side constant has a 1 in the first position and
zeros elsewhere,
1
{𝑏} = {0}
0

the resulting solution will be the first column of the matrix inverse. Similarly, if a unit vector with a 1 at the
second row is used
0
{𝑏} = {1}
0

the result will be the second column of the matrix inverse.


The best way to implement such a calculation is with the LU decomposition algorithm described at
the beginning of this chapter. Recall that one of the great strengths of LU decomposition is that it provides
a very efficient means to evaluate multiple right-hand-side vectors. Thus, it is ideal for evaluating the
multiple unit vectors needed to compute the inverse.

EXAMPLE 1. Matrix Inversion

Problem Statement. Employ LU decomposition to determine the matrix inverse for the system previous
example.
3 −0.1 −0.2
[A] = [0.1 7 −0.3]
0.3 −0.2 10

Recall that the decomposition resulted in the following lower and upper triangular matrices:

3 −0.1 −0.2 1 0 0
[U] = [0 7.00333 −0.293333] [L] = [0.0333333 1 0]
0 0 10.0120 0.100000 −0.0271300 1

Solution. The first column of the matrix inverse can be determined by performing the forward-substitution
solution procedure with a unit vector (with 1 in the first row) as the right-hand-side vector. Thus, the lower-
triangular system, can be set up as

1 0 0 𝑑1 0
[0.0333333 1 0] {𝑑2 } = {0}
0.100000 −0.0271300 1 𝑑3 1

Chapra & Canale, 2015, Numerical Methods for Engineers, 7th Edition
and solved with forward substitution for {𝐷}𝑇 =⌊1 − 0.03333 − 0.1009⌋. This vector can then be used
as the right-hand side,

3 −0.1 −0.2 𝑥1 1
[0 7.00333 −0.293333] {𝑥2 } = {−0.03333}
0 0 10.0120 𝑥3 −0.1009

which can be solved by back substitution for {𝑋}𝑇 = ⌊0.33249 − 0.00518 − 0.01008⌋, which is the first
column of the matrix,

0.33249 0 0
[𝐴]−1 = [−0.00518 0 0]
−0.01008 0 0

To determine the second column, it is formulated as

1 0 0 𝑑1 0
[0.0333333 1 0] {𝑑2 } = {1}
0.100000 −0.0271300 1 𝑑3 0

This can be solved for {D}, and the results are used to determine {𝑋}𝑇 = ⌊0.004944 0.142903 0.00271⌋,
which is the second column of the matrix,

0.33249 0.004944 0
[𝐴]−1 = [−0.00518 0.142903 0]
−0.01008 0.002271 0

Finally, the forward- and back-substitution procedures can be implemented with {𝐵}𝑇 = ⌊0 0 1⌋to solve for
{𝑋}𝑇 = ⌊0.006798 0.004183 0.09988⌋ which is the final column of the matrix

0.33249 0.004944 0.006798


[𝐴]−1 = [−0.00518 0.142903 0.004183]
−0.01008 0.002271 0.09988

The validity of this result can be checked by verifying that [A][𝐴−1 ] = [𝐼].

Pseudocode to generate the matrix inverse is shown in figures. Notice how the decomposition
subroutine is called to perform the decomposition and then generates the inverse by repeatedly calling the
substitution algorithm with unit vectors. The effort required for this algorithm is simply computed as

𝑛3 𝑛 4𝑛3 𝑛
−3 + 𝑛(𝑛2 ) = −4 (Eq.1)
3 3

decomposition + n × substitutions

where the decomposition is defined and the effort involved with every right-hand-side evaluation involves
𝑛2 multiply/divide flops.

Chapra & Canale, 2015, Numerical Methods for Engineers, 7th Edition
CALL Decompose (a, n, tol, o, s, er)
IF er = 0 THEN
DOFOR i = 1, n
DOFOR j = 1, n
IF i = j THEN
b(j) = 1
FIGURE 1 ELSE
Driver program that b(j) = 0
uses some of the END IF
subprograms to END DO
generate a matrix CALL Substitute (a, o, n, b, x)
inverse. DOFOR j = 1, n
ai(j, i) = x(j)
END DO
END DO
Output ai, if desired
ELSE
PRINT "ill-conditioned system"
END IF

Chapra & Canale, 2015, Numerical Methods for Engineers, 7th Edition

You might also like