The PA=LU Factorization - Math 218bfitzpat/teaching/218s20/...Background \Big Picture" Overview of...

Post on 05-Aug-2020

1 views 0 download

Transcript of The PA=LU Factorization - Math 218bfitzpat/teaching/218s20/...Background \Big Picture" Overview of...

The PA = LU FactorizationMath 218

Brian D. Fitzpatrick

Duke University

November 1, 2019

MATH

Overview

Background“Big Picture” Overview of PA = LUComputational Limitations of rrefRounding ErrorsPermutation MatricesForward Elimination

The PA = LU AlgorithmDescriptionExample

Row EquivalencyA and U are Row-Equivalent

Background“Big Picture” Overview of PA = LU

The PA = LU algorithm produces a factorization used in numericallinear algebra.

I P is a permutation matrix

I L is lower triangular

I U is upper triangular

I PA = LU algorithm is faster than EA = rref(A)

I PA = LU algorithm uses only row swaps and row addition

I row swaps are determined by the method of partial pivoting

I A #»x =#»

b is equivalent to U #»x = #»y where #»y solves L #»y = P#»

b

Background“Big Picture” Overview of PA = LU

The PA = LU algorithm produces a factorization used in numericallinear algebra.

I P is a permutation matrix

I L is lower triangular

I U is upper triangular

I PA = LU algorithm is faster than EA = rref(A)

I PA = LU algorithm uses only row swaps and row addition

I row swaps are determined by the method of partial pivoting

I A #»x =#»

b is equivalent to U #»x = #»y where #»y solves L #»y = P#»

b

Background“Big Picture” Overview of PA = LU

The PA = LU algorithm produces a factorization used in numericallinear algebra.

I P is a permutation matrix

I L is lower triangular

I U is upper triangular

I PA = LU algorithm is faster than EA = rref(A)

I PA = LU algorithm uses only row swaps and row addition

I row swaps are determined by the method of partial pivoting

I A #»x =#»

b is equivalent to U #»x = #»y where #»y solves L #»y = P#»

b

Background“Big Picture” Overview of PA = LU

The PA = LU algorithm produces a factorization used in numericallinear algebra.

I P is a permutation matrix

I L is lower triangular

I U is upper triangular

I PA = LU algorithm is faster than EA = rref(A)

I PA = LU algorithm uses only row swaps and row addition

I row swaps are determined by the method of partial pivoting

I A #»x =#»

b is equivalent to U #»x = #»y where #»y solves L #»y = P#»

b

Background“Big Picture” Overview of PA = LU

The PA = LU algorithm produces a factorization used in numericallinear algebra.

I P is a permutation matrix

I L is lower triangular

I U is upper triangular

I PA = LU algorithm is faster than EA = rref(A)

I PA = LU algorithm uses only row swaps and row addition

I row swaps are determined by the method of partial pivoting

I A #»x =#»

b is equivalent to U #»x = #»y where #»y solves L #»y = P#»

b

Background“Big Picture” Overview of PA = LU

The PA = LU algorithm produces a factorization used in numericallinear algebra.

I P is a permutation matrix

I L is lower triangular

I U is upper triangular

I PA = LU algorithm is faster than EA = rref(A)

I PA = LU algorithm uses only row swaps and row addition

I row swaps are determined by the method of partial pivoting

I A #»x =#»

b is equivalent to U #»x = #»y where #»y solves L #»y = P#»

b

Background“Big Picture” Overview of PA = LU

The PA = LU algorithm produces a factorization used in numericallinear algebra.

I P is a permutation matrix

I L is lower triangular

I U is upper triangular

I PA = LU algorithm is faster than EA = rref(A)

I PA = LU algorithm uses only row swaps and row addition

I row swaps are determined by the method of partial pivoting

I A #»x =#»

b is equivalent to U #»x = #»y where #»y solves L #»y = P#»

b

BackgroundComputational Limitations of rref

RecallThe Gauß-Jordan algorithm produces a matrix factorizationEA = rref(A).

The matrix E is of the form

E = Er · · ·E2E1

where E1,E2, . . . ,Er are the elementary matrices corresponding tothe row operations used in the Gauß-Jordan algorithm.

Utility

Solving A #»x =#»

b is equivalent to solving rref(A) #»x = E#»

b .

BackgroundComputational Limitations of rref

RecallThe Gauß-Jordan algorithm produces a matrix factorizationEA = rref(A). The matrix E is of the form

E = Er · · ·E2E1

where E1,E2, . . . ,Er are the elementary matrices corresponding tothe row operations used in the Gauß-Jordan algorithm.

Utility

Solving A #»x =#»

b is equivalent to solving rref(A) #»x = E#»

b .

BackgroundComputational Limitations of rref

RecallThe Gauß-Jordan algorithm produces a matrix factorizationEA = rref(A). The matrix E is of the form

E = Er · · ·E2E1

