Gaussian Elimination and Row Reduction

Can a machine solve any system of linear equations? This holds no matter how many unknowns or equations it has. This is not a rhetorical question. It demands an actual procedure. That procedure must terminate in finitely many steps. It must report every solution, or correctly report that none exist. Gaussian elimination is that procedure. It is arguably the single most-used algorithm in all of mathematics. It runs invisibly inside spreadsheets, engineering simulations, and machine learning pipelines. This happens every second of every day. The idea is deceptively simple: replace a hard system of equations with an easy one. The easy one has exactly the same solutions. "Easy" means triangular or staircase-shaped. There, back-substitution or direct reading gives the answer. Three moves let us simplify without changing the solution set. These are swapping equations, scaling an equation, and adding a multiple of one equation to another. These are the elementary row operations. The entire theory of solving linear systems, by hand or by computer, rests on one fact. These moves are reversible. Beyond its practical utility, Gaussian elimination is the entry point to structural ideas in linear algebra. The number of nonzero rows surviving row reduction is the rank of a matrix. Whether a reduced system has free variables tells us about the dimension of a solution set. The row-reduction process itself is really matrix multiplication by invertible elementary matrices. This fact will matter greatly once we study Fields, Span and Linear Combinations, and eventually invertibility and determinants in full generality. This article develops the algorithm with complete rigor. It gives precise definitions of echelon and reduced row echelon form. It proves that every matrix over a field reduces to a unique reduced echelon form. It carefully explains why row operations preserve the solution set of a linear system. Two fully worked examples illustrate the mechanics: one consistent with a free variable, one inconsistent. We also examine exactly which hypotheses are indispensable, in particular working over a field.

Key takeaways
  • A system of linear equations can be encoded as an augmented matrix; solving the system is equivalent to simplifying that matrix.
  • Three elementary row operations — swap, scale by a nonzero constant, add a multiple of one row to another — never change the solution set.
  • Row echelon form (REF) staggers leading entries down and to the right; reduced row echelon form (RREF) additionally makes each leading entry a 11 that is the only nonzero entry in its column.
  • Every matrix over a field has a unique RREF, though it may have many different REFs.
  • Pivot columns mark the "leading" variables; the remaining columns give free variables, which parametrize all solutions.
  • Key idea: row-reducing the augmented matrix of a system to RREF reveals, in one uniform algorithm, whether the system is consistent and, if so, an explicit parametrization of every solution.

Where this lives today

Gaussian elimination is the computational backbone of numerical linear algebra: LU decomposition, used to solve Ax=bAx=b efficiently for many right-hand sides bb, is essentially a bookkeeping-optimized record of the elimination steps performed on AA alone. Structural and electrical engineers solve systems of thousands to millions of equations (finite element models, circuit node equations) using elimination-based solvers, typically with partial pivoting for numerical stability on floating-point hardware. In computer graphics and robotics, inverse kinematics and camera calibration problems reduce to linear (or linearized) systems solved via row reduction. In cryptography and coding theory, row reduction over finite fields such as F2\mathbb{F}_2 or F28\mathbb{F}_{2^8} underlies decoding algorithms for linear codes and Gaussian elimination over F2\mathbb{F}_2 appears inside some cryptanalytic attacks on stream ciphers. In statistics, solving the normal equations for ordinary least squares regression is a linear system amenable to (a numerically refined version of) Gaussian elimination. Finally, within pure mathematics itself, row reduction is the standard tool for computing the rank of a matrix, a basis for its null space and column space, and the coefficients of a linear combination expressing one vector in terms of others — the very language of Span and Linear Combinations that this algorithm sets up.

:::quiz[If row reduction of an augmented matrix [A∣b][A\mid b] produces a row of the form [0 0 ⋯ 0∣c][0\ 0\ \cdots\ 0 \mid c] with c≠0c \neq 0, what can we conclude?]

  • The system has infinitely many solutions
  • The system has a unique solution
  • The system is inconsistent (no solutions) ✓
  • The matrix AA must be square

Ask the tutor: How does the number of pivots (the rank) in row reduction determine the dimension of a solution space once we formally define span and linear combinations?

DefinitionElementary row operations, echelon form, and reduced echelon form

Let FF be a field (for instance R\mathbb{R} or C\mathbb{C}) and let AA be an m×nm \times n matrix with entries in FF. The three elementary row operations on AA are: 1. (Swap) Interchange two rows RiR_i and RjR_j, i≠ji \neq j. 2. (Scale) Replace row RiR_i by cRic R_i for some nonzero scalar c∈Fc \in F. 3. (Replacement) Replace row RiR_i by Ri+cRjR_i + c R_j for some scalar c∈Fc \in F and some j≠ij \neq i. Two matrices AA and BB (of the same size) are row equivalent, written A∼BA \sim B, if BB can be obtained from AA by a finite sequence of elementary row operations. A matrix RR is in row echelon form (REF) if: (a) All rows consisting entirely of zeros are at the bottom. (b) In each nonzero row, the first (leftmost) nonzero entry — called the pivot or leading entry — lies strictly to the right of the pivot in the row above it. (Condition (b) forces the pivots to move down and to the right as you read the matrix from top to bottom, and it is understood to be an empty condition on the first row.) A matrix RR is in reduced row echelon form (RREF) if, in addition to being in REF: (c) Every pivot equals 11. (d) Each pivot is the only nonzero entry in its column. A column containing a pivot is called a pivot column; the variable corresponding to a pivot column (when RR is the coefficient part of a linear system) is a basic (leading) variable, and all other variables are free variables.

Intuition

