Systems of Linear Equations: Cramer’s Rule and the Rouché-Capelli Theorem

Cramer’s rule solves a square system Ax = b with det A ≠ 0 by the formulas xi = det Ai/det A, where Ai is A with its i-th column replaced by b; the Rouché–Capelli theorem decides solvability of any linear system: Ax = b has a solution exactly when rank A = rank [A | b], and then the solution is unique if the rank equals the number of unknowns. In brief: for 2x + y = 5, x − y = 1, det A = −3 and x = (−6)/(−3) = 2, y = (−3)/(−3) = 1. For the system x + y + z = 1, x + 2y + 3z = 2, x + 3y + az = b, there is a unique solution if a ≠ 5, infinitely many if a = 5 and b = 3, and none if a = 5 and b ≠ 3.

This guide states both results with the conditions, shows how to apply them with worked examples, covers parametric systems and homogeneous systems, and compares the methods in a table.

How does Cramer’s rule work?

Let A be an n × n matrix with det A ≠ 0. The unique solution of Ax = b is xi = det Ai/det A, where Ai is obtained from A by replacing column i with b. The rule follows from x = A−1b and the adjugate formula for the inverse.

Example 1: a 2 × 2 system

2x + y = 5 and x − y = 1. det A = det [[2, 1], [1, −1]] = −3. For x, replace the first column by (5, 1): det [[5, 1], [1, −1]] = −6, so x = 2. For y, replace the second column: det [[2, 5], [1, 1]] = −3, so y = 1. Check: 4 + 1 = 5 and 2 − 1 = 1 ✓.

x = 511−1 / 211−1 = −6/−3 = 2 y = 2511 / 211−1 = −3/−3 = 1

Example 2: a 3 × 3 system

x + y + z = 6, 2x − y + z = 3, x + 2y − z = 2. det A = 1(1 − 2) − 1(−2 − 1) + 1(4 + 1) = −1 + 3 + 5 = 7. Replacing the columns by b = (6, 3, 2):

6113−1122−1 16123112−1 1162−13122 Dx = 7 Dy = 14 Dz = 21 det A = 7 (x, y, z) = (7/7, 14/7, 21/7) = (1, 2, 3)

The solution is (1, 2, 3), as before. Cramer’s rule needs n + 1 determinants, which is far more work than elimination for large n, so it is mainly a theoretical tool and a convenient method for 2 × 2 and 3 × 3 systems or for one unknown in a large system.

What does the Rouché–Capelli theorem say?

Let A be the m × n coefficient matrix and [A | b] the augmented matrix of a system with n unknowns.

The reason: Ax = b is solvable if and only if b lies in the column space of A, which means that adding b as a column does not increase the rank. When the system is consistent, the solution set is a particular solution plus the null space of dimension n − r.

Example 3: three outcomes with a parameter

x + y + z = 1, x + 2y + 3z = 2, x + 3y + az = b. Row reduce [[1, 1, 1 | 1], [1, 2, 3 | 2], [1, 3, a | b]]: R2 − R1 = (0, 1, 2 | 1), R3 − R1 = (0, 2, a − 1 | b − 1), then R3 − 2R2 = (0, 0, a − 5 | b − 3).

1111123213ab -> 1111012102a−1b−1 -> 1111012100a−5b−3

Example 4: counting parameters

A system of 3 equations in 5 unknowns with rank A = rank [A | b] = 3 has 5 − 3 = 2 free parameters. A system of 4 equations in 3 unknowns with rank A = rank [A | b] = 3 has exactly one solution, although there are more equations than unknowns.

How do you analyze a system with parameters?

For a square system, compute det A as a function of the parameter. For the parameter values with det A ≠ 0, Cramer’s rule gives a unique solution. For the roots of det A = 0, substitute the value and examine the ranks.

Example 5: a parametric 2 × 2 system

x + ky = 1, kx + 4y = 2. det A = 4 − k2. For k ≠ ±2: x = (4 − 2k)/(4 − k2) = 2(2 − k)/((2 − k)(2 + k)) = 2/(2 + k) and y = (2 − k)/(4 − k2) = 1/(2 + k). For k = 2: x + 2y = 1 and 2x + 4y = 2, the same line, so infinitely many solutions (rank 1 = rank 1). For k = −2: x − 2y = 1 and −2x + 4y = 2, that is x − 2y = −1: parallel lines, no solution.

When does a homogeneous system have nontrivial solutions?

The system Ax = 0 always has the zero solution. For a square matrix, a nonzero solution exists exactly when det A = 0. In general, there are nontrivial solutions iff rank A < n; in particular whenever there are more unknowns than equations.

Example 6: finding the critical parameter

For which λ does (1 − λ)x + 2y = 0, 2x + (4 − λ)y = 0 have a nonzero solution? det = (1 − λ)(4 − λ) − 4 = λ2 − 5λ = λ(λ − 5). So λ = 0 or λ = 5. This is the eigenvalue condition for the matrix [[1, 2], [2, 4]].

Table of cases

Solvability of Ax = b with n unknowns
rank A vs rank [A | b] rank A vs n Solutions Method
rank A < rank [A | b]anynoneRouché–Capelli
equalrank A = nexactly oneCramer (square), elimination
equalrank A = r < ninfinitely many, n − r parameterselimination, free variables
b = 0rank A = nonly x = 0det A ≠ 0
b = 0rank A < nnontrivial solutionsdet A = 0 (square case)

Who discovered these results?

The rule bears the name of Gabriel Cramer, who published it in 1750 in his work on algebraic curves; Colin Maclaurin had obtained the formulas for systems of two and three equations earlier (published posthumously in 1748). The consistency criterion is named after Eugène Rouché (1875) and Alfredo Capelli (1892); in Russian-language literature it is called the Kronecker–Capelli theorem, and in Spanish the Rouché–Frobenius theorem, which reflects the contributions of several authors.

Which mistakes are common?

Using Cramer’s rule when det A = 0

The formulas divide by det A. If it is zero, the system has either no solution or infinitely many, and you need the ranks.

Replacing the wrong column

For xi, replace the i-th column of A by b, and keep the other columns.

Comparing rank A with the number of equations

The relevant comparison is with the number of unknowns n, for the uniqueness of the solution.

Forgetting the augmented rank

Having rank A = n is not enough for a rectangular system: check that adding b does not increase the rank.