where E1,E2, . . . ,Er are the elementary matrices corresponding tothe row operations used in the Gauß-Jordan algorithm.

Utility

Solving A #»x =#»

b is equivalent to solving rref(A) #»x = E#»

b .

BackgroundComputational Limitations of rref

ProblemThe matrix E is the product of a lot of elementary matrices. Themore row operations used, the more time it takes to compute E .

BackgroundComputational Limitations of rref

ExampleThe Gauß-Jordan algorithm gives

9 38 −204 17 −93 17 −11

A

(1/9)·R1→R1−−−−−−−−→

1 38/9 −20/94 17 −93 17 −11

R2 + (−4) · R1 → R2R3 + (−3) · R1 → R3−−−−−−−−−−−−−−−−→

1 38/9 −20/90 1/9 −1/90 13/3 −13/3

9·R2→R2−−−−−−→

1 38/9 −20/90 1 −10 13/3 −13/3

R1 + (−38/9) · R2 → R1R3 + (−13/3) · R2 → R3−−−−−−−−−−−−−−−−−→

1 0 20 1 −10 0 0

rref(A)

The EA = rref(A) factorization is

17 −38 0−4 9 017 −39 1

E

9 38 −204 17 −93 17 −11

A

=

1 0 20 1 −10 0 0

rref(A)

Where did the entries in E come from?

BackgroundComputational Limitations of rref

ExampleThe Gauß-Jordan algorithm gives

9 38 −204 17 −93 17 −11

A

(1/9)·R1→R1−−−−−−−−→

1 38/9 −20/94 17 −93 17 −11

R2 + (−4) · R1 → R2R3 + (−3) · R1 → R3−−−−−−−−−−−−−−−−→

1 38/9 −20/90 1/9 −1/90 13/3 −13/3

9·R2→R2−−−−−−→

1 38/9 −20/90 1 −10 13/3 −13/3

R1 + (−38/9) · R2 → R1R3 + (−13/3) · R2 → R3−−−−−−−−−−−−−−−−−→

1 0 20 1 −10 0 0

rref(A)

The EA = rref(A) factorization is

17 −38 0−4 9 017 −39 1

E

9 38 −204 17 −93 17 −11

A

=

1 0 20 1 −10 0 0

rref(A)

Where did the entries in E come from?

BackgroundComputational Limitations of rref

ExampleThe Gauß-Jordan algorithm gives

9 38 −204 17 −93 17 −11

A

(1/9)·R1→R1−−−−−−−−→

1 38/9 −20/94 17 −93 17 −11

R2 + (−4) · R1 → R2R3 + (−3) · R1 → R3−−−−−−−−−−−−−−−−→

1 38/9 −20/90 1/9 −1/90 13/3 −13/3

9·R2→R2−−−−−−→

1 38/9 −20/90 1 −10 13/3 −13/3

R1 + (−38/9) · R2 → R1R3 + (−13/3) · R2 → R3−−−−−−−−−−−−−−−−−→

1 0 20 1 −10 0 0

rref(A)

The EA = rref(A) factorization is

17 −38 0−4 9 017 −39 1

E

9 38 −204 17 −93 17 −11

A

=

1 0 20 1 −10 0 0

rref(A)

Where did the entries in E come from?

BackgroundRounding Errors

NoteUsing rational numbers to reduce a system produces an exactanswer.

rref

7/1000 306/5 93/1000 613/10481/100 −148/25 111/100 0

407/5 28/25 59/50 837/10

=

1 0 0 10 1 0 10 0 1 1

BackgroundRounding Errors

In practice, computers use floating point numbers to store data.After each computation, the computer rounds each entry to agiven number of significant digits.

BackgroundRounding Errors

Applying Gauß-Jordan algorithm to the previous example withrounding to three significant digits gives

0.007 61.2 0.093 61.34.81 −5.92 1.11 0.081.4 1.12 1.18 83.7

→ 1.0 8740.0 13.3 8760.0

4.81 −5.92 1.11 0.081.4 1.12 1.18 83.7

1.0 8740.0 13.3 8760.00.0 −42000.0 −62.9 −42100.00.0 −711000.0 −1080.0 −713000.0

1.0 8740.0 13.3 8760.00.0 1.0 0.0015 1.00.0 −711000.0 −1080.0 −713000.0

1.0 0.0 0.19 20.00.0 1.0 0.0015 1.00.0 0.0 −13.5 −2000.0

1.0 0.0 0.19 20.00.0 1.0 0.0015 1.00.0 0.0 1.0 148.0

1.0 0.0 0.0 −8.120.0 1.0 0.0 0.7780.0 0.0 1.0 148.0

The exact solution is #»x = 〈1, 1, 1〉 . Rounding “destabilized” thealgorithm.

BackgroundRounding Errors

Applying Gauß-Jordan algorithm to the previous example withrounding to three significant digits gives

0.007 61.2 0.093 61.34.81 −5.92 1.11 0.081.4 1.12 1.18 83.7

