Skip to content

Systems of Linear Equations

A system of linear equations is a set of equations you want to solve simultaneously. In this lesson you’ll learn how to solve them using substitution, elimination, and matrix form, and understand what their solutions look like geometrically.

A system of two equations in two unknowns:

{2x+3y=84xy=7\begin{cases} 2x + 3y = 8 \\ 4x - y = 7 \end{cases}

We want to find values of xx and yy that satisfy all equations at the same time.

  1. Substitution: Solve one equation for one variable and substitute into the other.
  2. Elimination: Add or subtract equations to eliminate one variable.
  3. Matrix Method: Write the system as Ax=bA\mathbf{x} = \mathbf{b} and solve using matrices (covered more in later lessons).

Geometrically, each equation in 2D is a line. Two lines can:

  1. Intersect at exactly one point (unique solution)
  2. Be parallel and never meet (no solution, inconsistent)
  3. Be the same line (infinitely many solutions, dependent)
One Solution (2, 1) No Solution parallel Infinite Solutions same line Equation 1 Equation 2 Solution point

In the diagram: the left panel shows two lines crossing at a single point (2,1)(2, 1), the unique solution. The middle panel shows two parallel lines with no intersection. The right panel shows two overlapping lines with infinitely many solutions.

We often write the system as an augmented matrix, combining AA and b\mathbf{b}:

[238417]\left[\begin{array}{cc|c} 2 & 3 & 8 \\ 4 & -1 & 7 \end{array}\right]

This compact form is what we’ll use for row reduction in the next lesson.

Example 1: Substitution Method

{x+2y=53xy=8\begin{cases} x + 2y = 5 \\ 3x - y = 8 \end{cases}

From the first equation: x=52yx = 5 - 2y

Plug into the second: 3(52y)y=83(5 - 2y) - y = 8

156yy=815 - 6y - y = 8

157y=815 - 7y = 8

y=1y = 1

Then x=52(1)=3x = 5 - 2(1) = 3. Solution: (3,1)(3, 1).

Example 2: Elimination Method

{2x+3y=124x3y=6\begin{cases} 2x + 3y = 12 \\ 4x - 3y = 6 \end{cases}

Add the equations: 6x=186x = 18, so x=3x = 3.

Plug back in: 2(3)+3y=122(3) + 3y = 12, so 3y=63y = 6, y=2y = 2.

Solution: (3,2)(3, 2).

Example 3: No Solution (Inconsistent)

{x+y=5x+y=7\begin{cases} x + y = 5 \\ x + y = 7 \end{cases}

Both equations say x+yx + y equals something, but 5 and 7 are different. The lines are parallel. No solution exists.

Systems of equations show up everywhere:

  • Game physics: solving for collision points between objects
  • Pathfinding: balancing constraints across routes
  • Circuit analysis: finding currents through components
  • Economics: supply and demand equilibrium

Example: In a 3D game, you might solve a system to find where a projectile will hit a moving target, or to determine the exact position where two objects collide. The engine does this many times per frame.

A system of linear equations has a unique solution when the lines:
The elimination method works by:
If a system has no solution, it is called:
The system $x + y = 5$ and $x + y = 5$ has:
In game development, systems of equations are often solved to find: