Row Reduction & Rank

Study Sheet

Row Reduction & Rank

Gaussian elimination and the shape of solution sets

Gaussian Elimination

Tip
Three moves solve every system
xyx + y = 3x − y = 1−2y = −2(2, 1)
Replacing x − y = 1 by −2y = −2 (dashed) changes the line, not the crossing point (2, 1).

Swap two rows, scale a row by a nonzero number, add a multiple of one row to another — none of these changes the solution set. March to echelon form (each leading entry, the pivot, strictly right of the one above). Each pivot pins a variable; each column without a pivot leaves a free variable. Unique solution, infinitely many, or none: the pivots decide.

Each move can be undone by another move of the same kind, and any solution of the old equations satisfies the new ones, since every new equation is built from old ones. So nothing is gained or lost. In the row picture, replacing x−y=1x - y = 1 in the system x+y=3x + y = 3, x−y=1x - y = 1 by (x−y)−(x+y)=1−3(x - y) - (x + y) = 1 - 3, that is −2y=−2-2y = -2, swaps a slanted line for the horizontal line y=1y = 1 — a different line through the same crossing point (2,1)(2, 1). Elimination turns lines into ones that are easier to read without moving the solution.

Tip
Rank and the rank–nullity theorem

The rank is the number of pivots — the true dimension of what the matrix can reach. For an m×nm \times n matrix, (free variables) =n−rank= n - \text{rank}: a 3×53\times5 homogeneous system of rank 33 always has a 22-parameter family of solutions.

Why the count works: after elimination, every column either holds a pivot or it does not. Pivot columns correspond to variables that back-substitution determines; the other n−rankn - \text{rank} columns correspond to variables you may choose freely. Each free choice is one independent direction of solutions of Ax=0A\mathbf x = \mathbf 0, so the columns split exactly as "determined" plus "free": n=rank+nullityn = \text{rank} + \text{nullity}.

Example
Reading consistency off proportions
xyx + 2y = 32x + 4y = 2
At h = 2 the lines are parallel and never meet; at h = 6 the second line lies on the first.

x+2y=3x + 2y = 3 and 2x+4y=h2x + 4y = h: the left sides are proportional, so either h=6h = 6 (same line — infinitely many solutions) or h≠6h \ne 6 (parallel lines — none). Elimination makes the dichotomy mechanical.

In the row picture the left sides x+2yx + 2y and 2x+4y2x + 4y describe parallel lines, since the second is twice the first. Elimination says the same thing: R2←R2−2R1R_2 \gets R_2 - 2R_1 turns the second row into (0,0∣h−6)(0, 0 \mid h - 6), which reads 0=h−60 = h - 6. At h=6h = 6 that row is empty and one line is left (infinitely many solutions); at any other hh, for instance h=2h = 2, it is the false statement 0=−40 = -4 and the lines never meet.

Side note
Significance: the most-executed algorithm on Earth

Every engineering simulation, circuit solver, weather model, and structural analysis ends in a huge linear system, and Gaussian elimination (with clever pivoting) is how they are all solved. Its cost — about n33\tfrac{n^3}{3} operations — is a number every computational scientist knows by heart.

Try it
Try it: read the verdict without finishing

A system reduces to the echelon rows (1,2∣5)(1, 2 \mid 5), (0,3∣6)(0, 3 \mid 6), (0,0∣c)(0, 0 \mid c). For which cc is it consistent, and what is the solution then?

Show the answer

The last row says 0x+0y=c0x + 0y = c, that is 0=c0 = c. If c≠0c \ne 0 that is false, so there is no solution at all. If c=0c = 0 the row is empty and drops out, leaving two pivots for two variables — no free variable, so exactly one solution. Back-substitute from the bottom: 3y=63y = 6 gives y=2y = 2; then x+2⋅2=5x + 2\cdot2 = 5 gives x=1x = 1. So the system is consistent only for c=0c = 0, with the unique solution (x,y)=(1,2)(x, y) = (1, 2). One look at the echelon form settles existence, uniqueness, and the answer.

Reduced Echelon Form and Free Variables

Tip
Pivot variables in terms of free ones