→ 1.0 8740.0 13.3 8760.0

4.81 −5.92 1.11 0.081.4 1.12 1.18 83.7

1.0 8740.0 13.3 8760.00.0 −42000.0 −62.9 −42100.00.0 −711000.0 −1080.0 −713000.0

1.0 8740.0 13.3 8760.00.0 1.0 0.0015 1.00.0 −711000.0 −1080.0 −713000.0

1.0 0.0 0.19 20.00.0 1.0 0.0015 1.00.0 0.0 −13.5 −2000.0

1.0 0.0 0.19 20.00.0 1.0 0.0015 1.00.0 0.0 1.0 148.0

1.0 0.0 0.0 −8.120.0 1.0 0.0 0.7780.0 0.0 1.0 148.0

The exact solution is #»x = 〈1, 1, 1〉 .

Rounding “destabilized” thealgorithm.

BackgroundRounding Errors

Applying Gauß-Jordan algorithm to the previous example withrounding to three significant digits gives

0.007 61.2 0.093 61.34.81 −5.92 1.11 0.081.4 1.12 1.18 83.7

→ 1.0 8740.0 13.3 8760.0

4.81 −5.92 1.11 0.081.4 1.12 1.18 83.7

1.0 8740.0 13.3 8760.00.0 −42000.0 −62.9 −42100.00.0 −711000.0 −1080.0 −713000.0

1.0 8740.0 13.3 8760.00.0 1.0 0.0015 1.00.0 −711000.0 −1080.0 −713000.0

1.0 0.0 0.19 20.00.0 1.0 0.0015 1.00.0 0.0 −13.5 −2000.0

1.0 0.0 0.19 20.00.0 1.0 0.0015 1.00.0 0.0 1.0 148.0

1.0 0.0 0.0 −8.120.0 1.0 0.0 0.7780.0 0.0 1.0 148.0

The exact solution is #»x = 〈1, 1, 1〉 . Rounding “destabilized” thealgorithm.

BackgroundRounding Errors

The method of partial pivoting uses the largest possible number (inabsolute value) to create pivots. This minimizes rounding errors.

BackgroundRounding Errors

Using partial pivoting, we have 0.007 61.2 0.093 61.34.81 −5.92 1.11 0.081.4 1.12 1.18 83.7

→ 81.4 1.12 1.18 83.7

4.81 −5.92 1.11 0.00.007 61.2 0.093 61.3

1.0 0.0138 0.0145 1.034.81 −5.92 1.11 0.0

0.007 61.2 0.093 61.3

→ 1.0 0.0138 0.0145 1.03

0.0 −5.99 1.04 −4.950.0 61.2 0.0929 61.3

1.0 0.0138 0.0145 1.030.0 61.2 0.0929 61.30.0 −5.99 1.04 −4.95

→ 1.0 0.0138 0.0145 1.03

0.0 1.0 0.00152 1.00.0 −5.99 1.04 −4.95

1.0 0.0 0.0145 1.020.0 1.0 0.00152 1.00.0 0.0 1.05 1.04

→ 1.0 0.0 0.0145 1.02

0.0 1.0 0.00152 1.00.0 0.0 1.0 0.99

1.0 0.0 0.0 1.010.0 1.0 0.0 0.9980.0 0.0 1.0 0.99

By using partial pivoting, we have reduced the rounding error.

BackgroundRounding Errors

Using partial pivoting, we have 0.007 61.2 0.093 61.34.81 −5.92 1.11 0.081.4 1.12 1.18 83.7

→ 81.4 1.12 1.18 83.7

4.81 −5.92 1.11 0.00.007 61.2 0.093 61.3

1.0 0.0138 0.0145 1.034.81 −5.92 1.11 0.0

0.007 61.2 0.093 61.3

→ 1.0 0.0138 0.0145 1.03

0.0 −5.99 1.04 −4.950.0 61.2 0.0929 61.3

1.0 0.0138 0.0145 1.030.0 61.2 0.0929 61.30.0 −5.99 1.04 −4.95

→ 1.0 0.0138 0.0145 1.03

0.0 1.0 0.00152 1.00.0 −5.99 1.04 −4.95

1.0 0.0 0.0145 1.020.0 1.0 0.00152 1.00.0 0.0 1.05 1.04

→ 1.0 0.0 0.0145 1.02

0.0 1.0 0.00152 1.00.0 0.0 1.0 0.99

1.0 0.0 0.0 1.010.0 1.0 0.0 0.9980.0 0.0 1.0 0.99

By using partial pivoting, we have reduced the rounding error.

BackgroundPermutation Matrices

DefinitionA permutation matrix is a matrix obtained by performing rowswaps on an identity matrix.

Example

[1 00 1

] 0 0 10 1 01 0 0

0 1 0 00 0 0 10 0 1 01 0 0 0

BackgroundPermutation Matrices

DefinitionA permutation matrix is a matrix obtained by performing rowswaps on an identity matrix.

