Systems of linear equations
Systems of linear equations: modeling, matrix form Ax = b, solution types (unique, infinite, none), Gaussian and Gauss–Jordan elimination, Cramer's rule, consistency via ranks (Rouché–Capelli), homogeneous systems, and geometric meaning.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Systems of linear equations arise whenever multiple linear constraints act together: balancing electrical currents at nodes, finding reactions in trusses, mass balances in chemical plants, fitting linear models in data, and allocating resources in operations. You will often reduce a physical problem to Ax = b, solve it reliably, and interpret whether a solution is unique, does not exist, or has infinitely many possibilities.
Key ideas
- The matrix form of a system is
A·x = b, where:Ais anm × ncoefficient matrix with entriesaij.xis then × 1column vector of unknowns.bis them × 1column vector of constants (right-hand side).
- The augmented matrix
[A | b]is the matrix obtained by appendingbas the last column ofA. It is a bookkeeping device to carry coefficients and constants together during elimination. - A homogeneous system is
A·x = 0. It always has the trivial solutionx = 0. If there are nonzero solutions, they are called nontrivial solutions. - A solution set can be:
- Unique (exactly one vector x),
- Infinitely many (a family with parameters), or
- Inconsistent (no solution).
- An elementary row operation (ERO) on a matrix is one of: (1) swap two rows, (2) multiply a row by a nonzero scalar, (3) replace a row by itself plus a scalar multiple of another row. EROs do not change the solution set of the corresponding linear system when applied to the augmented matrix.
- Row-echelon form (REF) and reduced row-echelon form (RREF) are standard simplified shapes obtained by EROs:
- In REF: all nonzero rows are above any zero rows; in each nonzero row, the first nonzero entry (the pivot) is to the right of the pivot above; entries below each pivot are zero.
- In RREF: additionally, each pivot is 1 and is the only nonzero entry in its column.
- The Gaussian elimination method reduces
[A | b]to REF by EROs, then solves by back-substitution. - The Gauss–Jordan elimination method continues to RREF, from which solutions are read directly without back-substitution.
- The determinant of a square matrix
A(n × n) is a scalar. Ifdet(A) ≠ 0, the matrix is invertible and the systemA·x = bhas a unique solutionx = A⁻¹·bfor everyb. - Cramer’s rule (square systems): If
Aisn × nwithdet(A) ≠ 0, the unique solution is given byxi = det(Ai) / det(A), whereAiisAwith its i-th column replaced byb. Cramer’s rule is theoretically important but computationally inefficient for large n.
- (Reference to rank; brief here, details in the topic “Rank of a matrix and echelon form”.) The rank of a matrix
rank(A)is the maximum number of linearly independent rows or columns. In REF or RREF, it equals the number of pivots. - Rouché–Capelli theorem (consistency criterion): For a linear system
A·x = b, the system is consistent (has at least one solution) if and only ifrank(A) = rank([A | b]). If consistent andrank(A) = n(full column rank), the solution is unique. If consistent andrank(A) < n, there are infinitely many solutions withn − rank(A)free parameters. - Free variables and basic variables: In RREF, pivot columns correspond to basic variables. Non-pivot columns correspond to free variables that can take arbitrary parameter values, generating infinitely many solutions.
- Geometric interpretation:
- In 2 variables, each equation is a line in the plane. A unique solution is their intersection point; infinite solutions occur when the lines are coincident; no solution when they are parallel distinct.
- In 3 variables, each equation is a plane. Solutions are intersection point (unique), a line or plane of intersection (infinitely many), or empty (inconsistent).
- What to draw and label (typical exam diagram prompts):
- For 2 equations in 2 unknowns: Draw x- and y-axes. Sketch two lines
a1x + b1y = c1anda2x + b2y = c2. Label slopes/intercepts if known. Show and label: (i) one intersection point (unique), or (ii) same line twice (infinite), or (iii) two parallel lines (none). Mark solution set appropriately. - For 3 equations in 3 unknowns: Draw three planes in 3D using perspective: (i) intersecting at a point (unique), (ii) two planes intersecting in a line and the third containing that line (infinite), (iii) three planes forming a triangular prism with no common point (none). Label the intersection feature.
- For 2 equations in 2 unknowns: Draw x- and y-axes. Sketch two lines
Exact statements commonly examined
- Definition: A system of linear equations is consistent if it has at least one solution and inconsistent otherwise.
- Theorem (Rouché–Capelli): For
A·x = bwithAanm × nmatrix, the system is consistent if and only ifrank(A) = rank([A | b]). If consistent, the general solution hasn − rank(A)free parameters. The solution is unique if and only ifrank(A) = n(full column rank). - Proposition: Applying elementary row operations to the augmented matrix preserves the solution set of the system.
- Theorem: If
Aisn × n, thendet(A) ≠ 0if and only ifAis invertible if and only ifA·x = bhas a unique solution for everyb.
Derivations universities commonly ask for (sketches)
- Why row operations preserve solutions: Swapping equations does not change the set of solutions; multiplying an equation by a nonzero scalar keeps the same set of solutions; replacing an equation by itself plus a multiple of another is a linear combination that vanishes for exactly the same solution set. Therefore EROs leave the solution set unchanged.
- Rouché–Capelli (idea): EROs reduce
[A | b]to REF. A contradiction row[0 0 … 0 | c]withc ≠ 0appears exactly whenrank([A | b]) > rank(A), meaning inconsistency. Otherwise, the number of pivots equalsrank(A), and the remainingn − rank(A)variables are free, giving infinite solutions unlessrank(A) = n.
Formulas
A·x = b — A is m × n coefficient matrix (dimensionless here), x is n × 1 vector of unknowns, b is m × 1 vector of constants; applies to any linear system.
[A | b] — Augmented matrix; used during elimination; entries are dimensionless in pure math problems.
det(A) ≠ 0 ⇔ A⁻¹ exists ⇔ A·x = b has a unique solution for every b — Square n × n A; determinant is a scalar (dimensionless); applies to square systems only.
xi = det(Ai) / det(A) — Cramer’s rule for square A with det(A) ≠ 0; Ai is A with i-th column replaced by b; all quantities dimensionless in pure math problems.
rank(A) = rank([A | b]) ⇔ system is consistent — Rouché–Capelli; A is m × n; ranks are nonnegative integers ≤ min(m, n); dimensionless.
number of free variables = n − rank(A) — For a consistent system with n unknowns; dimensionless count; gives parameters in the general solution.
Worked examples
Example 1: Gaussian elimination (unique solution)
Solve the system (all quantities dimensionless):
2x + y − z = 8, −3x − y + 2z = −11, −2x + y + 2z = −3.
Step 1: Write augmented matrix.
[ 2 1 −1 | 8 ]
[−3 −1 2 | −11]
[−2 1 2 | −3 ]
Step 2: Make a leading 1 in Row 1 (optional). Here proceed to eliminate below pivot 2 in Row 1.
- R2 ← R2 + (3/2)·R1: To avoid fractions, instead do R2 ← 2·R2 + 3·R1.
Original R2·2:
[−6 −2 4 | −22]; add 3·R1:[ 6 3 −3 | 24]; sum:[0 1 1 | 2]. So take R2 ←[0 1 1 | 2]. - R3 ← R3 + R1:
[−2+2, 1+1, 2−1 | −3+8] = [0, 2, 1 | 5]. Matrix now:[ 2 1 −1 | 8 ][ 0 1 1 | 2 ][ 0 2 1 | 5 ]
Step 3: Eliminate below pivot in Row 2.
- R3 ← R3 − 2·R2:
[0, 2−2, 1−2, 5−4] = [0, 0, −1, 1]. Matrix now:[ 2 1 −1 | 8 ][ 0 1 1 | 2 ][ 0 0 −1 | 1 ]
Step 4: Back-substitution from REF.
- From Row 3:
−z = 1⇒z = −1. - From Row 2:
y + z = 2⇒y + (−1) = 2⇒y = 3. - From Row 1:
2x + y − z = 8⇒2x + 3 − (−1) = 8⇒2x + 4 = 8⇒x = 2.
Final answer: x = 2, y = 3, z = −1.
Example 2: Consistency and general solution (infinitely many solutions)
Solve and describe all solutions using Gauss–Jordan (dimensionless):
x + 2y − z = 1, 2x + 4y − 2z = 2, −x − 2y + z = −1.
Step 1: Augmented matrix.
[ 1 2 −1 | 1 ]
[ 2 4 −2 | 2 ]
[−1 −2 1 | −1 ]
Step 2: R2 ← R2 − 2·R1 ⇒ [0 0 0 | 0].
R3 ← R3 + R1 ⇒ [0 0 0 | 0].
Matrix now:
[1 2 −1 | 1]
[0 0 0 | 0]
[0 0 0 | 0]
Step 3: RREF already in top row; pivot in column 1 only. Columns 2 and 3 are non-pivot ⇒ y and z are free variables.
From Row 1: x + 2y − z = 1 ⇒ x = 1 − 2y + z.
Let y = s, z = t be free parameters (any real numbers).
General solution: x = 1 − 2s + t, y = s, z = t, with parameters s, t ∈ ℝ. The system is consistent with rank(A) = rank([A | b]) = 1 and two free variables.
Example 3: Cramer’s rule (2 × 2 system)
Solve (dimensionless): 3x − 2y = 5, 4x + y = 6.
Step 1: Coefficient matrix and determinant.
A = [ [3, −2], [4, 1] ].
det(A) = 3·1 − (−2)·4 = 3 + 8 = 11 (nonzero ⇒ unique solution).
Step 2: Compute determinants for numerators.
A1 = [ [5, −2], [6, 1] ] ⇒ det(A1) = 5·1 − (−2)·6 = 5 + 12 = 17.
A2 = [ [3, 5], [4, 6] ] ⇒ det(A2) = 3·6 − 5·4 = 18 − 20 = −2.
Step 3: Apply Cramer’s rule.
x = det(A1)/det(A) = 17/11.
y = det(A2)/det(A) = (−2)/11 = −2/11.
Final answer: x = 17/11, y = −2/11.
Common mistakes
- Assuming a solution exists without checking consistency: missing a contradiction row like
[0 0 … 0 | c ≠ 0]. - In Cramer’s rule, replacing the wrong column with b, or computing determinants with sign errors.
- Treating a homogeneous system
A·x = 0as having only the trivial solution without checking if rank is less than number of unknowns (which gives nontrivial solutions). - Confusing rank(A) with number of equations m; rank is at most min(m, n) and equals the pivot count, not simply m.
- For square systems, using
A⁻¹or Cramer’s rule whendet(A) = 0; those formulas do not apply.
For your exam
- Theorems: Exact statements and brief proofs/ideas for Rouché–Capelli; equivalences
det(A) ≠ 0 ⇔ invertible ⇔ unique solution; justification that EROs preserve solutions. - Procedures/numericals: Perform elimination cleanly with numbered EROs, reach REF or RREF, identify pivots, state rank, and write solution (unique value or parametric form). Carry parameters explicitly for infinite solutions.
- Determinant-based: For small n (2 or 3), compute determinants accurately and apply Cramer’s rule, but first check
det(A) ≠ 0. - Diagrams: If asked, draw and label intersection of lines (2D) or planes (3D), and indicate whether the intersection set is a point/line/plane or empty.
- Full-marks answers include: correct setup
A, x, b, clear ERO steps with reasons, correct arithmetic, explicit statement of consistency via ranks or contradiction row, and a boxed final solution (values or parametric family). If using Cramer’s rule, show each determinant and the final ratios.
Quick check
- State the Rouché–Capelli condition for consistency and what it implies about the number of free variables.
- For
A·x = bwith A 3 × 3 anddet(A) = 0, can there be a unique solution for every b? Explain briefly. - Solve using mental elimination:
x + y = 7,x − y = 3.
Answers: 1) Consistent iff rank(A) = rank([A | b]); then free variables = n − rank(A). 2) No; det(A) = 0 means A is not invertible, so there is not a unique solution for every b; for some b there are either none or infinitely many solutions. 3) Add equations: 2x = 10 ⇒ x = 5; then y = 2.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?