Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Open In Colab Binder

The word fangcheng, the modern Chinese term for “equation,” is older, and carries more meaning, than most people realize.

Chapter 8 of The Nine Chapters on the Mathematical Art is titled Fangcheng (“Rectangular Arrays”); the book was compiled and edited over a long period of accumulation. Its method lays out counting rods as an array of numbers: the coefficients of each equation are arranged along a vertical column, the unknowns are eliminated step by step by multiplying and subtracting, and the solution is then found by back substitution. This is an important record of the ancient idea of elimination; what was used at the time was counting rods on a counting board, not the modern abacus.

In modern notation, writing each equation horizontally as a row gives the augmented matrix, and the corresponding elimination steps are written as row operations. The ancient arrays and modern matrices follow different conventions of orientation, but both use equivalence transformations that leave the solutions unchanged. This connection helps us understand the history, but it does not mean that the ancients already used the modern concept of a matrix.

By the middle of the nineteenth century, systems of linear equations had begun to play an increasingly important role in problems of physics and engineering.

In 1845, Gustav Kirchhoff studied the relations between currents and voltages in electrical networks. Conservation of current at the nodes and the voltage relations around loops, together with the constitutive equations of the components, provided a systematic framework for circuit analysis. For a linear resistive network these relations form a system of linear equations; the number of independent equations must take the topological constraints of the network into account, and is not obtained by simply adding up the numbers of nodes, branches, or loops.

Under a suitable linear model, the connection and equilibrium conditions of a physical system can be translated into a system of linear equations. Nonlinear components, by contrast, usually require nonlinear solves and local linearization.

This framework extends to modern circuit simulation: many algorithms solve linear systems over and over in the course of their iterations. Multi-antenna channel equalization in communications also often involves linear equations and least-squares problems. Different applications rest on different modeling assumptions, yet they share one body of linear algebra tools.

More profoundly, solving a system of equations means far more than arithmetic elimination. From the modern geometric viewpoint, solving Ax=b\mathbf{A}\mathbf{x} = \mathbf{b} is at once a search for the common intersection point of several hyperplanes in a high-dimensional space and a test of whether the target vector b\mathbf{b} can be formed as a linear combination of the column vectors of the matrix.

The grain calculations on ancient counting boards, the resistive networks in the notes of nineteenth-century physicists, and today’s simulations of electromagnetic fields on supercomputers can all, under suitable models, be reduced to systems of linear equations. This consistency across civilizations, engineering, and pure geometry is an important reason why systems of linear equations sit at the heart of linear algebra.

Chapter Structure and Learning Objectives

The elimination algorithm of The Nine Chapters is intuitive and effective, but what structure lies behind it? Why can those operations be applied freely without changing the solutions of the system? §6.1 starts from this question and interprets row operations as invertible linear transformations—left multiplication by elementary matrices—thereby raising the arithmetic act of “solving equations” to the language of linear algebra.

Each of these elementary operations corresponds to an invertible elementary matrix, so they preserve the dimensions of the row space and the column space, which guarantees the legitimacy of every subsequent reduction step in the chapter.

§6.2 introduces the row echelon form and the reduced row echelon form, the end point of elimination: once a matrix has been brought to this canonical form, the structure of the solutions—no solution, a unique solution, or infinitely many solutions—becomes clear at a glance. Here the concept of rank receives its most concrete computational definition, and it formally connects with the concept of dimension from Chapter 4 on abstract linear spaces.

§6.3 contains the central algorithms of the chapter: Gaussian elimination and the LU decomposition. The former is the procedure for solving; the latter is the same procedure in the language of matrices—factoring A\mathbf{A} as the product of a lower triangular matrix L\mathbf{L} and an upper triangular matrix U\mathbf{U}. The significance of the LU decomposition goes beyond computational efficiency: it records every step of the elimination permanently in L\mathbf{L}, so that the same coefficient matrix can be reused for different right-hand-side vectors, which is one of the basic design principles of modern numerical linear algebra.

§6.4 closes with three concrete applications: the balance equations of network flows, the conservation of atoms in chemical reactions, and the static equilibrium of mechanical systems. These three problems come from different fields, yet mathematically they are all Ax=b\mathbf{Ax} = \mathbf{b}—they share one theory and one set of algorithms.

Once you have read this chapter, you will see a different depth of field in the ancient name of the fangcheng method.

6.1 Elementary Matrix Operations

We begin with the most basic matrix operations and set out to explore the mysteries of systems of linear equations.

Elementary matrix operations are the basic tools for solving systems of linear equations. In essence they are an algebraic upgrade of the three operations for solving equations that you already know from high school—multiplying by a constant, interchanging two equations, and adding two equations. Let us first look at a concrete example to get a feel for this upgrade:

Multiplying row 0 of the system by 2 is completely equivalent to “left-multiplying by the diagonal matrix E0(2)\mathbf{E}_0(2)”:

[2001]⏟E0(2)[1325]⏟A=[2625]=[2⋅row0(A)row1(A)]⏟result of row scaling\underbrace{\begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix}}_{\mathbf{E}_0(2)} \underbrace{\begin{bmatrix} 1 & 3 \\ 2 & 5 \end{bmatrix}}_{\mathbf{A}} = \begin{bmatrix} 2 & 6 \\ 2 & 5 \end{bmatrix} = \underbrace{\begin{bmatrix} 2 \cdot \text{row}_0(\mathbf{A}) \\ \text{row}_1(\mathbf{A}) \end{bmatrix}}_{\text{result of row scaling}}

