Chalk−1

Math · Precalculus · Concept

Matrix row reduction, determinants and inverses

A matrix is a rectangular array of numbers. Writing a linear system as an augmented matrix lets you solve it with three row operations that never change the solutions, and the reduced row echelon form shows the answer directly. Row reduction also shows when a system has no solution, or a free variable and infinitely many. A square matrix has an inverse exactly when its determinant is not zero.

Try one — Chalk checks each line

A concrete case

Elimination without the letters

Solve x+2⁢y=8 and 3⁢x+4⁢y=18 by elimination, and watch what changes from line to line. Subtracting 3 times the first equation from the second gives −2⁢y=−6. Dividing by −2 gives y=3, and subtracting 2⁢y from the first equation leaves x=2.

The letters x and y never moved. Every step changed only the numbers in front of them and the numbers on the right. The right column of the table keeps only those numbers, one row per equation, and goes through the same steps without writing a single letter.

The last rows read 1, 0, 2 and 0, 1, 3, which say x=2 and y=3. Both check, since 2+6=8 and 6+12=18.

[1283418]→[102013]
The same elimination, with and without letters
StepThe equationsThe rows of numbers
Startx+2⁢y =8 and 3⁢x+4⁢y =181, 2, 8 and 3, 4, 18
Second minus 3 times firstx+2⁢y =8 and −2⁢y=−61, 2, 8 and 0, −2, −6
Divide the second by −2x+2⁢y =8 and y=31, 2, 8 and 0, 1, 3
First minus 2 times secondx=2 and y=31, 0, 2 and 0, 1, 3

The rule

Augmented matrices and row operations

A matrix is a rectangular array of numbers, and an m×n matrix has m rows and n columns. The augmented matrix of a linear system puts each equation on one row. The coefficients of x, y and z fill the first columns, a 0 stands for a missing variable, and the constants sit to the right of a vertical bar that stands for the equals signs.

Three row operations are allowed. Swap two rows, written Ri↔Rj. Multiply a row by a nonzero number c, written cRi. Replace a row with itself plus a multiple of another row, written Ri+cRj. None of them changes the solutions of the system.