Keep going past echelon form: scale each pivot to 11 and clear the entries above it too. The result is the reduced row echelon form (RREF), and it is unique. Each nonzero row then reads "one pivot variable == a number minus a combination of free variables." Setting the free variables to parameters s,t,…s, t, \ldots writes every solution as

x=xp+s n1+t n2+⋯ ,\mathbf x = \mathbf x_p + s\,\mathbf n_1 + t\,\mathbf n_2 + \cdots,

a particular solution plus a combination of null-space vectors.

The shape of the answer follows from linearity. If Axp=bA\mathbf x_p = \mathbf b and An=0A\mathbf n = \mathbf 0, then A(xp+n)=b+0=bA(\mathbf x_p + \mathbf n) = \mathbf b + \mathbf 0 = \mathbf b; conversely, two solutions of Ax=bA\mathbf x = \mathbf b differ by a solution of Ax=0A\mathbf x = \mathbf 0. So the full solution set is one solution shifted by the whole null space, and the free variables are exactly the coordinates on that null space — one parameter per pivotless column.

Example
Worked: two equations, three unknowns

Solve x+2y−z=3x + 2y - z = 3, 2x+4y+z=92x + 4y + z = 9. Clear below the first pivot with R2←R2−2R1R_2 \gets R_2 - 2R_1: the second row becomes (0,0,3∣3)(0, 0, 3 \mid 3). The yy-column got no pivot, so yy is free.

Row 2 now says 3z=33z = 3, so z=1z = 1. Row 1 says x=3−2y+z=4−2yx = 3 - 2y + z = 4 - 2y. Name the free variable y=ty = t:

(x,y,z)=(4−2t, t, 1)=(4,0,1)+t(−2,1,0).(x, y, z) = (4 - 2t,\ t,\ 1) = (4, 0, 1) + t(-2, 1, 0).

Check in the original equations: (4−2t)+2t−1=3(4 - 2t) + 2t - 1 = 3 ✓ and 2(4−2t)+4t+1=92(4 - 2t) + 4t + 1 = 9 ✓ for every tt. Geometrically, two planes in R3\mathbb R^3 that are not parallel meet in a line, and this is that line: through (4,0,1)(4, 0, 1) in the direction (−2,1,0)(-2, 1, 0).

Example
Worked: the RREF of a 3×4 system

Solve the system with augmented matrix [1201424141112137]\left[\begin{array}{cccc|c}1&2&0&1&4\\2&4&1&4&11\\1&2&1&3&7\end{array}\right]. Clear column 1: R2←R2−2R1R_2 \gets R_2 - 2R_1 and R3←R3−R1R_3 \gets R_3 - R_1 both give (0,0,1,2∣3)(0, 0, 1, 2 \mid 3). Then R3←R3−R2R_3 \gets R_3 - R_2 gives a zero row.

The RREF is [120140012300000]\left[\begin{array}{cccc|c}1&2&0&1&4\\0&0&1&2&3\\0&0&0&0&0\end{array}\right]: pivots in columns 1 and 3, so x2=sx_2 = s and x4=tx_4 = t are free. Read each row as "pivot variable == …": x1=4−2s−tx_1 = 4 - 2s - t and x3=3−2tx_3 = 3 - 2t. So

x=(4,0,3,0)+s(−2,1,0,0)+t(−1,0,−2,1).\mathbf x = (4, 0, 3, 0) + s(-2, 1, 0, 0) + t(-1, 0, -2, 1).

The zero row was the third equation repeating information (row 3 == row 2 −- row 1 in the original), so it constrains nothing. Audit: rank 22 and nullity 22 add to the 44 columns, as rank–nullity demands.

Example
Worked: a parameter that changes the verdict

For which kk does x+y+z=1x + y + z = 1, x+2y+3z=2x + 2y + 3z = 2, x+3y+kz=3x + 3y + kz = 3 have exactly one solution? Eliminate: R2−R1R_2 - R_1 gives (0,1,2∣1)(0, 1, 2 \mid 1) and R3−R1R_3 - R_1 gives (0,2,k−1∣2)(0, 2, k - 1 \mid 2); then R3−2R2R_3 - 2R_2 gives (0,0,k−5∣0)(0, 0, k - 5 \mid 0).