This observation reveals the central theme of this section: every elimination operation done by hand corresponds to left multiplication by a particular elementary matrix. Once you master this correspondence, Gaussian elimination turns from a “technique” into a “structure.”

6.1.1 Row Scaling

Row scaling means multiplying one row of a matrix by a nonzero constant.

Row scaling does not change the dimension of the row space, because it merely stretches one row vector by a nonzero factor and does not change linear dependence. At the same time, the dimension of the column space is also unchanged, because Ei(c)\mathbf{E}_i(c) is invertible and an invertible transformation does not change the dimension of the image. Since the rank is defined as the dimension of the column space, row scaling does not change the rank of the matrix.

In a system of linear equations Ax=b\mathbf{Ax=b}, row scaling amounts to multiplying both sides of one equation by a nonzero constant, which does not change the solution set of the equation.

6.1.2 Row Exchange

Row exchange means interchanging the positions of two rows of a matrix.

Row exchange does not change the dimension of the row space, because interchanging two rows merely reorders the row vectors without changing what their linear combinations can produce. Since Pij\mathbf{P}_{ij} is an invertible matrix (in fact an orthogonal matrix), the dimension of the column space is also unchanged. Therefore row exchange preserves the rank of the matrix.

The row exchange operation amounts to reordering the equations of a system of linear equations, which does not change the solution set of the system.

6.1.3 Row Elimination

Row elimination means adding a multiple of one row to another row, with the aim of eliminating the entry in a particular position.

Row elimination does not change the dimension of the row space, because it merely replaces one row vector by a linear combination of that vector and another row vector, and the span of all the row vectors stays the same. Since Eij(c)\mathbf{E}_{ij}(c) is an invertible matrix (its inverse is Eij(−c)\mathbf{E}_{ij}(-c)), the dimension of the column space is also unchanged. Therefore the row elimination operation preserves the rank of the matrix.

Row elimination is the central operation for solving systems of linear equations: it simplifies the system by eliminating variables, but it does not change the solution set of the system.

6.1.4 The Relation Between Row Operations and Column Operations

Column operations and row operations are dual to each other, and the connection between them is made through the matrix transpose. A column operation on the matrix A\mathbf{A} is equivalent to the corresponding row operation on its transpose A⊤\mathbf{A}^{\top}.

From the property above and the fact that row operations preserve the dimension of the column space, we can deduce that column operations preserve the dimension of the row space. Since dim⁡(Col(A))=dim⁡(Row(A⊤))\dim(\text{Col}(\mathbf{A})) = \dim(\text{Row}(\mathbf{A}^{\top})), column operations do not change the dimension of the row space, and row operations do not change the dimension of the column space; hence all elementary operations preserve the rank of the matrix.

Column scaling

Column scaling means multiplying one column of a matrix by a nonzero constant; it is equivalent to right multiplication by a diagonal elementary matrix Ej(c)\mathbf{E}_j(c), written AEj(c)\mathbf{A}\mathbf{E}_j(c).

Column scaling does not change the dimension of the column space, because it merely stretches one column vector by a nonzero factor and does not change linear dependence. By the definition of the rank of a matrix (the dimension of the column space), column scaling does not change the rank of the matrix.

Column exchange

Column exchange means interchanging the positions of two columns of a matrix; it is equivalent to right multiplication by a permutation matrix Pij\mathbf{P}_{ij}, written APij\mathbf{A}\mathbf{P}_{ij}.

Column exchange does not change the dimension of the column space, because interchanging two columns merely reorders the column vectors without changing what their linear combinations can produce. Therefore column exchange preserves the rank of the matrix.

Column elimination

Column elimination means adding a multiple of one column to another column; it is equivalent to right multiplication by an elementary matrix Eji(c)\mathbf{E}_{ji}(c), written AEji(c)\mathbf{A}\mathbf{E}_{ji}(c).

Column elimination does not change the dimension of the column space, because it merely replaces one column vector by a linear combination of that vector and another column vector, and the span of all the column vectors stays the same. Therefore the column elimination operation preserves the rank of the matrix.

6.1.5 Elementary Operations and Subspaces

Every elementary matrix operation preserves the dimensions of the row space and the column space of the matrix; this is the key to understanding the structure of the solutions of a system of linear equations. We give a slightly more general statement.

Summary of Elementary Matrix Operations

Type of operationMatrix representationEffect on the dimension of the row spaceEffect on the dimension of the column spaceEffect on the rank
Row scalingEi(c)A\mathbf{E}_i(c)\mathbf{A}NoneNoneNone
Row exchangePijA\mathbf{P}_{ij}\mathbf{A}NoneNoneNone
Row eliminationEij(c)A\mathbf{E}_{ij}(c)\mathbf{A}NoneNoneNone
Column scalingAEj(c)\mathbf{A}\mathbf{E}_j(c)NoneNoneNone
Column exchangeAPij\mathbf{A}\mathbf{P}_{ij}NoneNoneNone
Column eliminationAEji(c)\mathbf{A}\mathbf{E}_{ji}(c)NoneNoneNone

