Numerical Analysis/LU decomposition exercises

From testwiki
Jump to navigation Jump to search

LU Decomposition exercises and quiz

Exercise 1


Problem
Given the 3x3 matrix:

A=[213421612]

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=[213421612]=[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:

<quiz display=simple> { |type="{}"}

 l21= { 2 }.


And AA1=[213045612].

In the similar manner we have:

 l31= { -3 }.

And A1A2=[2130450411]

 l32= { -1 }.

And A2A3=U=[213045006].

Eventually, A has been factorized to LU:

A=[213421612]=[100**10***1]×[213045006].

</quiz>

Exercise 2

Use exercise 1's result to solve the system:

[2x1x2+3x3=44x1+2x2+x3=76x1x2+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=[213421612]×[x1x2x3] = [475].

Since A=LU, by Exercise 1 we have:

[100**10***1]×[213045006]×[x1x2x3]=[475].

Lets y=U×x, we have:

[100**10***1]×[y1y2y3]=[475].

Use forward substitution we have:

<quiz display=simple> { |type="{}"}

 y1= { 4 }  y2= { -1 }  y3= { 6 }

Next, since Ux=y, we have

[213045006]×[x1x2x3]=[y1y2y3].

Use backward substitution we have:

 x1= { 1 }  x2= { 1 }  x3= { 1 } </quiz>