If k≠5k \ne 5, the last row has a nonzero pivot k−5k - 5, so there are three pivots and a unique solution: (k−5)z=0(k - 5)z = 0 gives z=0z = 0, then y=1−2z=1y = 1 - 2z = 1, then x=1−y−z=0x = 1 - y - z = 0. Check in the third equation: 0+3+0=30 + 3 + 0 = 3 ✓. If k=5k = 5, the last row is all zeros — zz becomes free and there are infinitely many solutions. There is no value of kk with no solution, because the right-hand entry of that row is 00 for every kk. The case split is not optional: dividing by k−5k - 5 without asking whether it is zero would miss the whole line of solutions at k=5k = 5.

Side note
Where it goes wrong: a free variable is not zero

In the first example it is tempting to set the free variable to 00 and report "the solution (4,0,1)(4, 0, 1)." That is one solution, not the answer: (2,1,1)(2, 1, 1) also works (2+2−1=32 + 2 - 1 = 3 and 4+4+1=94 + 4 + 1 = 9), and so does every point (4−2t,t,1)(4 - 2t, t, 1). A pivotless column means infinitely many solutions, and the answer must carry the parameter.

Try it
Try it: the general solution

Solve x−y+2z=1x - y + 2z = 1, 2x−2y+5z=42x - 2y + 5z = 4 and write every solution as a particular solution plus a multiple of a null-space vector.

Show the answer

Eliminate: R2←R2−2R1R_2 \gets R_2 - 2R_1 gives (0,0,1∣2)(0, 0, 1 \mid 2), so z=2z = 2. The yy-column has no pivot, so y=ty = t is free. Row 1 gives x=1+y−2z=t−3x = 1 + y - 2z = t - 3. So

(x,y,z)=(−3,0,2)+t(1,1,0).(x, y, z) = (-3, 0, 2) + t(1, 1, 0).

Check: (t−3)−t+4=1(t - 3) - t + 4 = 1 ✓ and 2(t−3)−2t+10=42(t - 3) - 2t + 10 = 4 ✓. The null-space direction (1,1,0)(1, 1, 0) solves the homogeneous system: 1−1+0=01 - 1 + 0 = 0 and 2−2+0=02 - 2 + 0 = 0.

Elimination as a Factorization: A = LU

Tip
Elimination records itself

When elimination needs no row swaps, it factors A=LUA = LU: UU is the echelon form (upper triangular) and LL is lower triangular with 11s on the diagonal and, below it, the multipliers used — the entry ℓij\ell_{ij} is the number mm in the step Ri←Ri−mRjR_i \gets R_i - mR_j. To solve Ax=bA\mathbf x = \mathbf b, solve Ly=bL\mathbf y = \mathbf b from the top down, then Ux=yU\mathbf x = \mathbf y from the bottom up.

Each step Ri←Ri−mRjR_i \gets R_i - mR_j is undone by adding mRjm R_j back, so running the steps in reverse rebuilds AA from UU, and the reverse steps assemble into LL with the multipliers sitting in place, signs unchanged. The payoff is reuse: elimination costs about n33\tfrac{n^3}{3} operations, but once LL and UU are stored, each new right-hand side costs only two triangular solves, about n2n^2 operations. That is why software factors a matrix once and then solves many systems with it.

Example
Worked: a 2×2 factorization and solve
xy2x + y = 36x + 5y = 132y = 4(1/2, 2)
Elimination replaces 6x + 5y = 13 by 2y = 4 (dashed): same crossing point (1/2, 2).

Factor A=(2165)A = \begin{pmatrix}2&1\\6&5\end{pmatrix} and solve Ax=(3,13)A\mathbf x = (3, 13). One step clears the first column: R2←R2−3R1R_2 \gets R_2 - 3R_1, multiplier 33, leaving U=(2102)U = \begin{pmatrix}2&1\\0&2\end{pmatrix} and L=(1031)L = \begin{pmatrix}1&0\\3&1\end{pmatrix}.

