Contents / Linear Algebra / Systems of Linear Equations
Chapter 1
Systems of Linear Equations
Row reduction, Gaussian elimination, solution structure, rank, and the LU factorization.
Introduction
A system of linear equations is a list of constraints that must hold at the same time. The question is always the same: do values of the unknowns exist that satisfy every equation at once, and if so, how many?
Two things make this question worth a whole chapter. The first is that the answer is completely algorithmic. Gaussian elimination — systematically row-reducing the augmented matrix — settles existence and uniqueness for any system of any size, in finitely many arithmetic steps, with no cleverness required. The second is that the algorithm quietly produces the entire theory. Rank, the null space, span, linear independence, the LU factorization and the structure of solution sets are all read off the same staircase of pivots.
The chapter runs in the order a first course does. We start with the geometry of a system and the three row operations, then build echelon forms and the elimination algorithm, then discover that a row operation is itself a matrix — the elementary matrices, which turn "run the algorithm" into an algebraic identity and which the chapters on matrices and determinants will lean on constantly. From there we take the three views of the same object (equations, vector equations, ), settle consistency, describe solution sets in parametric vector form, meet linear independence and rank, factor the elimination itself as , and close with two real applications and the numerical facts that decide how this is done on a computer.
1.1Linear equations and the geometry of a system
Definition 1.1 (Linear equation). A linear equation in the unknowns is an equation that can be written
where the coefficients and the constant are fixed numbers. A system of linear equations (a linear system) is a finite list of such equations in the same unknowns. A solution is a list that satisfies every equation of the list; the solution set is the collection of all solutions.
The word linear is doing real work. Each unknown appears to the first power, multiplied by a constant, and never multiplied by another unknown. So is linear, while , and are not. Everything in this chapter — every theorem, the whole algorithm — fails immediately outside that restriction, which is why it is stated first.
Two systems are called equivalent when they have exactly the same solution set. This is the only relation we care about: the entire method consists of replacing a system by an equivalent, simpler one, repeatedly, until the answer is visible. The systems are not equal, and they may not even have the same equations; they only need to constrain the unknowns in exactly the same way.
The geometry is worth carrying in your head. In the equation (with not both zero) is a line. Two such equations ask for a point on both lines, and there are exactly three pictures: the lines cross once, the lines are parallel and distinct, or the lines coincide. In each equation is a plane, and three planes can meet in a single point, in a line, in a plane, or not at all — two planes may be parallel, or the three may form a triangular prism with no common point. Notice that "exactly two solutions" never appears in either list. That is not an accident of small cases; it is the trichotomy we prove later in the chapter.
Intuition. Think of each equation as a rule a spy must satisfy: "my latitude plus twice my longitude is . " One rule leaves you free to wander along a whole line. A second, genuinely new rule pins you to a single point. A second rule that merely restates the first ("twice my latitude plus four times my longitude is ") tells you nothing new and leaves you on the line. A second rule that contradicts the first ("latitude plus twice longitude is ") means no such spy exists. Those are the only three things a second rule can do, and that is the whole classification.
Example 1.2 (Reading the three pictures off the equations). Classify the solution set of each of these systems in , without any machinery:
(a) , ; (b) , ; (c) , .
Solution. In (a) the two lines have slopes and , so they are not parallel and must cross exactly once. Adding the equations gives , so and then . The solution set is the single point . Check: and .
In (b) the left-hand side of the second equation is twice the first, so any solution would satisfy , which is false. The lines are parallel and distinct, and the solution set is empty.
In (c) the second equation is exactly twice the first, so it carries no information the first did not. The lines coincide and the solution set is the whole line . Sanity check with : gives and .□
Example 1.3 (A system in three unknowns with a free direction). Describe the solution set of the single equation in , and then of the pair , .
Solution. A single linear equation in three unknowns with a nonzero coefficient vector is a plane. Solving for gives , so and may be chosen freely and follows:
Two free parameters, as a plane should have.
The second equation of the pair is twice the first, so it describes the same plane and the solution set is unchanged. Adding an equation can only shrink a solution set, and here it shrinks it not at all. Sanity check at : satisfies and .□
Pitfall. An equation is linear in its unknowns, not in its coefficients. In , where is a parameter to be determined later, the equation is linear in and for each fixed — so the methods of this chapter apply — but the solution may depend on in a very non-linear way, and the interesting question is usually "for which does the behaviour change?" Those questions are answered by tracking when a pivot appears or disappears.
1.2Augmented matrices and elementary row operations
Writing , and over and over is wasted effort: the unknowns never move, so only the coefficients matter. Line the unknowns up in the same order in every equation and record the numbers.
Definition 1.4 (Coefficient matrix and augmented matrix). For the system
the coefficient matrix is the array , the right-hand side is the column , and the augmented matrix is the array
whose rows are the equations and whose vertical bar separates coefficients from constants. The system itself is written .
The size of the augmented matrix already tells you the shape of the problem: rows is equations, columns to the left of the bar is unknowns. A system with more equations than unknowns () is called overdetermined and is usually inconsistent; one with fewer () is underdetermined and, as we will prove, can never have exactly one solution.
Definition 1.5 (Elementary row operations). Three operations may be applied to the rows of a matrix:
- (R1) Interchange: swap two rows, .
- (R2) Scaling: multiply a row by a nonzero scalar, with .
- (R3) Replacement: add a multiple of one row to a different row, with .
Two matrices are row equivalent when one can be turned into the other by a finite sequence of these operations.
Each operation is reversible, and that is the point. Swapping rows is undone by swapping them back; scaling by is undone by scaling by — which is exactly why is forbidden, since multiplying a row by zero deletes an equation and cannot be undone; and is undone by . Reversibility is what makes row equivalence an equivalence relation, and it is what makes the next proposition true in both directions.
Proposition 1.6 (Row operations preserve the solution set). If the augmented matrices and are row equivalent, then the systems and are equivalent: they have exactly the same solution set.
Proof. It suffices to check one operation, since a finite sequence of solution-preserving steps preserves solutions.
Let be a solution of the original system, so every equation holds at . (R1) merely reorders the list of equations, and a list of true statements stays true when reordered. For (R2), if equation reads then multiplying both sides by gives , which is the new equation ; the other equations are untouched. For (R3), if and , then adding times the second to the first gives , the new equation . So every solution of the old system solves the new one.
For the reverse inclusion, apply the same argument to the inverse operation, which is again of type (R1), (R2) or (R3) and carries the new system back to the old one. Hence the two solution sets contain each other.∎
Two warnings hide inside that proof. The scalar in (R2) must be nonzero, or the inverse operation does not exist and a solution of the new system need not solve the old one: from you cannot recover . And in (R3) the two rows must be different, or "add times row to row " would erase row for the same reason.
Intuition. Each equation is a constraint on a map: "I am somewhere on this line" and "I am somewhere on that line." The solution is where the lines cross. Row operations redraw the map without moving the crossing point — they replace two slanted lines by one horizontal and one vertical line through the same intersection. Nothing about the answer changes; only how hard it is to read.
Example 1.7 (From a system to an augmented matrix, and one row operation). Write , as an augmented matrix, apply , and solve.
Solution. The coefficient matrix is and the right-hand side is , so the augmented matrix is
Applying replaces the second row by :
The new second row says , and the first row then gives .
Sanity check against the original equations: and . Both hold, as the proposition promised.□
Example 1.8 (Detecting an impossible system by a row operation). Apply row operations to , and read off the conclusion.
Solution. The augmented matrix is . Apply :
The second row is the equation , which no pair satisfies. Since row operations preserve solutions, the original system has no solutions either. Geometrically the two lines have the same slope but different intercepts: they are parallel and distinct.□
Pitfall. When you perform , only row changes. Row is the source and keeps its old values — including for the next operation in the same sweep. Changing both rows at once is the single most common bookkeeping error in elimination, and it does not preserve the solution set.
1.3Echelon forms and Gaussian elimination
The target of the row operations is a shape from which the solution can be read. There are two such shapes, one weaker and one stronger.
Definition 1.9 (Echelon form and reduced echelon form). A matrix is in row echelon form (REF) when
- every row consisting entirely of zeros is below every nonzero row, and
- the leading entry (the leftmost nonzero entry) of each nonzero row is strictly to the right of the leading entry of the row above it.
The leading entries are called pivots, and the positions they occupy are pivot positions; a column containing a pivot position is a pivot column.
The matrix is in reduced row echelon form (RREF) when, in addition,
- every pivot equals , and
- each pivot is the only nonzero entry in its column.
Condition 2 is what produces the staircase: reading down the rows, the pivots move right, so the zeros pile up in a triangular wedge at the bottom left. Condition 1 is a bookkeeping convention that keeps the staircase from being interrupted. Conditions 3 and 4 do the work that back substitution would otherwise do, at the cost of more arithmetic.
Definition 1.10 (Free and basic variables). In a system whose augmented matrix has been reduced to echelon form, a variable whose column is a pivot column is a basic (or pivot) variable; a variable whose column has no pivot is a free variable.
The names say exactly what happens: a free variable may be assigned any value at all, and once all free variables are assigned, the basic variables are forced.
Method 1.11 (Gaussian elimination (row reduction)). Given a matrix, produce an echelon form:
- Begin with the leftmost nonzero column. This is a pivot column; the pivot position is at its top.
- If necessary, interchange rows to bring a nonzero entry into the pivot position.
- Use replacement operations (R3) to create zeros in every position below the pivot.
- Ignore the pivot row and everything above it, and repeat steps 1–3 on the submatrix that remains. Stop when no nonzero rows remain.
This is the forward phase, and it ends in echelon form. To continue to the reduced form (backward phase):
- Starting with the rightmost pivot and working left, scale its row so the pivot is , and use replacement operations to create zeros above it.
To solve a system, run the forward phase on ; if no row of the form with appears, either back-substitute from the bottom row upward, or run the backward phase and read the answer off directly.
The forward phase alone already answers the existence and uniqueness questions: consistency is visible from the absence of an impossible row, and uniqueness from the absence of free variables. The backward phase costs extra arithmetic and buys only convenience of reading — which is why hand computation usually stops at echelon form and back-substitutes, while theory prefers the reduced form, because it is unique.
Theorem 1.12 (Existence and uniqueness of the reduced echelon form). Every matrix is row equivalent to one and only one matrix in reduced row echelon form. Consequently the pivot positions of a matrix, and hence the number of pivots, depend only on the matrix and not on the sequence of row operations used.
Proof. Existence is the algorithm: steps 1–5 of Gaussian elimination terminate (each pass consumes at least one row and one column) and end in reduced echelon form.
For uniqueness, suppose and are reduced echelon forms of the same matrix, so and are row equivalent to each other and therefore, by the proposition on row operations applied to the homogeneous system, and have the same solution set . Argue by induction on the number of columns. Deleting the last column of a reduced echelon matrix leaves a reduced echelon matrix, and deleting the last column of two row-equivalent matrices leaves two row-equivalent matrices, so by induction and agree in all columns but the last. If the last column of is a pivot column but that of is not, then has a free variable while does not, so some vector of has nonzero last entry while the corresponding equation of forces the last entry to be — a contradiction. So the last columns are both pivot columns, in which case both equal the same standard basis column determined by the earlier columns, or both are non-pivot columns, in which case is free and the unique element of with determines the last column of and of by the same formula. Either way .∎
Only the reduced form is unique; echelon forms are not. Running the algorithm with different row swaps can produce or from the same matrix. What the theorem guarantees is that the positions of the pivots — and therefore which variables are free — are the same every time. That is what makes rank well defined.
Intuition. Elimination is the crossword strategy. Each equation is used once, to knock out one unknown from all the equations below it. After the sweep, the last surviving equation involves a single unknown; solve it, feed the value upward, and each equation above now has one unknown again. The staircase of pivots is a record of which unknown each equation was spent on.
Example 1.13 (A system with a unique solution). Solve , , .
Solution. The augmented matrix is
Forward phase, column 1. The pivot is the in position . Apply , giving , and , giving :
Column 2. The pivot is in position . Apply : the entry becomes , the next entry becomes , and the constant becomes :
This is echelon form, with pivots in columns — no free variables, so the solution is unique.
Back substitution. Row 3: , so . Row 2: , so . Row 1: .
Sanity check in the original system: ; ; . All three hold.□
Example 1.14 (Running the backward phase to reduced echelon form). Reduce all the way to RREF and read off the solution.
Solution. Forward phase. gives :
gives :
Backward phase, starting with the rightmost pivot in column 3, which is already . Apply , giving , and , giving :
Now the pivot in column 2: gives :
The reduced form is , so with no further work. Sanity check: , , . All three original equations hold.□
Example 1.15 (An echelon form with a free variable). Reduce to echelon form and identify the basic and free variables.
Solution. gives and gives :
Then gives a zero row:
Pivots sit in columns and , so and are basic and are free. The zero row is the equation , which is true, so the system is consistent; with two free variables the solution set is two-dimensional.
Sanity check on the count: unknowns basic free.□
Pitfall. A zero row on the left of the bar with a nonzero constant on the right, with , is the death sentence: the system is inconsistent, and no amount of further reduction changes that. A completely zero row, , is harmless — it says — and merely signals that one equation was redundant. Confusing the two is the most costly misreading in the chapter.
1.4Elementary matrices
A row operation looks like a procedure, but it is secretly a matrix multiplication. Making that explicit converts "I ran the algorithm" into an equation, and equations can be manipulated, inverted and factored. Everything in the sections on , on matrix inverses and on determinants depends on this observation.
Definition 1.16 (Elementary matrix). An matrix is elementary when it is obtained from the identity matrix by performing a single elementary row operation.
For the three types look like
obtained from by , by and by respectively.
Theorem 1.17 (Row operations are left multiplications). Let be the elementary matrix obtained by performing a row operation on . Then for every matrix , the matrix is the result of performing that same row operation on .
Proof. Row of a product is (row of ) times , that is, the linear combination of the rows of whose coefficients are the entries of row of . Row of is , which picks out row of ; so if agrees with in row , then agrees with in row .
Now inspect the rows a single operation changes. For an interchange , rows and of are and , and these select rows and of — exactly the interchange. For a scaling , row of is , which yields times row of . For a replacement , row of is , which yields (row of ) (row of ). In each case is with the operation performed.∎
Corollary 1.18 (Elementary matrices are invertible). Every elementary matrix is invertible, and is the elementary matrix of the inverse row operation. Specifically, the inverse of the interchange is itself; the inverse of is ; and the inverse of is .
Proof. Let be the elementary matrix of the inverse operation. Applying the operation and then its inverse returns any matrix to itself, so by the previous theorem for every ; taking gives . Applying them in the other order gives in the same way. Hence is invertible with .∎
Corollary 1.19 (Row equivalence in matrix form). and are row equivalent if and only if for some invertible matrix that is a product of elementary matrices. In particular, for every there is an invertible with , the reduced echelon form of .
Proof. If is obtained from by the operations corresponding to in that order, then applying the theorem repeatedly gives , and is invertible as a product of invertibles. Conversely, if is a product of elementary matrices then is reached from by the corresponding sequence of row operations, so the two are row equivalent.∎
This is the payoff. "Row-reduce to " is now the identity with invertible, and an invertible matrix can be moved to the other side. That single move proves the consistency theorem later in this chapter, produces the algorithm for inverting a matrix, and explains why changes in a controlled way under row operations.
Intuition. An elementary matrix is a row operation frozen into an object you can hold. Once the operation is an object, it has an inverse, it can be multiplied by other operations, and a whole run of the elimination algorithm collapses into a single matrix — the complete record of what you did to . You no longer have to remember the steps; you carry the product.
Example 1.20 (Building an elementary matrix and checking it). Find the elementary matrix that performs , and verify it on .
Solution. Apply the operation to : only row changes, becoming . So
Now compute . Rows and of are , so the first two rows of are and . Row of is . Hence
which is exactly with performed. Sanity check on the inverse: should have in position , and indeed .□
Example 1.21 (Recording a whole elimination as one matrix). Reduce to by row operations and produce the invertible with .
Solution. Step 1: , with elementary matrix , giving .
Step 2: , with elementary matrix , giving .
Therefore .
Sanity check: . Note what we have incidentally computed: , because for a square . Row reduction is an inversion algorithm.□
Pitfall. The order of the product runs opposite to the order of the steps. If you do operation first and operation second, the matrix is , not — the later operation sits further left, because it acts on the result of the earlier one. Matrix multiplication is not commutative, and is generally a different matrix describing a different pair of operations.
1.5Vector equations, span and the equation
A system can be read in three ways, and fluency means switching between them without thinking. Written out, the system
is a list of scalar equations. Collecting the columns, it is a vector equation
and abbreviating the left side, it is the matrix equation .
Definition 1.22 (Linear combination and span). Given vectors and scalars , the vector
is a linear combination of with weights . The span of the list, written , is the set of all such linear combinations.
Definition 1.23 (The matrix–vector product). If has columns and , then
So is the linear combination of the columns of with weights the entries of .
That definition is worth memorising in exactly this form. Most students first learn as "row dotted with ", which is a correct recipe and a poor idea, because it hides the fact that the set of achievable outputs is the span of the columns.
Theorem 1.24 (The three views agree). For an matrix with columns and a vector , the following have exactly the same solution set:
- the linear system with augmented matrix ;
- the vector equation ;
- the matrix equation .
In particular, has a solution if and only if .
Proof. By the definition of the matrix–vector product, (2) and (3) are literally the same equation. For (1) and (2), compare entry : the -th entry of is , so the vector equation holds if and only if for every — which is the system. The final sentence is (2) unwound: lies in the span exactly when weights exist, and weights are a solution.∎
Geometrically, for a nonzero is the line through the origin in the direction of . The span of two vectors that are not multiples of one another is the plane through the origin containing both. In general a span is a subspace: it contains (take all weights zero) and is closed under addition and scaling, because a combination of combinations is again a combination. Asking whether is solvable is therefore asking a geometric question — does lie in this particular flat object through the origin? — and elimination is how we answer it.
Intuition. Think of the columns of as the only moves you are allowed to make, each usable any number of times (including a negative or fractional number). is the place you end up after choosing how much of each move to use. is the set of reachable destinations, and asks whether is reachable. Two moves along the same line reach only that line, no matter how you weight them — which is the geometry behind a matrix with a redundant column.
Example 1.25 (Deciding membership in a span). Is in ? Is ?
Solution. For we must solve . The third coordinate gives , so . The first gives , so . Check the second: , which matches. So and is in the span.
For the same first two steps force and , but the second coordinate then reads . There is no choice of weights, so is not in the span. Geometrically the span is a plane through the origin in , and is off it.□
Example 1.26 (Describing a span as an equation). Describe as a single equation in .
Solution. Row-reduce the augmented matrix with a general right-hand side:
Now gives last row . The system is consistent exactly when that entry vanishes, so
is the plane in question. Sanity check with the previous example: gives , and gives , matching what we found.□
1.6Consistency: when a solution exists
Definition 1.27 (Consistent and inconsistent). A linear system is consistent when it has at least one solution, and inconsistent when it has none.
Theorem 1.28 (Existence and uniqueness criterion). A linear system is consistent if and only if an echelon form of its augmented matrix contains no row of the form
equivalently, if and only if the last column of the augmented matrix is not a pivot column. If the system is consistent, then its solution is unique when there are no free variables, and there are infinitely many solutions when at least one variable is free.
Proof. Row operations preserve the solution set, so we may argue with any echelon form. If such a row appears, it is the equation with , which no satisfies, so the system is inconsistent. If no such row appears, every nonzero row has a pivot to the left of the bar; assign arbitrary values to the free variables and solve the pivot equations from the bottom up, each determining one basic variable — this manufactures a solution, so the system is consistent.
For the count: if there are no free variables, the bottom-up procedure leaves no choices anywhere, so the solution just constructed is the only one. If some variable is free, the procedure produces a solution for every real value of , and different values of give different solutions, so the solution set is infinite.∎
Corollary 1.29 (Trichotomy for linear systems). A linear system over has no solution, exactly one solution, or infinitely many solutions. No other count is possible.
Proof. The theorem exhausts the cases: either an impossible row appears (no solutions) or it does not, and then either there are no free variables (exactly one) or there is at least one (infinitely many).∎
"Exactly two solutions" is impossible because solution sets are affine: if and both solve , then for any ,
so the whole line through and consists of solutions. Two distinct solutions always drag infinitely many others along with them.
Theorem 1.30 (Solvability for every right-hand side). Let be an matrix. The following are equivalent:
- is consistent for every ;
- every is a linear combination of the columns of ;
- the columns of span ;
- has a pivot position in every row.
Proof. (1) (2) (3) is the theorem on the three views, restated.
(4) (1). Let be an echelon form of with a pivot in every row. Row-reduce the augmented matrix using the same operations on the left block; the result is for some . Every row of has a pivot, so no row of is zero to the left of the bar, and the impossible row of the existence criterion cannot occur. Hence the system is consistent, whatever was.
(1) (4). We prove the contrapositive. Suppose some row of the echelon form has no pivot; being an echelon form, its zero rows are at the bottom, so the last row of is zero. By the corollary on row equivalence, for an invertible . Let , the vector with in the last entry and zeros elsewhere, and set . The same operations that carry to carry to , whose last row is . So is inconsistent and (1) fails.∎
Notice where the hypotheses live. Condition (4) is about rows and governs existence for all ; the companion condition "a pivot in every column" is about columns and governs uniqueness. They are independent, and confusing them is the source of most wrong answers about square-versus-rectangular systems. A matrix can easily have a pivot in every row (so every system is consistent) and never has a pivot in every column (so no solution is ever unique).
Intuition. A pivot in every row means no equation was ever rendered redundant by the others — nothing collapsed to — so no combination of the left-hand sides can be forced to zero, and therefore no right-hand side can be exposed as contradictory. If instead a row does collapse, you have found a combination of the equations whose left side is identically zero; whether the system is solvable now depends on whether the same combination of the right sides also happens to be zero, and for most it will not be.
Example 1.31 (Consistency depending on a parameter). For which is the system with augmented matrix consistent, and how many solutions does it then have?
Solution. Apply :
The second row is . If this is impossible and the system is inconsistent. If the row is ; then column has no pivot, so is free and there are infinitely many solutions, namely , .
Sanity check at , : gives and . Correct.□
Example 1.32 (A system whose behaviour switches twice). For which values of does have no solution, a unique solution, infinitely many solutions?
Solution. Everything is decided by the last row, .
If , that is , we may divide: . All three columns then hold pivots, so the solution is unique.
If the last row is . Two pivots, three unknowns, so is free and there are infinitely many solutions.
If the last row is , which is impossible: no solution.
Sanity check at : the matrix is , giving , , , and indeed .□
Example 1.33 (Consistency from ranks). A system of equations in unknowns has and . What can be said about its solutions?
Solution. Adding the column created a new pivot, so the last column of the augmented matrix is a pivot column. By the existence criterion the system is inconsistent and there are no solutions, regardless of the fact that there are more unknowns than equations.
Sanity check on the numbers: an echelon form of has pivots in rows and only of them lie left of the bar, so one row must read with , as expected.□
Pitfall. "More unknowns than equations" guarantees that a solution, if one exists, is not unique. It does not guarantee that one exists. The example above has six unknowns, four equations and no solutions at all.
1.7Homogeneous systems and the null space
Definition 1.34 (Homogeneous system, null space). A system is homogeneous when its right-hand side is zero:
Its solution set is called the null space of , written . The solution is the trivial solution; any other is nontrivial.
A homogeneous system is never inconsistent: always. So for these systems the only question is whether the trivial solution is the only one, and the existence criterion answers it immediately — nontrivial solutions exist precisely when some variable is free.
Proposition 1.35 (The null space is a subspace). If is , then contains and is closed under addition and scalar multiplication: if and , then and lie in .
Proof. , so belongs. If and then and , using the distributivity of the matrix–vector product over addition and scalars, which is immediate from the column formula.∎
Proposition 1.36 (When nontrivial solutions exist). The system in unknowns has a nontrivial solution if and only if has at least one non-pivot column, that is, if and only if the number of pivots of is strictly less than .
Proof. If every column is a pivot column there are no free variables, and by the existence criterion the consistent system has exactly one solution — which must be , since is one. If some column is not a pivot column, its variable is free; setting that free variable to and all other free variables to and solving upward produces a solution whose entry in that position is , hence nonzero.∎
Corollary 1.37 (Wide homogeneous systems). If a homogeneous system has more unknowns than equations (), it has infinitely many solutions.
Proof. Each pivot occupies its own row, so the number of pivots is at most . By the previous proposition a nontrivial solution exists, and by the trichotomy a consistent system with a free variable has infinitely many solutions.∎
Intuition. A homogeneous system asks which inputs the matrix crushes to zero. Zero itself is always crushed, so that answer is free and uninformative. The real content is whether the matrix collapses any direction: if two of its columns point the same way, then some combination of them cancels, and the whole line of such combinations lands on zero. The null space is the record of everything the matrix destroys.
Example 1.38 (A null space that is a plane). Find all solutions of for , and give a spanning set.
Solution. Row-reduce: turns the second row into , leaving
There is one pivot, in column , so is basic and are free. The surviving equation is , so . Setting , :
So , a plane through the origin in .
Sanity check each spanning vector: and , and the second row of is twice the first, so it vanishes too.□
Example 1.39 (A null space that is only the origin). Show that has .
Solution. Row-reduce: gives . Both columns are pivot columns, so there are no free variables and, by the proposition, only the trivial solution.
Sanity check by hand: the second equation of the reduced system is , and the first is then .□
Example 1.40 (Reading a homogeneous solution set off a parameter). For which does have a nontrivial solution?
Solution. Apply , giving . If , that is , there are two pivots and only the trivial solution. If the second row vanishes, is free, and solves the system for every .
Sanity check at , : .□
1.8Parametric vector form and the shape of a solution set
Once free variables are present, "infinitely many solutions" is not an answer — you must describe the set. The standard description writes the solution as a fixed vector plus a combination of direction vectors, one per free variable.
Method 1.41 (Parametric vector form). To describe the solution set of a consistent system :
- Row-reduce to reduced echelon form.
- Identify the basic variables (pivot columns) and the free variables.
- Solve each pivot row for its basic variable in terms of the free variables.
- Assign a parameter to each free variable and write the general solution as a column vector.
- Split that column into the constant vector plus one term for each parameter. The result is
with the number of free variables.
Theorem 1.42 (Structure of the solution set). Suppose is consistent and is any one solution. Then the solution set is exactly
the translate of the null space of by the vector .
Proof. If then , so every such vector is a solution.
Conversely, let be any solution and put . Then , so and has the stated form.∎
This is the single most useful structural fact about linear systems, and it says two things at once. First, the shape of the solution set never depends on : whatever is, as long as the system is consistent the solution set is a parallel copy of one fixed object, . If the null space is a line, every consistent right-hand side gives a line of solutions; if it is a point, every consistent right-hand side gives a single point. Second, solving splits into two independent tasks — find any particular solution, and find the null space — and the second task does not mention at all.
The translate is not a subspace unless can be taken to be : the solution set of a consistent inhomogeneous system misses the origin. Sets of this shape are called affine.
Intuition. Fix a machine that takes a recipe and outputs a product . The null space is the list of "do-nothing adjustments" — changes to the recipe that alter the output not at all. If you know one recipe that produces , every other recipe that produces is that recipe plus a do-nothing adjustment. The catalogue of adjustments has nothing to do with which product you wanted.
Example 1.43 (Parametric vector form with one free variable). Solve , , and write the answer in parametric vector form.
Solution. Reduce . Applying and gives second and third rows both :
Clearing above the second pivot with gives the reduced form
Pivots in columns ; is free. Set . Then and , so
Here is a particular solution and , a line — so the solution set is a line in not through the origin.
Sanity check at , i.e. : , , . All hold.□
Example 1.44 (Two free variables, and the null space read off). Write the solution set of the system with reduced echelon augmented matrix
in parametric vector form, and give a spanning set for the null space of the coefficient matrix.
Solution. Pivots are in columns and , so are basic and are free. The rows say and . Put , :
By the structure theorem the two parameter vectors span the null space: . Setting the right-hand column to zero in the same computation confirms it.
Sanity check at : , and row 1 gives , row 2 gives . Both hold.□
Example 1.45 (Recovering the particular solution from two solutions). Suppose and both solve . Produce a nonzero element of and a third solution.
Solution. By the structure theorem, the difference of two solutions lies in the null space:
and it is nonzero, so has a free variable and the system has infinitely many solutions.
A third solution is . In fact solves the system for every real .
Sanity check of the logic: .□
Pitfall. The particular solution is not unique — any solution will do, and setting all free variables to zero is only the most convenient choice. What is determined by the system is the set itself and the null space directions. A final answer of the form and one of the form can both be right, provided is a solution and is a nonzero multiple of .
1.9Linear independence in
The question "does this system have a free variable?" has a name when it is asked about the columns.
Definition 1.46 (Linear independence). A list of vectors in is linearly independent when the only solution of
is . Otherwise the list is linearly dependent, and any solution with some is called a linear dependence relation.
Proposition 1.47 (Independence in terms of pivots). The columns of a matrix are linearly independent if and only if has only the trivial solution, if and only if every column of is a pivot column.
Proof. The vector equation in the definition is exactly written out, by the theorem on the three views. The second equivalence is the proposition on nontrivial solutions.∎
Theorem 1.48 (Characterisation of dependence). A list with is linearly dependent if and only if some is a linear combination of the others. Moreover, if , then such a may be chosen so that lies in the span of the vectors that precede it.
Proof. If , move everything to one side: is a dependence relation, since the coefficient of is .
Conversely, take a dependence relation with some ; then . For the refinement, let be the largest index with ; the same formula expresses using only , and because with would force .∎
Corollary 1.49 (Too many vectors are dependent). Any list of vectors in with is linearly dependent. Any list containing is linearly dependent.
Proof. Form the matrix with these columns. Pivots occupy distinct rows, so has at most pivots, leaving a non-pivot column; by the pivot criterion the columns are dependent. If , then is a nontrivial relation.∎
Intuition. Independence means no vector in the list is redundant: remove any one and the span genuinely shrinks. Dependence means at least one of them was reachable using the others, so it added no new direction. Three arrows in a plane must be dependent for the same reason that three people cannot each have a private room in a two-room flat — there are more vectors than dimensions to spread them over.
Example 1.50 (Testing three vectors for independence). Are , , independent? If not, exhibit a dependence relation.
Solution. Row-reduce . gives and gives :
Only two pivots for three columns, so the list is dependent. Column is free: set , then gives , and . So
Sanity check: .□
Example 1.51 (Independence with a parameter). For which are , linearly independent?
Solution. Two vectors are dependent exactly when one is a multiple of the other. The second is a candidate multiple of the first with factor (from the first two coordinates), which requires . For any the pair is independent.
Formally: reduce by and to get rows and . The second column holds a pivot precisely when .
Sanity check at : , so the pair is dependent there, as claimed.□
1.10Rank and the rank theorem
Definition 1.52 (Rank and nullity). The rank of a matrix , written , is the number of pivot positions in an echelon form of — equivalently, the number of pivot columns. The nullity of is the number of non-pivot columns, equivalently the number of free variables in .
The definition is legitimate only because the pivot positions do not depend on how the reduction was carried out, which is what the uniqueness of the reduced echelon form gave us. Later chapters prove that the rank also equals the dimension of the column space and of the row space, and that the nullity equals the dimension of — the spanning vectors produced by the parametric form turn out to be linearly independent, so the count of free variables really is a dimension. Here we work with the pivot count, which is what the algorithm hands us.
Theorem 1.53 (The rank theorem). For every matrix ,
Proof. Reduce to its reduced echelon form . Every one of the columns of either contains a pivot position or does not, and these two cases are mutually exclusive and exhaustive. The first case occurs times by definition, the second times, and together they count every column exactly once.∎
The proof is a sentence, but the statement is not trivial: it says that two numbers computed from completely different-looking questions — "how many independent constraints does impose?" and "how many degrees of freedom survive?" — must add to the number of unknowns. Every constraint you impose costs you exactly one degree of freedom, or is redundant and costs nothing.
Proposition 1.54 (Rank bounds). For an matrix, , with if and only if is the zero matrix.
Proof. Distinct pivots occupy distinct rows and distinct columns, so their number is at most and at most . If then some entry is nonzero, so some column is nonzero and the leftmost such column yields a pivot, giving rank at least ; if no pivot exists.∎
Proposition 1.55 (Consistency and uniqueness in terms of rank). For an matrix and :
- is consistent if and only if ;
- a consistent system has a unique solution if and only if (full column rank);
- is consistent for every if and only if (full row rank).
Proof. Row-reduce ; the left block becomes an echelon form of . Appending can create at most one new pivot, and it does so exactly when the last column is a pivot column, which by the existence criterion is exactly when the system is inconsistent. Hence consistency is equivalent to the two ranks being equal, proving (1).
For (2), a consistent system is uniquely solvable exactly when there are no free variables, i.e. when all columns are pivot columns, i.e. . For (3), "a pivot in every row" means the number of pivots equals the number of rows, i.e. ; this is the solvability theorem restated.∎
Intuition. Rank counts the equations that genuinely say something. Ten equations may contain only three independent constraints if the other seven are combinations of those three; elimination exposes the redundancy by turning the extras into zero rows. Nullity counts what is left undetermined. The rank theorem is the conservation law between them: unknowns in, constraints plus freedoms out.
Example 1.56 (Rank, nullity and the theorem checked). Let . Find the rank and nullity.
Solution. gives and gives :
Pivots in columns and , so . Note that column has nonzero entries yet holds no pivot — rank counts pivot columns, not nonzero columns.
By the rank theorem , matching the two free variables .
Sanity check the bound: , as required, and since , there exist right-hand sides for which the system is inconsistent.□
Example 1.57 (Rank as a function of a parameter). For which does have rank ? What is the rank otherwise?
Solution. Row equals row , so produces a zero row immediately. Then gives :
If the second row vanishes and only one pivot remains, so . If there is a second pivot in column and ; the rank never reaches , because the third row is a copy of the first.
Sanity check at : every row of is then a multiple of , namely times it, so the rank is certainly .□
Example 1.58 (Using rank to predict the solution count). is with . Describe the solution set of for an arbitrary .
Solution. Since , has a pivot in every row, so by the solvability theorem the system is consistent for every . By the rank theorem , so there are two free variables and the solution set is
a two-parameter family: a translated plane inside . There are infinitely many solutions for every , and never a unique one.
Sanity check against the bounds: , so the rank is as large as it could possibly be, which is why consistency never fails.□
Pitfall. Rank is a property of a matrix, not of a system, but and are different matrices. is either or , never more, and the whole consistency question is which of the two it is.
1.11The factorization
Elimination is usually run once and thrown away. That is wasteful when the same coefficient matrix must be used with many right-hand sides — a structure loaded in a hundred different ways, a circuit driven at a hundred frequencies. The remedy is to store the elimination itself as a product of two triangular matrices.
Definition 1.59 ( factorization). An factorization of an matrix is a product
where is an unit lower triangular matrix (ones on the diagonal, zeros above it) and is an echelon form of (in particular upper triangular when ).
Where does come from? Suppose the forward phase of elimination needs no row interchanges: every pivot appears in the right place, and each step is a replacement with . By the theorem on elementary matrices, the whole forward phase is
so, since each is invertible,
Each is unit lower triangular (a replacement adding a multiple of an earlier row to a later one), so each inverse is too, and a product of unit lower triangular matrices is unit lower triangular. Hence is unit lower triangular, as promised.
Theorem 1.60 (The multipliers are the entries of ). If is reduced to the echelon form by replacement operations with , performed column by column from left to right, then where is unit lower triangular with entry equal to the multiplier .
Proof. Work one column at a time. Clearing column uses the matrices for the various , and each inverse is , because when makes the cross term vanish.
Now multiply the inverses in the order . A product has cross term , which vanishes whenever . Because the operations are performed columns left to right and always target a row strictly below the source, the pairs that occur always have , so never happens with the second factor to the right. All cross terms drop out and
which is the unit lower triangular matrix whose entry is .∎
That is the practical miracle: you do not compute , you record it. Each time you perform , write into position of a lower triangular array. When the forward phase ends you have in the upper part and in the lower part, at no extra arithmetic cost.
Method 1.61 (Solving by ). Given :
- Forward substitution. Solve from the top down: , then .
- Back substitution. Solve from the bottom up.
Then , so solves the original system.
Theorem 1.62 (Existence of an factorization). If can be reduced to echelon form using only replacement operations that add a multiple of a row to a lower row — equivalently, if no row interchange is needed — then has an factorization. If in addition is square and invertible, the factorization with unit lower triangular is unique.
Proof. Existence is the construction above. For uniqueness with square and invertible, suppose . Then are invertible (their diagonal entries are the nonzero pivots), so . The left side is unit lower triangular and the right side is upper triangular, since inverses and products preserve each triangular class and the unit diagonal. A matrix that is both lower and upper triangular is diagonal, and having a unit diagonal it must be . Hence and .∎
Not every matrix has an factorization. The simplest counterexample is : the entry is zero, so no multiple of row can ever produce a pivot there, and a swap is unavoidable. The fix is to record the swaps too.
Theorem 1.63 (). For every square matrix there is a permutation matrix — a matrix obtained by permuting the rows of — such that with unit lower triangular and upper triangular.
Proof. Run Gaussian elimination with the interchanges that the algorithm actually requires, and let be the product of the corresponding permutation matrices, applied to in advance. Concretely, if you knew ahead of time which rows would be swapped, you could swap them first and then eliminate with no further interchanges; performing all the interchanges at the start is exactly left multiplication by a single permutation matrix . The matrix then reduces by replacements alone, so the previous theorem applies to it.∎
Intuition. is the system after elimination and is the receipt — it lists exactly how much of each earlier equation was subtracted from each later one. Given a new right-hand side you do not redo the elimination; you replay the receipt on (forward substitution) and then back-substitute. Solving becomes as cheap as two triangular sweeps, and the expensive part is paid once.
Example 1.64 (A full factorization). Factor as .
Solution. Column . The pivot is . The multiplier for row is , so gives . The multiplier for row is , so gives :
Column . The pivot is and the multiplier for row is , so gives :
Assemble from the recorded multipliers , , :
Sanity check by multiplying out row of : , which is row of . Row : , also correct.□
Example 1.65 (Using the factorization to solve). With as above, solve for .
Solution. Forward substitution on , top down:
Back substitution on , bottom up:
So .
Sanity check in : row gives ; row gives ; row gives . All match .□
Example 1.66 (A matrix that needs a permutation). Find a permutation matrix and an factorization of for .
Solution. The entry is zero, so elimination must begin with . The corresponding permutation matrix is , and
This is already upper triangular, so no elimination step is needed: and .
Sanity check: , and is indeed with its rows swapped. Note itself has no factorization: any unit lower triangular times an upper triangular has entry and entry , so would force the entry to be as well, contradicting .□
Pitfall. The multiplier stored in is the number you subtracted, not the number you added. If you perform , the operation is , so , not . Getting the sign wrong produces an that multiplies out to something other than , which is exactly why the check is worth the thirty seconds.
1.12Two applications
Linear systems earn their place because so many quantitative questions are, after one modelling step, exactly this problem. Two standard examples show the modelling step in full.
Example 1.67 (Balancing a chemical equation). Balance the combustion of propane,
with positive whole numbers.
Solution. Conservation of each element gives one linear equation. Carbon: the left has atoms and the right has , so . Hydrogen: . Oxygen: . Writing the system as homogeneous equations,
This is equations in unknowns, so by the corollary on wide homogeneous systems there are infinitely many solutions — as there must be, since scaling a balanced equation keeps it balanced. Take as the free variable and set . Then from the carbon equation and from the hydrogen equation, and the oxygen equation gives , so .
The balanced equation is
Sanity check atom by atom: carbon ; hydrogen ; oxygen on the left and on the right.□
Example 1.68 (A traffic network). Four one-way intersections are joined in a cycle by internal roads carrying cars per hour from to , from to , from to and from to . External traffic enters and leaves at each intersection: takes in and releases ; takes in and releases ; takes in and releases ; takes in and releases . Find all possible flows, and the smallest possible value of given that no road carries negative traffic.
Solution. The modelling rule is that flow in equals flow out at each intersection.
At : , so . At : , so . At : , so . At : , so .
Take as the parameter and substitute forward: , then , then , and the equation at gives , which is automatically satisfied. So the fourth equation is redundant: the coefficient matrix has rank with unknowns, and in parametric vector form
That the null space direction is is the physical statement that you may add a constant circulation around the loop without changing any external flow.
Now impose . The binding constraint is , so ; the others need only , , . Hence the smallest admissible is , giving the minimum (with , , ).
Sanity check the total: external inflow is and external outflow is . Had these differed, the system would have been inconsistent — cars would be accumulating somewhere.□
Remark. A third standard application, the Leontief input–output model, has the same shape. If is the vector of sectoral outputs, the consumption matrix whose entry is the amount of good needed to produce one unit of good , and the final demand, then production must satisfy , that is,
a linear system solved by exactly the methods of this chapter. The economically meaningful question — does a nonnegative exist for every nonnegative ? — is the solvability theorem with an extra positivity condition.
Pitfall. In an application, the mathematics does not know what the variables mean. Elimination will happily return a negative traffic flow or a fractional number of molecules. Constraints such as or "integer" are not part of the linear system and must be imposed afterwards, on the parametric description of the solution set.
1.13Numerical notes: cost and stability
Everything above is exact arithmetic. On a computer neither the cost nor the accuracy can be ignored, and both change how the algorithm is written.
Proposition 1.69 (Operation count for elimination). Reducing an matrix to echelon form by Gaussian elimination costs approximately
floating-point operations, while forward and back substitution each cost approximately .
Proof. Clearing column requires, for each of the rows below the pivot, one division to form the multiplier and then multiply–add pairs across the remaining entries of the row — about operations in total for that column. Summing over gives
For back substitution, solving row costs about operations, and .∎
Two consequences follow at once. First, doubling multiplies the work by roughly eight, so the size of solvable dense systems grows only slowly with computing power. Second, once has been factored as at cost , each additional right-hand side costs only about — for , a factor of several hundred cheaper. That ratio is the entire commercial argument for storing the factorization.
Cramer's rule, by contrast, needs determinants of size ; computed by cofactor expansion this is on the order of operations, which for exceeds the number of operations a fast computer performs in a human lifetime. Cramer's rule is a theoretical formula, not an algorithm.
Definition 1.70 (Partial pivoting). Partial pivoting is the rule that, before clearing column , one interchanges rows so that the entry of largest absolute value in the remaining part of column occupies the pivot position.
Partial pivoting is not about avoiding division by zero, although it does that too. It is about keeping the multipliers small: after the swap every multiplier satisfies , so the elimination cannot amplify the rounding errors already present in the data.
Example 1.71 (Why pivoting matters). Solve , in arithmetic that keeps three significant digits, first without and then with a row interchange.
Solution. Without pivoting, the multiplier is and gives , i.e. . Rounding to three significant digits makes both coefficients , so . Back substitution then gives
because the tiny difference that carried all the information about was rounded away.
With pivoting, swap the rows first: , then . The multiplier is now , and gives , i.e. , so and .
The true solution is , , so the pivoted computation is accurate to three digits and the unpivoted one gets completely wrong. Sanity check on the unpivoted answer: gives — the first equation is satisfied — but in the second. The error hid in the equation that had been scaled up enormously.□
Definition 1.72 (Ill-conditioned system). A system is ill-conditioned when small relative changes in or produce large relative changes in the solution. Geometrically, the constraint hyperplanes meet at a very shallow angle, so the intersection point slides far when a plane is nudged.
Example 1.73 (An ill-conditioned pair of lines). Compare the solutions of , and of , .
Solution. Subtract the first equation from the second in each case. In the first system, gives and then . In the second, gives and then .
A change of one part in twenty thousand in a single right-hand entry moved the solution from to . No algorithm can repair this: the difficulty is in the problem, not in the method. Pivoting protects against errors the algorithm introduces; conditioning measures how much the data can be trusted.
Sanity check of the second solution: and , both exact.□
Remark. This is why "the matrix is invertible" is an unhelpful answer in numerical work. Invertibility is a yes-or-no property that takes no notice of how nearly singular a matrix is, and a matrix can be invertible while being, for computational purposes, indistinguishable from one that is not. The chapters on determinants and on eigenvalues make that distance precise.
Summary (The solution set in terms of rank). Every matrix is row equivalent to a unique reduced echelon form, so the pivot positions, and the free variables are well defined. For an matrix and :
- is consistent iff no echelon row reads with , iff ;
- it is consistent for every iff (a pivot in every row), and a consistent system is uniquely solvable iff (a pivot in every column, equivalently the columns of are independent);
- , so a consistent system has no solution, exactly one, or infinitely many, and never anything else;
- when consistent, the solution set is for any one particular solution — the shape is set by alone, not by .
Elimination itself is algebra: each row operation is left multiplication by an invertible elementary matrix, so , and when no interchange is needed the recorded multipliers give ; in general for some permutation matrix .
- Multiplying a row by zero. Scaling is legal only by a nonzero scalar. Multiplying by zero destroys an equation irreversibly, and the resulting system may have solutions the original did not.
- Changing both rows during a replacement. In only row changes. Row is the source and must be left exactly as it was.
- Reading a zero row as inconsistency. The row says and merely reports a redundant equation; only with means no solution.
- Confusing free variables with no solution. Free variables mean infinitely many solutions, not zero.
- **Confusing with . ** They differ by at most one, and the system is consistent exactly when they are equal.
- Mixing up the row and column criteria. A pivot in every row controls *existence for all *; a pivot in every column controls *uniqueness*. For non-square matrices these are genuinely different conditions.
- Assuming "more unknowns than equations" means solutions exist. It only means a solution, if one exists, cannot be unique. The homogeneous case is the one where existence is automatic.
- Stopping at a particular solution. When free variables are present, the answer is the whole set , written in parametric vector form — not one convenient point of it.
- **Getting the sign of an multiplier wrong.** The entry of is the number subtracted in . Always verify with .
- Multiplying elementary matrices in the order the operations were performed. The first operation sits furthest right: two steps then give the product .
- Forgetting that applications impose extra constraints. Nonnegativity and integrality are conditions on the parametric solution set, not part of the linear algebra.