Example

[1 00 1

] 0 0 10 1 01 0 0

0 1 0 00 0 0 10 0 1 01 0 0 0

BackgroundPermutation Matrices

TheoremLet P be an elementary matrix corresponding to a row swap. ThenP is a permutation matrix, P is symmetric (Pᵀ = P), and P is selfinverse (P2 = I ).

BackgroundPermutation Matrices

TheoremLet P be a permutation matrix. Then P is the product ofelementary matrices corresponding to row swaps.

BackgroundPermutation Matrices

DefinitionAn orthogonal matrix is a matrix Q satisfying Q−1 = Qᵀ.

Example

Consider the matrix Q given by

Q =

[35/37 12/37−12/37 35/37

]Then Q is orthogonal since

QQᵀ =

[35/37 12/37−12/37 35/37

] [35/37 −12/3712/37 35/37

]=

[1 00 1

]

BackgroundPermutation Matrices

DefinitionAn orthogonal matrix is a matrix Q satisfying Q−1 = Qᵀ.

Example

Consider the matrix Q given by

Q =

[35/37 12/37−12/37 35/37

]

Then Q is orthogonal since

QQᵀ =

[35/37 12/37−12/37 35/37

] [35/37 −12/3712/37 35/37

]=

[1 00 1

]

BackgroundPermutation Matrices

DefinitionAn orthogonal matrix is a matrix Q satisfying Q−1 = Qᵀ.

Example

Consider the matrix Q given by

Q =

[35/37 12/37−12/37 35/37

]Then Q is orthogonal since

QQᵀ =

[35/37 12/37−12/37 35/37

] [35/37 −12/3712/37 35/37

]=

[1 00 1

]

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk .

Then P is invertible since each Pi isinvertible. Furthermore, we have

P−1 = (P1P2 · · ·Pk)−1

= P−1k · · ·P−12 P−11

= Pk · · ·P2P1

= Pᵀk · · ·P

ᵀ2P

ᵀ1

= (P1P2 · · ·Pk)ᵀ

= Pᵀ

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk .

Then P is invertible since each Pi isinvertible. Furthermore, we have

P−1 = (P1P2 · · ·Pk)−1

= P−1k · · ·P−12 P−11

= Pk · · ·P2P1

= Pᵀk · · ·P

ᵀ2P

ᵀ1

= (P1P2 · · ·Pk)ᵀ

= Pᵀ

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk . Then P is invertible since each Pi isinvertible.

Furthermore, we have

P−1 = (P1P2 · · ·Pk)−1

= P−1k · · ·P−12 P−11

= Pk · · ·P2P1

= Pᵀk · · ·P

ᵀ2P

ᵀ1

= (P1P2 · · ·Pk)ᵀ

= Pᵀ

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk . Then P is invertible since each Pi isinvertible. Furthermore, we have

P−1 = (P1P2 · · ·Pk)−1

= P−1k · · ·P−12 P−11

= Pk · · ·P2P1

= Pᵀk · · ·P

ᵀ2P

ᵀ1

= (P1P2 · · ·Pk)ᵀ

= Pᵀ

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk . Then P is invertible since each Pi isinvertible. Furthermore, we have

P−1 =

(P1P2 · · ·Pk)−1

= P−1k · · ·P−12 P−11

= Pk · · ·P2P1

= Pᵀk · · ·P

ᵀ2P

ᵀ1

= (P1P2 · · ·Pk)ᵀ

= Pᵀ

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk . Then P is invertible since each Pi isinvertible. Furthermore, we have

P−1 = (P1P2 · · ·Pk)−1

=

P−1k · · ·P−12 P−11

= Pk · · ·P2P1

= Pᵀk · · ·P

ᵀ2P

ᵀ1

= (P1P2 · · ·Pk)ᵀ

= Pᵀ

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk . Then P is invertible since each Pi isinvertible. Furthermore, we have

P−1 = (P1P2 · · ·Pk)−1

= P−1k · · ·P−12 P−11

=

Pk · · ·P2P1

= Pᵀk · · ·P

ᵀ2P

ᵀ1

= (P1P2 · · ·Pk)ᵀ

= Pᵀ

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk . Then P is invertible since each Pi isinvertible. Furthermore, we have

P−1 = (P1P2 · · ·Pk)−1

= P−1k · · ·P−12 P−11

= Pk · · ·P2P1

=

Pᵀk · · ·P

ᵀ2P

ᵀ1

= (P1P2 · · ·Pk)ᵀ

= Pᵀ

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk . Then P is invertible since each Pi isinvertible. Furthermore, we have

P−1 = (P1P2 · · ·Pk)−1

= P−1k · · ·P−12 P−11

= Pk · · ·P2P1

= Pᵀk · · ·P

ᵀ2P

ᵀ1

=

(P1P2 · · ·Pk)ᵀ

= Pᵀ

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk . Then P is invertible since each Pi isinvertible. Furthermore, we have

