Chapter 16

Matrix Decompositions — LU

00 · Symbol Glossary

$L$L — lower triangular factor

A unit lower triangular matrix: ones on the main diagonal, zeros strictly above the diagonal. In the LU decomposition A=LUA = LU, the entries below the diagonal of LL are the multipliers from Gaussian elimination — the scalars cc in row operations RiRicRjR_i \to R_i - cR_j.

$U$U — upper triangular factor

An upper triangular matrix: zeros strictly below the main diagonal. In A=LUA = LU, UU is the row echelon form of AA (before back-substitution scales pivots to 1). Solving Ax=bA\mathbf{x}=\mathbf{b} reduces to two easy triangular solves: Ly=bL\mathbf{y}=\mathbf{b}, then Ux=yU\mathbf{x}=\mathbf{y}.

$P$P — permutation matrix

A matrix obtained by permuting the rows of the identity InI_n. Each row and column has exactly one entry equal to 1, all others 0. When Gaussian elimination requires row swaps, the factorisation becomes PA=LUPA = LU — pivoting is encoded in PP, not in LL or UU.

$\ell_{ij}$ell sub i j — elimination multiplier

The multiplier stored at position (i,j)(i,j) of LL for i>ji > j. If elimination uses RiRiijRjR_i \to R_i - \ell_{ij} R_j, then ij\ell_{ij} is the ratio of the entry being eliminated to the pivot above it: ij=aij/ajj\ell_{ij} = a_{ij}/a_{jj} at the moment of elimination.


01 · Why Factor a Matrix

Chapter 4 showed how to solve Ax=bA\mathbf{x}=\mathbf{b} once by Gaussian elimination. In quantitative work, the matrix AA is often fixed while the right-hand side b\mathbf{b} changes — stress scenarios, Monte Carlo paths, or successive time steps in a risk engine. Re-running full elimination for every new b\mathbf{b} wastes the work already invested in reducing AA.

The LU decomposition records elimination as a matrix product: A=LUA = LU. The expensive step — reducing AA to triangular form — is done once. Each new b\mathbf{b} costs only two triangular solves, each O(n2)O(n^2) for an n×nn \times n system instead of O(n3)O(n^3) for full elimination.

Definition — LU Decomposition

A square matrix ARn×nA \in \mathbb{R}^{n \times n} has an LU decomposition if there exist matrices L,URn×nL, U \in \mathbb{R}^{n \times n} such that:

A=LUA = LU

LL is unit lower triangularii=1\ell_{ii} = 1 for all ii, and ij=0\ell_{ij} = 0 for i<ji < j.

UU is upper triangularuij=0u_{ij} = 0 for i>ji > j.

When no row interchanges are needed during elimination, AA admits a direct LU factorisation. When pivots require row swaps, the factorisation becomes PA=LUPA = LU with a permutation matrix PP.

✓ Example — Risk Engine with Many Right-Hand Sides

A 500×500500 \times 500 sensitivity matrix AA arises from a finite-difference approximation of a PDE used in counterparty exposure. For each of 10,00010{,}000 Monte Carlo scenarios, you must solve Ax(k)=b(k)A\mathbf{x}^{(k)} = \mathbf{b}^{(k)}.

Full Gaussian elimination per scenario: 10,000×O(5003)1.25×101210{,}000 \times O(500^3) \approx 1.25 \times 10^{12} flops.

LU once (O(5003)O(500^3)) plus 10,00010{,}000 triangular solves (2×10,000×O(5002)5×1092 \times 10{,}000 \times O(500^2) \approx 5 \times 10^9 flops): dominated by the single factorisation. The LU approach is roughly 250×250\times faster — the difference between overnight and a week of compute.

❌ Failure — Re-Factoring When Only $\mathbf{b}$ Changes

Suppose A=(2143)A = \begin{pmatrix}2&1\\4&3\end{pmatrix} is fixed and you need solutions for b1=(37)\mathbf{b}_1 = \begin{pmatrix}3\\7\end{pmatrix} and b2=(15)\mathbf{b}_2 = \begin{pmatrix}1\\5\end{pmatrix}.

