Solving Linear Systems Using Matrices

A system of linear equations arises whenever two or more unknown quantities are related by straight-line (linear) relationships. Rather than solving each equation one at a time by substitution or elimination, linear algebra lets us package the entire system into a single matrix equation Ax = b, where A is the coefficient matrix, x is the column vector of unknowns, and b is the column vector of constants. This compact notation is not just convenient — it opens the door to powerful solution methods that scale to hundreds or thousands of variables. The determinant of the coefficient matrix A plays a central role in deciding whether a unique solution exists. If det(A) ≠ 0, the matrix is invertible and the system has exactly one solution, which can be found by computing the inverse matrix, by row reduction (Gaussian elimination), or by Cramer's Rule. If det(A) = 0 the matrix is singular, meaning the system either has no solution (inconsistent) or infinitely many solutions (dependent). Checking the determinant first is therefore a quick diagnostic before investing effort in a full solution. Mastering matrix methods for linear systems is foundational for all of science and engineering. Circuits, chemical balancing, economic models, and computer graphics all reduce to solving Ax = b. The techniques introduced here — matrix multiplication, the inverse, row operations, and Cramer's Rule — will appear repeatedly throughout higher mathematics and quantitative disciplines.

Key takeaways
  • Write the Matrix Equation
  • Compute det(A) to Test Solvability
  • Method 1 — Inverse Matrix
  • Method 2 — Gaussian Elimination (Row Reduction)
  • Method 3 — Cramer's Rule

Write the Matrix Equation

Arrange every coefficient into an n×n matrix A (rows = equations, columns = variables) and write the right-hand side constants as a column vector b. For example, the system 2x + y = 5, x − 3y = −1 becomes A = [[2,1],[1,−3]], x = [x,y]^T, b = [5,−1]^T, giving Ax = b.

Compute det(A) to Test Solvability

Calculate the determinant of A. For a 2×2 matrix [[a,b],[c,d]], det(A) = ad − bc. For the example: det(A) = (2)(−3) − (1)(1) = −6 − 1 = −7 ≠ 0, so a unique solution exists. If det(A) = 0, stop and analyse the augmented matrix for consistency.

Method 1 — Inverse Matrix

When det(A) ≠ 0, the unique solution is x = A⁻¹b. For a 2×2 matrix, A⁻¹ = (1/det(A)) × [[d,−b],[−c,a]]. Using the example: A⁻¹ = (1/−7)×[[−3,−1],[−1,2]] = [[3/7, 1/7],[1/7, −2/7]]. Multiplying: x = [[3/7,1/7],[1/7,−2/7]] × [5,−1]^T = [(15/7 − 1/7),(5/7 + 2/7)] = [2, 1]. So x = 2, y = 1.

Method 2 — Gaussian Elimination (Row Reduction)

Form the augmented matrix [A|b] and apply elementary row operations — swap rows, multiply a row by a nonzero scalar, add a multiple of one row to another — to reach row echelon form, then back-substitute. For the example: [[2,1|5],[1,−3|−1]]. R1↔R2 → [[1,−3|−1],[2,1|5]]. R2 − 2R1 → [[1,−3|−1],[0,7|7]]. Divide R2 by 7 → [[1,−3|−1],[0,1|1]]. Back-sub: y = 1, x = −1 + 3(1) = 2. Same answer.

Method 3 — Cramer's Rule

For an n×n system Ax = b with det(A) ≠ 0, the i-th unknown is xᵢ = det(Aᵢ)/det(A), where Aᵢ is the matrix A with column i replaced by b. For x: A₁ = [[5,1],[−1,−3]], det(A₁) = (5)(−3)−(1)(−1) = −14, so x = −14/−7 = 2. For y: A₂ = [[2,5],[1,−1]], det(A₂) = (2)(−1)−(5)(1) = −7, so y = −7/−7 = 1. Cramer's Rule is elegant for small systems but less efficient than row reduction for large ones.

The Key Equation

x=A−1b=1det⁡(A)(d−b−ca)(b1b2)\mathbf{x} = A^{-1}\mathbf{b} = \frac{1}{\det(A)} \begin{pmatrix} d & -b \\ -c & a \end{pmatrix} \begin{pmatrix} b_1 \\ b_2 \end{pmatrix}
  • A^{-1} — Inverse of A (dimensionless): The matrix such that A⁻¹A = I; exists only when det(A) ≠ 0.
  • \det(A) — Determinant (dimensionless): For [[a,b],[c,d]], det(A) = ad − bc; measures how A scales area and whether A is invertible.
  • \mathbf{b} — Constant vector (dimensionless): Column vector of right-hand side values from the original equations.
  • \mathbf{x} — Solution vector (dimensionless): Column vector of unknowns [x₁, x₂, …, xₙ]^T whose values satisfy the system.

Worked Example

Problem. Solve the system using both Cramer's Rule and the inverse matrix method: 3x + 2y = 8 and x − y = 1.

x=2,y=1x = 2,\quad y = 1

Answer. x = 2, y = 1

Figure
Diagram
Geometric Interpretation: Two Equations, One Solutionxy12345123453x+2y=8x−y=1(2, 1)The unique intersection point (2,1) is the solution to the system.
Origins · 1 minGabriel Cramer and how this was discovered
GC
Gabriel Cramer
1704–1752 · Swiss

Cramer published his famous rule for solving a system of n linear equations in n unknowns in his 1750 work 'Introduction à l'Analyse des lignes Courbes algébriques'. Cramer's Rule expresses each unknown as a ratio of two determinants, providing the first systematic formula connecting determinants to the solution of linear systems. Although computationally expensive for large systems, it gave mathematicians a closed-form expression for solutions and deepened the theoretical understanding of determinants. Cramer studied under the renowned mathematician Johann Bernoulli and, at just 20 years old, was appointed co-chair of mathematics at the Geneva Academy — a position he eventually held alone, all while corresponding with Euler and other giants of the era.