P−1 = (P1P2 · · ·Pk)−1

= P−1k · · ·P−12 P−11

= Pk · · ·P2P1

= Pᵀk · · ·P

ᵀ2P

ᵀ1

= (P1P2 · · ·Pk)ᵀ

=

Pᵀ

BackgroundPermutation Matrices

TheoremEvery permutation matrix is an orthogonal matrix.

Proof.Write P as the product of elementary matrices corresponding torow swaps P = P1P2 · · ·Pk . Then P is invertible since each Pi isinvertible. Furthermore, we have

P−1 = (P1P2 · · ·Pk)−1

= P−1k · · ·P−12 P−11

= Pk · · ·P2P1

= Pᵀk · · ·P

ᵀ2P

ᵀ1

= (P1P2 · · ·Pk)ᵀ

= Pᵀ

BackgroundForward Elimination

The PA = LU algorithm uses forward elimination.

BackgroundForward Elimination

Consider the row reductions 1 −2 11 0 2−1 1 0

A

R2 − R1 → R2R3 + R1 → R3−−−−−−−−−→

1 −2 10 2 10 −1 1

R3+(1/2)·R2→R3−−−−−−−−−−→

1 −2 10 2 10 0 3/2

U

The EA = U factorization is 1 0 0−1 1 01/2 1/2 1

E

1 −2 11 0 2−1 1 0

A

=

1 −2 10 2 10 0 3/2

U

Putting L = E−1 gives A = LU where 1 −2 11 0 2−1 1 0

A

=

1 0 01 1 0−1 −1/2 1

L

1 −2 10 2 10 0 3/2

U

The entries of L are the “multipliers” used in the row reductions.

BackgroundForward Elimination

Consider the row reductions 1 −2 11 0 2−1 1 0

A

R2 − R1 → R2R3 + R1 → R3−−−−−−−−−→

1 −2 10 2 10 −1 1

R3+(1/2)·R2→R3−−−−−−−−−−→

1 −2 10 2 10 0 3/2

U

The EA = U factorization is 1 0 0−1 1 01/2 1/2 1

E

1 −2 11 0 2−1 1 0

A

=

1 −2 10 2 10 0 3/2

U

Putting L = E−1 gives A = LU where 1 −2 11 0 2−1 1 0

A

=

1 0 01 1 0−1 −1/2 1

L

1 −2 10 2 10 0 3/2

U

The entries of L are the “multipliers” used in the row reductions.

BackgroundForward Elimination

Consider the row reductions 1 −2 11 0 2−1 1 0

A

R2 − R1 → R2R3 + R1 → R3−−−−−−−−−→

1 −2 10 2 10 −1 1

R3+(1/2)·R2→R3−−−−−−−−−−→

1 −2 10 2 10 0 3/2

U

The EA = U factorization is 1 0 0−1 1 01/2 1/2 1

E

1 −2 11 0 2−1 1 0

A

=

1 −2 10 2 10 0 3/2

U

Putting L = E−1 gives A = LU where 1 −2 11 0 2−1 1 0

A

=

1 0 01 1 0−1 −1/2 1

L

1 −2 10 2 10 0 3/2

U

The entries of L are the “multipliers” used in the row reductions.

BackgroundForward Elimination

Consider the row reductions 1 −2 11 0 2−1 1 0

A

R2 − R1 → R2R3 + R1 → R3−−−−−−−−−→

1 −2 10 2 10 −1 1

R3+(1/2)·R2→R3−−−−−−−−−−→

1 −2 10 2 10 0 3/2

U

The EA = U factorization is 1 0 0−1 1 01/2 1/2 1

E

1 −2 11 0 2−1 1 0

A

=

1 −2 10 2 10 0 3/2

U

Putting L = E−1 gives A = LU where 1 −2 11 0 2−1 1 0

A

=

1 0 01 1 0−1 −1/2 1

L

1 −2 10 2 10 0 3/2

U

The entries of L are the “multipliers” used in the row reductions.

The PA = LU AlgorithmDescription

Algorithm (PA = LU Factorization with Partial Pivoting)

Suppose A is m × n. Start with i = j = 1 and L = P = Im.

Step 1 Find k ≥ i where |akj | > 0 is as large as possible.Perform Ri ↔ Rk on A, P, and the multipliers in L.If not possible, increase j by one and repeat this step.

Step 2 Eliminate all entries below aij by subtracting suitiblemultiples mkj of Rowi . Put `kj = −mkj .

Step 3 Increase i and j by one and return to Step 1.

The algorithm terminates after the last row or column is processed.

The PA = LU AlgorithmDescription

Algorithm (PA = LU Factorization with Partial Pivoting)

Suppose A is m × n. Start with i = j = 1 and L = P = Im.

Step 1 Find k ≥ i where |akj | > 0 is as large as possible.Perform Ri ↔ Rk on A, P, and the multipliers in L.If not possible, increase j by one and repeat this step.

Step 2 Eliminate all entries below aij by subtracting suitiblemultiples mkj of Rowi . Put `kj = −mkj .