Check: LU=(213⋅23⋅1+2)=(2165)LU = \begin{pmatrix}2&1\\3\cdot2&3\cdot1 + 2\end{pmatrix} = \begin{pmatrix}2&1\\6&5\end{pmatrix} ✓. Forward solve Ly=(3,13)L\mathbf y = (3, 13): y1=3y_1 = 3, then 3y1+y2=133y_1 + y_2 = 13 gives y2=4y_2 = 4. Back solve Ux=(3,4)U\mathbf x = (3, 4): 2x2=42x_2 = 4 gives x2=2x_2 = 2, then 2x1+2=32x_1 + 2 = 3 gives x1=12x_1 = \tfrac12. Check in the original: 2⋅12+2=32\cdot\tfrac12 + 2 = 3 ✓ and 6⋅12+5⋅2=136\cdot\tfrac12 + 5\cdot2 = 13 ✓. In the row picture, the second equation became 2y=42y = 4 — a horizontal line through the same point.

Example
Worked: a 3×3 factorization

Factor A=(121254389)A = \begin{pmatrix}1&2&1\\2&5&4\\3&8&9\end{pmatrix}. Column 1: R2←R2−2R1R_2 \gets R_2 - 2R_1 gives (0,1,2)(0, 1, 2) and R3←R3−3R1R_3 \gets R_3 - 3R_1 gives (0,2,6)(0, 2, 6) — multipliers 22 and 33.

Column 2: R3←R3−2R2R_3 \gets R_3 - 2R_2 gives (0,0,2)(0, 0, 2) — multiplier 22. So

U=(121012002),L=(100210321),U = \begin{pmatrix}1&2&1\\0&1&2\\0&0&2\end{pmatrix},\qquad L = \begin{pmatrix}1&0&0\\2&1&0\\3&2&1\end{pmatrix},

each multiplier stored where it created a zero. Check the bottom row of LULU: (3,2,1)(3, 2, 1) against the columns of UU gives (3, 6+2, 3+4+2)=(3,8,9)(3,\ 6 + 2,\ 3 + 4 + 2) = (3, 8, 9) ✓. A bonus: det⁡A=det⁡L⋅det⁡U=1⋅(1⋅1⋅2)=2\det A = \det L\cdot\det U = 1\cdot(1\cdot1\cdot2) = 2, the product of the pivots.

Side note
Where it goes wrong: storing the negated multiplier

The step R2←R2−3R1R_2 \gets R_2 - 3R_1 subtracts, so it is tempting to store −3-3 in LL. But LL undoes the elimination, so it adds the multiple back: with L=(10−31)L = \begin{pmatrix}1&0\\-3&1\end{pmatrix} the product LU=(21−6−1)LU = \begin{pmatrix}2&1\\-6&-1\end{pmatrix}, not AA. And when a pivot is 00 — as in (0111)\begin{pmatrix}0&1\\1&1\end{pmatrix} — no multiplier can clear below it; a row swap is needed first, and the factorization becomes PA=LUPA = LU.

Try it
Try it: factor, then solve

Factor A=(1146)A = \begin{pmatrix}1&1\\4&6\end{pmatrix} as LULU and use the factors to solve Ax=(2,10)A\mathbf x = (2, 10).

Show the answer

One step: R2←R2−4R1R_2 \gets R_2 - 4R_1 turns (4,6)(4, 6) into (0,2)(0, 2), so U=(1102)U = \begin{pmatrix}1&1\\0&2\end{pmatrix} and L=(1041)L = \begin{pmatrix}1&0\\4&1\end{pmatrix} (the multiplier 44 goes below the diagonal). Check: LU=(1144+2)=ALU = \begin{pmatrix}1&1\\4&4 + 2\end{pmatrix} = A ✓. Forward: y1=2y_1 = 2 and 4y1+y2=104y_1 + y_2 = 10 give y=(2,2)\mathbf y = (2, 2). Back: 2x2=22x_2 = 2 gives x2=1x_2 = 1, and x1+x2=2x_1 + x_2 = 2 gives x1=1x_1 = 1. Check: 1+1=21 + 1 = 2 and 4+6=104 + 6 = 10 ✓.

Proofs & Why It Matters