Attempted computation: run Gaussian elimination from scratch on the augmented matrix (213437)\left(\begin{array}{cc|c}2&1&3\\4&3&7\end{array}\right), then again on (211435)\left(\begin{array}{cc|c}2&1&1\\4&3&5\end{array}\right).

Where it breaks: the coefficient matrix operations — eliminating the (2,1)(2,1) entry, updating rows 2 — are identical in both runs. Only the augmented column differs. Re-doing elimination on AA duplicates O(n3)O(n^3) work that LU stores permanently in LL and UU.

Consequence: for mm right-hand sides, naive elimination costs O(mn3)O(mn^3). LU plus mm solves costs O(n3+mn2)O(n^3 + mn^2). When mnm \gg n, this gap is decisive.


02 · LU from Gaussian Elimination

Every multiplier written down during elimination becomes an entry of LL. The upper triangular result of elimination is UU.

Definition — Elimination Multiplier

When Gaussian elimination eliminates the entry at position (i,j)(i,j) using pivot row jj (with j<ij < i), the multiplier is:

ij=aij(before)ajj(pivot)\ell_{ij} = \frac{a_{ij}^{(\text{before})}}{a_{jj}^{(\text{pivot})}}

aij(before)a_{ij}^{(\text{before})} — the entry in row ii, column jj immediately before the elimination step.

ajj(pivot)a_{jj}^{(\text{pivot})} — the pivot in row jj, column jj, which must be nonzero.

The row operation is RiRiijRjR_i \to R_i - \ell_{ij} R_j. The multiplier ij\ell_{ij} is stored at position (i,j)(i,j) of LL.

Step-by-step — LU decomposition of $A = \begin{pmatrix}1&2&3\\4&5&6\\7&8&10\end{pmatrix}$
1

Identify the matrix: AR3×3A \in \mathbb{R}^{3 \times 3}. No zero pivot appears in column 1 — row swaps are not needed. Initialise L=I3L = I_3 (ones on the diagonal, zeros elsewhere) and work on a copy of AA to build UU.

2

Eliminate below pivot (1,1)=1(1,1) = 1: target column 1, rows 2 and 3.

21=a21/a11=4/1=4\ell_{21} = a_{21}/a_{11} = 4/1 = 4. Operation: R2R24R1R_2 \to R_2 - 4R_1. Row 2 becomes (44, 58, 612)=(0, 3, 6)(4-4,\ 5-8,\ 6-12) = (0,\ -3,\ -6).

31=a31/a11=7/1=7\ell_{31} = a_{31}/a_{11} = 7/1 = 7. Operation: R3R37R1R_3 \to R_3 - 7R_1. Row 3 becomes (77, 814, 1021)=(0, 6, 11)(7-7,\ 8-14,\ 10-21) = (0,\ -6,\ -11).

Store 21=4\ell_{21} = 4 at L21L_{21}, 31=7\ell_{31} = 7 at L31L_{31}.

3

Eliminate below pivot (2,2)=3(2,2) = -3: target column 2, row 3 only.

32=a32/a22=(6)/(3)=2\ell_{32} = a_{32}/a_{22} = (-6)/(-3) = 2. Operation: R3R32R2R_3 \to R_3 - 2R_2. Row 3 becomes (0, 62(3), 112(6))=(0, 0, 1)(0,\ -6-2(-3),\ -11-2(-6)) = (0,\ 0,\ 1).

Store 32=2\ell_{32} = 2 at L32L_{32}.

4

Read off UU from the reduced matrix:

U=(123036001)U = \begin{pmatrix}1 & 2 & 3 \\ 0 & -3 & -6 \\ 0 & 0 & 1\end{pmatrix}
The three pivots sit on the diagonal: 11, 3-3, 11. No free variables — AA is invertible.

5

Assemble LL from stored multipliers:

L=(100410721)L = \begin{pmatrix}1 & 0 & 0 \\ 4 & 1 & 0 \\ 7 & 2 & 1\end{pmatrix}
Ones on the diagonal by construction. Below-diagonal entries are exactly the ij\ell_{ij} computed above.

6

Verify A=LUA = LU entry by entry:

(LU)11=11=1=a11(LU)_{11} = 1 \cdot 1 = 1 = a_{11} ✓.

(LU)12=12=2=a12(LU)_{12} = 1 \cdot 2 = 2 = a_{12} ✓.

(LU)21=41+10=4=a21(LU)_{21} = 4 \cdot 1 + 1 \cdot 0 = 4 = a_{21} ✓.

(LU)22=42+1(3)=83=5=a22(LU)_{22} = 4 \cdot 2 + 1 \cdot (-3) = 8 - 3 = 5 = a_{22} ✓.

(LU)33=73+2(6)+11=2112+1=10=a33(LU)_{33} = 7 \cdot 3 + 2 \cdot (-6) + 1 \cdot 1 = 21 - 12 + 1 = 10 = a_{33} ✓.

All nine entries match. The factorisation is correct.

What $L$ Encodes

LL is not mysterious — it is a bookkeeping matrix for the elimination multipliers. Row ii of LL (below the diagonal) records every scalar by which row ii was reduced during elimination. UU is the echelon form. Together they reconstruct AA exactly.


03 · Solving Systems via Forward and Back Substitution

Once A=LUA = LU is known, solving Ax=bA\mathbf{x} = \mathbf{b} splits into two triangular systems.

Definition — Forward and Back Substitution

Given A=LUA = LU and bRn\mathbf{b} \in \mathbb{R}^n, solve Ax=bA\mathbf{x} = \mathbf{b} in two stages:

Stage 1 — Forward substitution: solve Ly=bL\mathbf{y} = \mathbf{b} for y\mathbf{y}. Since LL is lower triangular with unit diagonal, solve top to bottom: y1=b1y_1 = b_1, then yi=bij=1i1ijyjy_i = b_i - \sum_{j=1}^{i-1}\ell_{ij} y_j.

Stage 2 — Back substitution: solve Ux=yU\mathbf{x} = \mathbf{y} for x\mathbf{x}. Since UU is upper triangular, solve bottom to top: xn=yn/unnx_n = y_n/u_{nn}, then xi=(yij=i+1nuijxj)/uiix_i = (y_i - \sum_{j=i+1}^{n} u_{ij} x_j)/u_{ii}.

Step-by-step — Solving $A\mathbf{x}=\mathbf{b}$ for $A$ above, $\mathbf{b}=\begin{pmatrix}6\\15\\28\end{pmatrix}$
1

Forward substitution — solve Ly=bL\mathbf{y}=\mathbf{b}:

y1=b1=6y_1 = b_1 = 6.

y2=b221y1=154(6)=1524=9y_2 = b_2 - \ell_{21} y_1 = 15 - 4(6) = 15 - 24 = -9.

y3=b331y132y2=287(6)2(9)=2842+18=4y_3 = b_3 - \ell_{31} y_1 - \ell_{32} y_2 = 28 - 7(6) - 2(-9) = 28 - 42 + 18 = 4.

y=(694)\mathbf{y} = \begin{pmatrix}6\\-9\\4\end{pmatrix}
2

Back substitution — solve Ux=yU\mathbf{x}=\mathbf{y}:

x3=y3/u33=4/1=4x_3 = y_3/u_{33} = 4/1 = 4.

x2=(y2u23x3)/u22=(9(6)(4))/(3)=(9+24)/(3)=15/(3)=5x_2 = (y_2 - u_{23} x_3)/u_{22} = (-9 - (-6)(4))/(-3) = (-9+24)/(-3) = 15/(-3) = -5.

x1=(y1u12x2u13x3)/u11=(62(5)3(4))/1=(6+1012)/1=4x_1 = (y_1 - u_{12} x_2 - u_{13} x_3)/u_{11} = (6 - 2(-5) - 3(4))/1 = (6+10-12)/1 = 4.

x=(454)\mathbf{x} = \begin{pmatrix}4\\-5\\4\end{pmatrix}
3

Verify in the original system: AxA\mathbf{x}:

Row 1: 1(4)+2(5)+3(4)=410+12=6=b11(4)+2(-5)+3(4) = 4-10+12 = 6 = b_1 ✓.