Step 3 Increase i and j by one and return to Step 1.

The algorithm terminates after the last row or column is processed.

The PA = LU AlgorithmDescription

Algorithm (PA = LU Factorization with Partial Pivoting)

Suppose A is m × n. Start with i = j = 1 and L = P = Im.

Step 1 Find k ≥ i where |akj | > 0 is as large as possible.Perform Ri ↔ Rk on A, P, and the multipliers in L.If not possible, increase j by one and repeat this step.

Step 2 Eliminate all entries below aij by subtracting suitiblemultiples mkj of Rowi . Put `kj = −mkj .

Step 3 Increase i and j by one and return to Step 1.

The algorithm terminates after the last row or column is processed.

The PA = LU AlgorithmDescription

Algorithm (PA = LU Factorization with Partial Pivoting)

Suppose A is m × n. Start with i = j = 1 and L = P = Im.

Step 1 Find k ≥ i where |akj | > 0 is as large as possible.Perform Ri ↔ Rk on A, P, and the multipliers in L.If not possible, increase j by one and repeat this step.

Step 2 Eliminate all entries below aij by subtracting suitiblemultiples mkj of Rowi . Put `kj = −mkj .

Step 3 Increase i and j by one and return to Step 1.

The algorithm terminates after the last row or column is processed.

The PA = LU AlgorithmDescription

QuestionHow does PA = LU help us solve A #»x =

b ?

AnswerA #»x =

b is equivalent to PA #»x = P#»

b . This gives LU #»x = P#»

b .

Step 1 Use “forward substitution” to solve L #»y = P#»

b for #»y .

Step 2 Use “back substitution” to solve U #»x = #»y for #»x .

The PA = LU AlgorithmDescription

QuestionHow does PA = LU help us solve A #»x =

b ?

AnswerA #»x =

b is equivalent to PA #»x = P#»

b . This gives LU #»x = P#»

b .

Step 1 Use “forward substitution” to solve L #»y = P#»

b for #»y .

Step 2 Use “back substitution” to solve U #»x = #»y for #»x .

The PA = LU AlgorithmDescription

QuestionHow does PA = LU help us solve A #»x =

b ?

AnswerA #»x =

b is equivalent to PA #»x = P#»

b . This gives LU #»x = P#»

b .

Step 1 Use “forward substitution” to solve L #»y = P#»

b for #»y .

Step 2 Use “back substitution” to solve U #»x = #»y for #»x .

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2

−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3

−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2

−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3

−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3

−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 00 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3

−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 01 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3

−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3

−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3

−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3

−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3

−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

The PA = LU agorithm with partial pivoting gives

A 1 2 04 −3 −53 2 13

R1↔R2−−−−−→

U 4 −3 −51 2 03 2 13

L 1 0 0

0 1 00 0 1

P 0 1 0

1 0 00 0 1

R2 − (1/4) · R1 → R2R3 − (3/4) · R1 → R3−−−−−−−−−−−−−−−→

4 −3 −50 11/4 5/40 17/4 67/4

1 0 01/4 1 03/4 0 1

0 1 01 0 00 0 1

R2↔R3−−−−−→

4 −3 −50 17/4 67/40 11/4 5/4

1 0 03/4 1 01/4 0 1

0 1 00 0 11 0 0

R3−(11/17)·R2→R3−−−−−−−−−−−−→

4 −3 −50 17/4 67/40 0 −163/17

1 0 03/4 1 01/4 11/17 1

0 1 00 0 11 0 0

This gives the PA = LU factorization

0 1 00 0 11 0 0

P

1 2 04 −3 −53 2 13

A

=

1 0 03/4 1 01/4 11/17 1

L

4 −3 −50 17/4 67/40 0 −163/17

U

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326 → y1 = −326(3/4) · y1 + y2 = −163 → y2 = 163/2(1/4) · y1 + (11/17) · y2 + y3 = 326 → y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326 → x1 = −4(17/4) · x2 + (67/4) · x3 = 163/2 → x2 = 165

(−163/17) · x3 = 6031/17

→ x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326

→ y1 = −326

(3/4) · y1 + y2 = −163

→ y2 = 163/2

(1/4) · y1 + (11/17) · y2 + y3 = 326

→ y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326 → x1 = −4(17/4) · x2 + (67/4) · x3 = 163/2 → x2 = 165

(−163/17) · x3 = 6031/17

→ x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326 → y1 = −326(3/4) · y1 + y2 = −163

→ y2 = 163/2

(1/4) · y1 + (11/17) · y2 + y3 = 326

→ y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326 → x1 = −4(17/4) · x2 + (67/4) · x3 = 163/2 → x2 = 165

(−163/17) · x3 = 6031/17

→ x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326 → y1 = −326(3/4) · y1 + y2 = −163 → y2 = 163/2(1/4) · y1 + (11/17) · y2 + y3 = 326

