🧮Linear Systems: Direct Methods
Cholesky, Banded and Tridiagonal Systems
Symmetric positive definite matrices and energy, A = LLᵀ, band storage and the Thomas algorithm
Crete, 1907
André-Louis Cholesky, a graduate of the École Polytechnique, is an officer of the French artillery assigned to the army's geographic service. Between 1907 and 1908 he surveys Crete; later, North Africa.
A survey network is a web of triangles, with angles and distances measured more times than strictly necessary, and every measurement slightly wrong. Fitting the best coordinates to all of them by least squares produces a system of linear equations whose matrix is symmetric — and has one more property that Cholesky exploits. Around 1910 he writes up a method that solves such systems in about half the work of elimination, by taking square roots.
He never publishes it. Cholesky is mortally wounded in battle in the last summer of the First World War and dies on 31 August 1918. In 1924 a fellow officer, Commandant Benoît, publishes the method in the Bulletin géodésique under Cholesky's name. A century later, it is how almost every finite-element code factorises a stiffness matrix.
A matrix is symmetric positive definite (SPD) if and for every nonzero . That second condition sounds abstract. In engineering it is usually energy:
- for a structure, is the strain energy stored by displacements — positive for any deformation of a properly supported structure;
- for a resistor network, is the power dissipated;
- for heat conduction, it is the integral of .
Remove the supports and the structure can move as a rigid body with zero energy: becomes only semi-definite and singular. Positive definiteness is the matrix form of 'the structure is stable'.
💡Cholesky factorisation
Every SPD matrix can be written uniquely as
with lower triangular and positive diagonal. Column by column:
Symmetry means only half the matrix is stored and computed: operations, half of LU. Positive definiteness guarantees the quantity under every square root is positive and that no pivoting is needed — Cholesky is backward stable as it stands. And if a square root of a negative number appears, the matrix was not positive definite: Cholesky doubles as the cheapest test for it.
Derivation
Cholesky's formulas, by matching entries
The case. Write out the product and match it with entry by entry:
Top left: . Off diagonal: . Bottom right: . The last square root is real exactly when — when the determinant is positive, which positive definiteness guarantees. When a quantity under a root comes out exactly zero — as it will for the springs below once their support is removed — the matrix is singular.
The general case. Entry of is row of times row of : , and since both rows end at their diagonal the sum stops at when . Split off the last term:
For this is , which gives ; for it gives — the two formulas above. Working column by column, everything on the right is already known. The quantity under each square root equals the pivot that Gaussian elimination would produce, and for an SPD matrix every pivot is positive (each leading block has positive determinant, the product of the pivots so far).
📐Three springs
Springs of 150, 150 and 100 kN/m in series, fixed at one end, 5 kN at the free end. The stiffness matrix and its Cholesky factor are
Forward and back substitution give displacements 0.0333, 0.0667 and 0.1167 m — just , then , then , as springs in series must. Remove the support (set ) and the third pivot becomes exactly zero: the structure is a mechanism.
It is not knowledge, but the act of learning, not possession but the act of getting there, which grants the greatest enjoyment.
Bandwidth. Number the unknowns along a rod and each one is coupled only to its neighbours: whenever , the half-bandwidth. The key fact:
In Gaussian elimination or Cholesky without pivoting, the factors stay inside the band. Zeros outside the band are never touched.
So only the band needs to be stored — numbers, or for a symmetric matrix — and the work drops from to about . For the beam below, : the work is proportional to , not .
scipy.linalg.solve_banded and cholesky_banded take matrices in exactly this compressed form.Derivation
Why elimination never leaves the band
At stage , row is changed only if it has a nonzero in column below the pivot, which in a band means . The change subtracts a multiple of row , whose nonzeros lie in columns to . So row can only gain nonzeros in columns , and : inside the band on the right. On the left, columns before have already been cleared in both rows. Nothing can appear outside .
The work follows: at each of the stages, at most rows are updated in at most columns, about operations, so a banded LU costs about and banded Cholesky, using symmetry, about — instead of and .
💡The Thomas algorithm
For a tridiagonal system () with sub-diagonal , diagonal , super-diagonal , elimination reduces to two short sweeps:
forward:
backward:
About operations and numbers of storage. It is stable without pivoting when the matrix is diagonally dominant or SPD — which the matrices of heat conduction, diffusion and cubic splines always are. Llewellyn Thomas described it in 1949.
Derivation
The Thomas algorithm is elimination, written for three diagonals
Row of the system reads (with and ).
Row 1. Divide by : , with and .
Row . Suppose the row above has already been reduced to . Use it to eliminate : substitute into row ,
and divide by . The result has the same two-term form, , with exactly the forward-sweep formulas above.
Back substitution. The last row has no , so ; each earlier row then gives . Every row costs a handful of operations: in total. Diagonal dominance keeps each divisor away from zero, which is why no pivoting is needed.
Derivation
The second-difference stencil, from Taylor's theorem
Lesson 1-3 built first-derivative formulas by subtracting the expansions of and . Adding them instead cancels every odd derivative:
Solve for :
So — the rows of the matrix below — with a truncation error proportional to . Each equation involves a point and its two neighbours, and that is the whole reason the matrix is tridiagonal.
Applying it twice gives the fourth derivative of the beam equation. The second difference of the second differences has weights combined with :
five diagonals: , then , then , and symmetrically.
📐Heat in a rod, and a beam
Steady conduction with internal heating, on , discretised with central differences on interior points, gives the tridiagonal system with rows . With the exact answer is , and the Thomas algorithm gives maximum errors , and for : the of lesson 1-3, at a cost proportional to . Stored densely, would need 80 GB; as three diagonals, 2.4 MB.
A simply supported beam, , gives five diagonals . For m, N m², kN/m, the banded solver's midspan deflection converges to 65.1042 mm — exactly the textbook .
⚠When the band is not enough
Number a 2-D plate's grid row by row and each node is coupled to the node one full row away: the half-bandwidth is the number of nodes per row, , and the band is mostly holes. Cholesky fills those holes — every zero inside the band becomes a nonzero in , called fill-in. For unknowns that is about entries in and operations: far better than dense, far worse than the five nonzeros per row the matrix actually has.
💡Where you will use this
Structures and Geotechnics: stiffness matrices are SPD and banded; skyline and banded Cholesky solvers ran the first generations of finite-element software. Hydraulic and Thermal engineering: implicit time steps for 1-D diffusion and open-channel flow are tridiagonal, solved by Thomas at every step. Attitude Control and Navigation: Kalman filters keep covariance matrices as Cholesky factors ('square-root filters') so they stay positive definite in finite precision. Interpolation: cubic splines (Unit 7) solve a tridiagonal system.
📚Further reading
- Gene Golub and Charles Van Loan, Matrix Computations (4th ed., Johns Hopkins, 2013), chapter 4, 'Special Linear Systems' — Cholesky, banded and tridiagonal solvers.
- Lloyd N. Trefethen and David Bau, Numerical Linear Algebra (SIAM, 1997), Lecture 23, 'Cholesky Factorization'.
- Randall LeVeque, Finite Difference Methods for Ordinary and Partial Differential Equations (SIAM, 2007), chapter 2 — the second-difference matrix of a two-point boundary value problem, its accuracy and its stability.
↓But there is a problem
Banded solvers rescue 1-D problems completely. In 2-D and 3-D the band is wide and full of holes, and fill-in eats most of the savings.
In 1956 four engineers at Boeing — M. J. Turner, R. W. Clough, H. C. Martin and L. J. Topp — needed the stiffness of a swept delta wing. They broke it into small triangular panels, wrote a stiffness matrix for each, and assembled them into one huge system. The method became the finite element method. Its matrices have millions of rows and only a handful of nonzeros in each — and the order in which you number the unknowns decides whether it can be solved at all.