Row 2: 4(4)+5(5)+6(4)=1625+24=15=b24(4)+5(-5)+6(4) = 16-25+24 = 15 = b_2 ✓.

Row 3: 7(4)+8(5)+10(4)=2840+40=28=b37(4)+8(-5)+10(4) = 28-40+40 = 28 = b_3 ✓.

❌ Failure — Solving $U\mathbf{x}=\mathbf{y}$ Top-Down

With U=(123036001)U = \begin{pmatrix}1&2&3\\0&-3&-6\\0&0&1\end{pmatrix} and y=(694)\mathbf{y}=\begin{pmatrix}6\\-9\\4\end{pmatrix}, attempting x1=y1/u11=6x_1 = y_1/u_{11} = 6 first is wrong.

Why it breaks: u12=2u_{12}=2 and u13=3u_{13}=3 mean x2x_2 and x3x_3 contribute to row 1. Until x2x_2 and x3x_3 are known, x1x_1 cannot be determined. Upper triangular systems must be solved from the bottom row upward.

Consequence: solving top-down gives a vector that satisfies row 1 by accident but violates rows 2 and 3. Back substitution is mandatory.


04 · Pivoting and the PA=LUPA = LU Factorisation

When a pivot is zero (or dangerously small), elimination must swap rows. The permutation is factored separately.

Definition — $PA = LU$ Factorisation

If Gaussian elimination on AA requires row interchanges, there exists a permutation matrix PP such that:

PA=LUPA = LU

PP records the sequence of row swaps. Equivalently, A=P1LUA = P^{-1}LU. Since PP is a permutation matrix, P1=PTP^{-1} = P^T — inversion is transposition.

To solve Ax=bA\mathbf{x}=\mathbf{b}: compute PA=LUPA = LU, then solve Ly=PbL\mathbf{y} = P\mathbf{b} (forward), then Ux=yU\mathbf{x}=\mathbf{y} (back). The permutation PP reorders b\mathbf{b} to match the pivoted rows of AA.

✓ Example — Pivot Required

A=(0123)A = \begin{pmatrix}0&1\\2&3\end{pmatrix}. Pivot in position (1,1)(1,1) is 00 — elimination stalls.

Swap rows: P=(0110)P = \begin{pmatrix}0&1\\1&0\end{pmatrix}, so PA=(2301)PA = \begin{pmatrix}2&3\\0&1\end{pmatrix}.

Now 21=0/2=0\ell_{21} = 0/2 = 0, giving L=I2L = I_2 and U=(2301)U = \begin{pmatrix}2&3\\0&1\end{pmatrix}.

PA=LUPA = LU ✓. Without the swap, no LU factorisation of AA exists without pivoting.

❌ Failure — Ignoring a Zero Pivot

For A=(0213)A = \begin{pmatrix}0&2\\1&3\end{pmatrix}, attempting 21=1/0\ell_{21} = 1/0 is undefined.

Why it breaks: division by zero in the multiplier formula. The matrix may still be invertible — here det(A)=0321=20\det(A) = 0\cdot3 - 2\cdot1 = -2 \neq 0 — but elimination must swap rows first so a nonzero pivot sits in position (1,1)(1,1).

Consequence: LU without pivoting fails on matrices that are perfectly well-conditioned. Production solvers always use PA=LUPA=LU.


05 · Complexity and Quant Application

Definition — LU Computational Cost

For ARn×nA \in \mathbb{R}^{n \times n}:

LU factorisation: O(n3)O(n^3) flops — same order as one Gaussian elimination.

Each triangular solve: O(n2)O(n^2) flops.

mm right-hand sides: O(n3+mn2)O(n^3 + mn^2) total — factorise once, solve mm times.

Determinant via LU: det(A)=det(L)det(U)=1i=1nuii\det(A) = \det(L)\det(U) = 1 \cdot \prod_{i=1}^n u_{ii} (times det(P)=±1\det(P) = \pm 1 if pivoting was used).

✓ Example — Greeks via Multiple Linear Systems