→ y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326 → x1 = −4(17/4) · x2 + (67/4) · x3 = 163/2 → x2 = 165

(−163/17) · x3 = 6031/17

→ x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326 → y1 = −326(3/4) · y1 + y2 = −163 → y2 = 163/2(1/4) · y1 + (11/17) · y2 + y3 = 326 → y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326 → x1 = −4(17/4) · x2 + (67/4) · x3 = 163/2 → x2 = 165

(−163/17) · x3 = 6031/17

→ x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326 → y1 = −326(3/4) · y1 + y2 = −163 → y2 = 163/2(1/4) · y1 + (11/17) · y2 + y3 = 326 → y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326 → x1 = −4(17/4) · x2 + (67/4) · x3 = 163/2 → x2 = 165

(−163/17) · x3 = 6031/17

→ x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326 → y1 = −326(3/4) · y1 + y2 = −163 → y2 = 163/2(1/4) · y1 + (11/17) · y2 + y3 = 326 → y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326

→ x1 = −4

(17/4) · x2 + (67/4) · x3 = 163/2

→ x2 = 165

(−163/17) · x3 = 6031/17

→ x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326 → y1 = −326(3/4) · y1 + y2 = −163 → y2 = 163/2(1/4) · y1 + (11/17) · y2 + y3 = 326 → y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326

→ x1 = −4

(17/4) · x2 + (67/4) · x3 = 163/2

→ x2 = 165

(−163/17) · x3 = 6031/17 → x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326 → y1 = −326(3/4) · y1 + y2 = −163 → y2 = 163/2(1/4) · y1 + (11/17) · y2 + y3 = 326 → y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326

→ x1 = −4

(17/4) · x2 + (67/4) · x3 = 163/2 → x2 = 165(−163/17) · x3 = 6031/17 → x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326 → y1 = −326(3/4) · y1 + y2 = −163 → y2 = 163/2(1/4) · y1 + (11/17) · y2 + y3 = 326 → y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326 → x1 = −4(17/4) · x2 + (67/4) · x3 = 163/2 → x2 = 165

(−163/17) · x3 = 6031/17 → x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

The PA = LU AlgorithmExample

For#»

b = 〈326, −326, −163〉 , the system L #»y = P#»

b is

y1 = −326 → y1 = −326(3/4) · y1 + y2 = −163 → y2 = 163/2(1/4) · y1 + (11/17) · y2 + y3 = 326 → y3 = 6031/17

For #»y = 〈−326, 163/2, 6031/17〉 , the system U #»x = #»y is

4 x1 − 3 x2 − 5 x3 = −326 → x1 = −4(17/4) · x2 + (67/4) · x3 = 163/2 → x2 = 165

(−163/17) · x3 = 6031/17 → x3 = −37

The solution to A #»x =#»

b is #»x = 〈−4, 165, −37〉 .

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

Aop1−−→ A1

op2−−→ A2op3−−→ · · · opr−−→ U

This means that A and U are row equivalent. In particular,rank(A) = rank(U) and nullity(A) = nullity(U).

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

A

op1−−→ A1op2−−→ A2

op3−−→ · · · opr−−→ U

This means that A and U are row equivalent. In particular,rank(A) = rank(U) and nullity(A) = nullity(U).

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

Aop1−−→ A1

op2−−→ A2op3−−→ · · · opr−−→ U

This means that A and U are row equivalent. In particular,rank(A) = rank(U) and nullity(A) = nullity(U).

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

Aop1−−→ A1

op2−−→ A2

op3−−→ · · · opr−−→ U

This means that A and U are row equivalent. In particular,rank(A) = rank(U) and nullity(A) = nullity(U).

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

Aop1−−→ A1

op2−−→ A2op3−−→ · · ·

opr−−→ U

This means that A and U are row equivalent. In particular,rank(A) = rank(U) and nullity(A) = nullity(U).

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

Aop1−−→ A1

op2−−→ A2op3−−→ · · · opr−−→ U

This means that A and U are row equivalent. In particular,rank(A) = rank(U) and nullity(A) = nullity(U).

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

Aop1−−→ A1

op2−−→ A2op3−−→ · · · opr−−→ U

This means that A and U are row equivalent.

In particular,rank(A) = rank(U) and nullity(A) = nullity(U).

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

Aop1−−→ A1

op2−−→ A2op3−−→ · · · opr−−→ U

This means that A and U are row equivalent. In particular,rank(A) =

rank(U) and nullity(A) = nullity(U).

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

Aop1−−→ A1

op2−−→ A2op3−−→ · · · opr−−→ U

This means that A and U are row equivalent. In particular,rank(A) = rank(U)

and nullity(A) = nullity(U).

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

Aop1−−→ A1

op2−−→ A2op3−−→ · · · opr−−→ U

This means that A and U are row equivalent. In particular,rank(A) = rank(U) and nullity(A) =

