TExcelTAD
Home › Linear Algebra & Matrix Theory › Geometric View of Systems of Equations

Geometric View of Systems of Equations

A linear equation in two variables describes a straight line in the plane, and a system of such equations asks where all the lines meet. This picture explains at a glance why a linear system has exactly one solution, no solution, or infinitely many, and never, say, exactly two.

One equation, one line

The solutions of a linear equation a⋅x+b⋅y=ca \cdot x + b \cdot y = c (with aa and bb not both 0) are the points (x,y)(x, y) on a straight line. For example, 2x+y=42x + y = 4 contains the points (0,4)(0, 4), (1,2)(1, 2) and (2,0)(2, 0).

A system of two equations asks for the points that lie on both lines. Two lines in the plane can relate in only three ways:

Lines Number of solutions Example
cross at one point exactly one x+y=3, x−y=1→(2,1)x + y = 3,\ x - y = 1 \to (2, 1)
parallel, different none (the system is inconsistent) x+y=3, x+y=5x + y = 3,\ x + y = 5
the same line infinitely many x+y=3, 2x+2y=6x + y = 3,\ 2x + 2y = 6
python · try it yourself
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-1, 5, 50)
fig, axes = plt.subplots(1, 3, figsize=(9, 3))
cases = [("one solution", [(1, 1, 3), (1, -1, 1)]),
         ("no solution", [(1, 1, 3), (1, 1, 5)]),
         ("infinitely many", [(1, 1, 3), (2, 2, 6)])]
for ax, (title, eqs) in zip(axes, cases):
    for i, (a, b, c) in enumerate(eqs):
        ax.plot(x, (c - a * x) / b, lw=3 - i, ls="-" if i == 0 else "--",
                label=f"{a}x + {b}y = {c}")
    ax.set_title(title); ax.set_ylim(-2, 6); ax.legend(fontsize=7); ax.grid(alpha=0.3)
axes[0].plot(2, 1, "ko")
plt.tight_layout()
print("drawn 3 panels")
drawn 3 panels

The middle panel is why the parallel case has no solution: two different parallel lines never meet. In the right panel the second equation is just the first one multiplied by 2, so it adds no new information.

How to tell the cases apart algebraically

For two equations a1x+b1y=c1a_1x + b_1y = c_1 and a2x+b2y=c2a_2x + b_2y = c_2, the lines are parallel exactly when their normal directions (a1,b1)(a_1, b_1) and (a2,b2)(a_2, b_2) are proportional, which happens when

a1⋅b2−a2⋅b1=0a_1 \cdot b_2 - a_2 \cdot b_1 = 0

This number is the determinant of the coefficient matrix; you will meet it properly in Determinants of 2×2 and 3×3 Matrices. If it is not 0, there is exactly one solution. If it is 0, the system has either none or infinitely many, depending on the right-hand sides.

python · try it yourself
def classify(e1, e2):
    (a1, b1, c1), (a2, b2, c2) = e1, e2
    det = a1 * b2 - a2 * b1
    if det != 0:
        x = (c1 * b2 - c2 * b1) / det
        y = (a1 * c2 - a2 * c1) / det
        return f"one solution ({x}, {y})"
    # parallel: same line if the whole equations are proportional
    if a1 * c2 - a2 * c1 == 0 and b1 * c2 - b2 * c1 == 0:
        return "infinitely many (same line)"
    return "no solution (parallel lines)"

print(classify((1, 1, 3), (1, -1, 1)))
print(classify((1, 1, 3), (1, 1, 5)))
print(classify((1, 1, 3), (2, 2, 6)))
print(classify((3, -2, 4), (1, 4, 6)))
one solution (2.0, 1.0)
no solution (parallel lines)
infinitely many (same line)
one solution (2.0, 1.0)

Three variables: planes

An equation a⋅x+b⋅y+c⋅z=da \cdot x + b \cdot y + c \cdot z = d in three variables describes a plane in space. Three planes can meet in a single point (the typical case), along a common line (like pages of a book meeting at the spine), in a whole plane (all three equations the same), or not at all (for example two parallel planes, or three planes forming a triangular "tent" with no common point).

In nn variables each equation is a "flat" of dimension n−1n - 1 (a hyperplane), and the same three outcomes remain: zero, one or infinitely many solutions. Why not exactly two? If two different points both lie on all the flats, so does the whole line through them, because each equation is linear. You will prove this in Homogeneous Systems.

Note: More equations than unknowns does not automatically mean "no solution", and fewer does not guarantee infinitely many. The equations might be redundant or contradictory. Only elimination tells you for sure.