The core property of elementary matrix operations is that they preserve the dimensions of the row space and the column space, and hence the rank of the matrix. This property is the foundation of Gaussian elimination and the other algorithms for solving systems of linear equations. Row operations apply an invertible linear transformation on the output side and leave the solution set unchanged, which makes them the main tool for solving systems of linear equations; column operations have important applications in matrix decompositions and in understanding the structure of the solution space. Understanding how elementary operations affect the subspace structure of a matrix is the key to mastering the core ideas of linear algebra.

6.2 Reduced Row Echelon Form and the Geometric Structure of Solutions

The reduced row echelon form is not only a key intermediate step in solving systems of linear equations; it also gives an intuitive expression of the geometric structure of the solutions. Through the reduced row echelon form we can clearly see the dimension and shape of the solution space of a system and its relation to the subspaces of the coefficient matrix.

6.2.1 Square Upper Triangular Matrices with Nonzero Diagonal and Their Geometric Interpretation

An upper triangular matrix with nonzero diagonal entries is like a “staircase” system of equations: each equation is “simpler” than the one before it, so we can start from the last equation and solve backward step by step. In §5.3.3, Theorem 3, we already proved that such a system necessarily has a solution; now we work through an actual example and solve it.

Why do upper triangular matrices have this special structure?

From the viewpoint of transformations, an upper triangular matrix has a kind of “hierarchy”:

  • It maps the standard basis vectors {e0,e1,…,en−1}\{\mathbf{e}_0, \mathbf{e}_1, \ldots, \mathbf{e}_{n-1}\} to an image with a special structure

  • This image can be decomposed into nested, properly contained subspaces: {0}⊂span{e0}⊂span{e0,e1}⊂⋯⊂Rn\{0\} \subset \text{span}\{\mathbf{e}_0\} \subset \text{span}\{\mathbf{e}_0,\mathbf{e}_1\} \subset \cdots \subset \mathbb{R}^n. This is because

    • every diagonal entry is nonzero, which guarantees that every standard basis vector makes a “new contribution” to the image

    • the matrix has full rank (rank = n), so the image is the whole of Rn\mathbb{R}^n

    • each additional basis vector increases the dimension of the image by 1

An intuitive analogy. It is like the floors of a building: the upper floors can affect the lower floors, but the lower floors cannot affect the upper ones. This “one-way dependence” lets us start from the “top floor” and solve downward floor by floor.

This structure is especially important in numerical computation, because it guarantees the stability and efficiency of the solution process.


6.2.2 Row Echelon Matrices and the Reduced Row Echelon Form

A square upper triangular matrix whose diagonal entries are all nonzero is a REF whose pivots all lie on the diagonal; a general upper triangular matrix need not be a REF.

A matrix in row echelon form (Row Echelon Form, REF) is a special kind of upper triangular matrix (conversely, an upper triangular matrix need not be in row echelon form); its image can be decomposed into nested subspaces, but the containments are not necessarily proper. Let us next consider a simpler form, which can be converted to and from a row echelon matrix by row scaling and row elimination: the reduced row echelon matrix (Reduced Row Echelon Form, RREF), which simplifies this geometric representation further.

6.2.3 Reading the Rank and the Subspace Dimensions from the Block Structure of the RREF

§6.2.1 showed that an upper triangular matrix with nonzero diagonal has a nested “flag” structure of subspaces: each new pivot contributes an entirely new direction to the image, and back substitution solves step by step from the last row upward. The RREF and the upper triangular matrix share essentially the same “staircase of pivots” geometry; the only difference is that an upper triangular matrix allows nonzero entries above the pivots, while the RREF further requires the entries above and below each pivot to be cleared to zero and each pivot to equal 1. This extra reduction costs very little (row elimination plus row scaling), but it brings a decisive benefit: the block structure of the RREF can be read off directly, with no back substitution needed.

However, the pivots of an RREF do not fall neatly on the diagonal as they do for a square upper triangular matrix. Take the following matrix as an example:

RRREF=[10205013040001−200000]\mathbf{R}_{RREF} = \begin{bmatrix} 1 & 0 & 2 & 0 & 5 \\ 0 & 1 & 3 & 0 & 4 \\ 0 & 0 & 0 & 1 & -2 \\ 0 & 0 & 0 & 0 & 0 \end{bmatrix}

The pivots are in columns 0, 1, and 3, while columns 2 and 4 have no pivot. This phenomenon of “pivots skipping columns” tells us that the order of the variables needs to be adjusted before the RREF can be rearranged into a standard block form. Below we illustrate the whole process with a complete numerical example, and then state the theorem.

With this concrete example as a foundation, we can now state the general theorem.

6.2.4 Nonhomogeneous Systems of Linear Equations: Particular Solution plus Homogeneous Solution

§6.2.3 settled the homogeneous system Rx=0\mathbf{R}\mathbf{x}=\mathbf{0}: the structure of the kernel is completely determined by the block matrix [IrF]\begin{bmatrix}\mathbf{I}_r & \mathbf{F}\end{bmatrix}, and the basis matrix is N=P[−FIn−r]\mathbf{N} = \mathbf{P}\begin{bmatrix}-\mathbf{F}\\\mathbf{I}_{n-r}\end{bmatrix}.