{x+y+z=62⁢x−y+z=3x+2⁢y−z=2[11162−11312−12]
{x+y+z=62⁢x−y+z=3x+2⁢y−z=2[11162−11312−12]

Echelon forms, and what they say

The pivot of a row is its first nonzero entry. A matrix is in row echelon form when any rows of zeros sit at the bottom, each pivot lies to the right of the pivot above it, and every entry below a pivot is 0. Some courses also ask for each pivot to be 1. Reduced row echelon form, or RREF, goes further, and every pivot is 1 and is the only nonzero entry in its column.

The echelon form tells you how many solutions there are. A row that reads 0=c with c≠0 means no solution, and the system is called inconsistent. Otherwise, a column on the left with no pivot belongs to a free variable, which can take any value, and there are infinitely many solutions. With a pivot in every column on the left, there is exactly one.

Determinants and inverses

A square matrix has as many rows as columns. The determinant of a 2×2 matrix with rows a, b and c, d is a⁢d−b⁢c. A 3×3 determinant expands along a row. Each entry multiplies the 2×2 determinant left when its row and column are crossed out, with the signs +, −, + across the first row.

The identity matrix I has 1s down its diagonal and 0s elsewhere, and multiplying by it changes nothing. The inverse A−1 of a square matrix A is the matrix with AA−1=A−1A=I. It exists exactly when detA≠0. A 2×2 inverse swaps the diagonal entries, changes the signs of the other two and divides by the determinant. Then the system A⁢X=B has the one solution X=A−1B.

det(abcd)=a⁢d−b⁢c,(abcd)−1=1a⁢d−b⁢c(d−b−ca)
det(abcd)=a⁢d−b⁢c(abcd)−1=1a⁢d−b⁢c(d−b−ca)

Why it works

Why the row operations are safe

Each row operation can be undone by another of the same kind. A swap is undone by swapping back. Multiplying a row by c is undone by multiplying by 1⁢/⁢c, which is why c may not be 0. Adding c times row j to row i is undone by subtracting c times row j again.

Any solution of the old system satisfies the new one, because each new row is built from true equations. Undoing the operation shows the reverse, so the new system has exactly the same solutions as the old. Multiplying a row by 0 cannot be undone, and it would erase an equation.

Where a⁢d−b⁢c comes from

Take the general system a⁢x+by=e and c⁢x+d⁢y=f, and eliminate x. Multiply the first equation by c and the second by a, then subtract. The x-terms cancel and (a⁢d−b⁢c)⁢y=a⁢f−c⁢e is left.

If a⁢d−b⁢c is not 0, divide by it, and y has exactly one value. If a⁢d−b⁢c=0, the left side vanishes and 0=a⁢f−c⁢e remains. Either that is false, and no pair works, or it is 0=0, and the elimination no longer pins down y. Either way there is no single answer: no solution or infinitely many, never exactly one. The determinant is the number that decides.

In the opening case, a⁢d−b⁢c =1⋅4−2⋅3 =−2, the same −2 that appeared in front of y. Multiplying the matrix by its claimed inverse gives (a⁢d−b⁢c) times I divided by a⁢d−b⁢c, which is I, and this proves the 2×2 inverse formula.

The method

Gaussian elimination, step by step

Elimination on the augmented matrix works one column at a time, left to right. The table follows the first worked example below, x+y+z=6, 2⁢x−y+z=3 and x+2⁢y−z=2.

The steps on the first worked example
StepWhat to doFor this system
1Write the augmented matrix, with 0 for any missing variableRows 1, 1, 1 ∣ 6 and 2, −1, 1 ∣ 3 and 1, 2, −1 ∣ 2
2Put a nonzero pivot in the top left, swapping rows if neededThe 1 in row 1 is already there
3Clear the entries below the pivot with Ri+cRjR2−2R1 and R3−R1
4Move one row down and one column right, and repeatSwap R2 and R3, then R3+3R2
5Read the bottom row−7⁢z =−21, so z=3, one solution
6Back-substitute upward, or keep going to RREFy=2, then x=1
7Check in every original equation1+2+3 =6, 2−2+3 =3, 1+4−3 =2

A determinant and an inverse, step by step

For a 2×2 matrix, find a⁢d−b⁢c first. If it is 0, stop, because there is no inverse. Otherwise swap a and d, change the signs of b and c, and divide every entry by a⁢d−b⁢c. Then multiply A by your answer and check that you get I.

For a 3×3 determinant, expand along the row or column with the most zeros, since each 0 removes a term. The signs follow a checkerboard that starts with + in the top left corner. Find each 2×2 determinant, multiply it by its entry and sign, and add.

(+−+−+−+−+)

Where it breaks

Where it breaks

A row operation must act on the whole row, the constant included. Scaling only the coefficients changes the equation, and the solution that follows is wrong.

A row of zeros, 0=0, is not a contradiction. It only says that one equation repeated the information in the others. The row 0, 0, 0 ∣ 4, which says 0=4, is the one that means no solution.

Determinants and inverses belong to square matrices only. A system of two equations in three unknowns has a 2×3 coefficient matrix, which has neither, and row reduction is the tool for it.

The inverse is not the matrix of reciprocals. For the rows 2, 1 and 5, 3, the reciprocals give rows 1⁢/2, 1 and 1⁢/5, 1⁢/3. Its first row times the first column of the matrix gives 1⁢/2⋅2+1⋅5=6, not 1.

Matrix products depend on order, and A⁢B is usually not B⁢A. From A⁢X=B, multiply by A−1 on the left of both sides to get X=A−1B. The product BA−1 is not even defined when B is a single column.

Check your answer

Check your answer

Put the solution into every original equation, not into a row you reduced. A slip made during the reduction cannot show up in the rows it produced.

Find a determinant a second way, by expanding along a different row or column. Both ways give the same value. For an inverse, multiply A by your answer, entry by entry, and look for 1s on the diagonal and 0s elsewhere.

The Matrices & linear systems studio row-reduces a matrix and lists every operation, so you can compare its trail with yours.

A Math box does not read an augmented matrix. A matrix row after a row operation reads ? with “Not checked: Chalk can’t read the notation in this row yet.” To have Chalk check the work, write the system as equations, one per row. The second and third equations read • with “Another equation of the system.” Each new equation and each final value then reads ✓. A slip reads ✗ with “Doesn’t follow from the equations above.” With infinitely many solutions, a row that holds at none of them reads ✗ too, and one that holds at some reads ?. Check one solution in every original equation.

Write a determinant as its expansion with the 2×2 pieces multiplied out, such as detA =2⁢((−1)⁢(0)−(4)⁢(2))−…, and each row below it is checked against that value. A system with no solution in three unknowns is followed too. The right rows that lead to 0=1 read ✓, and “no solution” can go on the row below.

Can a system of two linear equations in three unknowns have exactly one solution?

No. Row reduction leaves at most two leading entries, one per row, so at least one of the three unknowns is free. A consistent system then has infinitely many solutions, one for each value of the free unknown. A row 0=c with c≠0 means none. Two planes in space meet in a line, coincide, or never meet.

Unique answers, large systems and Cramer’s rule

Different choices of row operations lead to different row echelon forms, but every route ends at the same reduced row echelon form. That is why the RREF can be read as the answer.

Computers solve systems with millions of unknowns by this same elimination. The work grows like the cube of the number of unknowns, so ten times as many unknowns take about a thousand times as long. A computer also swaps the largest available entry into each pivot position, because dividing by a tiny pivot magnifies rounding errors.

The formula y=(a⁢f−c⁢e)⁢/⁢(a⁢d−b⁢c) in “Where a⁢d−b⁢c comes from” is Cramer’s rule. Each unknown is a ratio of two determinants, the denominator being detA and the numerator detA with one column replaced by the constants. It is handy for 2×2 systems and slow for large ones.

As a transformation of the plane, a 2×2 matrix scales every area by ∣detA⁢∣, and a negative determinant also flips orientation. Applying A and then B scales area by detA times detB, which is why det(B⁢A)=detB⋅detA.

Common mistakes

  • Leaving the constant out of a row operation. With rows 1, 1, 1 ∣ 6 and 2, −1, 1 ∣ 3, the operation R2−2R1 gives 0, −3, −1 ∣ −9, not 0, −3, −1 ∣ 3, because the constant is part of the equation.
  • Reading a row of zeros as no solution. The row 0, 0, 0 ∣ 0 says 0=0, which is true and only means one equation was redundant. The row 0, 0, 0 ∣ 4 says 0=4, which is false, and that is the row that means no solution.
  • Replacing a row with a multiple of another, such as R2→3R1 instead of R2→R2−3R1. The first throws away equation 2, so the new system can have more solutions than the old. A replacement always keeps the row it changes.
  • Losing a sign in a⁢d−b⁢c. For the rows 4, −2 and 3, 5, the determinant is 4⋅5−(−2)⁢(3) =20+6 =26. Writing 20−6=14 treats b as 2 and drops the minus sign of −2.
  • Forgetting the alternating signs when expanding a 3×3 determinant. The middle entry of the first row takes a minus sign, so the example below gives 2⁢(−8)−1⁢(−4)+3⁢(1) =−9, not 2⁢(−8)+1⁢(−4)+3⁢(1) =−17.
  • Writing X=BA−1 for A⁢X=B. Matrix products depend on order, and with B a single column the product BA−1 is not even defined. Multiplying both sides on the left by A−1 gives X=A−1B.

Key terms

Matrix
A rectangular array of numbers in rows and columns. In a system’s coefficient matrix, each row is an equation and each column belongs to one unknown.
Augmented matrix
A matrix holding a system’s coefficients, with the constants from the right-hand sides added as a last column. That column holds the equations’ values, not another unknown.
Elementary row operation
One of three moves that don’t change a system’s solutions: swap two rows, multiply a row by a nonzero number, or add a multiple of one row to another.
Gaussian elimination
Using elementary row operations to simplify a system into echelon form and solve it. Gauss–Jordan elimination continues until pivots are also cleared above, producing reduced row echelon form.
Pivot
The first nonzero entry of a row once the matrix is in echelon form: the entry elimination uses to clear those below it (and, in Gauss–Jordan elimination, above it). In reduced row echelon form every pivot is 1, alone in its column.
Reduced row echelon form
The simplest form row reduction reaches: each row’s first nonzero entry is a 1, alone in its column and to the right of the one above, with any zero rows at the bottom. The solutions can be read straight off it.
Determinant
A number computed from a square matrix. For [[a,b],[c,d]] it is a⁢d−b⁢c. Its absolute value is the factor by which the matrix scales area or volume, and the matrix has an inverse exactly when it isn’t zero.
Matrix inverse
The matrix A−1 that undoes A: AA−1=A−1A=I. Only square matrices with a nonzero determinant have one.
Identity matrix
A square matrix with 1 on the main diagonal and 0 elsewhere. Multiplying a compatible matrix or vector by it leaves that object unchanged.
Singular matrix
A square matrix with no inverse, which happens exactly when its determinant is 0. A system with a singular coefficient matrix has either no solution or infinitely many.

Work through an example

Solve the system x+y+z=6, 2⁢x−y+z=3, x+2⁢y−z=2 by row reduction.

Solve a 3×3 system with row reduction →

Find the determinant of a 3×3 matrix →

Find the inverse of a 2×2 matrix →

Recognize infinitely many solutions in RREF →

Sources and scope

Authored study material. Tool results depend on the stated inputs and model assumptions.

After reading

Try it, then study it

Open the example in its tool to check steps or change values, then review the key terms as flashcards.

Row-reduce it in Matrices & linear systems Check each equation in Math Study the 10 key terms Open worked example on a board Matrix Transformations in Math Reference

Your existing work stays on this device. Examples open as editable copies.