In software

  • Collision detection and ray casting in games intersect lines with lines or planes, which is solving a small linear system. See Game Math: Ray–Plane.
  • Constraint solvers (CAD sketches, UI auto-layout engines like Cassowary) find points satisfying many linear equations at once; the "no solution" case is a conflicting constraint and the "infinitely many" case is an under-constrained layout.
  • The determinant test above is exactly what a 2D line-intersection routine checks before dividing.

Exercises

Exercise 1: Classify by eye

Without solving, how many solutions does each system have? (a) y=2x+1y = 2x + 1, y=2x−3y = 2x - 3. (b) y=2x+1y = 2x + 1, y=−x+4y = -x + 4. (c) y=2x+1y = 2x + 1, 4x−2y=−24x - 2y = -2.

Answer

(a) none, (b) one, (c) infinitely many.

Solution
(a) same slope 2, different intercepts→parallel→none(b) slopes 2 and −1 differ→cross once (at x=1, y=3)(c) 4x−2y=−2  ⟺  y=2x+1→the same line→infinitely many\begin{aligned} &\text{(a) same slope } 2, \text{ different intercepts} \to \text{parallel} \to \text{none} \\ &\text{(b) slopes } 2 \text{ and } -1 \text{ differ} \to \text{cross once (at } x = 1,\ y = 3\text{)} \\ &\text{(c) } 4x - 2y = -2 \iff y = 2x + 1 \to \text{the same line} \to \text{infinitely many} \end{aligned}

Exercise 2: Find the crossing

Find the intersection point of 3x+y=73x + y = 7 and x−2y=0x - 2y = 0.

Answer

(2,1)(2, 1).

Solution
From the second equation: x=2ySubstitute: 3⋅(2y)+y=7→7y=7→y=1, x=2Check: 3⋅2+1=7✓2−2⋅1=0✓\begin{aligned} &\text{From the second equation: } x = 2y \\ &\text{Substitute: } 3 \cdot (2y) + y = 7 \to 7y = 7 \to y = 1,\ x = 2 \\ &\text{Check: } 3 \cdot 2 + 1 = 7 \checkmark \qquad 2 - 2 \cdot 1 = 0 \checkmark \end{aligned}

Exercise 3: Choose k

For which kk does the system x+2y=1x + 2y = 1, 3x+k⋅y=53x + k \cdot y = 5 have no solution?

Answer

k=6k = 6.

Solution
det⁡=1⋅k−3⋅2=k−6=0→k=6For k=6 the second line is 3x+6y=5, i.e. x+2y=53≠1→parallel, distinct→no solutionFor every other k there is exactly one solution.\begin{aligned} &\det = 1 \cdot k - 3 \cdot 2 = k - 6 = 0 \to k = 6 \\ &\text{For } k = 6 \text{ the second line is } 3x + 6y = 5, \text{ i.e. } x + 2y = \tfrac{5}{3} \ne 1 \to \text{parallel, distinct} \to \text{no solution} \\ &\text{For every other } k \text{ there is exactly one solution.} \end{aligned}

Exercise 4: Line intersection function (code)

Use classify from the lesson (or write your own) on 0.5x+y=20.5x + y = 2 and −x+3y=1-x + 3y = 1.

Answer

One solution, (x,y)=(2,1)(x, y) = (2, 1).

Solution
det⁡=0.5⋅3−(−1)⋅1=2.5x=2⋅3−1⋅12.5=2,y=0.5⋅1−(−1)⋅22.5=1\begin{aligned} \det &= 0.5 \cdot 3 - (-1) \cdot 1 = 2.5 \\ x &= \frac{2 \cdot 3 - 1 \cdot 1}{2.5} = 2, \qquad y = \frac{0.5 \cdot 1 - (-1) \cdot 2}{2.5} = 1 \end{aligned}
python · try it yourself
a1, b1, c1, a2, b2, c2 = 0.5, 1, 2, -1, 3, 1
det = a1 * b2 - a2 * b1
print(det, (c1 * b2 - c2 * b1) / det, (a1 * c2 - a2 * c1) / det)
2.5 2.0 1.0

Test yourself

Can a system of linear equations have exactly two solutions?

  1. Yes, if two lines cross twice
  2. Yes, with three variables
  3. No: if it has two, it has infinitely many
  4. Only over the complex numbers

Two equations in xx and yy have coefficient determinant a1b2−a2b1=0a_1b_2 - a_2b_1 = 0. What can you conclude?

  1. Exactly one solution
  2. The lines are parallel or identical, so none or infinitely many
  3. No solution
  4. The system has three solutions

What does one linear equation in three unknowns describe geometrically?

  1. A point
  2. A line
  3. A plane
  4. A sphere