Back to the on-screen lesson ·

Direct factorisations and their cost

What elimination and Cholesky cost in work and storage, why a factorisation is kept rather than repeated, and what partial pivoting actually buys in the backward error analysis.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to count the work and storage of the standard factorisations, choose one from the structure of the matrix, state the backward error bound for elimination and where the growth factor enters it, and say what pivoting does not buy.

2. What you already know

You can eliminate, pivot and factorise, and you know a matrix condition number and what backward stability means. This lesson asks what those factorisations cost, and what exactly pivoting is buying in the backward error analysis.

3. The words this lesson uses

A flop is one arithmetic operation. The growth factor $\rho$ is the largest entry met during elimination divided by the largest entry of $A$. Partial pivoting takes the largest entry of the column as the pivot; the multipliers are then at most one in size. A matrix is positive definite when $x^{\mathsf{T}}Ax > 0$ for every non-zero $x$, which is what makes Cholesky possible.

4. What it costs, and what pivoting is for

Elimination costs about $\tfrac23 n^{3}$ operations; a triangular solve costs $n^{2}$. The ratio is the reason a factorisation is kept: the expensive part depends on $A$ alone, so a second right-hand side costs two solves rather than another elimination. For a symmetric positive definite matrix, Cholesky computes $A = LL^{\mathsf{T}}$ at half the work and half the storage, and needs no pivoting at all, because positive definiteness guarantees a positive pivot at every step. What pivoting is for is subtler than avoiding division by zero. Writing every rounded operation as exact-times-$(1 + \delta)$ and collecting gives $\hat{L}\hat{U} = A + E$ exactly, and the computed solution satisfies $(A + \Delta)\hat{x} = b$ with

$$\|\Delta\| \;\lesssim\; c\,n\,\rho\,\varepsilon\,\|A\|,$$

where $\rho$ is the growth factor. Partial pivoting keeps the multipliers at most one, which is what keeps $\rho$ from exploding — so pivoting buys backward stability, not accuracy. The forward error is still $\kappa(A)$ times that bound, and no arrangement of the elimination touches $\kappa$. The worst case for $\rho$ under partial pivoting is $2^{n-1}$, attained by matrices built for the purpose; in practice it is about ten, on essentially everything, and why remains one of the open questions of the subject.

Another way: steps

  1. Look at the matrix: symmetric positive definite, symmetric indefinite, general, or large and sparse.
  2. Choose the factorisation the structure allows.
  3. Factor once; solve for each right-hand side with two triangular solves.
  4. Judge the answer with $\kappa$, not with the residual.

Another way: example

$A = \begin{pmatrix} 4 & 2 \\ 2 & 5 \end{pmatrix}$ is symmetric positive definite. Cholesky: $l_{11} = 2$, $l_{21} = 1$, $l_{22} = \sqrt{5 - 1} = 2$, so $L = \begin{pmatrix} 2 & 0 \\ 1 & 2 \end{pmatrix}$. A negative number under the root would have proved $A$ was not positive definite — the factorisation is also the test.

5. The mistake to watch for

Pivoting is remembered as a way of avoiding a zero pivot, and is then thought unnecessary when no pivot happens to be zero. A small pivot is the real danger: it makes the multipliers enormous, the entries grow, and the elimination becomes unstable without anything dividing by zero. The second mistake is to expect pivoting to improve the answer on an ill-conditioned system. It shrinks the backward error, which was already going to be small; the forward error is that times $\kappa$, and $\kappa$ is untouched.

6. A small pivot without a zero

  1. $\begin{pmatrix} 10^{-20} & 1 \\ 1 & 1 \end{pmatrix}$, no pivoting: the multiplier is $10^{20}$.

    Nothing divided by zero.

  2. The $(2,2)$ entry becomes $1 - 10^{20}$, which rounds to $-10^{20}$ — the original $1$ has been lost entirely.

    Catastrophic growth.

  3. Swap the rows first: the multiplier is $10^{-20}$ and nothing is lost.

    The whole of what pivoting does.

7. Amortising a factorisation

  1. $n = 1000$: elimination is about $6.7 \times 10^{8}$ operations.

    The one-off cost.

  2. Each further right-hand side is two triangular solves: about $2 \times 10^{6}$.

    Three hundred times cheaper.

8. Your turn: the storage for a Cholesky factor of a $6 \times 6$ matrix

  1. The factor is lower triangular: the diagonal and everything below.

  2. That is $\dfrac{6 \times 7}{2} = 21$ entries.

  3. Your turn: work this step out. Its working is at the end of the packet.

    Against $36$ for the full matrix — and it can be written over the lower triangle of $A$, which was redundant anyway since $A$ is symmetric.

9. Guided practice

A symmetric positive definite matrix of size $6$ is factorised as $A = LL^{\mathsf{T}}$. How many entries of $L$ have to be stored?

Answer:

10. Guided practice

A system of size $n = 12$ is to be solved. Using $\tfrac23 n^{3}$ for elimination, $\tfrac13 n^{3}$ for Cholesky and $n^{2}$ for one triangular solve, give each cost.

StageOperations
Elimination$\tfrac23 n^{3}$
Cholesky$\tfrac13 n^{3}$
One triangular solve$n^{2}$

11. Practice

Match each matrix to the factorisation it calls for.

Cholesky: half the work, half the storage, no pivotingLU with partial pivoting$LDL^{\mathsf{T}}$ with block pivots, keeping the symmetryNo dense factorisation: the factors fill in
Symmetric positive definite, of moderate size
General and invertible
Symmetric but indefinite
Large and sparse

12. Practice

Partial pivoting chooses the largest entry in the column as the pivot. What does that buy, in the backward error analysis?

13. Somewhere new

Elimination with partial pivoting on a $3 \times 3$ matrix produced an upper factor with diagonal $6$, $3$, $2$, after $1$ row interchanges. Give the product of that diagonal and the determinant of the original matrix.

Product w, determinant z.

14. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

15. Test question

Put the five steps of the backward error analysis of Gaussian elimination into order.

Number the steps in order (write the number in the box):

16. What you can do now

You can cost a factorisation, choose one for a given matrix and state the backward error bound. Say in your own words why a small pivot is dangerous even though nothing divides by zero.

Working for the steps left to you

8. Your turn: the storage for a Cholesky factor of a $6 \times 6$ matrix, step 3