Linear systems in science

A linear system Ax = b — a square matrix of coefficients A, an unknown vector x, and a right-hand side b — turns up wherever models are discretized: heat flow, structures, circuit analysis, least-squares fitting. Solving such systems reliably is one of the core skills of scientific computing.

Gaussian elimination

Gaussian elimination is a direct method: it transforms the system into an equivalent one whose matrix is upper triangular, then reads off the unknowns from the bottom up. The transformation uses elementary row operations — multiplying a row by a scalar, and adding a multiple of one row to another — applied to the augmented matrix formed from A and b.

The forward phase eliminates each column below the diagonal in turn; the back-substitution phase then solves the triangular system, starting from the last unknown and working upward. The method costs on the order of n cubed operations for an n-by-n system, which is why very large sparse systems usually switch to iterative approaches.

Pivoting in brief

Elimination divides by the diagonal element of the current column — the pivot. If that element is zero, division fails; if it is tiny, rounding errors get amplified. Partial pivoting swaps rows at each step so the pivot is the largest available in the column. The swap changes nothing about the solution but keeps the arithmetic stable, and pivoting is standard practice in serious implementations.

Triangular systems

Triangular systems are the easy case that elimination works toward. For an upper triangular system, the last equation has a single unknown, which is solved directly; substituting that value into the equation above leaves one unknown again, and so on — back substitution. A lower triangular system is solved the same way from the top down, by forward substitution. Each requires only on the order of n squared operations.

Because small changes in the data can be amplified when a matrix is ill-conditioned, checking a solution's quality — by computing how well Ax reproduces b — is a habit worth keeping. The companion article Ordinary Differential Equations shows linear systems put to work inside time-stepping methods.