logo for matrixlab-examples.com
[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Matrixmania Blog
Contact
-> Sitemap <-
Matlab Books
Quick Matlab Guide
Matlab Tutorials
Matlab Examples
Matlab Flow Control
Boolean Algebra
Linear Algebra
Matlab 2D Plots
Matlab 3D Plots
Matlab GUI
Matlab Cookbook I
Matlab Cookbook II
Probability and Stats
Forums and Help
Relevant Links
Fun!
Your own Website?
Terms/Policies
leftimage for matrixlab-examples.com

LU Factorization


In Matlab there are several built-in functions provided for matrix factorization (also called decomposition).

The name of the built-in function for a Lower-Upper decomposition is 'lu'. To get the LU factorization of a square matrix A, type the command
'[L, U] = lu(A)'.

Matlab returns a lower triangular matrix L and an upper triangular matrix  U such that L*U = A.

Suppose that

A= [ 1  2 -3
     -3 -4 13
       2 1 -5]

We can verify that if

L = [ 1   0     0
      -3   1     0
       2  -1.5  1]

and

U = [1   2  -3
       0   2   4
       0   0   7]

Then, A = L*U

The decomposition of the matrix A is an illustration of an important and well known theorem. If A is a nonsingular matrix that can be transformed into an upper diagonal form U by the application or row addition operations, then there exists a lower triangular matrix L such that A = LU.

Row addition operations can be represented by a product of elementary matrices. If n such operations are required, the matrix U is related to the matrix A in the following way:

U = En En-1 ... E2 E1 A

The lower triangular matrix L is found from

L = E1-1 E2-1 ... En-1

L will have ones on the diagonal. The off-diagonal elements are zeros above the diagonal, while the elements below the diagonal are the multipliers required to perform Gaussian elimination on the matrix A. The element lij
is equal to the multiplier used to eliminate the (i, j) position.

Example:



In Matlab, let's find the LU decomposition of the matrix

A = [-2 1 -3; 6 -1 8; 8 3 -7]

Write this instruction in the command window or within a script:

[L, U] = lu(A)

And the Matlab answer is:

L =
   -0.2500   -0.5385    1.0000
    0.7500     1.0000           0
    1.0000            0           0

U =
    8.0000    3.0000   -7.0000
         0     -3.2500   13.2500
         0         0         2.3846

We can test the answer, by typing

L*U

And, finnally, the Matlab answer is:

ans =
   -2.0000    1.0000   -3.0000
    6.0000   -1.0000    8.0000
    8.0000    3.0000   -7.0000

>>

Showing that A = L*U, indeed.

From 'LU Factorization' to home
From 'LU Factorization' to 'Linear Algebra Menu'

footer for LU factorization page