A delta-gamma approximation for a book of n=200n = 200 risk factors requires solving Ax=b(k)A\mathbf{x} = \mathbf{b}^{(k)} for each of m=50m = 50 bump scenarios, where AA is the Hessian of mark-to-market value and each b(k)\mathbf{b}^{(k)} is a gradient under a different stress.

LU factorisation of AA: one O(2003)=8×106O(200^3) = 8 \times 10^6 flop pass.

50 solves: 50×2×O(2002)=50×80,000=4×10650 \times 2 \times O(200^2) = 50 \times 80{,}000 = 4 \times 10^6 flops.

Total 1.2×107\approx 1.2 \times 10^7 flops. Naive elimination: 50×8×106=4×10850 \times 8 \times 10^6 = 4 \times 10^8 flops — roughly 33×33\times more work. In a nightly risk batch processing thousands of instruments, LU is the standard backend for repeated solves.


06 · Practice Exercises

EXERCISE 16.1

Run Gaussian elimination without row swaps. Store each multiplier ij=aij/ajj\ell_{ij} = a_{ij}/a_{jj} in LijL_{ij}. The final reduced matrix is UU.

A=(210422221)A = \begin{pmatrix}2&1&0\\4&-2&2\\-2&2&1\end{pmatrix}.

21=4/2=2\ell_{21} = 4/2 = 2. R2R22R1R_2 \to R_2 - 2R_1: row 2 becomes (0,4,2)(0, -4, 2).

31=2/2=1\ell_{31} = -2/2 = -1. R3R3+R1R_3 \to R_3 + R_1: row 3 becomes (0,3,1)(0, 3, 1).

32=3/(4)=3/4\ell_{32} = 3/(-4) = -3/4. R3R3+34R2R_3 \to R_3 + \frac{3}{4}R_2: row 3 becomes (0,0,1+34(2))=(0,0,2.5)(0, 0, 1 + \frac{3}{4}(2)) = (0, 0, 2.5).

L=(1002101341),U=(210042002.5)L = \begin{pmatrix}1&0&0\\2&1&0\\-1&-\frac{3}{4}&1\end{pmatrix}, \quad U = \begin{pmatrix}2&1&0\\0&-4&2\\0&0&2.5\end{pmatrix}

Verify (LU)22=2(1)+1(4)=2(LU)_{22} = 2(1) + 1(-4) = -2 ✓. (LU)33=1(0)34(2)+2.5=1.5+2.5=1(LU)_{33} = -1(0) - \frac{3}{4}(2) + 2.5 = -1.5 + 2.5 = 1 ✓.

Find the LU decomposition of A=(210422221)A = \begin{pmatrix}2&1&0\\4&-2&2\\-2&2&1\end{pmatrix}. Show all three multipliers and verify A=LUA = LU for at least three entries.

EXERCISE 16.2

After factorising, solve Ly=bL\mathbf{y}=\mathbf{b} top to bottom, then Ux=yU\mathbf{x}=\mathbf{y} bottom to top.

From Exercise 16.1: L=(1002101341)L = \begin{pmatrix}1&0&0\\2&1&0\\-1&-\frac{3}{4}&1\end{pmatrix}, U=(210042002.5)U = \begin{pmatrix}2&1&0\\0&-4&2\\0&0&2.5\end{pmatrix}, b=(103)\mathbf{b}=\begin{pmatrix}1\\0\\3\end{pmatrix}.

Forward: y1=1y_1 = 1. y2=02(1)=2y_2 = 0 - 2(1) = -2. y3=3(1)(1)(34)(2)=3+11.5=2.5y_3 = 3 - (-1)(1) - (-\frac{3}{4})(-2) = 3 + 1 - 1.5 = 2.5.

Back: x3=2.5/2.5=1x_3 = 2.5/2.5 = 1. x2=(22(1))/(4)=4/(4)=1x_2 = (-2 - 2(1))/(-4) = -4/(-4) = 1. x1=(11(1))/2=0/2=0x_1 = (1 - 1(1))/2 = 0/2 = 0.

