LU factorization

1.Gaussian elimination and row echelon reduction

Suppose now that Ax=b admits a unique solution. How to find it? We are especially interested in constructing a general procedure, that will work no matter what the size of A might be. This means we seek an algorithm that precisely specifies the steps that lead to the solution, and that we can program a computing device to carry out automatically. One such algorithm is Gaussian elimination.

Consider the system

{ x1+2x2-x3 = 2 2x1-x2+x3 = 2 3x1-x2-x3 = 1 .

The idea is to combine equations such that we have one fewer unknown in each equation. Ask: with what number should the first equation be multiplied in order to eliminate x1 from sum of equation 1 and equation 2? This number is called a Gaussian multiplier, and is in this case -2. Repeat the question for eliminating x1 from third equation, with multiplier -3.

{ x1+2x2-x3 = 2 2x1-x2+x3 = 2 3x1-x2-x3 = 1 .{ x1+2x2-x3 = 2 -5x2+3x3 = -2 -7x2+2x3 = -5 .

Now, ask: with what number should the second equation be multiplied to eliminate x2 from sum of second and third equations. The multiplier is in this case -7/5.

{ x1+2x2-x3 = 2 -5x2+3x3 = -2 -7x2+2x3 = -5 .{ x1+2x2-x3 = 2 -5x2+3x3 = -2 -115x3 = -115 .

Starting from the last equation we can now find x3=1, replace in the second to obtain -5x2=-5, hence x2=1, and finally replace in the first equation to obtain x1=1.

The above operations only involve coefficients. A more compact notation is therefore to work with what is known as the "bordered matrix"

( 1 2 -1 2 2 -1 1 2 3 -1 -1 1 )( 1 2 -1 2 0 -5 3 -2 0 -7 2 -5 )( 1 2 -1 2 0 -5 3 -2 0 0 -115 -115 )

Once the above triangular form has been obtain, the solution is found by back substitution, in which we seek to form the identity matrix in the first 3 columns, and the solution is obtained in the last column.

( 1 2 -1 2 0 -5 3 -2 0 0 -115 -115 )( 1 2 -1 2 0 -5 3 -2 0 0 1 1 )( 1 0 0 1 0 1 0 1 0 0 1 1 )

2.LU-factorization

2.1.Example for m=3

Consider the system Ax=b

{ x1+2x2-x3 = 2 2x1-x2+x3 = 2 3x1-x2-x3 = 1 .

with

A=( 1 2 -1 2 -1 1 3 -1 -1 ),b=( 2 2 1 )

We ask if there is a matrix L1 that could be multiplied with A to produce a result L1A with zeros under the main diagonal in the first column. First, gain insight by considering multiplication by the identity matrix, which leaves A unchanged

( 1 0 0 0 1 0 0 0 1 )( 1 2 -1 2 -1 1 3 -1 -1 )=( 1 2 -1 2 -1 1 3 -1 -1 )

In the first stage of Gaussian multiplication, the first line remains unchanged, so we deduce that L1 should have the same first line as the identity matrix

L1=( 1 0 0 ? ? ? ? ? ? )
( 1 0 0 ? ? ? ? ? ? )( 1 2 -1 2 -1 1 3 -1 -1 )=( 1 2 -1 0 -5 3 0 -7 2 )

Next, recall the way Gaussian multipliers were determined: find number to multiply first line so that added to second, third lines a zero is obtained. This leads to the form

L1=( 1 0 0 ? 1 0 ? 0 1 )

Finally, identify the missing entries with the Gaussian multipliers to determine

L1=( 1 0 0 -2 1 0 -3 0 1 )

Verify by carrying out the matrix multiplication

L1A=( 1 0 0 -2 1 0 -3 0 1 )( 1 2 -1 2 -1 1 3 -1 -1 )=( 1 2 -1 0 -5 3 0 -7 2 )

Repeat the above reasoning to come up with a second matrix L2 that forms a zero under the main diagonal in the second column

L2=( 1 0 0 0 1 0 0 -7/5 1 )
L2L1A=( 1 0 0 0 1 0 0 -7/5 1 )( 1 2 -1 0 -5 3 0 -7 2 )=( 1 2 -1 0 -5 3 0 0 -11/5 )=U

We have obtained a matrix with zero entries under the main diagonal (an upper triangular matrix) by a sequence of matrix multiplications.

2.2.General m case

From the above, we assume that we can form a sequence of multiplier matrices such that the result is an upper triangular matrix U

Lm-1...L2L1A=U

Definition. The matrix

𝑳k=( 1 0 1 0 0 0 0 1 0 0 -lk+1,k 0 0 -lk+2,k 0 0 -lm,k 1 )

with li,k=ai,k(k)/ak,k(k), and 𝑨(k)=(ai,j(k)) the matrix obtained after step k of row echelon reduction (or, equivalently, Gaussian elimination) is called a Gaussian multiplier matrix.

We will show that this indeed possible if Ax=b admits a unique solution. Furthermore, the product of lower triangular matrices is lower triangular, and the inverse of a lower triangular matrix is lower triangular (same applies for upper triangular matrices). Introduce the notation

L-1=Lm-1...L2L1

and obtain

L-1A=U

or

A=LU

The above result permits a basic insight into Gaussian elimination: the procedure depends on "factoring" the matrix A into two "simpler" matrices L,U. The idea of representing a matrix as a product of simpler matrices is fundamental to linear algebra, and we will come across it repeatedly.

For now, the factorization allows us to devise the following general approach to solving Ax=b

  1. Find the factorization LU=A

  2. Insert the factorization into Ax=b to obtain (LU)x=L(Ux)=Ly=b, where the notation y=Ux has been introduced. The system

    Ly=b

    is easy to solve by forward substitution to find y for given b

  3. Finally find x by backward substitution solution of

    Ux=y

Algorithm Gauss elimination without pivoting

for s=1 to m-1

for i=s+1 to m

t=-ais/ass

for j=s+1 to m

aij=aij+tasj

bi=bi+tbs

for s=m downto 1

xs=bs/ass

for i=1 to s-1

bi=bi-aisxs

return x

Algorithm Gauss elimination with partial pivoting

p=1:m (initialize row permutation vector)

for s=1 to m-1

piv = abs(ap(s),s)

for i=s+1 to m

mag = abs(ap(i),s)

if mag>piv then

piv=mag;k=p(s);p(s)=p(i);p(i)=k

if piv<ϵ then break(“Singular matrix”)

t=-ap(i)s/ap(s)s

for j=s+1 to m

ap(i)j=ap(i)j+tap(s)j

bp(i)=bp(i)+tbp(s)

for s=m downto 1

xs=bp(s)/ap(s)s

for i=1 to s-1

bp(i)=bp(i)-ap(i)sxs

return x

Given 𝑨m×n

Singular value decomposition

Gram-Schmidt

Lower-upper

Transformation of coordinates

𝑨𝒙=𝒃

𝑼𝚺𝑽T=𝑨

𝑸𝑹=𝑨

𝑳𝑼=𝑨

(𝑼𝚺𝑽T)𝒙=𝒃𝑼𝒚=𝒃𝒚=𝑼T𝒃

(𝑸𝑹)𝒙=𝒃𝑸𝒚=𝒃, 𝒚=𝑸T𝒃

(𝑳𝑼)𝒙=𝒃𝑳𝒚=𝒃(forwardsubtofind)y

𝚺𝒛=𝒚𝒛=𝚺+𝒚

𝑹𝒙=𝒚(backsubtofind.𝒙)

𝑼𝒙=𝒚 (back sub to find 𝒙)

𝑽T𝒙=𝒛𝒙=𝑽𝒛

3.Inverse matrix

By analogy to the simple scalar equation ax=b with solution x=a-1b when a0, we are interested in writing the solution to a linear system Ax=b as x=A-1b for Am×m, xm. Recall that solving Ax=b=Ib corresponds to expressing the vector b as a linear combination of the columns of A. This can only be done if the columns of A form a basis for m, in which case we say that A is non-singular.

Definition 1. For matrix Am×m non-singular the inverse matrix is denoted by A-1 and satisfies the properties

AA-1=A-1A=I

3.1.Gauss-Jordan algorithm

Computation of the inverse A-1 can be carried out by repeated use of Gauss elimination. Denote the inverse by B=A-1 for a moment and consider the inverse matrix property AB=I. Introducing the column notation for B,I leads to

A( B1 ... Bm )=( e1 ... em )

and identification of each column in the equality states

ABk=ek,k=1,2,..,m

with ek the column unit vector with zero components everywhere except for a 1 in row k. To find the inverse we need to simultaneously solve the m linear systems given above.

Gauss-Jordan algorithm example. Consider

A=( 1 2 3 -1 3 1 2 -1 -2 )

To find the inverse we solve the systems AB1=e1,AB2=e2,AB3=e3. This can be done simultaneously by working with the matrix A bordered by I

(A|I)=( 1 1 0 1 0 0 -1 1 1 0 1 0 2 4 -2 0 0 1 )

Carry out now operations involving linear row combinations and permutations to bring the left side to I

( 1 1 0 1 0 0 -1 1 1 0 1 0 2 4 -2 0 0 1 )( 1 1 0 1 0 0 0 2 1 1 1 0 0 2 -2 -2 0 1 )( 1 1 0 1 0 0 0 2 1 1 1 0 0 0 -3 -3 -1 1 )
( 1 1 0 1 0 0 0 2 1 1 1 0 0 0 1 1 13 -13 )( 1 1 0 1 0 0 0 2 0 0 23 13 0 0 1 1 13 -13 )( 1 1 0 1 0 0 0 1 0 0 13 16 0 0 1 1 13 -13 )
( 1 0 0 1 -13 -16 0 1 0 0 13 16 0 0 1 1 13 -13 )

to obtain

A-1=( 1 -13 -16 0 13 16 1 13 -13 )

4.Determinants

Definition. The determinant of a square matrix 𝑨=( 𝒂1 𝒂m )m×m is a real number

det(A)=| a11 a12 a1m a21 a22 a2m am1 am2 amm |

giving the (oriented) volume of the parallelepiped spanned by matrix column vectors.

4.1.Cross product