Think of a linear system as a stack of constraints on the unknowns. Some constraints are redundant combinations of others; some may directly contradict each other. Row reduction is a systematic way of "clearing the fog": at each stage we use one equation to eliminate a particular unknown from all the other equations, exactly as one does by hand when solving two equations in two unknowns by substitution — except organized so it never fails, never loops, and scales to any size. Geometrically, each linear equation in nn unknowns describes a hyperplane in FnF^n. The solution set of a system is the intersection of these hyperplanes. Row operations do not move the hyperplanes' common intersection; they replace one description of the same family of hyperplanes with a more convenient one — ultimately with hyperplanes that are mutually "aligned with the coordinate axes" in the staircase pattern of echelon form, so the intersection can be read off directly. The staircase picture is worth internalizing. In REF, each new row's leading entry is pushed further right than the previous row's, producing a shape like descending stairs. Columns without a pivot correspond to directions in which the solution set is free to move — these become the free parameters in the final answer.

Figure
A row-echelon staircase pattern: pivots (●) move right and down; ✻ marks a free-variable column
x₁ x₂ x₃ x₄ x₅ 1 2 0 3 5 0 0 1 4 -2 0 0 0 0 1 ✻ ✻ free variables: x₂, x₄

Central results

TheoremElementary row operations preserve the solution set

Let Ax=bA x = b be a linear system with AA an m×nm \times n matrix over a field FF, x∈Fnx \in F^n the unknown vector, and b∈Fmb \in F^m. Let [A∣b][A \mid b] denote the augmented matrix. If [A′∣b′][A' \mid b'] is obtained from [A∣b][A \mid b] by a single elementary row operation, then Ax=bA x = b and A′x=b′A' x = b' have exactly the same solution set in FnF^n.

Proof

It suffices to prove the claim for each of the three operation types, since a general row operation applied to the augmented matrix is one of these three, and the solution set of a system is precisely the solution set determined by its augmented matrix (each row of [A∣b][A\mid b] is one linear equation).

(Swap.) Interchanging two rows of [A∣b][A \mid b] merely reorders the list of equations; the set of x∈Fnx \in F^n satisfying all the equations is unaffected by the order in which we list them. So the solution sets are identical.

(Scale.) Suppose row ii of [A∣b][A \mid b], i.e. the equation

ai1x1+⋯+ainxn=bi,a_{i1}x_1 + \cdots + a_{in}x_n = b_i,

is replaced by cc times itself, c≠0c \neq 0, giving

c ai1x1+⋯+c ainxn=c bi.c\,a_{i1}x_1 + \cdots + c\,a_{in}x_n = c\,b_i.

If xx satisfies the original equation, multiplying both sides by cc shows xx satisfies the new equation. Conversely if xx satisfies the new equation, multiplying both sides by c−1c^{-1} (which exists since FF is a field and c≠0c \neq 0) recovers the original equation. All other equations in the system are untouched. Hence a vector xx satisfies every equation of the new system if and only if it satisfies every equation of the old system, so the solution sets coincide.

(Replacement.) Suppose row ii is replaced by Ri+cRjR_i + c R_j where j≠ij \neq i. Write the ii-th and jj-th equations of the original system as

Ei:∑kaikxk=bi,Ej:∑kajkxk=bj.E_i:\quad \textstyle\sum_k a_{ik}x_k = b_i, \qquad E_j:\quad \textstyle\sum_k a_{jk}x_k = b_j.

The new ii-th equation is Ei+cEjE_i + c E_j, meaning

∑k(aik+c ajk)xk=bi+c bj.\textstyle\sum_k (a_{ik} + c\,a_{jk})x_k = b_i + c\,b_j.

If xx satisfies EiE_i and EjE_j, then adding cc times the second to the first shows xx satisfies the new equation; combined with the unchanged equations (including EjE_j itself, which is still present), xx satisfies the whole new system. Conversely, if xx satisfies the new system, then in particular xx satisfies EjE_j (unchanged) and the new ii-th equation Ei+cEjE_i + cE_j. Subtracting cc times EjE_j from the new ii-th equation recovers exactly EiE_i. So xx also satisfies EiE_i, and hence satisfies the entire original system. In all three cases the solution set is unchanged. ■\blacksquare

∎
CorollaryRow equivalence preserves solution sets

If [A∣b]∼[A′∣b′][A \mid b] \sim [A' \mid b'] (row equivalent via a finite sequence of elementary row operations), then Ax=bAx = b and A′x=b′A'x = b' have the same solution set.

Proof

Induct on the number of elementary row operations used to pass from [A∣b][A\mid b] to [A′∣b′][A' \mid b']. If zero operations are used the two matrices are equal and the claim is trivial. If [A∣b]→M1→M2→⋯→Mk=[A′∣b′][A \mid b] \to M_1 \to M_2 \to \cdots \to M_k = [A' \mid b'] is a chain of kk elementary operations, then by the Theorem: Elementary row operations preserve the solution set each consecutive pair in the chain has systems with identical solution sets. Since "having the same solution set" is transitive (if S(X)=S(Y)S(X) = S(Y) and S(Y)=S(Z)S(Y) = S(Z) then S(X)=S(Z)S(X) = S(Z), immediate from set equality), the solution set of [A∣b][A \mid b] equals the solution set of M1M_1, which equals that of M2M_2, and so on, up through [A′∣b′][A' \mid b']. ■\blacksquare

∎
TheoremEvery matrix reduces to row echelon form

Let FF be a field and AA an m×nm \times n matrix over FF. There is a finite sequence of elementary row operations taking AA to a matrix RR in row echelon form. Consequently A∼RA \sim R.

Proof

