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 (with and not both 0) are the points on a straight line. For example, contains the points , and .
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 | |
| parallel, different | none (the system is inconsistent) | |
| the same line | infinitely many |
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 and , the lines are parallel exactly when their normal directions and are proportional, which happens when
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.
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 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 variables each equation is a "flat" of dimension (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) , . (b) , . (c) , .
Answer
(a) none, (b) one, (c) infinitely many.
Solution
Exercise 2: Find the crossing
Find the intersection point of and .
Answer
.
Solution
Exercise 3: Choose k
For which does the system , have no solution?
Answer
.
Solution
Exercise 4: Line intersection function (code)
Use classify from the lesson (or write your own) on and .
Answer
One solution, .
Solution
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?
- Yes, if two lines cross twice
- Yes, with three variables
- No: if it has two, it has infinitely many
- Only over the complex numbers
Two equations in and have coefficient determinant . What can you conclude?
- Exactly one solution
- The lines are parallel or identical, so none or infinitely many
- No solution
- The system has three solutions
What does one linear equation in three unknowns describe geometrically?
- A point
- A line
- A plane
- A sphere