4.5.26 · D4Linear Algebra (Full)

Exercises — LU decomposition — algorithm, applications

2,599 words12 min readBack to topic

This page is your self-test for LU decomposition — algorithm, applications. Every problem states cleanly what to do, then hides a complete worked solution. Try first, then open the callout. Levels climb from "just recognise the pieces" up to "put everything together."

Before we start, one word does all the heavy lifting on this page, so let's pin it down in plain language.

Everything here uses only tools from the parent note: elimination multipliers , unit-lower-triangular , upper-triangular , forward/back substitution, permutations , and the product-of-pivots rule.

Figure — LU decomposition — algorithm, applications

This figure is your map for every solution below: whenever a solution says "pivot" look at the magenta diagonal cell; whenever it computes a multiplier and stores it in , that number lives in an orange lower-left cell at position ; the violet upper cells are the entries that survive into . Keep this picture open as you work Exercises 2.3, 4.1 and 4.2 — each row operation there is literally "orange cell becomes , its multiplier recorded in ."


Level 1 — Recognition

Exercise 1.1

Which of these are valid (unit lower triangular) and which are valid (upper triangular)?

Recall Solution

Recall two rules from the parent note:

  • Unit lower triangular : zeros above the diagonal, and 1's on the diagonal.

  • Upper triangular : zeros below the diagonal (diagonal can be anything).

  • : zeros above diagonal ✓, diagonal ✓ → valid .

  • : zero below diagonal ✓ → valid (diagonal is fine for ).

  • : zero below diagonal ✓ → valid . (It also happens to have 1's on the diagonal, so it is also a valid ? No — needs zeros above, but has a above. So it is only a valid .)

  • : zeros above ✓ but diagonal , and NOT unit lower triangular. It is a valid lower triangular matrix, just not the unit kind LU uses.

Exercise 1.2

In the factorisation

name (a) the two pivots, (b) the single multiplier , and (c) read straight off .

Recall Solution
  • (a) Pivots are the diagonal of (the magenta cells in the figure): and .
  • (b) The multiplier is the off-diagonal entry of (an orange cell): . Sanity check: ✓.
  • (c) . (No row swaps, so no sign flip.)

Level 2 — Application

Exercise 2.1

Factor into .

Recall Solution

Step 1 (WHY): we stand on pivot (the top-left magenta cell). To make the matrix upper-triangular we must turn the directly below it into . The multiplier is "how many copies of row 1 to subtract from row 2": Step 2 (WHAT + WHY): row rowrow gives . The leading is exactly the cleared entry; this is why the operation produces the upper-triangular shape of : Step 3 (WHY): must record how we reached so that . The parent note shows each multiplier drops in with a sign, so store in the orange cell: Check: ✓.

Exercise 2.2

Using the and factors from 2.1, solve with by the two-solve method.

Recall Solution

Forward solve (row by row, top-down): Back solve (row by row, bottom-up): Answer: . Verify ✓.

Exercise 2.3

Factor the matrix

Recall Solution

Column 1 (WHY): we stand on pivot and must zero out both entries below it (the two orange cells in column 1). Each multiplier is that entry divided by the pivot: Subtract those multiples of row 1 — this is why the whole first column below the pivot becomes zero:

  • rowrow
  • rowrow Column 2 (WHY): now we stand on the new pivot in position , which is (read it off the matrix as it stands, not the original ). One entry, the at , sits below it, so That zeroes the last sub-diagonal entry, completing the upper-triangular shape:
L=\begin{pmatrix}1&0&0\\2&1&0\\3&2&1\end{pmatrix}.$$ **WHY $L$ looks like this:** each multiplier we used is stored (with a $+$ sign) in the orange cell whose position matches the entry it cleared — $m_{21}\to(2,1)$, $m_{31}\to(3,1)$, $m_{32}\to(3,2)$ — which is exactly *how we got to $U$*. **Full check** — multiply out **every** entry of $LU$, not just one row: $$LU=\begin{pmatrix}1&0&0\\2&1&0\\3&2&1\end{pmatrix}\begin{pmatrix}1&2&1\\0&1&1\\0&0&2\end{pmatrix} =\begin{pmatrix} 1 & 2 & 1\\ 2 & 2{+}1 & 2{+}1\\ 3 & 6{+}2 & 3{+}2{+}2 \end{pmatrix} =\begin{pmatrix}1&2&1\\2&5&3\\3&8&7\end{pmatrix}=A\ ✓.$$ (Row 2: $2\cdot(1,2,1)=(2,4,2)$ plus $1\cdot(0,1,1)$ gives $(2,5,3)$. Row 3: $3\cdot(1,2,1)+2\cdot(0,1,1)+1\cdot(0,0,2)=(3,8,7)$. Every entry matches.)

Level 3 — Analysis

Exercise 3.1

Attempt to factor . If plain fails, produce instead.

Recall Solution

Why plain fails: the first pivot is . The multiplier is undefined — division by zero. No amount of algebra fixes this; we must move a nonzero entry into the pivot slot.

Partial pivoting: swap rows 1 and 2. The permutation matrix that swaps rows of a is Now pivot , and the entry below it is already , so . Hence Check: ✓.

Exercise 3.2

Read off the factorisation of 3.1. Remember the sign rule.

Recall Solution

, and . But we performed one row swap, so Direct check: ✓.

Exercise 3.3

For the matrix of Exercise 2.3 (with diagonal ), compute , and state how many flops the factorisation cost roughly for using the estimate.

Recall Solution

Determinant: no swaps were used, so Flop estimate: flops (an order-of-magnitude estimate, not exact). The point isn't the exact count — it's that cost grows like , so a bigger matrix costs more to factor.


Level 4 — Synthesis

Exercise 4.1

You must solve for the three right-hand sides

undefined