Now consider the general case Ax=b\mathbf{A}\mathbf{x}=\mathbf{b}, b≠0\mathbf{b}\neq\mathbf{0}. Compared with the homogeneous case, a nonhomogeneous system faces a new problem: a solution need not exist. Before discussing how to solve, we must first ask: what condition must b\mathbf{b} satisfy for the system to have a solution?

Existence of Solutions: Two Views

The hyperplane view. Each row of the system Ax=b\mathbf{A}\mathbf{x}=\mathbf{b} is the equation of a hyperplane in Rn\mathbb{R}^n. Having a solution is equivalent to all the hyperplanes having a common point of intersection. If the RREF of the augmented matrix [R∣c][\mathbf{R}|\mathbf{c}] contains a row of the form

[0, 0, …, 0  ∣  k],k≠0[0,\,0,\,\ldots,\,0\;|\;k],\quad k\neq 0

then that row requires “0=k0 = k,” which cannot be satisfied by any x\mathbf{x}; this shows that the hyperplanes contradict one another and have no common point of intersection.

The image view. Regard Ax=b\mathbf{A}\mathbf{x}=\mathbf{b} as asking: does b\mathbf{b} lie in the column space (the image) Col⁡(A)\operatorname{Col}(\mathbf{A}) of A\mathbf{A}?

Ax=b has a solution↔b∈Col⁡(A)\mathbf{A}\mathbf{x}=\mathbf{b} \text{ has a solution} \leftrightarrow \mathbf{b}\in\operatorname{Col}(\mathbf{A})

Because Ax\mathbf{A}\mathbf{x} is a linear combination of the columns of A\mathbf{A}, having a solution is equivalent to b\mathbf{b} being expressible as a linear combination of these columns. In terms of rank: b∈Col⁡(A)\mathbf{b}\in\operatorname{Col}(\mathbf{A}) if and only if appending b\mathbf{b} to A\mathbf{A} does not increase the dimension of the column space, that is,

rank⁡([A∣b])=rank⁡(A)\operatorname{rank}([\mathbf{A}|\mathbf{b}]) = \operatorname{rank}(\mathbf{A})

The two views are equivalent: an inconsistent row appearing in the RREF is equivalent to b\mathbf{b} not lying in the image of A\mathbf{A}, which is equivalent to the rank of the augmented matrix exceeding the rank of the coefficient matrix.

The Structure of the Solutions When a Solution Exists: Particular Solution plus Homogeneous Solution

Once we have confirmed that the system has a solution, the structure of the solutions is described by the following theorem:

Let R=EA\mathbf{R}=\mathbf{E}\mathbf{A}; the right-hand side must undergo the same row operations, giving c=Eb\mathbf{c}=\mathbf{E}\mathbf{b}. Let bp\mathbf{b}_p be the first rr components of c\mathbf{c}; consistency requires the remaining m−rm-r components all to be zero. After the columns are rearranged we have yp=bp−Fyf\mathbf{y}_p=\mathbf{b}_p-\mathbf{F}\mathbf{y}_f. In this block structure the most natural choice of particular solution is to set all the free variables to zero (yf=0\mathbf{y}_f = \mathbf{0}); then yp=bp\mathbf{y}_p = \mathbf{b}_p, and restoring the order of the columns gives a particular solution. The complete solution is then obtained by adding to this particular solution the kernel already found in §6.2.3.

The three forms of the solutions are now clear at a glance:

CaseCondition (RREF)Solution setDimension
No solutionAn inconsistent row [0⋯0 ∣ k][0\cdots0\,|\,k], k≠0k\neq 0, appearsEmpty set—
Unique solutionNo inconsistent row, and no free variables (r=nr=n)A single point {xp}\{\mathbf{x}_p\}0
Infinitely many solutionsNo inconsistent row, and there are free variables (r<nr<n)The affine subspace xp+ker⁡(A)\mathbf{x}_p+\ker(\mathbf{A})n−rn-r

6.3 Gaussian Elimination

Gaussian elimination is the systematic method for transforming the augmented matrix of a system of linear equations into row echelon form (REF) or reduced row echelon form (RREF). It provides the actual computational steps for reaching the matrix forms discussed in §6.2.

6.3.1 The Essence of Gaussian Elimination

At the heart of Gaussian elimination is a sequence of elementary row operations that transform the augmented matrix into an equivalent row echelon matrix. These operations are in essence isomorphic transformations of the image, which guarantee that the solution set of the system is the same before and after the transformation.

6.3.2 Simplified Gaussian Elimination and the LU Decomposition

Before giving the definition, let us first settle a question of notation: the elimination process produces a product of elementary matrices En−1⋯E1E0 A=U\mathbf{E}_{n-1} \cdots \mathbf{E}_1 \mathbf{E}_0 \,\mathbf{A} = \mathbf{U}, and there are two possible choices of notation:

Core idea. Ideal Gaussian elimination brings the original matrix A\mathbf{A} step by step to an upper triangular (upper trapezoidal) matrix U\mathbf{U} using pure “row elimination operations” alone (without interchanging the order of the rows); if the pivots fall in turn on the diagonal and are all nonzero, U\mathbf{U} is also in row echelon form; otherwise, in general, it is only guaranteed to be upper triangular and need not be a REF.

6.3.3 Python/Simplified LU Decomposition

The following code implements the algorithm above; please read it alongside the steps.