nullity(U).

Row EquivalencyA and U are Row-Equivalent

NoteThe U in PA = LU factorization is obtained by performingelementary row operations on A.

Aop1−−→ A1

op2−−→ A2op3−−→ · · · opr−−→ U

This means that A and U are row equivalent. In particular,rank(A) = rank(U) and nullity(A) = nullity(U).

Row EquivalencyA and U are Row-Equivalent

TheoremGiven PA = LU, we have

rank(A) = rank(U) nullity(A) = nullity(U)

Advantage

We can compute U faster than we can compute rref(A). ThePA = LU algorithm improves our rank algorithm!

Row EquivalencyA and U are Row-Equivalent

TheoremGiven PA = LU, we have

rank(A) = rank(U) nullity(A) = nullity(U)

Advantage

We can compute U faster than we can compute rref(A).

ThePA = LU algorithm improves our rank algorithm!

Row EquivalencyA and U are Row-Equivalent

TheoremGiven PA = LU, we have

rank(A) = rank(U) nullity(A) = nullity(U)

Advantage

We can compute U faster than we can compute rref(A). ThePA = LU algorithm improves our rank algorithm!

Row EquivalencyA and U are Row-Equivalent

Example

Consider the PA = LU factorization

P0 1 0 00 0 0 11 0 0 00 0 1 0

A

1 −5 −4 −21 −18 −14 −6−2 11 16 68 54 45 −2

0 0 1 3 2 2 −2−2 13 16 72 58 47 2

=

L1 0 0 01 1 0 0

−1/2 1/4 1 00 0 1/4 1

U

−2 11 16 68 54 45 −20 2 0 4 4 2 40 0 4 12 8 8 −80 0 0 0 0 0 0

Here, we have

rank(A) = 3 nullity(A) = 4

Row EquivalencyA and U are Row-Equivalent

Example

Consider the PA = LU factorization

P0 1 0 00 0 0 11 0 0 00 0 1 0

A

1 −5 −4 −21 −18 −14 −6−2 11 16 68 54 45 −2

0 0 1 3 2 2 −2−2 13 16 72 58 47 2

=

L1 0 0 01 1 0 0

−1/2 1/4 1 00 0 1/4 1

U

−2 11 16 68 54 45 −20 2 0 4 4 2 40 0 4 12 8 8 −80 0 0 0 0 0 0

Here, we have

rank(A) = 3 nullity(A) = 4

Row EquivalencyA and U are Row-Equivalent

Example

Consider the PA = LU factorization

P0 1 0 00 0 0 11 0 0 00 0 1 0

A

1 −5 −4 −21 −18 −14 −6−2 11 16 68 54 45 −2

0 0 1 3 2 2 −2−2 13 16 72 58 47 2

=

L1 0 0 01 1 0 0

−1/2 1/4 1 00 0 1/4 1

U

−2 11 16 68 54 45 −20 2 0 4 4 2 40 0 4 12 8 8 −80 0 0 0 0 0 0

Here, we have

rank(A) =

3 nullity(A) = 4

Row EquivalencyA and U are Row-Equivalent

Example

Consider the PA = LU factorization

P0 1 0 00 0 0 11 0 0 00 0 1 0

A

1 −5 −4 −21 −18 −14 −6−2 11 16 68 54 45 −2

0 0 1 3 2 2 −2−2 13 16 72 58 47 2

=

L1 0 0 01 1 0 0

−1/2 1/4 1 00 0 1/4 1

U

−2 11 16 68 54 45 −20 2 0 4 4 2 40 0 4 12 8 8 −80 0 0 0 0 0 0

Here, we have

rank(A) = 3

nullity(A) = 4

Row EquivalencyA and U are Row-Equivalent

Example

Consider the PA = LU factorization

P0 1 0 00 0 0 11 0 0 00 0 1 0

A

1 −5 −4 −21 −18 −14 −6−2 11 16 68 54 45 −2

0 0 1 3 2 2 −2−2 13 16 72 58 47 2

=

L1 0 0 01 1 0 0

−1/2 1/4 1 00 0 1/4 1

U

−2 11 16 68 54 45 −20 2 0 4 4 2 40 0 4 12 8 8 −80 0 0 0 0 0 0

Here, we have

rank(A) = 3 nullity(A) =

4

Row EquivalencyA and U are Row-Equivalent

Example

Consider the PA = LU factorization

P0 1 0 00 0 0 11 0 0 00 0 1 0

A

1 −5 −4 −21 −18 −14 −6−2 11 16 68 54 45 −2

0 0 1 3 2 2 −2−2 13 16 72 58 47 2

=

L1 0 0 01 1 0 0

−1/2 1/4 1 00 0 1/4 1

U

−2 11 16 68 54 45 −20 2 0 4 4 2 40 0 4 12 8 8 −80 0 0 0 0 0 0

Here, we have

rank(A) = 3 nullity(A) = 4