We give the Gaussian elimination algorithm explicitly and prove by strong induction on mm (the number of rows) that it terminates with a matrix in REF. Base case m=1m = 1. A single row is trivially in echelon form (conditions (a) and (b) of the definition are vacuous), so no operations are needed. Inductive step. Assume the claim holds for all matrices with fewer than mm rows (over any field, any number of columns), and let AA be m×nm \times n. If AA is the zero matrix, it is already in REF (all rows are zero, at the "bottom"); stop. Otherwise, let c1c_1 be the smallest column index such that column c1c_1 of AA has some nonzero entry. Among the rows, choose a row with a nonzero entry in column c1c_1 and, if it is not already row 11, swap it into the first row position (a swap operation). Now AA's first row has a nonzero entry aa in column c1c_1, and columns 1,…,c1−11, \dots, c_1 - 1 are entirely zero (since c1c_1 was minimal). For each row i=2,…,mi = 2, \dots, m with entry ai,c1a_{i,c_1} in column c1c_1, perform the replacement operation

Ri  ←  Ri−ai,c1aR1,R_i \;\leftarrow\; R_i - \frac{a_{i,c_1}}{a} R_1,

which is a valid elementary row operation since FF is a field, so a−1a^{-1} exists and ai,c1/a∈Fa_{i,c_1}/a \in F. After this, every entry in column c1c_1 below row 11 is zero, and row 11 is unchanged in columns 1,…,c11,\dots,c_1. Now consider the submatrix A′A' formed by rows 22 through mm and columns c1+1c_1+1 through nn; it has m−1<mm - 1 < m rows. By the induction hypothesis, a finite sequence of elementary row operations reduces A′A' to a matrix R′R' in row echelon form. Performing this same sequence of row operations on rows 2,…,m2,\dots,m of the full matrix (restricted to those columns; entries in columns 1,…,c11,\dots,c_1 of these rows are already all zero and are unaffected by operations confined to later columns) yields a matrix RR whose first row has leading entry aa in column c1c_1, and whose rows 2,…,m2,\dots,m (restricted to columns c1+1,…,nc_1+1,\dots,n) form R′R', in echelon form. We check RR is in REF. Condition (a): the zero rows of R′R' (bottom of rows 2,…,m2,\ldots,m) remain at the bottom, since row 11 is nonzero (it has the pivot aa). Condition (b): every pivot in rows 2,…,m2,\dots,m lies in a column >c1> c_1 (since these pivots come from R′R', whose columns are c1+1,…,nc_1+1,\dots,n), so in particular strictly right of row 11's pivot at c1c_1; and among rows 2,…,m2,\dots,m themselves, the echelon condition holds because R′R' is in echelon form. Hence RR satisfies both conditions and is in row echelon form. This entire procedure used only finitely many elementary row operations (the swap, at most m−1m-1 replacements to clear column c1c_1, and the finitely many operations used recursively on the smaller matrix), so by induction the claim holds for all mm. ■\blacksquare

∎
TheoremExistence and uniqueness of reduced row echelon form

Let FF be a field and AA an m×nm \times n matrix over FF. There exists a matrix RR in reduced row echelon form with A∼RA \sim R, and this RR is unique: if A∼R1A \sim R_1 and A∼R2A \sim R_2 with R1,R2R_1, R_2 both in RREF, then R1=R2R_1 = R_2.

Proof

