Last modified: September 03, 2024

This article is written in: 🇺🇸

LU Decomposition

LU Decomposition (or LU Factorization) is a powerful and widely used technique in numerical linear algebra for solving systems of linear equations, computing inverses, and determining determinants. The core idea is to factorize a given square matrix A into the product of a lower-triangular matrix L and an upper-triangular matrix U. This approach is particularly useful as it reduces complex operations such as solving Ax=b into simpler, more structured subproblems. Once the decomposition A=LU is found, solving the system becomes a matter of performing forward and backward substitutions, which are both computationally inexpensive compared to other direct methods like Gaussian elimination performed from scratch for each right-hand-side vector b.

output(27)

Mathematical Formulation

Consider a square n×n matrix A:

A=[a11a12a13a1na21a22a23a2na31a32a33a3nan1an2an3ann]

The LU decomposition expresses A as:

A=LU

where

L=[1000l21100l31l3210ln1ln2ln31]

U=[u11u12u13u1n0u22u23u2n00u33u3n000unn]

Here, L is lower-triangular with ones on the diagonal, and U is upper-triangular. The factorization is not always guaranteed to exist unless certain conditions are met (e.g., no zero pivots without partial pivoting, or A being nonsingular and well-conditioned).

Derivation

The derivation of the LU decomposition closely follows the steps of Gaussian elimination. Gaussian elimination transforms the matrix A into an upper-triangular matrix by adding multiples of one row to another. These multipliers can be stored in the entries of a lower-triangular matrix L.

Starting from:

Ax=b

we write A=LU. Substitute to get:

(LU)x=b

Introducing an intermediate vector c:

Ux=cLc=b

Since L is lower-triangular and nonsingular (with ones on its diagonal), we can quickly solve for c using forward substitution. Once c is known, we solve the upper-triangular system Ux=c via backward substitution.

The process of determining L and U essentially mimics the elimination steps:

I. Use the first row of A to eliminate entries below a11.

II. Store these elimination factors in L.

III. After the first column is dealt with, the submatrix of A (excluding the first row and column) is similarly factorized.

IV. This process continues recursively until A is fully decomposed into L and U.

Algorithm Steps

Given an n×n matrix A, the LU decomposition algorithm without pivoting can be described as follows:

I. Initialization:

Set L=I (the n×n identity matrix) and U=0 (the n×n zero matrix).

II. Main Loop (for i=1 to n):

Compute the diagonal and upper elements of U:

For j=i to n:

uij=aijk=1i1likukj.

Compute the lower elements of L:

For j=i+1 to n:

lji=1uii(ajik=1i1ljkuki).

III. After these loops complete, A=LU is obtained.

IV. Solving Ax=b:

Forward substitution for Lc=b:

For i=1 to n:

ci=bik=1i1likck.

Backward substitution for Ux=c:

For i=n down to 1:

xi=cik=i+1nuikxkuii.

Example

Consider the system of equations:

2x+3y4z=1,3x3y+2z=2,2x+6yz=3.

In matrix form:

A=[234332261]

b=[1 2 3]

Step-by-Step LU Decomposition

Step 1: Initialize

Set:

L=[100010001]

U=[000000000]

Compute First Row of U:

u11=a11=2,u12=a12=3,u13=a13=4.

Thus:

U=[234000000]

Compute First Column of L (below diagonal):

For i=2 to 3:

l21=a21u11=32=1.5,l31=a31u11=22=1.

Now:

L=[1001.510101]

Second Pivot (i=2):

Compute u22:

u22=a22l21u12=(3)(1.5)(3)=34.5=7.5.

Compute u23:

u23=a23l21u13=2(1.5)(4)=2+6=8.

Thus:

U=[23407.58000]

For l32:

l32=a32l31u12u22=6(1)(3)7.5=6+37.5=97.5=1.2.

Update L:

L=[1001.51011.21]

Third Pivot (i=3):

Compute u33:

u33=a33l31u13l32u23=(1)(1)(4)(1.2)(8).

Carefully evaluate:

(1)(1×4)(1.2×8)=(1)(4)(9.6)=5+9.6=4.6.

Thus:

U=[23407.58004.6]

So finally, we have:

L=[1001.51011.21]

U=[23407.58004.6]

Forward Substitution (Lc=b):

c1=b1=1

c2=b2l21c1=2(1.5)(1)=3.5

c3=b3l31c1l32c2=3(1)(1)(1.2)(3.5)=3+14.2=0.2

Backward Substitution (Ux=c):

x3=c3u33=0.24.60.0434783

x2=c2u23x3u22=3.5(8)(0.0434783)7.5=3.5+0.34782647.5=3.15217367.50.42029

x1=c1u12x2u13x3u11=13(0.42029)(4)(0.0434783)2=11.260870.17391322=0.43478322=0.2173916

Advantages

Limitations

Table of Contents

    LU Decomposition
    1. Mathematical Formulation
    2. Derivation
    3. Algorithm Steps
    4. Example
    5. Advantages
    6. Limitations