x=(011)\mathbf{x} = \begin{pmatrix}0\\1\\1\end{pmatrix}. Check: 2(0)+1(1)+0(1)=1=b12(0)+1(1)+0(1)=1=b_1 ✓; 4(0)+(2)(1)+2(1)=0=b24(0)+(-2)(1)+2(1)=0=b_2 ✓.

Using A=(210422221)A = \begin{pmatrix}2&1&0\\4&-2&2\\-2&2&1\end{pmatrix} with LU factors from elimination, solve Ax=bA\mathbf{x}=\mathbf{b} where b=(103)\mathbf{b}=\begin{pmatrix}1\\0\\3\end{pmatrix}. Show forward and back substitution steps.

EXERCISE 16.3

Row swap first: PP exchanges rows 1 and 2. Factorise PAPA, not AA. Then det(A)=det(P)det(L)det(U)=(1)uii\det(A) = \det(P)\det(L)\det(U) = (-1)\prod u_{ii}.

A=(0123)A = \begin{pmatrix}0&1\\2&3\end{pmatrix}. P=(0110)P = \begin{pmatrix}0&1\\1&0\end{pmatrix}, PA=(2301)PA = \begin{pmatrix}2&3\\0&1\end{pmatrix}.

21=0/2=0\ell_{21} = 0/2 = 0. L=I2L = I_2, U=(2301)U = \begin{pmatrix}2&3\\0&1\end{pmatrix}.

det(U)=21=2\det(U) = 2 \cdot 1 = 2. det(P)=1\det(P) = -1 (one row swap). det(A)=(1)(2)=2\det(A) = (-1)(2) = -2.

Direct check: det(A)=0312=2\det(A) = 0\cdot3 - 1\cdot2 = -2 ✓.

Find PA=LUPA=LU for A=(0123)A = \begin{pmatrix}0&1\\2&3\end{pmatrix}. State PP, LL, UU, and compute det(A)\det(A) from the factorisation.

EXERCISE 16.4

LU exists without pivoting only if every leading principal minor is nonzero. Equivalently, every upper-left k×kk \times k submatrix must have nonzero determinant.

A=(1224)A = \begin{pmatrix}1&2\\2&4\end{pmatrix}. Leading 1×11 \times 1 minor: det(1)=10\det(1) = 1 \neq 0 ✓. Leading 2×22 \times 2 minor: det(A)=1422=0\det(A) = 1\cdot4 - 2\cdot2 = 0.

Zero determinant means rows are linearly dependent: row 2 = 2×2 \times row 1. Elimination gives U=(1200)U = \begin{pmatrix}1&2\\0&0\end{pmatrix} — zero pivot on the diagonal. No LU factorisation with nonzero diagonal of UU exists.

For b=(36)\mathbf{b}=\begin{pmatrix}3\\6\end{pmatrix}: system is consistent (b2=2b1b_2 = 2b_1) with infinitely many solutions. For b=(37)\mathbf{b}=\begin{pmatrix}3\\7\end{pmatrix}: inconsistent (7237 \neq 2\cdot3). LU cannot be used to solve either case reliably because UU is singular.

Explain why A=(1224)A = \begin{pmatrix}1&2\\2&4\end{pmatrix} has no usable LU factorisation without pivoting. What happens when you try to solve Ax=bA\mathbf{x}=\mathbf{b} for b=(36)\mathbf{b}=\begin{pmatrix}3\\6\end{pmatrix} versus b=(37)\mathbf{b}=\begin{pmatrix}3\\7\end{pmatrix}?

EXERCISE 16.5

Count flops: one factorisation is 23n3\frac{2}{3}n^3; each triangular solve is n2n^2. Compare m23n3m \cdot \frac{2}{3}n^3 to 23n3+2mn2\frac{2}{3}n^3 + 2mn^2.

Let n=1000n = 1000, m=500m = 500.

Naive: mO(n3)500×23(109)3.33×1011m \cdot O(n^3) \approx 500 \times \frac{2}{3}(10^9) \approx 3.33 \times 10^{11} flops.

LU: O(n3)+2mO(n2)23(109)+2(500)(106)6.67×108+1091.67×109O(n^3) + 2m \cdot O(n^2) \approx \frac{2}{3}(10^9) + 2(500)(10^6) \approx 6.67 \times 10^8 + 10^9 \approx 1.67 \times 10^9 flops.