Why Is the LU Decomposition Written A=LU\mathbf{A} = \mathbf{L}\mathbf{U} Rather Than LA=U\mathbf{L}\mathbf{A} = \mathbf{U}?

Each step of Gaussian elimination left-multiplies A\mathbf{A} by an elementary lower triangular matrix Ek\mathbf{E}_k, clearing the entries below the pivot in column kk:

En−1⋯E1E0 A=U\mathbf{E}_{n-1} \cdots \mathbf{E}_1 \mathbf{E}_0 \,\mathbf{A} = \mathbf{U}

So from the viewpoint of the elimination operations, the notation LA=U\mathbf{L}\mathbf{A} = \mathbf{U} is not entirely wrong—it describes “applying a sequence of row operations to A\mathbf{A} to obtain U\mathbf{U}.”

But there are three fundamental reasons for writing it in the end as A=LU\mathbf{A} = \mathbf{L}\mathbf{U}:

Reason 1: the inverses of the Ek\mathbf{E}_k have a more elegant structure

Each Ek\mathbf{E}_k is a unit lower triangular matrix, and its inverse Ek−1\mathbf{E}_k^{-1} is obtained simply by changing the signs of the elimination multipliers, with exactly the same structure. Let

L=E0−1E1−1⋯En−1−1\mathbf{L} = \mathbf{E}_0^{-1} \mathbf{E}_1^{-1} \cdots \mathbf{E}_{n-1}^{-1}

Then L\mathbf{L} is precisely the lower triangular matrix obtained by entering all the elimination multipliers directly into their corresponding positions, with no extra computation. This is exactly what the code below demonstrates: multiplying the Ek−1\mathbf{E}_k^{-1} in order of increasing index (E0−1E1−1⋯En−1−1\mathbf{E}_0^{-1}\mathbf{E}_1^{-1}\cdots\mathbf{E}_{n-1}^{-1}, that is, in the reverse of the order in which the eliminations are performed) gives a product that is exactly the L\mathbf{L} assembled directly from the multipliers of each round; if they are multiplied in order of decreasing index (En−1−1⋯E0−1\mathbf{E}_{n-1}^{-1}\cdots\mathbf{E}_0^{-1}), the product is still a unit lower triangular matrix but is not equal to L\mathbf{L}.

Reason 2: A=LU\mathbf{A} = \mathbf{L}\mathbf{U} is a decomposition of A\mathbf{A}, while LA=U\mathbf{L}\mathbf{A} = \mathbf{U} is a transformation of A\mathbf{A}

The meaning of a decomposition is “to express A\mathbf{A} as the product of two matrices of simple structure,” for use in solving, analysis, and storage. The meaning of LA=U\mathbf{L}\mathbf{A} = \mathbf{U}, by contrast, is “to apply operations to A\mathbf{A}”; it describes a process rather than a structure.

Reason 3: the applications are built around A=LU\mathbf{A} = \mathbf{L}\mathbf{U}

When solving the linear system Ax=b\mathbf{A}\mathbf{x} = \mathbf{b}, the decomposition gives

LUx=b  ⟹  Ly=b,Ux=y\mathbf{L}\mathbf{U}\mathbf{x} = \mathbf{b} \implies \mathbf{L}\mathbf{y} = \mathbf{b},\quad \mathbf{U}\mathbf{x} = \mathbf{y}

Both substitution steps use L\mathbf{L} and U\mathbf{U} directly rather than the sequence of Ek\mathbf{E}_k. The form A=LU\mathbf{A} = \mathbf{L}\mathbf{U} makes this procedure natural and symmetric.

6.3.4 Complete Gaussian Elimination and the PLU Decomposition

As described in the previous subsection, the ideal LU decomposition is often not feasible in actual computation, because:

  • a diagonal entry may be zero and so cannot serve as the pivot entry

  • even when it is nonzero, a very small value leads to numerical instability

Practical Gaussian elimination therefore needs to introduce a row-exchange strategy (in engineering practice, column exchanges are also added to improve the stability of the algorithm further), which gives the PLU decomposition.

Permutation matrices and row exchanges

A permutation matrix is a matrix obtained by rearranging the rows (or the columns) of the identity matrix. Left-multiplying a matrix by a permutation matrix changes the order of the rows of that matrix.

An important property of permutation matrices is that their inverse equals their transpose: P−1=P⊤\mathbf{P}^{-1} = \mathbf{P}^\top.

The early stages of the PLU decomposition are no different from the LU decomposition, until during the elimination we find that rows kk and ii (i>ki > k) need to be interchanged. Because row exchanges and row eliminations are interleaved, the key question is: how can the PLU form of the decomposition be preserved while they are interleaved?

Block representation of the current state.

Suppose elimination has been completed for the first kk rows; the state of the matrix can then be written as

PkA=LkUk=[L000L10I][U00U010U11]\mathbf{P}_k\mathbf{A} = \mathbf{L}_k \mathbf{U}_k = \begin{bmatrix} \mathbf{L}_{00} & \mathbf{0} \\ \mathbf{L}_{10} & \mathbf{I} \end{bmatrix} \begin{bmatrix} \mathbf{U}_{00} & \mathbf{U}_{01} \\ \mathbf{0} & \mathbf{U}_{11} \end{bmatrix}