Tip
Proof: rank–nullity

Row reduce AA (m×nm \times n, rank rr): rr pivot columns and n−rn - r free columns. Each free variable can be set to 11 with the others 00, and back-substitution fills in the pivot variables — producing n−rn - r solutions of Ax=0A\mathbf x = \mathbf 0 that are independent (each has a 11 where the others have 00).

Conversely every homogeneous solution is determined by its free-variable values, so these span: the null space has dimension exactly n−rn - r. ■\blacksquare

Tip
Proof: pivots decide the trichotomy

In echelon form, a row (0;⋯ ;0 ∣ b)(0;\cdots;0\,|\,b) with b≠0b \ne 0 reads 0=b0 = b: no solution. Otherwise, if every column has a pivot, back-substitution determines each variable uniquely: exactly one solution. Otherwise some column is pivot-free: its variable is free, and each of its infinitely many values extends to a solution. No fourth case exists. ■\blacksquare

Going Deeper: Explanations & Worked Problems

Concept
Elimination as an algorithm, not an art

The method is fully mechanical. (1) Find the leftmost column with a nonzero entry; swap that entry's row to the top — it is the first pivot. (2) Subtract multiples of the pivot row from every row below, zeroing that column beneath the pivot. (3) Ignore the pivot row and repeat on the remaining rows.

The result is echelon form: pivots marching down and right, zeros below each. Then read off the verdict: a row (0 ⋯ 0 ∣ b)(0\,\cdots\,0\,|\,b), b≠0b \ne 0, means inconsistent; otherwise count pivots — every column with a pivot pins a variable, every column without one donates a free parameter. Back-substitution finishes: solve the last pivot equation, substitute upward. The whole of solvability theory — unique/infinite/none, rank, dimension of the solution space — is a bookkeeping layer on this one procedure.

Example
Worked: a full 3×3 elimination

Solve x+y+z=6x + y + z = 6, 2x+y+3z=132x + y + 3z = 13, x+2y−z=2x + 2y - z = 2.

Step 1 — clear column 1 below the pivot: R2←R2−2R1R_2 \gets R_2 - 2R_1: (0,−1,1 ∣ 1)(0, -1, 1\,|\,1); R3←R3−R1R_3 \gets R_3 - R_1: (0,1,−2 ∣ −4)(0, 1, -2\,|\,-4).

Step 2 — clear column 2 below the new pivot: R3←R3+R2R_3 \gets R_3 + R_2: (0,0,−1 ∣ −3)(0, 0, -1\,|\,-3).

Step 3 — echelon form reached with three pivots (1,−1,−11, -1, -1): a unique solution exists.

Step 4 — back-substitute: from row 3, z=3z = 3; from row 2, −y+3=1-y + 3 = 1 so y=2y = 2; from row 1, x=6−2−3=1x = 6 - 2 - 3 = 1.

Step 5 — verify in the original equations: 1+2+3=61 + 2 + 3 = 6 ✓, 2+2+9=132 + 2 + 9 = 13 ✓, 1+4−3=21 + 4 - 3 = 2 ✓. The verification step costs ten seconds and catches nearly every slip.

Example
Worked: reading rank and the solution space

Reduce A=(123246111)A = \begin{pmatrix}1&2&3\\2&4&6\\1&1&1\end{pmatrix}.

Step 1: R2←R2−2R1=(0,0,0)R_2 \gets R_2 - 2R_1 = (0,0,0) — row 2 was twice row 1, and elimination exposes the dependence as a zero row. Step 2: R3←R3−R1=(0,−1,−2)R_3 \gets R_3 - R_1 = (0,-1,-2). Echelon form: pivots in columns 1 and 2, none in column 3: rank 22.

Step 3 — the homogeneous solutions: zz is free; row 2 gives y=−2zy = -2z; row 1 gives x=−2y−3z=4z−3z=zx = -2y - 3z = 4z - 3z = z. So the null space is the line of multiples of (1,−2,1)(1, -2, 1), dimension 11 — and rank–nullity checks: 33 columns =2= 2 (rank) +1+ 1 (nullity) ✓. Rank counts surviving information; nullity counts what the matrix destroys.