Jump to content

Numerical Analysis/LU decomposition exercises

From Wikiversity

LU Decomposition exercises and quiz

[edit | edit source]

Exercise 1

[edit | edit source]


Problem
Given the 3x3 matrix:

A=[2−13421−6−12]

Find LU decomposition of A


Solution

The procedure of LU decomposition runs similar to the process of Gaussian Elimination. Firstly A is reduced to upper triangular form, which is U, using just the third elementary row operation, namely: add to one row of matrix a scalar time another row of that same matrix. Those scalar used during this process are co-efficient in the L matrix.

The final result will look like this: A=[2−13421−6−12]=[100l2110l31l321]×[u11u12u130u22u2300u33].

Here are the solution for this problem:

According to Gaussian Elimination, the first number in row 2 must be zero-out by adding the first row of matrix a scalar times second row. This scalar, fortunately, is −l21.

Therefore:

 l21=

.
And A→A1=[2−1304−5−6−12].
In the similar manner we have:
 l31=

.
And A1→A2=[2−1304−50−411]
 l32=

.
And A2→A3=U=[2−1304−5006].
Eventually, A has been factorized to LU:
A=[2−13421−6−12]=[100∗∗10∗∗∗1]×[2−1304−5006].


Exercise 2

[edit | edit source]

Use exercise 1's result to solve the system:

[2x1−x2+3x3=44x1+2x2+x3=7−6x1−x2+2x3=−5]

Solution:

The idea of using LU decomposition to solve systems of simultaneous linear equations Ax=b is rewriting the systems as L(Ux)=b. To solve x, we first solve the systems Ly=b for y, and then, once y is determined, we solve the systems: Ux=y for x. Both systems are easy to solve, the first by forward substitution and the second by backward substitution.

Here is the solution for this exercise:

This system has the matrix form:

A=[2−13421−6−12]×[x1x2x3] = [47−5].

Since A=LU, by Exercise 1 we have:

[100∗∗10∗∗∗1]×[2−1304−5006]×[x1x2x3]=[47−5].

Lets y=U×x, we have:

[100∗∗10∗∗∗1]×[y1y2y3]=[47−5].

Use forward substitution we have:

 y1=

 y2=

 y3=

Next, since Ux=y, we have
[2−1304−5006]×[x1x2x3]=[y1y2y3].
Use backward substitution we have:
 x1=

 x2=

 x3=