where:

  • Pk\mathbf{P}_k: the permutation matrix accumulated over the first kk steps

  • L00\mathbf{L}_{00}: the completed k×kk \times k unit lower triangular block; L10\mathbf{L}_{10}: the completed (m−k)×k(m-k) \times k matrix block

  • U00\mathbf{U}_{00}: the completed k×sk \times s generalized upper triangular block, also in REF form, with k≤sk \leq s

  • U11\mathbf{U}_{11}: the (m−k)×(n−s)(m-k) \times (n-s) block still to be processed

The row exchange operation.

When rows kk and ii need to be interchanged, we construct a permutation matrix acting only on the trailing rows:

Qk=[Ik00Qki′]\mathbf{Q}_k = \begin{bmatrix} \mathbf{I}_k & \mathbf{0} \\ \mathbf{0} & \mathbf{Q}'_{ki} \end{bmatrix}

where Qki′\mathbf{Q}'_{ki} is an (m−k)×(m−k)(m-k) \times (m-k) permutation matrix responsible for interchanging the corresponding rows.

Key lemma. Row exchanges do not destroy the lower triangular structure of L\mathbf{L}

This is the heart of why the PLU decomposition holds in general. We first check it on a 3×33 \times 3 block example, and then explain the general case.

A worked check. Let k=1k=1 (step 0 of the elimination is complete), and interchange row 1 and row 2. Then

L1=[100m1010m2001],Q1=[100001010]\mathbf{L}_1 = \begin{bmatrix} 1 & 0 & 0 \\ m_{10} & 1 & 0 \\ m_{20} & 0 & 1 \end{bmatrix}, \qquad \mathbf{Q}_1 = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 1 & 0 \end{bmatrix}

Compute Q1L1Q1\mathbf{Q}_1 \mathbf{L}_1 \mathbf{Q}_1 directly:

Step 1. First compute L1Q1\mathbf{L}_1 \mathbf{Q}_1 (right multiplication by the permutation = interchanging columns 1 and 2 of L1\mathbf{L}_1):

L1Q1=[100m1001m2010]\mathbf{L}_1 \mathbf{Q}_1 = \begin{bmatrix} 1 & 0 & 0 \\ m_{10} & 0 & 1 \\ m_{20} & 1 & 0 \end{bmatrix}

Step 2. Then compute Q1(L1Q1)\mathbf{Q}_1 (\mathbf{L}_1 \mathbf{Q}_1) (left multiplication by the permutation = interchanging rows 1 and 2):

Q1L1Q1=[100m2010m1001]\mathbf{Q}_1 \mathbf{L}_1 \mathbf{Q}_1 = \begin{bmatrix} 1 & 0 & 0 \\ m_{20} & 1 & 0 \\ m_{10} & 0 & 1 \end{bmatrix}

The result is still a unit lower triangular matrix—only the positions of m10m_{10} and m20m_{20} have been swapped (corresponding to the exchange of row 1 and row 2).

The general case. The structure of Qk\mathbf{Q}_k guarantees that it permutes only the row indices after step kk and does not touch the completed k×kk \times k upper-left block L00\mathbf{L}_{00}; and the lower-right block is I\mathbf{I} before the row exchange and is still I\mathbf{I} afterward (rows and columns are interchanged together, which leaves the identity matrix unchanged). Therefore

QkLkQk=[L000Q′L10I]\mathbf{Q}_k \mathbf{L}_k \mathbf{Q}_k = \begin{bmatrix} \mathbf{L}_{00} & \mathbf{0} \\ \mathbf{Q}' \mathbf{L}_{10} & \mathbf{I} \end{bmatrix}

where Q′L10\mathbf{Q}' \mathbf{L}_{10} is only a rearrangement of the multipliers already recorded and introduces no entries outside the lower triangle.

Lk′=QkLkQk\mathbf{L}'_k = \mathbf{Q}_k \mathbf{L}_k \mathbf{Q}_k is still a unit lower triangular matrix.

Updating the decomposition.

Using the property QkQk=I\mathbf{Q}_k \mathbf{Q}_k = \mathbf{I} of the permutation matrix, we obtain

(QkPk)A=(QkLkQk)(QkUk)=Lk′Uk′.(\mathbf{Q}_k\mathbf{P}_k)\mathbf{A}=(\mathbf{Q}_k\mathbf{L}_k\mathbf{Q}_k)(\mathbf{Q}_k\mathbf{U}_k)=\mathbf{L}'_k\mathbf{U}'_k.

where:

  • Pk+1=QkPk\mathbf{P}_{k+1} = \mathbf{Q}_k \mathbf{P}_k: the updated accumulated permutation matrix

  • Lk′=QkLkQk\mathbf{L}'_k = \mathbf{Q}_k \mathbf{L}_k \mathbf{Q}_k: the updated unit lower triangular matrix

  • Uk′=QkUk\mathbf{U}'_k = \mathbf{Q}_k \mathbf{U}_k: the partially upper triangular matrix after the row exchange, which is also partially in REF

Key insight. By this clever device we convert “row exchanges during the computation” into “row exchanges before the computation begins,” always maintaining the standard form PA=LU\mathbf{PA} = \mathbf{LU}. In other words, if we knew the final permutation matrix P\mathbf{P} in advance, the ideal LU decomposition of PA\mathbf{PA} would need no row exchanges at all!

Practical significance