Existence. By the Theorem: Every matrix reduces to row echelon form, reduce AA to some REF matrix EE. Process the nonzero rows of EE from the bottom row upward. For each nonzero row with pivot entry p≠0p \neq 0 in column kk: first scale that row by p−1p^{-1} (valid since FF is a field and p≠0p \neq 0) so the pivot becomes exactly 11; then, for every other row ii with a nonzero entry qq in column kk, replace Ri←Ri−qRpivot rowR_i \leftarrow R_i - q R_{\text{pivot row}} to zero out that entry. We must check this process does not disturb the echelon structure already achieved. Scaling a row by a nonzero constant does not change which entries are zero, so condition (b) (position of pivots) and (a) (zero rows at bottom) are preserved, and the pivot becomes 11. When we clear column kk using the pivot row, we only add multiples of a row whose nonzero entries lie in columns ≥k\geq k (by the echelon property, since it's a pivot row with pivot in column kk) to other rows; this can only change entries in columns ≥k\geq k of the target rows, hence cannot alter previously-established pivots in columns <k< k or disturb already-cleared columns to their left. Since we work from the bottom pivot upward, by the time we clear column kk, all columns of pivots below row's own pivot have already been made into "unit columns" (a single 11, rest zero) and remain so, because clearing column kk never touches columns >k> k... More carefully: when clearing column kk using row RpR_p (whose only nonzero entries are in columns ≥k\geq k), the update Ri←Ri−qRpR_i \leftarrow R_i - q R_p changes entries of RiR_i only in columns where RpR_p is nonzero, i.e., columns ≥k\geq k. In particular it does not change entries of RiR_i in columns <k< k, so if RiR_i was already a pivot row with pivot in some column k′<kk' < k made into a clean unit column, it stays a clean unit column (its only possible new nonzero entries are in columns ≥k>k′\ge k > k', but we specifically zero out its entry in column kk itself, and entries in columns strictly between k′k' and kk that are not pivot columns are simply whatever they are — they are not required to be zero for RREF, only pivot columns must be clean). Since we go pivot column by pivot column from right to left (equivalently, bottom row to top row, as pivots increase left-to-right down the rows), each pivot column, once cleared, is never touched again by later steps (which only add multiples of rows with pivots strictly to the right, hence zero in the already-cleared column). After processing every nonzero row, every pivot column has exactly one nonzero entry (a 11, in its own pivot row), giving conditions (c) and (d). The result RR is in RREF, and it was obtained from AA by finitely many elementary operations (those used to reach EE, plus finitely many more here), so A∼RA \sim R.

Uniqueness. This is the substantial part of the claim. We use the following key fact about row equivalence and linear dependence, proven first. Claim: If A∼BA \sim B (both m×nm\times n over FF), then for every choice of column indices j1<j2<⋯<jrj_1 < j_2 < \cdots < j_r, a linear dependence relation

λ1A[:,j1]+⋯+λrA[:,jr]=0\lambda_1 A_{[:,j_1]} + \cdots + \lambda_r A_{[:,j_r]} = 0

among the corresponding columns of AA holds (for scalars λi∈F\lambda_i \in F, not all zero) if and only if the same relation

λ1B[:,j1]+⋯+λrB[:,jr]=0\lambda_1 B_{[:,j_1]} + \cdots + \lambda_r B_{[:,j_r]} = 0

holds among the corresponding columns of BB, with the same scalars λi\lambda_i. Proof of claim: It suffices to check this for a single elementary row operation, since row equivalence is a finite chain of these and the property is preserved through each link (transitivity of "same dependence relations hold"). Each elementary row operation corresponds to left-multiplication by an invertible matrix: swapping rows i,ji,j is left-multiplication by a permutation matrix PP; scaling row ii by c≠0c\ne 0 is left-multiplication by a diagonal matrix DD with cc in position (i,i)(i,i) and 11s elsewhere, which is invertible since c≠0c \ne 0; replacement Ri←Ri+cRjR_i \leftarrow R_i + cR_j is left-multiplication by I+cEijI + cE_{ij} (elementary matrix), whose inverse is I−cEijI - cE_{ij}, confirmed by direct computation (I+cEij)(I−cEij)=I−c2Eij2=I(I+cE_{ij})(I-cE_{ij}) = I - c^2 E_{ij}^2 = I when i≠ji \ne j (since EijEij=0E_{ij}E_{ij} = 0 for i≠ji \neq j). In every case B=MAB = MA for some invertible matrix MM. Then for any columns, B[:,jt]=MA[:,jt]B_{[:,j_t]} = M A_{[:,j_t]}, so

λ1B[:,j1]+⋯+λrB[:,jr]=M(λ1A[:,j1]+⋯+λrA[:,jr]).\lambda_1 B_{[:,j_1]} + \cdots + \lambda_r B_{[:,j_r]} = M\left(\lambda_1 A_{[:,j_1]} + \cdots + \lambda_r A_{[:,j_r]}\right).

If the right-hand relation among the AA-columns is zero, the left side is M⋅0=0M \cdot 0 = 0. Conversely if the BB-relation is zero, since MM is invertible, M−1⋅0=0M^{-1} \cdot 0 = 0 forces the AA-relation λ1A[:,j1]+⋯+λrA[:,jr]=0\lambda_1 A_{[:,j_1]} + \cdots + \lambda_r A_{[:,j_r]} = 0 as well (apply M−1M^{-1} to both sides of M(⋅)=0M(\cdot) = 0). This proves the claim for one operation, and hence, by induction on the length of a row-equivalence chain, for row equivalence in general. Now suppose A∼R1A \sim R_1 and A∼R2A \sim R_2, with R1,R2R_1, R_2 in RREF. Since row equivalence is symmetric and transitive (each elementary operation is invertible by another elementary operation of the same type, e.g. a swap undoes a swap, scaling by c−1c^{-1} undoes scaling by cc, and replacement with −c-c undoes replacement with cc; concatenating finite chains gives transitivity), we get R1∼R2R_1 \sim R_2. We show the pivot columns of R1R_1 and R2R_2 occur in exactly the same positions, and that R1=R2R_1 = R_2 entirely, by induction on the column index k=1,…,nk = 1, \ldots, n, maintaining the hypothesis that columns 1,…,k1,\ldots,k of R1R_1 and R2R_2 are identical, and that a column index in {1,…,k}\{1,\ldots,k\} is a pivot column of R1R_1 if and only if it is a pivot column of R2R_2. For k=0k=0 there is nothing to check. Suppose the hypothesis holds up through column k−1k-1; consider column kk. Case A: column kk is a pivot column of R1R_1. Say it is the pivot column for row pp of R1R_1 (the pp-th nonzero row), so among columns 1,…,k1,\ldots,k of R1R_1, exactly the pivot columns of rows 1,…,p1,\ldots,p (all ≤k\le k, with the one in column kk being the newest) are nonzero-supporting, and in particular the columns 1,…,k−11, \ldots, k-1 contain exactly p−1p-1 pivot columns (by the induction hypothesis these are also exactly the pivot columns of R2R_2 among 1,…,k−11,\ldots,k-1, namely p−1p - 1 of them, in identical positions with identical column vectors — since R1,R2R_1,R_2 agree on columns 1,…,k−11,\ldots,k-1). The columns j1<⋯<jp−1<kj_1 < \cdots < j_{p-1} < k of pivot columns before column kk, together with column kk itself, satisfy in R1R_1: column kk equals epe_p (the pp-th standard basis vector in FmF^m, using that RREF pivot columns are standard basis vectors and R1R_1's pivot in column kk is in row pp) which is not a linear combination of the columns j1,…,jp−1j_1,\ldots,j_{p-1} of R1R_1 — those are e1,…,ep−1e_1,\ldots,e_{p-1} respectively (up to relabeling) — no relation μ1e1+⋯+μp−1ep−1=ep\mu_1 e_1 + \cdots + \mu_{p-1}e_{p-1} = e_p can hold since the left side has zero pp-th coordinate while the right side does not. So there is no linear dependence relation of the form μ1R1[:,j1]+⋯+μp−1R1[:,jp−1]−R1[:,k]=0\mu_1 R_{1[:,j_1]} + \cdots + \mu_{p-1} R_{1[:,j_{p-1}]} - R_{1[:,k]} = 0. By the Claim, exactly the same absence of relation holds among the corresponding columns of R2R_2: there is no relation μ1R2[:,j1]+⋯+μp−1R2[:,jp−1]−R2[:,k]=0\mu_1 R_{2[:,j_1]} + \cdots + \mu_{p-1}R_{2[:,j_{p-1}]} - R_{2[:,k]} = 0. Since columns j1,…,jp−1j_1,\ldots,j_{p-1} of R2R_2 are (by the induction hypothesis) the same vectors e1,…,ep−1e_1,\ldots,e_{p-1} as in R1R_1, this means column kk of R2R_2, call it v=R2[:,k]v = R_{2[:,k]}, is not in the span of e1,…,ep−1e_1,\ldots,e_{p-1}; since R2R_2 is in RREF, and its nonzero rows among 1,…,p−11,\ldots,p-1 already have pivots in columns j1,…,jp−1j_1,\ldots,j_{p-1} (with entries in later columns among rows 1,…,p−11,\ldots,p-1 possibly nonzero but the columns j1,…,jp−1j_1,\ldots,j_{p-1} are clean unit vectors)... we argue directly: since v∉span⁡(e1,…,ep−1)v \notin \operatorname{span}(e_1,\dots,e_{p-1}), some coordinate of vv among {p,p+1,…,m}\{p, p+1,\ldots,m\} is nonzero. If R2R_2 has not yet used a pivot at or before column kk beyond row p−1p-1, and R2R_2 is in echelon form, the only way column kk can have a nonzero entry in row ≥p\ge p consistent with the echelon staircase (pivots so far only through row p−1p-1, using columns <k<k) is if row pp of R2R_2 has its pivot exactly at column kk — any nonzero entry in row pp or below at column kk, given no earlier pivot has occurred past row p−1p - 1, must itself be a new pivot, and since R2R_2's columns before kk already account for pivots in rows 1,…,p−11,\ldots,p-1 only, the first available pivot row is pp, forced to appear in column kk (echelon form requires pivots to occur in the earliest available column for each row in sequence, and the argument that vv is not in the span of earlier standard basis vectors forces the entry in row pp, or a still-later row, to be the new leading entry, and REF forces it to be row pp exactly since rows are processed top to bottom without skipping). Since R2R_2 is in RREF, this new pivot entry equals 11 and all other entries of column kk are 00 (conditions (c),(d)), i.e. column kk of R2R_2 is exactly epe_p — identical to column kk of R1R_1. Moreover the pivot for row pp occurring at column kk in R2R_2, matching R1R_1, extends the induction hypothesis: column kk is a pivot column in both, in the same row position, with identical (standard basis) column vector. Case B: column kk is not a pivot column of R1R_1. Then, letting j1<⋯<jsj_1 < \cdots < j_s be the pivot columns of R1R_1 among 1,…,k1,\ldots,k (necessarily all <k< k, and by the induction hypothesis identical in R2R_2), column kk of R1R_1 is some vector ww expressible uniquely as w=∑t=1sμtetw = \sum_{t=1}^s \mu_t e_t where μt\mu_t is the entry of R1R_1 in row corresponding to pivot column jtj_t, at column kk (this holds because R1R_1 is in RREF: rows below the ss-th pivot row are entirely zero in columns ≤k\le k, since column kk is not itself a pivot column and no later pivot can occur at or before column kk; so column kk's only possibly-nonzero entries lie in rows 1,…,s1,\ldots,s, each such row's nonzero entries besides its own clean pivot column being otherwise free, but restricted to exactly those ss coordinates). This gives an explicit dependence relation

R1[:,k]−∑t=1sμtR1[:,jt]=0.R_{1[:,k]} - \sum_{t=1}^s \mu_t R_{1[:,j_t]} = 0.

By the Claim, the same relation, same scalars μt\mu_t, holds for R2R_2:

R2[:,k]=∑t=1sμtR2[:,jt]=∑t=1sμtR1[:,jt]=R1[:,k],R_{2[:,k]} = \sum_{t=1}^s \mu_t R_{2[:,j_t]} = \sum_{t=1}^s \mu_t R_{1[:,j_t]} = R_{1[:,k]},

using that R2R_2's pivot columns among 1,…,k−11,\ldots,k-1 coincide exactly with R1R_1's (induction hypothesis). Hence column kk of R2R_2 equals column kk of R1R_1, and since a matrix in RREF has column kk a pivot column exactly when it is not in the span of the strictly-earlier pivot columns (standard basis vectors of full support so far), and we've shown R2[:,k]R_{2[:,k]} is that specific combination of earlier standard basis vectors, column kk is not a pivot column of R2R_2 either. This extends the induction hypothesis to column kk. By induction, columns 11 through nn of R1R_1 and R2R_2 are all identical, i.e. R1=R2R_1 = R_2. ■\blacksquare

∎

Worked examples

Example 1 (consistent system with a free variable). Solve over R\mathbb{R}:

x1+2x2−x3=32x1+3x2+x3=7−x1−x2+4x3=1\begin{aligned} x_1 + 2x_2 - x_3 &= 3\\ 2x_1 + 3x_2 + x_3 &= 7\\ -x_1 - x_2 + 4x_3 &= 1 \end{aligned}

The augmented matrix is

[A∣b]=[12−132317−1−141].[A \mid b] = \left[\begin{array}{ccc|c} 1 & 2 & -1 & 3\\ 2 & 3 & 1 & 7\\ -1 & -1 & 4 & 1 \end{array}\right].

Step 1 — clear column 1 below the pivot (a=1a=1 in row 1) using replacement operations R2←R2−2R1R_2 \leftarrow R_2 - 2R_1 and R3←R3+R1R_3 \leftarrow R_3 + R_1:

[12−130−1310134].\left[\begin{array}{ccc|c} 1 & 2 & -1 & 3\\ 0 & -1 & 3 & 1\\ 0 & 1 & 3 & 4 \end{array}\right].

(Check: row 2 was (2,3,1,7)−2(1,2,−1,3)=(0,−1,3,1)(2,3,1,7) - 2(1,2,-1,3) = (0,-1,3,1); row 3 was (−1,−1,4,1)+(1,2,−1,3)=(0,1,3,4)(-1,-1,4,1)+(1,2,-1,3) = (0,1,3,4).) Step 2 — clear column 2 below the pivot in row 2 using R3←R3+R2R_3 \leftarrow R_3 + R_2:

[12−130−1310065].\left[\begin{array}{ccc|c} 1 & 2 & -1 & 3\\ 0 & -1 & 3 & 1\\ 0 & 0 & 6 & 5 \end{array}\right].

(Row 3 was (0,1,3,4)+(0,−1,3,1)=(0,0,6,5)(0,1,3,4) + (0,-1,3,1) = (0,0,6,5).) This is now in REF: pivots at columns 1,2,31,2,3, all rows nonzero — the system is consistent with a unique solution here since every column is a pivot column. Let's finish reducing to RREF to read it off cleanly. Step 3 — scale row 3 by 1/61/6, row 2 by −1-1:

[12−1301−3−10015/6].\left[\begin{array}{ccc|c} 1 & 2 & -1 & 3\\ 0 & 1 & -3 & -1\\ 0 & 0 & 1 & 5/6 \end{array}\right].

Step 4 — clear above the pivots. First, using row 3, do R2←R2+3R3R_2 \leftarrow R_2 + 3R_3 and R1←R1+R3R_1 \leftarrow R_1 + R_3:

R2:(0,1,−3,−1)+3(0,0,1,5/6)=(0,1,0,−1+5/2)=(0,1,0,3/2),R_2: (0,1,-3,-1) + 3(0,0,1,5/6) = (0,1,0, -1 + 5/2) = (0,1,0,3/2),
R1:(1,2,−1,3)+(0,0,1,5/6)=(1,2,0,3+5/6)=(1,2,0,23/6).R_1: (1,2,-1,3) + (0,0,1,5/6) = (1,2,0, 3 + 5/6) = (1,2,0,23/6).

Then using row 2, do R1←R1−2R2R_1 \leftarrow R_1 - 2R_2:

R1:(1,2,0,23/6)−2(0,1,0,3/2)=(1,0,0,23/6−3)=(1,0,0,5/6).R_1: (1,2,0,23/6) - 2(0,1,0,3/2) = (1,0,0, 23/6 - 3) = (1,0,0,5/6).

Final RREF:

[1005/60103/20015/6].\left[\begin{array}{ccc|c} 1 & 0 & 0 & 5/6\\ 0 & 1 & 0 & 3/2\\ 0 & 0 & 1 & 5/6 \end{array}\right].

Every column among 1,2,31,2,3 is a pivot column, so there are no free variables, and the unique solution is

x1=56,x2=32,x3=56.x_1 = \tfrac{5}{6}, \qquad x_2 = \tfrac{3}{2}, \qquad x_3 = \tfrac{5}{6}.

Verification: x1+2x2−x3=56+3−56=3x_1 + 2x_2 - x_3 = \tfrac56 + 3 - \tfrac56 = 3 ✓. 2x1+3x2+x3=106+92+56=53+92+56=106+276+56=426=72x_1+3x_2+x_3 = \tfrac{10}{6}+\tfrac92+\tfrac56 = \tfrac{5}{3}+\tfrac{9}{2}+\tfrac56 = \tfrac{10}{6}+\tfrac{27}{6}+\tfrac{5}{6}=\tfrac{42}{6}=7 ✓. −x1−x2+4x3=−56−32+103=−56−96+206=66=1-x_1-x_2+4x_3 = -\tfrac56-\tfrac32+\tfrac{10}3 = -\tfrac56-\tfrac96+\tfrac{20}{6}=\tfrac{6}{6}=1 ✓.

Example 2 (a 3×43\times 4 system: free variable and a consistency check). Solve over R\mathbb{R}:

x1+2x2+3x3−x4=42x1+4x2+8x3+0x4=14−x1−2x2−5x3−x4=−10\begin{aligned} x_1 + 2x_2 + 3x_3 - x_4 &= 4\\ 2x_1 + 4x_2 + 8x_3 + 0x_4 &= 14\\ -x_1 - 2x_2 - 5x_3 - x_4 &= -10 \end{aligned}

Augmented matrix:

[123−14248014−1−2−5−1−10].\left[\begin{array}{cccc|c} 1 & 2 & 3 & -1 & 4\\ 2 & 4 & 8 & 0 & 14\\ -1 & -2 & -5 & -1 & -10 \end{array}\right].

Eliminate column 1 using R2←R2−2R1R_2 \leftarrow R_2 - 2R_1, R3←R3+R1R_3 \leftarrow R_3 + R_1:

R2:(2,4,8,0,14)−2(1,2,3,−1,4)=(0,0,2,2,6),R_2: (2,4,8,0,14) - 2(1,2,3,-1,4) = (0,0,2,2,6),
R3:(−1,−2,−5,−1,−10)+(1,2,3,−1,4)=(0,0,−2,−2,−6).R_3: (-1,-2,-5,-1,-10)+(1,2,3,-1,4) = (0,0,-2,-2,-6).

So we have

[123−140022600−2−2−6].\left[\begin{array}{cccc|c} 1 & 2 & 3 & -1 & 4\\ 0 & 0 & 2 & 2 & 6\\ 0 & 0 & -2 & -2 & -6 \end{array}\right].

Now R3←R3+R2R_3 \leftarrow R_3 + R_2 gives (0,0,0,0,0)(0,0,0,0,0):

[123−140022600000].\left[\begin{array}{cccc|c} 1 & 2 & 3 & -1 & 4\\ 0 & 0 & 2 & 2 & 6\\ 0 & 0 & 0 & 0 & 0 \end{array}\right].

This is in REF (pivots in columns 11, then 33; zero row at the bottom). The system is consistent — the zero row reads 0=00=0, no contradiction. Continue to RREF: scale row 2 by 1/21/2, giving (0,0,1,1,3)(0,0,1,1,3); then R1←R1−3R2R_1 \leftarrow R_1 - 3R_2:

R1:(1,2,3,−1,4)−3(0,0,1,1,3)=(1,2,0,−4,−5).R_1: (1,2,3,-1,4) - 3(0,0,1,1,3) = (1,2,0,-4,-5).

Final RREF:

[120−4−50011300000].\left[\begin{array}{cccc|c} 1 & 2 & 0 & -4 & -5\\ 0 & 0 & 1 & 1 & 3\\ 0 & 0 & 0 & 0 & 0 \end{array}\right].

Pivot columns are 11 and 33, corresponding to basic variables x1,x3x_1, x_3. Columns 22 and 44 are free: let x2=sx_2 = s, x4=tx_4 = t for arbitrary s,t∈Rs,t \in \mathbb{R}. Reading the rows as equations:

x1+2s−4t=−5  ⇒  x1=−5−2s+4t,x3+t=3  ⇒  x3=3−t.x_1 + 2s - 4t = -5 \;\Rightarrow\; x_1 = -5 - 2s + 4t, \qquad x_3 + t = 3 \;\Rightarrow\; x_3 = 3 - t.

So the full solution set is

{(−5−2s+4t,  s,  3−t,  t):s,t∈R},\{(-5-2s+4t,\; s,\; 3-t,\; t) : s, t \in \mathbb{R}\},

a two-parameter family (a two-dimensional affine subset of R4\mathbb{R}^4), foreshadowing the language of Span and Linear Combinations once we express this as a particular solution plus a span of two vectors:

(x1,x2,x3,x4)=(−5,0,3,0)+s(−2,1,0,0)+t(4,0,−1,1).(x_1,x_2,x_3,x_4) = (-5,0,3,0) + s(-2,1,0,0) + t(4,0,-1,1).

Spot check with s=1,t=1s=1,t=1: x=(−5−2+4,1,3−1,1)=(−3,1,2,1)x = (-5-2+4,1,3-1,1) = (-3,1,2,1). Plug into the original equations: −3+2+6−1=4-3+2+6-1=4 ✓; −6+4+16+0=14-6+4+16+0=14 ✓; 3−2−10−1=−103-2-10-1=-10 ✓.

CounterexampleWhy we need a field: replacement over Z\mathbb{Z} can lose solutions

The proof that elementary operations preserve solution sets, and the reduction algorithm itself, crucially uses that nonzero scalars have multiplicative inverses — i.e., that the entries live in a field. If we instead work over the integers Z\mathbb{Z} (not a field, since e.g. 22 has no integer inverse) and insist that "scale" only be allowed by units of Z\mathbb{Z} (i.e. ±1\pm 1), the elimination algorithm as stated breaks down: we may be unable to create a pivot of 11 using only integer row operations without introducing fractions, so the notion of RREF (which demands pivots equal to exactly 11) may be unreachable while staying inside Z\mathbb{Z}. Concretely, consider the single equation over Z\mathbb{Z} (thought of as a "system" with coefficient matrix having entries restricted to Z\mathbb{Z}, and only integer solutions sought):

2x=3.2x = 3.

Here A=[2]A = [2], b=[3]b = [3]. Elimination would want to scale the row by 1/21/2 to reach RREF [1∣3/2][1 \mid 3/2] — but 1/2∉Z1/2 \notin \mathbb{Z}, so this operation is not available if we insist on staying within integer arithmetic with only integer-valid elementary operations. Indeed the equation 2x=32x=3 has no solution in Z\mathbb{Z} at all (the left side is always even, the right side is odd), even though the "real-number version" of RREF, x=3/2x = 3/2, exists and is the unique real solution. Row reduction over Z\mathbb{Z} with the field-style scale operation would incorrectly suggest a solution exists, by silently leaving the domain of integers. This shows the hypothesis "FF is a field" in the Theorem: Elementary row operations preserve the solution set and the RREF existence/uniqueness theorem is not a cosmetic convenience: without multiplicative inverses for nonzero scalars, the scale operation cannot be performed in general, pivots cannot always be normalized to 11, and the entire echelon-form machinery (as well as the notion of the RREF) fails to be well-defined or achievable. (Working purely within Z\mathbb{Z} instead uses a different, more delicate theory — Hermite normal form — which does not require division and behaves differently.)

Scope, edge cases & common traps

SituationWhat happensWhy
Zero row appears with nonzero entry only in the augmented column, e.g. [0  0  0∣5][0\;0\;0 \mid 5]System is inconsistent — no solutionsThe row asserts 0=50 = 5, impossible in a field
Zero row is entirely zero including augmented columnRow is redundant; drop it, does not restrict solutionsRepresents 0=00=0, always true
Number of pivot columns (rank) equals number of unknowns nnUnique solution, if consistentNo free variables remain
Number of pivot columns <n<nInfinitely many solutions (over an infinite field), if consistentFree variables parametrize a whole affine family
Working over a finite field, e.g. F2\mathbb{F}_2Algorithm works identically; "infinitely many" solutions becomes "more than one," finitely manyField axioms, not infinitude, are what elimination needs
Matrix has more columns than rows (n>mn>m)Cannot have full column rank; if consistent, must have a free variableAt most mm pivot columns exist since each pivot needs its own row

The mathematician behind it

Origins · 1 minCarl Friedrich Gauss and how this was discovered
CF
Carl Friedrich Gauss
1777–1855 · Göttingen, Germany

Carl Friedrich Gauss was one of history's most prolific mathematicians, contributing foundational results across number theory, geometry, astronomy, and statistics. The technique now called "Gaussian elimination" appears in his 1809 work on determining planetary and asteroid orbits from observational data, where he needed to solve large systems of linear equations arising from least-squares fitting. Gauss did not invent the underlying idea from nothing — a version of systematic elimination for solving linear systems appears far earlier in the Chinese mathematical text The Nine Chapters on the Mathematical Art (a compilation completed by roughly the 1st century CE, describing a method essentially identical in spirit to modern elimination for square systems). Gauss's contribution was to formalize, streamline, and popularize the method within the European mathematical tradition, embedding it in a broader computational framework for astronomy and geodesy that made it a standard practical tool. The name "Gaussian elimination" was cemented in the 20th century, notably through the influence of numerical analysts formalizing the algorithm for digital computers.

History
- c. 1st century CE — The Nine Chapters on the Mathematical Art describes an elimination method for solving systems of linear equations using array manipulations, the earliest known systematic version.
- 1809 — Gauss publishes Theoria Motus Corporum Coelestium, applying systematic elimination to least-squares orbit-determination problems.
- 1888 — Camille Jordan formalizes the reduced echelon form in the context of studying canonical forms, contributing the "Jordan" half of what is sometimes called Gauss–Jordan elimination.
- 1946 — John von Neumann and Herman Goldstine analyze the numerical stability and computational cost of Gaussian elimination for early electronic computers.
- 1950s–60s — Gaussian elimination (with partial pivoting for numerical stability) becomes the default method in early linear algebra software libraries, a role it retains today.
Does every linear system have a row-echelon form, even if it has no solutions?

Yes. Row reduction operates purely mechanically on the augmented matrix and always terminates in an echelon form, regardless of whether the underlying system is consistent. Inconsistency is revealed by the echelon form — specifically by a row that reads 0=c0 = c for some nonzero cc, which is a contradictory equation — rather than being an obstruction to performing the algorithm. The algorithm itself, as proved in the Theorem: Every matrix reduces to row echelon form, works for arbitrary matrices over any field, whether or not the associated system is solvable.

Is row echelon form itself unique, like reduced row echelon form?

No, and this is a common point of confusion. The positions of the pivots in any row echelon form of a given matrix are always the same (they are determined by the matrix's column dependencies), but the specific numerical entries can differ depending on which rows you use to eliminate and in what order, and how you scale. Only after imposing the two extra reduced conditions — every pivot equal to 11, and each pivot the sole nonzero entry in its column — does the result become unique, as proved in the uniqueness half of the RREF theorem.

Why must we work over a field for the theory here to hold as stated?

The scale operation, Ri←cRiR_i \leftarrow cR_i, is only reversible if cc has a multiplicative inverse, and creating a pivot equal to exactly 11 (needed for RREF) requires dividing by the pivot's original value. Both of these demand that every nonzero scalar be invertible, which is precisely the field axiom that distinguishes fields from more general rings. The counterexample above shows that over Z\mathbb{Z}, which is not a field, the naive algorithm can behave inconsistently with the true integer solution set, or fail to produce pivots equal to 11 at all.

How does row reduction relate to the concept of rank?

The rank of a matrix AA is defined as the number of pivot columns in any row echelon form of AA (equivalently, the number of nonzero rows in its REF, which by the staircase condition equals the number of pivots). Because the pivot positions are an invariant of AA under row equivalence — a consequence of the same linear-dependence-preservation argument used in the uniqueness proof — this number does not depend on which sequence of row operations you use to reach an echelon form. Rank will later be connected to the dimension of the column space and row space once Span and Linear Combinations is developed fully.

What is the difference between Gaussian elimination and Gauss–Jordan elimination?

"Gaussian elimination" traditionally refers to reducing a matrix only to row echelon form and then solving by back-substitution — plugging pivot values into earlier equations one at a time from the bottom up. "Gauss–Jordan elimination" continues the process all the way to reduced row echelon form, clearing out entries above each pivot as well as below, so that the solution can be read off directly without any back-substitution step. Both produce the same final solution set; Gauss–Jordan does more up-front arithmetic to make the read-off trivial, which is convenient by hand but occasionally less efficient for very large systems solved numerically.

Can Gaussian elimination fail to terminate, or loop forever, for some matrix?

No. The algorithm as constructed in the proof of the Theorem: Every matrix reduces to row echelon form always terminates, because each recursive step strictly reduces the number of rows under consideration (from mm rows to m−1m-1 rows in the induction), and this can happen only finitely many times before reaching a matrix with a single row or the zero matrix, both immediate base cases. There is no possibility of an infinite loop, unlike some iterative numerical methods used for other problems.

Does row reduction change the row space, column space, or null space of a matrix?

Elementary row operations preserve the row space (the span of the rows) exactly, since each operation replaces the set of rows with a new set that spans the identical subspace — a swap only reorders spanning vectors, a scale by a nonzero constant does not change the span of a single vector, and adding a multiple of one row to another keeps the same span (this is precisely why solution sets are preserved). The null space (solution set of the homogeneous system) is likewise preserved, exactly as shown for general solution sets in this article. The column space, however, is generally not preserved by row operations — a row-reduced matrix can have a completely different column space from the original, even though relationships (linear dependencies) among corresponding columns are preserved, which is exactly the fact used in the uniqueness proof of RREF.

Before this

Where this leads