Ratio: 3.33×1011/1.67×1092003.33 \times 10^{11} / 1.67 \times 10^9 \approx 200. LU is roughly 200 times cheaper for these parameters.

Break-even: LU wins when m>1m > 1 (one factorisation plus mm solves beats mm factorisations). The advantage grows linearly with mm.

A risk system has n=1000n = 1000 factors and m=500m = 500 scenario right-hand sides. Argue quantitatively why storing an LU factorisation beats re-running Gaussian elimination for each scenario. State the break-even value of mm.

EXERCISE 16.6

Factorise AA once. For each b(k)\mathbf{b}^{(k)}, forward then back substitute. Compare total flop count to 3m3m full eliminations.

A=(3124)A = \begin{pmatrix}3&1\\2&4\end{pmatrix}. 21=2/3\ell_{21} = 2/3. U=(31010/3)U = \begin{pmatrix}3&1\\0&10/3\end{pmatrix}, L=(102/31)L = \begin{pmatrix}1&0\\2/3&1\end{pmatrix}.

b(1)=(46)\mathbf{b}^{(1)} = \begin{pmatrix}4\\6\end{pmatrix}: y1=4y_1=4, y2=623(4)=68/3=10/3y_2 = 6 - \frac{2}{3}(4) = 6 - 8/3 = 10/3. x2=(10/3)/(10/3)=1x_2 = (10/3)/(10/3) = 1. x1=(41)/3=1x_1 = (4-1)/3 = 1. x(1)=(11)\mathbf{x}^{(1)} = \begin{pmatrix}1\\1\end{pmatrix}.

b(2)=(514)\mathbf{b}^{(2)} = \begin{pmatrix}5\\14\end{pmatrix}: y1=5y_1=5, y2=1423(5)=1410/3=32/3y_2 = 14 - \frac{2}{3}(5) = 14 - 10/3 = 32/3. x2=(32/3)/(10/3)=32/10=16/5x_2 = (32/3)/(10/3) = 32/10 = 16/5. x1=(516/5)/3=(9/5)/3=3/5x_1 = (5 - 16/5)/3 = (9/5)/3 = 3/5. x(2)=(3/516/5)\mathbf{x}^{(2)} = \begin{pmatrix}3/5\\16/5\end{pmatrix}.

Factorisation cost: O(8)O(8) flops for n=2n=2. Each solve: O(4)O(4) flops. Total: 8+2(4)=168 + 2(4) = 16 flops. Two full eliminations: 2×8=162 \times 8 = 16 flops — break-even at m=2m=2 for tiny nn; for n=500n=500, factorisation dominates once and solves are cheap.

A 2×22 \times 2 sensitivity matrix A=(3124)A = \begin{pmatrix}3&1\\2&4\end{pmatrix} is fixed. Solve Ax=b(k)A\mathbf{x}=\mathbf{b}^{(k)} for b(1)=(46)\mathbf{b}^{(1)}=\begin{pmatrix}4\\6\end{pmatrix} and b(2)=(514)\mathbf{b}^{(2)}=\begin{pmatrix}5\\14\end{pmatrix} using one LU factorisation. Show both solutions and comment on the cost advantage for large nn.


07 · Summary

TermDefinition
LU decompositionA=LUA = LU with LL unit lower triangular, UU upper triangular
Multiplier ij\ell_{ij}Scalar aij/ajja_{ij}/a_{jj} stored in LL during elimination
Forward substitutionSolve Ly=bL\mathbf{y}=\mathbf{b} top to bottom
Back substitutionSolve Ux=yU\mathbf{x}=\mathbf{y} bottom to top
PA=LUPA = LUPivoting version; PP records row swaps
ComplexityFactorise O(n3)O(n^3) once; each solve O(n2)O(n^2)
Determinantdet(A)=det(P)iuii\det(A) = \det(P)\prod_i u_{ii}

Next: Matrix Decompositions — QR — orthogonal-triangular factorisation via Gram-Schmidt, and why it delivers numerically stable least squares where normal equations fail.