The advantages of the PLU decomposition are:

  1. Numerical stability: choosing the pivot entry of largest absolute value greatly reduces the accumulation of rounding errors

  2. General applicability: it applies to every matrix and is not restricted by singularity

  3. Computational efficiency: although row exchange operations are added, the overall complexity is still O(mnmin⁡(m,n))O(mn \min(m,n))

  4. Theoretical completeness: it provides a reliable numerical foundation for the many applications of linear algebra

In practice, the PLU decomposition is the core tool for solving systems of linear equations, computing determinants, finding inverse matrices, and similar operations.

6.3.5 Python/Complete PLU Decomposition

The following code implements the algorithm above; please read it alongside the steps

6.3.6 A Unified Framework for Solving Linear Systems and Inverting Matrices

The PLU decomposition obtained in the previous subsection can not only solve the system of linear equations Ax=b\mathbf{Ax = b} but also compute the inverse of a matrix efficiently. In fact, finding the inverse matrix is equivalent to solving n special systems of linear equations simultaneously, Axi=ei\mathbf{Ax_i = e_i} (where ei\mathbf{e_i} is the i-th column vector of the identity matrix), so that Gaussian elimination, the LU decomposition, and the PLU decomposition provide a unified theoretical and computational framework for solving systems of linear equations and computing inverse matrices.

Features of Gaussian elimination. In essence, it transforms the system of linear equations Ax=b\mathbf{Ax = b} by a sequence of row operations into an equivalent upper triangular system Ux=b′\mathbf{Ux = b\prime}. The “advantage” of Gaussian elimination is that only the final simplified system needs to be recorded, not the transformation process, which makes it look “simple and intuitive”; even high school students can master it. However, because the transformation process is not recorded, every elimination step must be carried out again each time a new constant vector b\mathbf{b} comes along.

Features of the LU decomposition. This is an idealized method of matrix decomposition, which assumes that the pivots always lie on the diagonal during the elimination, so that no row exchanges are needed. Under this assumption we can express the elimination process as A=LU\mathbf{A} = \mathbf{LU}, where L records all the elimination multipliers and U is an upper triangular matrix. To solve a system of linear equations we only need to solve two triangular systems in turn: first Ly=b\mathbf{Ly = b} and then Ux=y\mathbf{Ux = y}. The advantage of this method is that the decomposition is computed once and can be used many times, while the constant vector b\mathbf{b} stays unchanged. However, the existence of the LU decomposition depends on the lucky condition that “no pivot is zero,” which does not always hold in practical applications.

Features of the PLU decomposition. This is the most complete and robust method of matrix decomposition: it introduces a permutation matrix P to record the necessary row exchanges and obtains PA=LU\mathbf{PA = LU}. For the system of linear equations Ax=b\mathbf{Ax = b}, we turn to solving PAx=Pb\mathbf{PAx = Pb}, and then solve Ly=Pb\mathbf{Ly = Pb} and Ux=y\mathbf{Ux = y} in turn. Since the permutation merely rearranges the entries of a vector, computing Pb\mathbf{Pb} is very efficient. The PLU decomposition combines the efficiency of decomposition methods with the numerical stability of row exchanges, and applies to almost every matrix.

Comparing the three methods. In terms of computational efficiency, for a single solve Gaussian elimination has a slight advantage because it avoids storing matrices; but when many systems with the same coefficient matrix must be solved, the advantage of the PLU decomposition is significant, because the decomposition is computed only once. In terms of numerical stability, Gaussian elimination and the PLU decomposition behave identically when they use the same pivoting strategy. In memory usage, Gaussian elimination has a slight advantage because it does not need to store the matrices L and P, but this difference is usually not decisive in modern computing environments.

Developments in modern numerical methods. Note that the three methods above all belong to the category of direct methods, which obtain the exact solution (within numerical precision) in finitely many steps. For large sparse systems, however, modern numerical linear algebra prefers iterative methods, such as the conjugate gradient method and GMRES. These methods need no explicit matrix decomposition; instead they approach the true solution by repeatedly improving an approximate solution, and they have better computational complexity and memory efficiency on large problems. The development of iterative methods, together with advances in preconditioning, has made them the mainstream approach to solving systems of linear equations in modern scientific computing.

Gaussian elimination can also be used to find the inverse of a matrix. For an n×nn \times n matrix A\mathbf{A}, construct the augmented matrix [A∣In][\mathbf{A}|\mathbf{I}_n], where In\mathbf{I}_n is the n×nn\times n identity matrix, and then apply Gaussian elimination to this augmented matrix. Note, however, that, as mentioned in the previous subsection, modern industry rarely computes inverse matrices; most of the time it prefers to solve the system of linear equations directly with iterative methods, and when an inverse matrix is really needed, the PLU decomposition is usually used, since it keeps the overall error under better control. Computing the inverse by Gaussian elimination in this subsection is therefore aimed more at understanding than at practical application.

6.4 Practical Applications of Systems of Linear Equations

Systems of linear equations have a wide range of applications in the real world; they appear everywhere from engineering design to economic analysis, and from network flows to chemical equilibrium.

6.4.1 Matrix Representation of Network Flow Problems

