Solving Ax = b asks whether b is in the range of A and how much freedom is left over. Row operations answer both without changing the solutions, and the pivots they expose give the rank, the four fundamental subspaces and the inverse.
Taught in 375/376Beyond the courseApostol 2.17 to 2.21Spagnolie, Lectures 1 and 11 to 13MATH 375 HW7MATH 375 Midterm 2 (2013 practice exam)
Chapter 2.3 ended with a promise: if T(x)=b has one solution, then all solutions are that one plus the null space. This chapter turns the promise into a method. You are given a system of equations like the ones you solved by substitution in school. Does it have a solution? Is that solution the only one? How do you find every solution, even when there are hundreds of equations? Spagnolie opened his course with exactly these questions (Lecture 1, “Whence linear algebra?”) and answered them in Lectures 11 to 13. The answer is Gaussian elimination. The numbers it produces, called pivots, also count the rank, the nullity and the dimensions of the four fundamental subspaces, and they compute inverses.
Before you start
2.3: null space, range, and the rank–nullity theorem. 2.2: basis and dimension. 2.5: a matrix times a vector, matrix multiplication, the identity matrix and the transpose. 2.4: the inverse of a map, and the fact that a map is invertible exactly when it is both one-to-one and onto.
Quick checkA linear map T:R5→R3 has rank 2. What is its nullity?
Rank plus nullity equals the dimension of the domain, which is 5. So the nullity is 5−2=3. The tempting answer 1 subtracts from the dimension 3 of the codomain, which does not appear in the theorem.Review: rank–nullity
Quick checkAre the vectors (1,2) and (2,4) linearly independent?
Independent means the only combination equal to O is the trivial one. Here 2(1,2)−(2,4)=O is a non-trivial combination. Being different vectors is not enough.Review: linear independence
Quick checkA is a 3×2 matrix (3 rows, 2 columns). The map x↦Ax goes from which space to which?
The vector x must have one entry for each column, so it has 2 entries. The output has one entry for each row, so it has 3. The tempting first option reads the shape 3 by 2 as 'from 3 to 2'.Review: matrices
Where this came from· Elimination is older than Gauss
The Chinese book Nine Chapters on the Mathematical Art has an eighth chapter, “fangcheng” (rectangular arrays), that solves systems of linear equations (the book took its final form around the first century CE). The coefficients are laid out as an array of counting rods, and columns are combined to clear unknowns one at a time. That is elimination on an augmented matrix. In Europe Newton wrote a lesson on it around 1670. The method carries Gauss’s name because of the problem astronomers and surveyors had in the early 1800s: more measurements than unknowns, so no exact solution. Gauss published the method of least squares for such systems in 1809, and in 1810 he gave a compact notation for eliminating on their “normal equations”. In the same period, in 1801, he worked out from 41 days of observations where the lost asteroid Ceres would reappear, and it was found again close to his prediction. The “too many measurements” situation is the second system in the picture below and returns in chapter 2.10.
The picture
Take the system x+y=1, 2x+2y=3. As lines in the plane the two equations are parallel and never meet, so there is no solution. That is the row picture: one line per equation. There is a second way to read the same system, by columns:
x[12]+y[12]=[13].
Now the question is whether (1,3) is a combination of the two columns. Both columns are (1,2), so every combination is a multiple of (1,2), and (1,3) is not one. Pick “Squash to a line” below and press “Apply the map”. (This preset has columns (1,21) and (2,1) instead of (1,2) twice, but the same thing happens: the second column is a multiple of the first.) The two arrows ^ and ^ land on the same line, and the whole plane is flattened onto it. That green line is the range, the set of right sides b the map can reach. The red line is the null space, everything the map sends to the origin. A right side b on the green line can be reached, and because the whole red line is sent to one point, each reachable b is reached by a whole line of inputs. A right side off the green line cannot be reached at all.
Now pick “Shear”. The two columns (1,0) and (1,1) point in different directions, so the map does not flatten anything. Every point of the plane is hit, and hit exactly once. Solving Ax=b here means asking where in the plane the point b came from, and there is always exactly one answer.
Spagnolie’s Lecture 1 listed four systems to show that the answer is not decided by counting equations and unknowns:
system
equations, unknowns
what happens
2x+3y−z=4, x−4y+2z=−1, 3x+10y−4z=9
3, 3
infinitely many solutions, because equation 3 is 2× (equation 1) − equation 2
3x1+x2=1, 2x1−x2=0, 4x1+7x2=2
3, 2
none: the first two force x1=51, x2=52, and then 4x1+7x2=518=2
3x1+x2+2x3=1, x1+x2+x3=2
2, 3
infinitely many
x+y=1, 3x−y=2
2, 2
exactly one, (43,41)
We solve the first three below with the method of this chapter. The second one comes back in chapter 2.10, where “no exact solution” turns into “find the best approximate one”.
The idea, in words
Write the system as Ax=b, where A is the matrix of the linear map T(x)=Ax (2.5). Then a solution is a point x that T sends to b. Three questions have three answers from earlier chapters.
Why· Three questions, three tools
Does a solution exist? Only if b is in the range of T. The range is spanned by the columns of A, so this asks whether b is a combination of the columns.
Is it the only one? Only if the null space of T is {O}. Two solutions differ by a vector of the null space.
How do I find it? By elimination: rewrite the equations, step by step, into a system with the same solutions but with the answer visible. Each rewriting step is something you did in school (add a multiple of one equation to another to cancel an unknown). The only new things are a proof that it is allowed, and a way to know when to stop.
Because solutions come as “one particular solution plus the null space”, the number of solutions can only be 0, 1 or infinitely many. It is never exactly two. A line through two solutions consists of solutions, and a line has infinitely many points. The proof is below.
In JEE you met 3 by 3 systems with a determinant Δ, and rules such as “if Δ=0 there is exactly one solution” and “if Δ=0 and Δ1=Δ2=Δ3=0 there are infinitely many solutions”. The second rule is not quite right. The system x+y+z=1, x+y+z=2, x+y+z=3 has all of these determinants equal to 0 and no solution at all. Determinant rules apply only to square systems, and even there they cannot always tell you which case you are in. Elimination works for every shape, tells you the case, and writes the solutions out. Chapter 2.7 shows what the determinant rules really say.
The numbers aij are the coefficients, the bi are the right-hand sides and x1,…,xn are the unknowns. A solution is an n-tuple x=(x1,…,xn) that makes all m equations true at once. Collect the coefficients into the m×n matrix A=(aij) and the right sides into b∈Rm. The system is then the single equation Ax=b (Apostol 2.17, equation 2.23). It is homogeneous if b=O (Spagnolie: “homos” means same, “genos” means kind). The homogeneous system Ay=O that shares the same A always has the solution y=O.
In one linem equations in n unknowns, each of the form (numbers) times x1,…,xn added up, equal to a number. Written Ax=b.
Why it existsIt is the oldest question in linear algebra, and it is exactly the question 'which inputs does the linear map x↦Ax send to b?'.
Theorem TApostol Thms 2.18 and 2.19; Spagnolie Lecture 11
Solutions are a particular solution plus the null space
Let A be an m×n matrix and suppose Axp=b. Then x solves Ax=b if and only if x−xp is in the null space N(A). So the solution set is {xp+y:y∈N(A)}. If v1,…,vk is a basis of N(A), every solution is
x=xp+t1v1+⋯+tkvk
for some scalars ti. Apostol calls this the general solution.
In one lineIf xp solves Ax=b, then the solutions are exactly xp+y with y in the null space of A.
Why it is trueSubtracting two solutions kills b, so the difference solves the homogeneous system. This is the +C of integration, now for matrices.
ProofSpagnolie Lecture 11; Apostol 2.17
The idea: One line of linearity, read in both directions. It is the same argument as the '+ C' application in 2.3.
A(x−xp)=Ax−Axp=Ax−b.
Linearity of x↦Ax: matrix times vector respects subtraction.
So Ax=b if and only if A(x−xp)=O.
The right side is O exactly when Ax=b.
So Ax=b if and only if x−xp∈N(A).
That is the definition of the null space.
The solutions are exactly xp+y with y∈N(A), and y=t1v1+⋯+tkvk.
Write y=x−xp. Then x=xp+y. Every y∈N(A) is a combination of the basis v1,…,vk.
In the picture. Go back to “Squash to a line” in the first viewer. The red line is N(A), and it is squashed onto the origin. Take any point on the green line. The inputs that land on it form a line parallel to the red one: one particular input xp, plus every vector of the red line. Step 1 of the proof is the statement that two inputs landing on the same point differ by something that lands on O.
Corollary TApostol 2.17; Spagnolie Lecture 11
A system has zero, one or infinitely many solutions
For Ax=b:
there is no solution exactly when b is not in the range of A;
there is exactly one solution exactly when b is in the range of A and N(A)={O};
there are infinitely many solutions exactly when b is in the range of A and N(A)={O}.
In one lineNo solution if b is not in the range of A. Otherwise one solution if the null space is {O}, and infinitely many if it is bigger.
Why it is trueThe solutions form a translated copy of the null space, and a subspace with a non-zero vector has infinitely many vectors.
ProofApostol 2.17
The idea: Case 1 is the definition of range. Cases 2 and 3 come from the previous theorem.
A solution exists exactly when b is in the range. This is case 1.
x is a solution if and only if Ax=b, and the range is the set of all Ax.
If b is in the range and N(A)={O}, there is exactly one solution.
Previous theorem: the solution set is xp+N(A). If N(A)={O}, that set is the single vector xp.
If N(A)={O}, the vectors xp+ty for t∈R are all different solutions, so there are infinitely many.
Pick a non-zero y∈N(A). For different scalars t=s, ty=sy because (t−s)y=O for a non-zero y.
So each of the three outcomes happens in exactly the stated situation and no other.
The three cases (not in the range; in the range with N(A)={O}; in the range with N(A)={O}) cover every possibility and exclude each other.
Quick checkThe system Ax=b has two different solutions. How many solutions does it have in total?
The difference of the two solutions is a non-zero vector y in the null space, so xp+ty is a solution for every real t. A line cannot have exactly two points.Review: the null space
Definition T
Column space
The column space of an m×n matrix A with columns a1,…,an∈Rm is the span L(a1,…,an) of its columns, a subspace of Rm.
In one lineThe span of the columns of A. It equals the range of x↦Ax.
Why it existsIt lets you decide whether Ax=b is solvable by asking whether b is a combination of the columns.
Theorem TSpagnolie Lecture 13 page 1
Matrix times vector is a combination of the columns
For an m×n matrix A with columns a1,…,an and x∈Rn,
Ax=x1a1+x2a2+⋯+xnan.
Consequently the range of x↦Ax equals the column space of A, and rankA=dim(column space). The rank of a matrix means the rank of the map x↦Ax from 2.3.
In one lineAx=x1a1+⋯+xnan, so the column space is the range of x↦Ax and the rank of A is its dimension.
Why it is trueEntry i of Ax is ∑jaijxj, which is entry i of ∑jxjaj.
ProofSpagnolie Lecture 13
The idea: Compare the two sides one entry at a time.
Entry i of Ax is ∑j=1naijxj.
Definition of matrix times vector, from 2.5.
Entry i of x1a1+⋯+xnan is ∑j=1nxjaij. The two entries agree for every i, so Ax=∑jxjaj.
Entry i of the column aj is aij, and scaling by xj and adding act entry by entry.
So the set of all Ax is the span of the columns.
The right side ranges over all combinations of the columns as x ranges over Rn.
Worked example Spagnolie Lecture 11 page 4, adapted
Is b in the column space? Then find all solutions of Ax = b, for A with rows (1, 2) and (2, 4)
Solution.
Write the columns. The columns of A are a1=(1,2) and a2=(2,4). Ax is a combination of the columns, so the question about solvability is a question about their span.
Find the span.a2=2a1, so the column space is {c(1,2)}, a line in the plane. A column that is a multiple of another adds nothing to the span (2.2).
Test b=(3,6).(3,6)=3(1,2) is on the line, so solutions exist. A particular solution is xp=(3,0), because 3a1+0a2=b. Take the coefficients of the combination as the entries of x.
Find the null space.Ay=O means y1+2y2=0 (the second equation is twice the first). So y=t(−2,1). One equation in two unknowns leaves one unknown free.
Assemble. The solutions are (3,0)+t(−2,1). Particular solution plus null space.
Test b=(3,7).(3,7) is not a multiple of (1,2), so it is not on the line and there is no solution. The second equation 2x1+4x2=7 contradicts twice the first, 2x1+4x2=6.
Answer. For b=(3,6) the solutions are (3,0)+t(−2,1). For b=(3,7) there are none.
Row operations
Elimination needs a bookkeeping device. Writing x1,x2,x3 again and again is a waste, so we keep only the numbers.
Definition T
Augmented matrix
The augmented matrix of Ax=b is the m×(n+1) matrix [A∣b] whose last column is b. The vertical bar is only a reminder; it is not part of the matrix. Row i stands for the equation ai1x1+⋯+ainxn=bi.
In one lineThe matrix [A∣b]: the coefficient matrix with the right-hand side added as an extra last column.
Why it existsEach row is one equation. Doing something to an equation is doing it to a row.
Definition T
Row operations
A row operation is one of three moves:
Swap two rows (Ri↔Rj).
Scale a row by a number c=0 (Ri→cRi).
Add a multiple of one row to a different row (Rj→Rj+cRi with i=j).
On an augmented matrix these are: reorder the equations, multiply an equation by a non-zero constant, add a multiple of one equation to another. Spagnolie’s Lecture 12 lists the same three.
In one lineThe three allowed moves on the rows of a matrix: swap two rows, multiply a row by a non-zero number, add a multiple of one row to another row.
Why it existsThey are exactly the moves of school elimination, and each one can be undone, so none of them changes the solutions.
If [A′∣b′] is obtained from [A∣b] by a sequence of row operations, then Ax=b and A′x=b′ have the same set of solutions. In particular (take b=O), N(A)=N(A′).
In one lineIf [A′∣b′] comes from [A∣b] by row operations, the two systems have exactly the same solutions.
Why it is trueEvery row operation can be undone by another row operation, so no solution can be lost or gained.
ProofSpagnolie Lecture 12; Apostol 2.18
The idea: Show that one row operation never loses a solution. Then notice that every row operation has an opposite row operation, so it never gains one either.
Suppose x solves the old system. After a swap, x still satisfies every equation.
Swapping lists the same equations in a different order, and a solution satisfies every equation in the list.
After scaling row i by c, the new equation i holds for x.
Write ai⋅x for ai1x1+⋯+ainxn, the left side of equation i (row i of A times x). If ai⋅x=bi then multiplying both sides by c gives (cai)⋅x=cbi.
After adding c times row i to row j, the new equation j holds for x.
Equals added to equals are equal: if ai⋅x=bi and aj⋅x=bj, then (aj+cai)⋅x=bj+cbi.
Every row operation is undone by a row operation of the same kind.
Swap again to undo a swap. Scale by 1/c to undo scaling by c (this is where c=0 is needed). Add −c times row i to row j to undo adding c times.
So every solution of the new system is a solution of the old system. Together with the earlier steps, the two systems have the same solutions.
Apply the first three steps to the undoing operation: it carries the new system back to the old one without losing a solution.
The same holds for any sequence of row operations.
Induction on the number of operations: the claim for one operation, applied again and again.
In the picture. Two lines in the plane cross at one point. Replace the second line’s equation by (second equation) plus c× (first equation). The new line is a different line, but it still passes through the crossing point, because that point satisfies both old equations. Tilting a line about the common point is what “add a multiple” does, and turning it back is what “subtract that multiple” does.
Quick checkWhich of these is NOT a legal row operation?
Multiplying by 0 turns the equation into 0=0 and cannot be undone, so solutions could be gained. The other three each have an opposite operation.Review: row operations
Echelon form
Definition T
Row echelon form
In a non-zero row, the first non-zero entry from the left is the leading entry of that row. A matrix is in row echelon form if
every zero row is below every non-zero row, and
the leading entry of each non-zero row is strictly to the right of the leading entry of the row above it.
(Spagnolie draws this as a staircase. Everything below the staircase is zero.)
In one lineA staircase shape: zero rows at the bottom, and the first non-zero entry of each row is further right than the first non-zero entry of the row above.
Why it existsA system in this shape can be solved from the bottom row up, and the staircase shows at once how many independent equations there are.
Definition T
Pivot
In a matrix in row echelon form, a pivot is the leading entry of a non-zero row. A pivot column is a column containing a pivot.
In one lineA leading entry of a matrix in echelon form. A column that holds one is a pivot column.
Why it existsThe pivots count the independent equations, so they will turn out to count the rank.
Definition T
Reduced row echelon form
A matrix is in reduced row echelon form (RREF) if it is in row echelon form, every pivot equals 1, and every pivot is the only non-zero entry in its column. Spagnolie’s example U=100300330210 is in echelon form with pivots 1 (column 1) and 3 (column 3). It is not reduced, because the second pivot is not 1 and the 3 above it is not zero. The matrix 1003000101310 is in RREF.
In one lineEchelon form where every pivot is 1 and is the only non-zero entry in its column.
Why it existsHere the answers can be read straight off, with no back substitution.
Definition T
Free variable
Let R be an echelon form of the coefficient matrix. The unknown xj is a pivot variable if column j of R is a pivot column, and a free variable otherwise.
In one lineAn unknown whose column has no pivot. You may choose its value freely, and the others follow.
Why it existsThe free variables are the freedom left over in the solution set, so they count the nullity.
The non-example [0110] fails condition 2: the leading entry of row 2 is in column 1, which is to the left of the leading entry of row 1. One swap puts it in echelon form.
Every m×n matrix can be turned into a matrix in reduced row echelon form by a finite sequence of row operations.
In one lineRow operations can turn any matrix into one in reduced row echelon form.
Why it is trueThe algorithm is the one you already know: pick a pivot, clear the column below it, repeat on what is left, then clear above.
ProofApostol 2.18
The idea: Induction on the number of rows. Make the first pivot, clear below it, and apply the induction hypothesis to the rows underneath. Then clear above each pivot from the bottom up.
If m=1, scale the row so that its leading entry is 1. The matrix is in RREF.
Base case. One row: it is a zero row (already in RREF) or it has a leading entry.
Suppose m≥2 and the matrix is not zero. Let j be the first column with a non-zero entry.
If the whole matrix is zero it is already in RREF, and there is nothing to do.
Swap rows if needed so that the entry in row 1, column j is non-zero.
A swap is a row operation. Now the entry in row 1, column j is non-zero.
Scale row 1 so that this entry is 1. This is the first pivot.
Scaling by the non-zero number 1/(that entry) is a row operation.
Clear column j below the pivot: it is now 1,0,…,0.
For each lower row i, add −(entry in column j) times row 1. This is the third kind of row operation.
The rows 2,…,m form a matrix with m−1 rows. By the induction hypothesis, row operations on those rows alone bring them to RREF.
Columns 1 to j are zero in rows 2 to m. Row operations among those rows keep them zero, and never touch row 1.
The whole matrix is now in row echelon form with every pivot equal to 1.
The result is a staircase: row 1 has its pivot in column j, and the pivots below sit strictly to the right of column j, because columns 1 to j are zero in those rows.
Starting at the bottom pivot and moving up, subtract multiples of each pivot row from the rows above to make the rest of that pivot’s column zero. The matrix is now in RREF.
A pivot row has a 1 at its pivot, zeros to the left of it, and (because we work from the bottom up) zeros in the pivot columns of the rows below it, which were cleared earlier. So subtracting a multiple of it from a higher row changes that row only in the pivot column (making it zero) and in non-pivot columns, and leaves the columns already cleared alone.
(The RREF of a matrix is in fact unique, but we never need that. Rank will be defined without reference to any particular reduction.)
Now we can see why this solves systems. Suppose [R∣d] is the RREF of [A∣b]. By the theorem on row operations, Rx=d has the same solutions as Ax=b, and Rx=d can be read.
Theorem TApostol 2.18; Spagnolie Lecture 12 pages 4 and 5
Reading the solutions off the reduced form
Let [R∣d] be in reduced row echelon form, where R is m×n with r pivots in columns j1<⋯<jr, and let F be the set of free columns.
If some row of [R∣d] is [0…0∣c] with c=0 (equivalently, the last column is a pivot column), there is no solution.
Otherwise the solutions are exactly the vectors with xji=di−∑k∈FRikxk for i=1,…,r and xk arbitrary for k∈F. Equivalently x=xp+∑k∈Fxkvk, where xp has xji=di and zeros at free positions, and vk has 1 in position k, −Rik in position ji, and 0 at the other free positions.
The vectors vk are a basis of N(R)=N(A). So dimN(A) is the number of free variables, and the solution is unique when there are none.
In one lineThe system is inconsistent exactly when the last column is a pivot column. Otherwise each pivot variable equals its right side minus a combination of the free variables.
Why it is trueIn RREF each row has one pivot variable with coefficient 1 and no other pivot variable, so each row says exactly what that pivot variable is.
ProofApostol 2.18
The idea: Write the rows of the reduced system out as equations and solve each for its pivot variable.
Case 1: such a row gives the false equation 0=c, so no x solves Rx=d.
A row [0…0∣c] reads 0=c. No x makes that true when c=0.
Case 2: row i reads xji+∑k∈FRikxk=di. Solving, xji=di−∑k∈FRikxk.
Row i of RREF has a 1 in pivot column ji, zeros in the other pivot columns, and arbitrary numbers Rik only in free columns k.
So the solutions are exactly the stated vectors. Substituting the formulas gives x=xp+∑kxkvk.
Zero rows read 0=0 and impose nothing. Any choice of the free xk gives values of the pivot variables that satisfy every row.
If ∑ktkvk=O, then reading the free position k gives tk=0. So the vk are independent.
Case 3. Take d=O so that the solutions are N(R). Look at the free positions: vk has a 1 in position k and 0 in the other free positions.
The vk span N(R), so they are a basis, and N(A)=N(R) by the theorem on row operations.
From the formula, an element of N(R) is ∑kxkvk with xk its own free entries.
Worked example Spagnolie Lecture 12 pages 3 and 4
Solve 2x + y + z = 5, 4x − 6y = −2, −2x + 7y + 2z = 9
Solution.
Write the augmented matrix. The first slide of the visualizer below. Only the numbers matter; the unknowns can be restored at the end.
Clear the first column below the pivot. Use the 2 in row 1 as the first pivot, and subtract 2R1 from R2, add R1 to R3. Each is “add a multiple of one row to another”, which does not change the solutions.
Clear the second column below its pivot. Use the −8 as the second pivot and add R2 to R3. The matrix is now in echelon form with three pivots. Three pivots in three unknowns: no free variable, so the solution is unique if it exists.
Continue upwards and scale. Clear above the pivots and divide each row by its pivot, until the left block is I. This is Gauss–Jordan elimination. The last column is then the solution.
Answer.(x,y,z)=(1,1,2), the only solution.
Your answerSolve x+y+z=6, x+2y+3z=14, 2x+y+z=7 by elimination. What is z?
After clearing column 1, add the two remaining equations to cancel y.
Subtract R1 from R2: y+2z=8. Subtract 2R1 from R3: −y−z=−5. Add these two: z=3. Then y=8−6=2 and x=6−2−3=1. Check in equation 3: 2+2+3=7.
Worked example Spagnolie Lecture 1 page 1
Spagnolie's opener: 2x + 3y − z = 4, x − 4y + 2z = −1, 3x + 10y − 4z = 9 (infinitely many solutions)
Solution.
Start with a pivot of 1 to avoid fractions. Swap rows 1 and 2. A swap does not change the solutions, and the leading 1 makes the arithmetic cleaner.
Clear column 1 below the pivot. Subtract 2R1 from R2 and 3R1 from R3. The pivot row is used to cancel the unknown x in the other equations.
Look at what appears. Row 3 becomes twice row 2, so subtracting 2R2 from it gives a zero row. A zero row 0=0 means that equation was a consequence of the others (equation 3 was 2× equation 1 minus equation 2), so there are only two independent equations for three unknowns.
Scale and clear above. Divide R2 by 11 and add 4R2 to R1. That puts the matrix in RREF, where the pivot variables x,y can be read off in terms of the free variable z.
Read the answer. Column 3 has no pivot, so z is free. Theorem above: each pivot variable equals its right side minus a multiple of the free variable.
Answer. The solutions are (1113,116,0)+t(−2,5,11), a line in R3 (the intersection of two independent planes). Check with t=1: (−119,1161,11) gives 11−18+183−121=4 in equation 1.
Write the augmented matrix and eliminate. Three equations, two unknowns. We expect to run out of unknowns before equations.
Reduce to echelon form. The steps are in the visualizer. Only the pivot pattern matters: a pivot in the last column is a contradiction.
Read the last row. It says 0=−58. Theorem above, case 1: a row [00∣c] with c=0 means no solution.
Answer. No solution. (The first two equations alone give x1=51, x2=52, and the third equation then fails: 54+514=518=2.) The right side (1,0,2) is not in the column space of A, which is only a plane in R3.
The third system in the picture table is short enough to do by eye. For 3x1+x2+2x3=1 and x1+x2+x3=2 the RREF is [10012121−2125]. Column 3 is free, so the solutions are (−21,25,0)+t(−1,−1,2). With two equations and three unknowns there is always at least one free variable (rank is at most 2 and there are 3 columns), so such a system never has a unique solution.
Worked example Spagnolie Lecture 12 page 5 (sign corrected)
Two equations, four unknowns: y − z + u = 2 and 4x + 2y + z = 1
Solution.
Pick pivots. Put the equation with the x term first, and scale: x+21y+41z=41 and y−z+u=2. Swapping equations is allowed. Note we reorder equations, never the unknowns.
Find the pivot and free columns. Pivots are in columns of x and y. So z and u are free. There are 4 unknowns and 2 pivots, so the nullity is 4−2=2.
Solve for the pivot variables.y=2+z−u. Then x=41−21(2+z−u)−41z=−43−43z+21u. Back substitution, which is Theorem “Reading the solutions” for a non-reduced form.
Split into particular plus null space. With z=a and u=b,
Set the free variables to 0 for the particular solution. Set one free variable to 1 and the other to 0 for each null vector.
5. Check by multiplying. Particular solution (−43,2,0,0): the equation y−z+u=2 gives 2−0+0=2, and 4x+2y+z=1 gives −3+4+0=1. Null vectors: (−43,1,1,0) gives 1−1+0=0 and −3+2+1=0. (21,−1,0,1) gives −1−0+1=0 and 2−2+0=0. Always check null vectors by multiplying. The printed lecture notes had the sign of the u term wrong, and the check catches that.
Answer.(−43,2,0,0)+a(−43,1,1,0)+b(21,−1,0,1) for all real a,b. The set of solutions is a plane in R4.
Rank, pivots and the four fundamental subspaces
Now the central count. The pivots found by elimination measure the rank, and we prove it.
Let A be an m×n matrix and let R be an echelon form of A with r pivots. Then:
dimN(A)=n−r (the number of free variables);
the pivot columns of A itself (not of R) are a basis of the column space of A;
rankA=r, so n=r+(n−r) is the rank–nullity theorem read off the staircase.
In one lineIf an echelon form of A has r pivots, then rank A=r, nullity =n−r, and the pivot columns of the original A are a basis of the column space.
Why it is trueRow operations do not change which combinations of columns equal zero, so they do not change which columns depend on which.
ProofSpagnolie Lecture 12 page 6 and Lecture 13 page 3
The idea: Row operations preserve every relation Σ cⱼaⱼ = O among the columns. In the reduced form the pivot columns are the standard vectors, so they are independent and every other column is a combination of them. The same is then true in A.
Let R be the RREF of A, with r pivots in columns j1<⋯<jr.
Reduce further if needed so R is the RREF of A. The pivot count does not change: further operations only clear and scale.
The nullity is the number of free variables, n−r. This proves part 1.
Theorem on reading solutions, case 3, with d=O.
Any coefficients c1,…,cn give ∑cjaj=O if and only if ∑cjaj′=O.
Row operations do not change the solutions of Ax=O, and Ax=∑xjaj (columns), so ∑xjaj=O exactly when ∑xjaj′=O, where aj′ are the columns of R.
The pivot columns of R are e1,…,er, which are independent.
In RREF, pivot column ji is the standard vector ei (a 1 in row i and 0 elsewhere).
So the pivot columns of A are independent.
Step 3 with a combination that uses only pivot columns: if ∑iciaji=O then ∑iciaji′=O, so all ci=0.
Every non-pivot column of R is a combination of the pivot columns of R.
A non-pivot column ak′ of R has non-zero entries only in rows 1,…,r (the rows below are zero), so ak′=∑i≤rRikei=∑iRikaji′.
So ak=∑iRikaji for every non-pivot column k.
Step 3 again: the relation ak′−∑iRikaji′=O among columns of R is also a relation among the columns of A.
The pivot columns of A are a basis of the column space, so rankA=r. This proves parts 2 and 3.
Every column is a combination of the pivot columns, so they span the column space (a span of all columns). They are independent.
Proof workshopRebuild the proof that the pivot columns of A are a basis of the column space
Tap the lines in the order a proof would write them. Each line can only use what is already above it.
Start from the staircase that elimination produces, and name the pieces we will compare with A.
Row operations do not change the solutions of Ax=O, and Ax is the combination ∑xjaj of the columns.
This compares the columns of A with the columns of R, so R must be introduced first.
In RREF a pivot column has a 1 in its own row and zeros elsewhere.
This reads off the shape of R, so it comes after R is introduced.
A relation among them would, by the line about coefficients, be a relation among e1,…,er, and there is only the trivial one.
You carry independence from R back to A, so you need both the coefficient line and the independence in R.
A non-pivot column of R has non-zero entries only in the first r rows, and the coefficient line moves the relation from R back to A.
This moves a relation from R to A, so it needs the coefficient line first.
Every column is a combination of the pivot columns (so they span), and they are independent.
A basis needs both spanning and independence, so both must already be on the page.
In the picture. In the first viewer, “Squash to a line” has columns (1,0.5) and (2,1). Column 2 is a multiple of column 1, so there is one pivot and the rank is 1, which is the green line. The second column is the non-pivot column and gives the free variable: the red line, of dimension 2−1=1. The “Shear” map has two independent columns, two pivots, rank 2, and a null space of dimension 0.
Quick checkRow reducing A gives an echelon form U with pivots in columns 1 and 3. Which vectors are a basis of the column space of A?
Row operations keep the dependences among columns but move the column space itself. So the pivot positions come from U, and the vectors come from A. Rows of U are a basis of the row space, which is a different space.Review: basis
Your answerWhat is the rank of A=123246134?
Clear column 1, then compare the two rows that are left.
R2→R2−2R1 gives (0,0,1) and R3→R3−3R1 gives (0,0,1). Then R3→R3−R2 gives a zero row. The echelon form has pivots in columns 1 and 3 only (column 2 is twice column 1), so there are 2 pivots and the rank is 2.
Your answerThe reduced row echelon form of a 3×5 matrix A has pivots in columns 1, 2 and 4. What is dimN(A)?
Nullity =n−r, where n is the number of columns.
The free variables are x3 and x5, the columns without a pivot. There are 5−3=2 of them, and the nullity is the number of free variables. This is rank–nullity read off the staircase.
The word “original” matters. Spagnolie’s example in Lecture 13 is A=[111100], which reduces to U=[101000]. The column space of A is the line through (1,1), and the column space of U is the line through (1,0). They are different lines of the same dimension. Row operations preserve the null space, the row space (next), and the dependences among columns, but they move the column space.
This answers a question from chapter 2.2: how do you find a basis for the span of some given vectors? Put the vectors in as the columns of a matrix, row reduce to find the pivot columns, and keep the original vectors in those columns.
Definition T
Row space
The row space of an m×n matrix A is the span of its m rows, a subspace of Rn. It equals the column space of AT.
In one lineThe span of the rows of A, which is the column space of the transpose AT.
Why it existsIt is the row-wise partner of the column space, and its dimension turns out to be the same number.
Definition T
Left null space
The left null space of an m×n matrix A is N(AT)={y∈Rm:ATy=O}. Since ATy=O says yTA=O (the row vector yT multiplies A from the left), this is the set of combinations of the rows of A that equal zero. It is a subspace of Rm.
In one lineThe null space of the transpose: all y∈Rm with ATy=O, equivalently yTA=O.
Why it existsIt records which combinations of the equations (the rows) add up to nothing, and so which right sides b are impossible.
In one lineThe row space and the column space of a matrix have the same dimension, the number of pivots. So rank A = rank AT.
Why it is trueRow operations do not change the row space, and in echelon form the non-zero rows are visibly independent, as many as there are pivots.
ProofSpagnolie Lecture 13 page 3; Apostol 2.18
The idea: Show the row space is unchanged by row operations. In echelon form the non-zero rows are independent. Then apply rank–nullity to the transpose.
A row operation replaces rows by combinations of rows, so the row space can only shrink.
After a row operation each new row is a combination of old rows, so the new span is inside the old one.
It cannot shrink either. So A and its echelon form R have the same row space.
Row operations are reversible (previous theorem's proof), so the old rows are combinations of the new rows too.
The row space of R is spanned by its r non-zero rows.
Zero rows add nothing to a span.
The r non-zero rows are independent, so dim(row space)=r.
Suppose ∑iciRi=O. Look at the first pivot column: every row below row 1 has a zero there, so only c1 contributes, and it forces c1=0. Repeat with row 2's pivot column, and so on.
Therefore dimN(AT)=m−r.
The row space of A is the column space of AT, so rankAT=r. Rank–nullity applies to AT:Rm→Rn, whose domain has dimension m.
Also dim(column space)=r and dimN(A)=n−r.
Parts 1 and 3 of the previous theorem.
This is surprising. A matrix can have 100 rows and 3 columns, and it still has the same number of independent rows as independent columns, which is at most 3. Spagnolie’s notes call it “not remotely obvious”.
Put the four subspaces on one page. This is Strang’s picture, and Spagnolie boxes it in Lecture 13 as the fundamental theorem of linear algebra.
subspace
lives in
dimension
column space (the range of A)
Rm
r
left null space N(AT)
Rm
m−r
row space (the range of AT)
Rn
r
null space N(A)
Rn
n−r
The input space Rn is split as row space (r) plus null space (n−r), and the output space Rm as column space (r) plus left null space (m−r). The dimensions in each pair add to n and to m.
Your answerA 5×8 matrix has rank 3. What is the dimension of its LEFT null space N(AT)?
Use m−r, where m is the number of ROWS.
The left null space lives in Rm=R5 and has dimension m−r=5−3=2. (For comparison, dimN(A)=8−3=5, and row space and column space both have dimension 3.)
Quick checkA 3×4 matrix has rank 2. Which statement is true?
The null space lives in R4 (the columns), so its dimension is n−r=4−2=2. The left null space lives in R3 (the rows), so its dimension is m−r=3−2=1. Mixing up m and n is the usual slip.
A preview· Preview: perpendicular subspaces
Each entry of Ax=O says that a row of A, dotted with x, is zero. So every vector of the null space is perpendicular to every row, and the null space and row space meet only at O. The same holds for the left null space and the column space. Chapter 2.9 defines “perpendicular” properly, and 2.10 uses it to find best approximate solutions when Ax=b has no solution.
Worked example Spagnolie Lecture 13 page 3
Find bases for all four subspaces of A with rows (1, 3, 3, 2), (2, 6, 9, 5), (−1, −3, 3, 0)
Solution.
Row reduce.R2→R2−2R1 and R3→R3+R1 give rows (0,0,3,1) and (0,0,6,2). Then R3→R3−2R2 gives (0,0,0,0). So U=100300330210. Standard elimination to echelon form. The pivots are in columns 1 and 3.
Count.r=2 pivots, m=3, n=4. The theorem gives dimensions 2,2,4−2=2 and 3−2=1.
Column space. Columns 1 and 3 of the ORIGINAL A: (1,2,−1) and (3,9,3). Pivot columns of A form a basis; the pivot columns of U would be wrong.
Row space. The non-zero rows of U: (1,3,3,2) and (0,0,3,1). Row operations keep the row space, so the rows of U are a basis of the row space of A.
Null space. Reduce to RREF: R1→R1−R2 and R2→R2/3 give 1003000101310. Free variables x2,x4. Then x1=−3x2−x4 and x3=−31x4. Take x2=1,x4=0 and x2=0,x4=3: (−3,1,0,0) and (−3,0,−1,3). One null vector per free variable. Multiply back to check: the second gives −3−3+6=0, −6−9+15=0, 3−3+0=0.
Left null space. Track the operations: U‘s third row is R3+R1−2(R2−2R1)=5R1−2R2+R3 of A, and it is zero. So y=(5,−2,1). The zero row records a combination of rows of A that vanishes; that is exactly yTA=O. The dimension count m−r=1 says one such vector is enough. Check: 5(1,3,3,2)−2(2,6,9,5)+(−1,−3,3,0)=(0,0,0,0).
Answer. Column space: {(1,2,−1),(3,9,3)}. Row space: {(1,3,3,2),(0,0,3,1)}. Null space: {(−3,1,0,0),(−3,0,−1,3)}. Left null space: {(5,−2,1)}. Dimensions 2,2,2,1, adding to n=4 and m=3 in pairs.
Inverses
Definition T
Inverse matrix
Let A be an n×n matrix. An inverse matrix of A is an n×n matrix B with AB=BA=I, where I is the identity matrix. If it exists, it is unique (2.4), written A−1, and A is called invertible (Apostol: nonsingular; a matrix with no inverse is singular). Since (AB)x=A(Bx), this says the map x↦Bx is the inverse of the map x↦Ax.
In one lineFor a square matrix A, a matrix B with AB=BA=I. It is written A−1.
Why it existsIt undoes A: A−1b is the solution of Ax=b.
Apostol defines “nonsingular” with a left inverse only (BA=I). The next theorem shows that for square matrices this is equivalent.
Theorem TApostol Thm 2.20
A left inverse of a square matrix is a full inverse
Let A,B be n×n matrices with BA=I. Then A is invertible and B=A−1.
In one lineIf A and B are n×n and BA=I, then AB=I too, so B=A−1.
Why it is trueBA=I forces the null space of A to be zero, and for a map from Rn to itself that makes the map one-to-one and onto.
ProofApostol 2.19
The idea: Show that A is one-to-one, hence onto by dimension counting, hence invertible. Then identify B with the inverse.
x=Ix=(BA)x=B(Ax)=BO=O. So N(A)={O}.
Suppose Ax=O. Multiply by B on the left.
So x↦Ax is one-to-one.
2.4, 'Equivalent forms of one-to-one for linear maps': a linear map is one-to-one exactly when its null space is only O.
The map is also onto, so it has an inverse map on all of Rn. Let C be the matrix of that inverse, so AC=CA=I.
2.4, 'One-to-one in finite dimension': the range has dimension n, and a dimension-n subspace of Rn is all of Rn (2.2). Then 2.5, 'The matrix of an inverse is the inverse of the matrix', gives a matrix C with AC=CA=I.
B=BI=B(AC)=(BA)C=IC=C.
Associativity of matrix multiplication (2.5), then AC=I and BA=I.
So AB=I as well, and B=A−1.
C is the inverse, so AC=I.
Proof workshopMatch each line of the left-inverse proof to its reason
Each line of the proof is shown in order. Choose the reason that justifies it, then press Check.
Suppose Ax=O. Then x=Ix=(BA)x=B(Ax)=BO=O.
So N(A)={O} and x↦Ax is one-to-one.
The range has dimension n, so it is all of Rn and the map is onto.
There is a matrix C with AC=CA=I.
B=BI=B(AC)=(BA)C=IC=C.
So AB=AC=I, and B=A−1.
The method for computing inverses needs a way to say “do a row operation” as a matrix.
Definition T
Elementary matrix
An elementary matrix is an n×n matrix obtained from I by one row operation: swapping two rows, scaling a row by c=0, or adding c times a row to another row.
In one lineThe matrix you get by doing one row operation to the identity matrix.
Why it existsMultiplying by an elementary matrix on the left does that row operation. So a whole row reduction is one matrix product.
For n=3: 010100001 swaps rows 1 and 2; 10001000c scales row 3; 1−30010001 is "R2→R2−3R1" done to I.
Theorem TApostol 2.19 (implicit); Strang
Row operations are multiplication by elementary matrices
Let E be the elementary matrix of a row operation. Then for every matrix A with n rows, EA equals A after that row operation. Also E is invertible, and E−1 is the elementary matrix of the opposite operation.
In one lineDoing a row operation to A gives the same result as multiplying A on the left by the elementary matrix of that operation. Elementary matrices are invertible, with elementary inverses.
Why it is trueRow k of EA is a combination of rows of A with coefficients taken from row k of E, and an elementary E has very simple rows.
ProofStrang 2.3
The idea: Compute the rows of EA, case by case. Then use that every row operation has an opposite.
Row k of EA is the combination of the rows of A whose coefficients are the entries of row k of E.
Matrix multiplication (2.5): (EA)kj=∑lEklAlj, so row k of EA is ∑lEkl⋅(row l of A).
Swap: row i of EA is row j of A, row j of EA is row i of A, and the others are unchanged.
Rows of E for a swap of rows i,j: row i is ej, row j is ei, other rows ek. Each picks out one row of A.
Scale: row i of EA is c times row i of A, and the others are unchanged.
Row i of E is cei, other rows ek.
Add: row j of EA is (row j of A) +c (row i of A), and the others are unchanged.
For Rj→Rj+cRi, row j of E is ej+cei, other rows ek.
E′E=I. By the same reasoning with the roles swapped, EE′=I. So E−1=E′.
Let E′ be the elementary matrix of the opposite operation. Doing the operation and then its opposite returns any matrix to itself, so E′(EA)=A for all A. Take A=I.
Worked example
Find the elementary matrix E that does R₂ → R₂ − 3R₁ on a 3 by 3 matrix, and its inverse
Solution.
Apply the operation to I. Row 2 of I is (0,1,0); subtract 3×(1,0,0) to get (−3,1,0). So E=1−30010001. By definition, E is I with the operation done to it.
Write the opposite operation. It is R2→R2+3R1, so E−1=130010001. Adding 3R1 undoes subtracting 3R1.
Check.E−1E: row 2 is 3(1,0,0)+(−3,1,0)=(0,1,0), and the other rows are those of I. So E−1E=I. Always confirm an inverse by multiplying.
Answer.E and E−1 as above.
Theorem TApostol 2.19 and 2.20; Spagnolie Lecture 13 page 5
Computing the inverse by row reducing [A | I]
Let A be n×n and let [R∣B] be the RREF of [A∣I]. If R=I, then A is invertible and B=A−1. If R=I, then A is not invertible.
In one lineRow reduce [A∣I]. If the left block becomes I, the right block is A−1. If the left block cannot become I, A has no inverse.
Why it is trueRow reducing with A on the left solves Abj=ej for every column bj of the inverse at once.
ProofApostol 2.19; Spagnolie Lecture 13
The idea: Row operations are left multiplication by one matrix P. It turns A into R and I into P. If R = I then P is a left inverse of A.
The whole reduction multiplies [A∣I] on the left by one matrix P=Ek⋯E1: [PA∣PI]=[R∣B]. So R=PA and B=P.
Each operation is left multiplication by an elementary matrix (previous theorem); do them one after another and multiply the matrices together.
If R=I, then BA=I.
Substitute R=I and B=P.
So A is invertible and B=A−1.
Theorem: a left inverse of a square matrix is the inverse.
If R=I, then R has fewer than n pivots, so at least one free variable.
An n×n RREF with n pivots has a pivot in every row and column, hence a 1 on each diagonal position and zeros elsewhere: it is I. So R=I means fewer than n pivots.
So N(A)={O}, so x↦Ax is not one-to-one, so A is not invertible.
Free variable means N(R)={O}, and N(A)=N(R) by the row-operations theorem.
Why does this work, in words? Write A−1 column by column as [b1∣⋯∣bn]. The equation AA−1=I says Abj=ej for each j: n systems with the same coefficient matrix A and different right sides. Row operations on [A∣e1∣⋯∣en] solve all n at once, as Spagnolie said. Applying the same row operations to I is the bookkeeping of what the operations did.
Worked example method of Apostol 2.19 and 2.20 #15
Find the inverse of A with rows (1, 2, 3), (0, 1, 4), (5, 6, 0)
Solution.
Form [A∣I]. Put the 3×3 identity to the right of A. The right block will record what the row operations do to I.
Reduce to echelon form. Subtract 5R1 from R3, then add 4R2 to R3. The left block becomes upper triangular with three pivots, each 1. Three pivots means A is invertible.
Clear above the pivots and finish. Use R3 to clear column 3, then R2 to clear column 2. That turns the left block into I without needing any scaling.
Read A−1 from the right block, then check.
Check one entry of AA−1: row 3 of A times column 1 of A−1 is 5(−24)+6(20)+0(−5)=0, and row 3 times column 3 is 5(5)+6(−4)+0=1.
Answer.A−1=−2420−518−1545−41.
Your answerRow reduce [A∣I] for A=100110011. What is the entry in row 1, column 3 of A−1?
The left block is already upper triangular. Clear column 3 above its pivot first, then column 2.
Clear above the pivots. R2→R2−R3 turns row 2 of the right block from (0,1,0) into (0,1,−1). Then R1→R1−R2 turns row 1 from (1,0,0) into (1,−1,1). So A−1=100−1101−11, and the entry is 1. Check: row 1 of A times column 3 of A−1 is 1⋅1+1⋅(−1)+0=0, as it should be for an off-diagonal entry of I.
For a 2×2 matrix the same reduction in letters gives the formula you may know from JEE. Reduce [acbd1001] (assume a=0): subtract acR1 from R2 to get the second pivot d−abc=aad−bc. The matrix has two pivots, and so is invertible, exactly when ad−bc=0. Finishing the reduction gives
A−1=ad−bc1[d−c−ba].
(A problem below does all cases.) The number ad−bc is the 2×2 determinant of chapter 2.7.
A non-example: A=[1224]. Reduce [A∣I]: R2→R2−2R1 gives [10201−201]. The left block has a zero row and cannot become I. So A has no inverse. Indeed its second column is twice its first, so A(2,−1)=O.
The invertible matrix theorem
We now have many ways to say the same thing about a square matrix. This list is called the invertible matrix theorem (a name from later courses; Apostol and Spagnolie never list it as one theorem).
Theorem Bassembled from Apostol 2.17 to 2.20 and Spagnolie Lectures 11 to 13
Invertible matrix theorem
For an n×n matrix A with T(x)=Ax, the following are equivalent:
A is invertible.
T is one-to-one.
N(A)={O}: the only solution of Ax=O is x=O.
The columns of A are linearly independent.
rankA=n.
The columns of A span Rn (the column space is Rn).
T is onto.
Ax=b has exactly one solution for every b∈Rn.
A has n pivots (no free variables), and its RREF is I.
A is a product of elementary matrices.
AT is invertible. (So the rows are independent and span too.)
Chapter 2.7 adds one more: detA=0.
In one lineFor an n×n matrix A, eleven conditions are equivalent: invertible, one-to-one, null space zero, independent columns, rank n, columns span Rn, onto, a unique solution for every b, n pivots, product of elementary matrices, invertible transpose.
Why it is trueA square matrix has as many unknowns as equations, so losing nothing (null space zero) and reaching everything (onto) are the same, by rank–nullity.
ProofApostol 2.19 and 2.20; Spagnolie Lecture 13 page 5
The idea: Link the conditions in a loop of implications, each one a result you already have.
(1) ⇒ (2) and (1) ⇒ (7).
Let B be the inverse matrix, so BA=AB=I. If Ax=Ay, multiply by B on the left: x=BAx=BAy=y. For onto, any b equals A(Bb).
(2) and (7) together are the same as (8).
'Exactly one solution for every b' is 'at least one solution for every b' (onto) together with 'at most one' (one-to-one, since two solutions of Ax=b differ by a null vector).
(2) ⇔ (3).
If Ax=Ay then A(x−y)=O, so x−y∈N(A). Conversely O and x would both map to O if x∈N(A) non-zero.
(3) ⇔ (4).
Ax=∑xjaj. 'Only trivial combination of the columns is O' is the definition of linear independence.
(3) ⇔ (5).
Rank–nullity: n=rank+nullity, so nullity 0 means rank n.
(5) ⇔ (6) ⇔ (7).
The range is the column space, a subspace of Rn. A subspace of dimension n in Rn is all of Rn (2.2).
(2) and (7) together give (1). With the steps above, every one of (1) to (8) now implies every other.
(3) gives (2) and (5) gives (7), so T is one-to-one and onto. Then 2.5, 'The matrix of an inverse is the inverse of the matrix', and 2.4 give a two-sided inverse map, whose matrix B has AB=BA=I.
(3) ⇔ (9).
Rank–nullity theorem read off the staircase: nullity is the number of free variables. No free variables with n columns means n pivots, and n pivots in an n×n RREF force I.
(9) ⇒ (10).
If the RREF is I, the operations multiply A to I, so Ek⋯E1A=I and A=E1−1⋯Ek−1, a product of elementary matrices.
(10) ⇒ (1).
Elementary matrices are invertible, and a product of invertible matrices is invertible with inverse the product of inverses in reverse order.
(1) ⇔ (11).
Row rank equals column rank (theorem above), so rankAT=rankA, and (5) for A is (5) for AT.
In the picture. “Shear” in the viewer is an invertible matrix: no direction is squashed (null space zero), every point is reached (onto), and “Undo the map” is the inverse. “Squash to a line” fails every condition on the list at once.
Quick checkA 4×4 matrix has rank 3. Which statement is true?
Rank 3 with 4 columns means nullity 4−3=1, so there is a non-zero null vector and the matrix is not invertible. Square size alone never makes a matrix invertible; only rank 4 does.Review: rank–nullity
Worked example Apostol 2.21 #2(e); MATH 375 HW7
Let A be a square matrix with A³ = O. Show that A − I is invertible
Solution.
Choose the cheapest equivalent condition. To show A−I is invertible, it is enough to show its null space is {O}. Condition 3 of the invertible matrix theorem: for a square matrix, trivial null space already means invertible.
Take an arbitrary vector in the null space. Let (A−I)x=O. Then Ax=x. Rewrite the equation so that A acts on x and gives x back.
Apply A again and again.A2x=A(Ax)=Ax=x, and then A3x=x. Each time A hits x it returns x.
Use the hypothesis.A3x=Ox=O, so x=O. We found two values for A3x, namely x and O, so they are equal.
Conclude.N(A−I)={O}, so A−I is invertible.
Answer. Yes. (Alternatively, (A−I)(A2+A+I)=A3−I=−I shows the inverse is −(A2+A+I).)
Worked example new, JEE style (compare Apostol 2.20 #8)
Find all values of a and b for which x + y + z = 6, x + 2y + 3z = 10, x + 2y + az = b has no solution, exactly one, or infinitely many
Solution.
Eliminate. Subtract R1 from R2 and from R3: y+2z=4 and y+(a−1)z=b−6. Then subtract the new R2 from R3. Clear column 1 below the pivot, then column 2.
Look at the last row. It is (a−3)z=b−10. This is the only row where a and b matter, so it decides everything.
Case a=3. Then z=a−3b−10, and y,x follow. Three pivots: exactly one solution for every b. Condition 9 of the theorem: the matrix is invertible, so every b gives a unique solution.
Case a=3, b=10. The last row is 0=0. Two pivots, z free: y=4−2z, x=6−y−z=2+z. The solutions are (2,4,0)+t(1,−2,1). Consistent with a free variable gives a line of solutions.
Case a=3, b=10. The last row is 0=b−10=0. A pivot in the last column: no solution.
Answer. Unique solution if a=3. Infinitely many if a=3 and b=10. None if a=3 and b=10.
Your answerFor the system x+2y=3, 2x+ay=7, there is NOT exactly one solution for exactly one value of a. Which value?
Eliminate x from the second equation and look at the coefficient of y.
R2→R2−2R1 gives (a−4)y=1. If a=4 this gives one value of y, then one x. If a=4 the row reads 0=1, a pivot in the last column, so there is no solution at all. The value is a=4 (the columns (1,2) and (2,a) are parallel exactly then).
Beyond: remembering the row operations (LU)
Beyond the course: for understanding· LU decomposition, the form that numerical libraries store
Write down, as you eliminate, the multiplier used in each step “subtract ℓij× row j from row i”. In the Lecture 12 example, A=24−21−67102, the multipliers were ℓ21=2, ℓ31=−1 (adding R1 is subtracting −1⋅R1) and ℓ32=−1. The echelon form was U=2001−801−21. Put the multipliers into a lower triangular matrix L with ones on the diagonal:
A=LU,L=12−101−1001,U=2001−801−21.
Check the first column of LU: it is 2 times the first column of L (because the first column of U is (2,0,0)), which is (2,4,−2), the first column of A. The reason it works: each step is multiplication by an elementary matrix, E3E2E1A=U, so A=E1−1E2−1E3−1U, and the product of the inverses is lower triangular and has the multipliers as its entries. Solving Ax=b becomes two cheap triangular solves, Ly=b then Ux=y. The costly part (about n3/3 steps) is done once; every new b costs only about n2. If a zero pivot forces a row swap, the factorization becomes PA=LU with a permutation matrix P. This is CS 532 material.
Examples and non-examples
The worked examples above cover each kind of question: deciding solvability by columns, a unique solution, infinitely many, none, a parameter family, bases for the four subspaces, an inverse, and a proof using the null space. Here are two further reminders of what elimination does not allow.
Not a row operation: multiplying a row by zero. Replacing R2 by 0⋅R2 turns the equation x+y=3 into 0=0. That loses information, and the undoing step would need to divide by zero. This is why the scale operation requires c=0.
Not allowed: swapping columns without relabelling. Swapping two columns of A swaps two unknowns. Lecture 12 marks this in the margin with “not reordered!” next to the unknowns. You may reorder the equations (rows) freely. Reordering the columns changes what each unknown means, so you must carry the relabelling along.
A singular square system.x+2y=3, 2x+4y=6 has 2 equations and 2 unknowns, yet infinitely many solutions (3,0)+t(−2,1). A square shape does not guarantee a unique solution. Only rank n does.
Where it is used
Used inside maths· Inside maths: every find-the-coefficients problem is a system
Fitting a polynomial through points is a linear system in the coefficients. To find the quadratic p(x)=c0+c1x+c2x2 through (1,2), (2,3), (4,9), write p(1)=c0+c1+c2=2, p(2)=c0+2c1+4c2=3 and p(4)=c0+4c1+16c2=9. Subtracting row 1 from row 2 and row 2 from row 3 gives c1+3c2=1 and 2c1+12c2=6, so c1+6c2=3, hence 3c2=2, c2=32, c1=−1, c0=37. So p(x)=31(7−3x+2x2). Check: p(1)=36=2, p(2)=39=3, p(4)=327=9. The solution is unique because the three columns (1,1,1), (1,2,4), (1,4,16) are independent, which chapter 2.7 will prove with a determinant (Vandermonde). The same method decides whether a vector is in a span, whether vectors are independent, and finds null space bases: all the stepper exercises of chapter 2.2 were small linear systems.
Used in the real world· Circuits: Kirchhoff's laws are a linear system
A 12 V battery drives a current I1 through a 2Ω resistor. The wire then splits: I2 flows through a 3Ω resistor and I3 through a 6Ω resistor, and the branches rejoin. Kirchhoff’s current law (what flows into a junction flows out) gives I1−I2−I3=0. His voltage law (the drops around a loop add up to the battery voltage, with Ohm’s law “drop = resistance times current”) gives 2I1+3I2=12 for the loop through the 3Ω branch and 2I1+6I3=12 for the loop through the 6Ω branch. In matrix form
122−130−106I1I2I3=01212.
Elimination (R2→R2−2R1, R3→R3−2R1, then clearing) gives I1=3 A, I2=2 A, I3=1 A. Check: 3=2+1, 6+6=12, 6+6=12. A third loop equation, around the two resistors only, is 3I2−6I3=0, which is true (6−6) and is just the difference of the other two loop equations. With four equations and three unknowns, the rank is still 3. Circuit simulators such as SPICE do this with a million nodes by exploiting that almost all entries of the matrix are zero.
Used in the real world· Chemistry: balancing an equation is finding a null vector
Burn propane: aC3H8+bO2→cCO2+dH2O. Atoms must balance: carbon 3a=c, hydrogen 8a=2d, oxygen 2b=2c+d. Moving everything to one side gives a homogeneous system with matrix (rows C, H, O; columns a,b,c,d)
380002−10−20−2−1abcd=O.
Rank 3 with 4 unknowns, so the nullity is 1: the solutions are the multiples of one vector, which is why a balanced equation is unique up to scaling. Solving: c=3a, d=4a, 2b=6a+4a, so b=5a. The null vector is (1,5,3,4) and the balanced equation is C3H8+5O2→3CO2+4H2O. Check oxygen: 10=6+4. Rust works the same way: aFe+bO2→cFe2O3 gives a=2c, 2b=3c, null vector (4,3,2), i.e. 4Fe+3O2→2Fe2O3. If the nullity were 2 there would be two independent ways to balance it, which signals a reaction that is really two reactions combined.
Used in the real world· Traffic and pipe networks: conservation at every junction
Four one-way roads form a ring: x1 cars per hour from A to B, x2 from B to C, x3 from C to D, x4 from D to A. From outside, 60 cars/h enter at A and 30 at C, and 40 leave at B and 50 at D. At each junction, cars in equal cars out: A: 60+x4=x1, B: x1=x2+40, C: x2+30=x3, D: x3=x4+50. Row reduction gives rank 3 with one free variable x4=t:
(x1,x2,x3,x4)=(60,20,50,0)+t(1,1,1,1).
Check C: x2+30=50+t=x3. The null vector (1,1,1,1) is a traffic jam circulating round the ring: it adds t cars/h on every road and changes nothing at any junction. Traffic engineers need the free variable, because the network alone cannot say how many cars loop. The system is solvable only because the total entering, 60+30=90, equals the total leaving, 40+50=90. If 100 left instead, b would not be in the column space and there would be no solution. A problem below proves this using the left null space.
Used in the real world· GPS: three distances give a linear system
A phone at an unknown point (x,y) measures its distance to three towers: 5 from (5,5), 13 from (7,13) and 10 from (10,7). Each distance gives a quadratic equation, for example (x−5)2+(y−5)2=25. The trick is to subtract equations: the x2+y2 terms cancel and what remains is linear. Equation 2 minus equation 1 gives −4x−16y=−24, i.e. x+4y=6. Equation 3 minus equation 1 gives −10x−4y=−24, i.e. 5x+2y=12. Eliminate: from the first, x=6−4y; then 30−20y+2y=12 gives y=1 and x=2. Check in equation 1: 9+16=25. Real GPS works in 3D with satellites, and a fourth satellite fixes the unknown error of the phone’s clock. The distance equations are not linear, so the receiver linearizes them around a guess and solves a linear system, again and again, each time with a slightly better guess. The linear systems have more equations than unknowns and are solved by least squares (chapter 2.10).
Beyond the course: for understanding· Why computers avoid the inverse, and what a nearly singular matrix does
Spagnolie’s “computational horror story” (Lecture 13): A=[1111.0001]. Then Ax=(2,2) has solution (2,0), but Ax=(2,2.0001) has solution (1,1). A change of one part in 20,000 in the data moves the answer by an amount of order 1. The two columns are almost parallel, so the matrix is almost singular, and tiny rounding errors get magnified. Such a matrix is called ill-conditioned. This is why libraries solve Ax=b by LU with row swaps (partial pivoting) rather than by computing A−1 and multiplying, which costs more and is less accurate.
Traps
Watch out· Row operations move the column space
Row operations keep the null space, the row space and the dependences among the columns. They do not keep the column space (Lecture 13: [111100] versus [101000]). So a basis of the column space is the pivot columns of the ORIGINAL A. Midterm 2 (Fall 2025), Problem 2(b), asks for a basis of the range of a map, and the correct answer takes columns 1 and 4 of the matrix itself, then translates back to polynomials. When you solve Ax=c by operating on A, you must also apply every operation to c.
Watch out· [0 0 0 | 0] is harmless, [0 0 0 | c] is fatal
A zero row in the augmented matrix with a zero on the right means a redundant equation. A zero row with a non-zero number on the right is 0=c, so there is no solution. The only difference is the last entry.
Watch out· Reorder equations, never unknowns
Swapping rows is free. Swapping columns renames the unknowns. If you swap columns to get a nicer pivot, keep a note of which unknown each column now belongs to, or just don’t.
Watch out· A sign slip in the printed Lecture 12 notes, and the habit that catches it
In the four-unknown example, the notes give the null vector (−21,−1,0,1). The correct vector is (21,−1,0,1). The slip happens when solving x=41−21(2+z−u)−41z: the u term carries a plus sign. Multiply the proposed null vector by A. The row (4,2,1,0) applied to the wrong vector gives −4, not 0. Spagnolie’s own advice, scribbled in Lecture 13, is “always check”.
Watch out· Shape does not decide the number of solutions
A square system can have none or infinitely many solutions (the example x+2y=3, 2x+4y=6). A system with more equations than unknowns can have one solution (when the extra equations are consequences of the others). Only the rank, counted by pivots, decides. Lecture 12 notes that “this can certainly happen with square matrices as well”.
Watch out· One solution for one b does not make a non-square matrix invertible
For the 3×2 matrix with rows (1,0),(0,1),(0,0), the system Ax=(1,2,0) has exactly one solution, but only some right sides are reachable and A has no inverse. Invertibility belongs to square matrices, and for those, one solution for any single b gives N(A)={O} and hence invertibility.
Problems
check
The reduced form of an augmented matrix is 1000102−10340. Which columns are pivot columns, which unknown is free, and what is the general solution?
Solution
Pivots are in columns 1 and 2, so x3 is free. Row 1 gives x1=3−2x3 and row 2 gives x2=4+x3. Putting x3=t, the solution is (3,4,0)+t(−2,1,1).
check
A 5×7 matrix has 3 pivots. State the dimensions of its column space, row space, null space and left null space.
Solution
Column space 3, row space 3, null space 7−3=4, left null space 5−3=2.
check
Write the 3×3 elementary matrix for R1↔R3. What is its inverse?
Solution
It is I with rows 1 and 3 swapped: 001010100. Swapping again undoes the swap, so it is its own inverse.
check
True or false: if Ax=b has exactly one solution for some b, then A is invertible. Consider (a) A square, (b) A not square.
Solution
(a) True. If x is the only solution, then N(A)={O}, since a non-zero y∈N(A) would give a second solution x+y. By the invertible matrix theorem a square matrix with trivial null space is invertible. (b) False for the 3×2 matrix with rows (1,0),(0,1),(0,0): the system Ax=(1,2,0) has the single solution (1,2), but non-square matrices have no inverse.
useApostol 2.20 #1
Solve x+y+3z=5, 2x−y+4z=11, −y+z=3 by Gauss–Jordan elimination.
Solution
Augmented matrix 1201−1−13415113. R2→R2−2R1 gives row 2 as (0,−3,−2∣1). R2→R2−3R3 gives (0,0,−5∣−8), so z=58. Row 3 gives y=z−3=−57. Row 1 gives x=5−y−3z=5+57−524=58. Check: 58−57+524=5; 516+57+532=11; 57+58=3. The solution is (58,−57,58).
useApostol 2.20 #8
Find all solutions of x−2y+z+2u=−2, 2x+3y−z−5u=9, 4x−y+z−u=5, 5x−3y+2z+u=3. Give a particular solution and a basis of the null space.
Solution
R2→R2−2R1, R3→R3−4R1, R4→R4−5R1 give three identical rows (0,7,−3,−9∣13). Subtracting the first of them from the other two leaves two zero rows, so the rank is 2 and z,u are free. From 7y−3z−9u=13: y=713+73z+79u. From row 1: x=−2+2y−z−2u=712−71z+74u. With z=a, u=b the solutions are
(712,713,0,0)+a(−71,73,1,0)+b(74,79,0,1).
The two vectors multiplying a,b are a basis of N(A). Check the first: row 1 gives −71−76+1=0, row 2 gives −72+79−1=0.
useApostol 2.20 #15
Find the inverse of A=1000210032104321.
Solution
Row reduce [A∣I]. The matrix is already upper triangular with 1s on the diagonal, so only clearing above the pivots remains. Use the bottom pivot first: R3→R3−2R4, then R2→R2−3R4−2R3 (using the new R3), then R1→R1−4R4−3R3−2R2 (using the new R3 and R2). Each is a sum of single add-a-multiple operations. The result is
A−1=1000−21001−21001−21.
Check the (1,3) entry of AA−1: 1⋅1+2(−2)+3(1)+4(0)=0, and the (1,4) entry: 0+2−6+4=0. Check (1,2): −2+2=0.
useMidterm 2 (2013 practice) Q1(b), (c)
Let A=123202022 and b=(3,2,5). Find a basis of the null space and all solutions of Ax=b. Then change one entry of b so that there is no solution, and explain.
Solution
Row 3 equals row 1 plus row 2, so the rank is 2 and there is one free variable. Solving Ay=O: the first two rows give y1+2y2=0 and 2y1+2y3=0, so y=t(2,−1,−2). Check: row 3 gives 6−2−4=0. A basis of N(A) is {(2,−1,−2)}. Since b3=5=3+2=b1+b2, the system is consistent. A particular solution is (1,1,0): 1+2=3, 2+0=2, 3+2=5. All solutions: (1,1,0)+t(2,−1,−2). For no solution take b=(3,2,6). Row 3 = row 1 + row 2 forces b3=b1+b2=5 for any solution, so 6 is impossible. The vector (3,2,6) is not in the column space.
usenew, JEE style
For which real k does the homogeneous system x+y+z=0, x+2y+3z=0, x+2y+kz=0 have a non-zero solution? Find it.
Solution
Subtract R1 from R2 and R3, then subtract the new R2 from the new R3: the last equation becomes (k−3)z=0. If k=3, then z=0, then y=0 and x=0: only the zero solution. If k=3, then z is free: y=−2z, x=−y−z=z. The non-zero solutions are t(1,−2,1). Check: 1−2+1=0, 1−4+3=0.
proveApostol 2.20 #11
Prove that A=[acbd] is invertible if and only if ad−bc=0, and that then A−1=ad−bc1[d−c−ba].
Solution
Multiply directly: [acbd][d−c−ba]=[ad−bccd−dc−ab+ba−cb+da]=(ad−bc)I. The product in the other order is also (ad−bc)I by the same computation. So if ad−bc=0, dividing by it shows that the stated matrix is a two-sided inverse.
Now suppose ad−bc=0; we show A is not invertible. Let y=(d,−c) and z=(−b,a), the two columns of the matrix above. The product above says Ay=(ad−bc,0)=O and Az=O. If y and z were both zero, then a=b=c=d=0 and A=O, which has N(A) equal to the whole plane. So in every case at least one of y,z is a non-zero vector of N(A), hence N(A)={O}, and by the invertible matrix theorem A is not invertible.
prove
Prove that if A is an m×n matrix with m<n, then Ax=O has a non-zero solution.
Solution
The range of x↦Ax is inside Rm, so the rank is at most m. By rank–nullity, the nullity is n−rank≥n−m>0. So N(A) contains a non-zero vector. (Equivalently: there are at most m pivots but n>m columns, so some column has no pivot and gives a free variable.)
prove
Prove that rank(AB)≤rankA and rank(AB)≤rankB, for matrices where AB is defined.
Solution
Range of AB: every ABx=A(Bx) is of the form Ay, so the range of AB is inside the range of A. A subspace inside another has dimension at most that of the other (a basis of the smaller is independent in the larger, and independent sets have size at most the dimension). So rankAB≤rankA.
For B: let w1,…,ws be a basis of the range of B, so s=rankB. Every vector in the range of AB is A(Bx) with Bx=∑ciwi, so equals ∑ciAwi. Thus the s vectors Aw1,…,Aws span the range of AB, and a spanning set of s vectors forces dimension at most s (2.2). So rankAB≤rankB.
proveApostol 2.21 #2(c) and (f), adapted
Let A and B be n×n. Prove: if A and B are invertible then AB is invertible with inverse B−1A−1. Prove the converse in this form: if AB is invertible, then A and B are both invertible.
Solution
First part: (AB)(B−1A−1)=A(BB−1)A−1=AA−1=I, using associativity. By the theorem that a one-sided inverse of a square matrix is a full inverse, B−1A−1=(AB)−1.
Converse: argue with null spaces. If Bx=O then (AB)x=A(Bx)=O, and AB is invertible so its null space is {O}, giving x=O. So N(B)={O} and B is invertible by the invertible matrix theorem. Then A=(AB)B−1 is a product of two invertible matrices, hence invertible by the first part.
stretch
Consider the traffic ring in the chapter, with external flows in at A and C, and out at B and D. Using only the equations at the four junctions, prove that if the numbers entering and leaving are (pA,pC) in and (qB,qD) out, a solution can exist only when pA+pC=qB+qD. Which vector in the left null space of the coefficient matrix does your argument use?
Solution
The equations are A: x1−x4=pA, B: x1−x2=qB, C: x2−x3=−pC, D: x3−x4=qD. Form the combination A − B − C − D, which is the row combination with coefficients y=(1,−1,−1,−1). On the left side the coefficient of x1 is 1−1=0, of x2 is +1−1=0, of x3 is +1−1=0, and of x4 is −1+1=0. So the left side vanishes identically, and the right side must vanish too: pA−qB+pC−qD=0. This is the stated condition. The vector y=(1,−1,−1,−1) satisfies yTA=O, so it is in the left null space, and any solvable right side b must satisfy yTb=0. (That this single condition is also enough here is what the rank 3 computation shows. The general statement, that b is in the column space exactly when yTb=0 for every y in the left null space, can be proved with the perpendicularity of chapter 2.9.)
stretch
Let A be an m×n matrix of rank r. Prove that A has an r×r submatrix (choose r rows and r columns and keep the entries where they cross) that is invertible.
Solution
Let P be the m×r matrix formed by the r pivot columns of A. Its columns are independent (the rank theorem), so rankP=r. By the theorem that row rank equals column rank, the row space of P has dimension r. The m rows of P span the row space, and a spanning set contains a basis (2.2), so we can choose r rows of P that are independent. Let Q be the r×r matrix of those rows. Its rows are independent, so its row space is r-dimensional, hence its column space is r-dimensional by the same theorem, and rankQ=r. By the invertible matrix theorem Q is invertible. Q consists of the entries of A in the chosen r rows and the r pivot columns, so it is the required submatrix.
Summary
Ax=b asks whether b is in the range of x↦Ax. The range is the column space, spanned by the columns, because Ax=x1a1+⋯+xnan.
The solution set is empty, or one particular solution plus the null space. So there are 0, 1 or infinitely many solutions, never exactly two.
The three row operations (swap, scale by non-zero, add a multiple) never change the solutions, because each is undone by another. Elimination uses them to reach echelon form and then reduced row echelon form.
Pivots are the staircase corners. Pivot columns of the original A are a basis of the column space. Free variables, one per non-pivot column, give a basis of the null space. So rank = number of pivots, and nullity = number of free variables.
Four fundamental subspaces: column space and row space have dimension r, null space n−r, left null space m−r. In particular rank A = rank AT.
Row reducing [A∣I] to [I∣A−1] computes the inverse, because row operations are left multiplication by elementary matrices. If the left block cannot reach I, A is not invertible.
For a square matrix, invertible, one-to-one, onto, trivial null space, independent columns, rank n, n pivots, and unique solutions are all the same statement. Chapter 2.7 adds detA=0.
Real systems (circuits, chemical balance, traffic, GPS) are linear systems. A free variable or null vector is meaningful there, and an inconsistent system means an impossible measurement.
Watch and read
The same ideas explained by someone else. Use these when an explanation here does not land.
CS 240: Elimination is an algorithm, and its correctness proof is a loop invariant: after every row operation the solution set is unchanged. That is the theorem on row operations below.
CS 532: Gaussian elimination costs about n cubed over 3 multiplications for an n by n system. Storing the multipliers gives the LU decomposition, which makes every further right-hand side cost only n squared. numpy.linalg.solve is exactly this, with row swaps for safety.
MATH 376: Systems of differential equations y' = Ay are solved by finding null spaces of A minus lambda times I. Each null space is found by the row reduction in this chapter.
AI: Fitting a linear regression leads to a square system called the normal equations (chapter 2.10), which libraries solve by elimination, never by forming an inverse.