Network flow problems show the important value of systems of linear equations in practical applications. We will see that flow conservation in a network can be expressed as a system of linear equations Af=b\mathbf{Af} = \mathbf{b}, and that, because of the special properties of the incidence matrix, this system usually has infinitely many solutions. The essence of a network flow problem is optimization over the degrees of freedom in the space formed by these solutions (in particular, the kernel of the homogeneous system Af=0\mathbf{Af} = \mathbf{0}), searching for the optimal distribution of flow subject to the capacity constraints.

Matrix Representation of the Flow Conservation Equations

Capacity Constraints

The Minimum-Cost Flow Problem

Common Network Flow Algorithms

6.4.2 A Case Study in Balancing Chemical Equations

Balancing a chemical reaction equation is in essence solving a system of linear equations.

6.4.3 Mechanical Equilibrium

In mechanics problems, a body acted on by several forces remains in equilibrium, and this can be described by a system of linear equations.

Systems of linear equations have wide applications in every field. By turning network flow problems, chemical equilibrium, and mechanical equilibrium into systems of linear equations, we can analyze and solve these problems systematically. The theoretical framework and computational tools provided by linear algebra make complex problems solvable, showing the power of mathematics in practical applications.

6.5 Chapter Summary

Review of the Theoretical Thread

This chapter started from the premise that “row operations are invertible linear transformations” and built a complete theoretical framework for solving systems of linear equations. §6.1 laid the foundation for the legitimacy of the operations: the three elementary row operations (row scaling, row exchange, row elimination) are each equivalent to left multiplication by an elementary matrix, and so they are invertible, change neither the solution set nor the rank of the matrix. The theorem on the preservation of subspace dimensions gives the most general statement—left or right multiplication by any invertible matrix preserves the dimensions of the row space and the column space—which guarantees the legitimacy of every subsequent reduction step.

§6.2 used this guarantee and, centered on the block structure [IrF00]\begin{bmatrix}\mathbf{I}_r & \mathbf{F} \\ \mathbf{0} & \mathbf{0}\end{bmatrix} of the RREF, gave a complete description of the geometric form of the solutions. The rank rr determines all the dimensions of the four subspaces; the number of free variables, n−rn - r, determines the dimension of the solution space; and the relation yp=−Fyf\mathbf{y}_p = -\mathbf{F}\mathbf{y}_f between the pivot variables and the free variables directly gives a parametric representation of the solution space. The three forms—no solution, a unique solution, infinitely many solutions—become clear at a glance from this block viewpoint, and the abstract question of “solvability” is reduced to a computable “comparison of ranks.”

§6.3 provided the algorithmic tools for bringing a general matrix to RREF. The LU decomposition is elegant in form and records the elimination multipliers directly as the lower triangular matrix L\mathbf{L}, but it depends on the precondition that no pivot is zero; the PLU decomposition records the row exchanges in a permutation matrix P\mathbf{P}, applies to every matrix, and the resulting U\mathbf{U} is itself already in row echelon form. The two share the same design philosophy: decompose once, use many times, so that when the same coefficient matrix meets different right-hand-side vectors, only two triangular systems need to be solved for each. §6.4 then used three very different applications—network flow, chemical balancing, and mechanical equilibrium—to show the breadth of Ax=b\mathbf{Ax} = \mathbf{b} as a unified modeling language.

Connections to Other Chapters

The link between this chapter and Chapter 5 (block matrices) lies in the block structure of the RREF itself: Chapter 5 established the algebraic rules for operating with block matrices, and this chapter applies them to reveal the rank structure of a matrix and the geometric form of the solution space. The rigorous derivation of the PLU decomposition relies on the multiplicative properties of block matrices, in particular on the key property that “the commutation relation between permutation matrices and lower triangular matrices allows the row exchanges to be moved, equivalently, to the very front of the decomposition”—a conclusion that becomes natural only from the block viewpoint.

The connection with Chapter 7 (determinants) is even more direct: the basic way of computing a determinant is precisely to bring the matrix to upper triangular form by row operations, and the effects of the row operations on the determinant—scaling multiplies it by cc, an exchange changes its sign, elimination leaves its value unchanged—all follow naturally from the elementary-matrix framework of this chapter. The concept of rank in this chapter also finally merges with the theory of dimension of abstract linear spaces in Chapter 4: the concrete computational statement that “the number of pivots equals the dimension of the image” is exactly the dimension theorem of Chapter 4 expressed in the language of coordinates. Looking further ahead, the idea of the LU decomposition will reappear in Chapter 8 (the eigenvalue problem) and Chapter 11 (the singular value decomposition) in the forms of the Schur decomposition, the QR decomposition, and the SVD; “factoring a matrix into a product of factors of simpler structure” is a central theme that runs throughout the book.

The Role of This Chapter in the Book

Systems of linear equations are the oldest problem in linear algebra and also its most central one. The significance of this chapter lies not in supplying techniques for “solving equations,” but in revealing the answers to two essential questions: “what determines solvability?” and “what is the structure of the solutions?”; and in raising the arithmetic elimination already recorded in The Nine Chapters on the Mathematical Art to a rigorous algebraic language. Elimination operations are isomorphisms, the RREF is a canonical form, and the solution set is an affine subspace—these three sentences capture the full depth of this chapter. If you keep reading with this viewpoint, you will find that every later chapter answers the same deeper question: how to find a “canonical form” in which the essential structure of a matrix is laid bare. This chapter is the first complete demonstration of this theme.

Concept Map