II.13 · Linear Algebra
Each row is a constraint; a solution satisfies all rows at once.
Move two exact lines through unique, parallel, coincident, vertical, and zero-row cases. The same geometry is the matrix equation Ax = b.
Move two exact constraints between one, none, and many solutions
The two exact constraints meet once at (2, 1). Vertical lines require no special mathematical guess; they are ordinary coefficient rows.
- matrix A
- 2×2 [1, 1; 1, −1]
- right-hand side
- (3, 1)
- exact coefficient determinant
- −2
- system classification
- one exact solution
- intersection / solution
- (2, 1)
Exact expressions use =. Rounded computations use ≈. Every view uses this same state.
The two exact constraints meet once at (2, 1). Vertical lines require no special mathematical guess; they are ordinary coefficient rows.
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
Begin with the unique intersection. Choose Vertical + horizontal to see that vertical lines need no slope special case. Compare Parallel, none with Coincident, many. Finish with the two zero-row presets and explain why and behave differently.
Intuition: simultaneous constraints
One linear equation in two unknowns describes every point on a line. A system asks for points that lie on all its lines simultaneously. The possibilities are geometric:
- two independent lines meet once;
- distinct parallel lines never meet;
- coincident lines share infinitely many points.
Writing the equations as rows of one matrix makes those same constraints available to exact algebra and later algorithms.
Definition
The system
is the matrix equation
Each row is one constraint. A solution is one vector whose row dot-products equal the corresponding entries of .
Mechanics: classify before reporting a point
For two variables, the coefficient determinant
separates the unique case. If , the two directions differ and there is one exact intersection. If , compare the complete equations, including their right-hand sides: consistent proportional equations describe the same line; inconsistent proportions describe parallel lines.
This classification prevents a solver from dividing by zero and then presenting an invented point.
Derivation: the unique intersection
Multiply the first equation by and the second by , then subtract:
Similarly,
When ,
Substituting the result into both original rows verifies the solution. This exact two-equation derivation prepares the need for a systematic elimination algorithm in II.14 without implementing that chapter here.
Vertical lines and zero rows
The equation is the ordinary row . It needs no slope and no special mathematical representation. Likewise, is true for every point and adds no restriction. But is false for every point and makes the entire system inconsistent.
None versus infinitely many
When left-hand sides are proportional, inspect the right-hand sides. The equations
conflict, so there is no solution. Replacing by makes the second equation redundant, so every point on the shared line is a solution. Both have ; the right-hand sides distinguish them.
Worked examples
For
the determinant is , and the exact formulas give . Both rows verify: and .
Inspect the worked calculation
Write both constraints as A[x,y]ᵀ = b.
- matrix A
- 2×2 [1, 1; 1, −1]
- right-hand side
- (3, 1)
- exact coefficient determinant
- −2
- system classification
- one exact solution
- intersection / solution
- (2, 1)
For and , the exact intersection is . For coincident equations, the stage reports infinitely many solutions rather than choosing an arbitrary representative.
Executable reference code
The Python reference uses exact fractions and cross-products to classify all three outcomes, including zero rows. The NumPy file demonstrates a well-conditioned unique solve and checks residuals, while explicitly classifying singular examples before calling a numerical solver.
from fractions import Fraction as F
def solve2(a, rhs):
determinant = a[0][0] * a[1][1] - a[0][1] * a[1][0]
if determinant:
return "unique", ((rhs[0] * a[1][1] - a[0][1] * rhs[1]) / determinant,
(a[0][0] * rhs[1] - rhs[0] * a[1][0]) / determinant)
augmented_minors = (a[0][0] * rhs[1] - a[1][0] * rhs[0],
a[0][1] * rhs[1] - a[1][1] * rhs[0])
return ("infinite", None) if augmented_minors == (0, 0) else ("none", None)
assert solve2(((F(1), F(1)), (F(1), F(-1))), (F(3), F(1))) == ("unique", (F(2), F(1)))
assert solve2(((F(1), F(1)), (F(2), F(2))), (F(1), F(3)))[0] == "none"
assert solve2(((F(1), F(1)), (F(2), F(2))), (F(1), F(2)))[0] == "infinite"import numpy as np
A = np.array([[1.0, 1.0], [1.0, -1.0]])
b = np.array([3.0, 1.0])
np.testing.assert_allclose(np.linalg.solve(A, b), [2.0, 1.0])
parallel = np.array([[1.0, 1.0], [2.0, 2.0]])
assert np.linalg.matrix_rank(parallel) == 1
assert np.linalg.matrix_rank(np.column_stack((parallel, [1.0, 3.0]))) == 2
assert np.linalg.matrix_rank(np.column_stack((parallel, [1.0, 2.0]))) == 1Explore
Make one line vertical, then slide it by changing only its right-hand side. Turn the second line until it is parallel to the first. Scale an entire equation, including its right-hand side, and confirm the geometric line does not change. Then scale only the left side and explain why the line moves.
Common mistakes
Zero determinant does not by itself mean “no solution”; it means the unique formula cannot apply. Parallel and coincident equations require the right-hand sides. Dividing by an x-coefficient loses vertical constraints when that coefficient is zero. A point that satisfies one row is not a system solution until every row is checked.
Numerical considerations
Exact decimal inputs let the stage distinguish parallel from nearly parallel without an epsilon. In measured floating-point systems, nearly parallel constraints can make the intersection extremely sensitive. Reliable solvers use factorizations, residual checks, and scale-aware diagnostics. A tiny residual alone does not guarantee an accurate solution when the problem is ill-conditioned.
Engineering and ML connections
Constraint systems appear in calibration, circuit models, geometry, fitting, and equilibrium calculations. Normal equations and least squares later address systems that cannot satisfy every data constraint exactly. Linear layers also evaluate many row constraints at once, but solving for an unknown input is a different task from applying a known matrix.
Exercises
Summary and checkpoints
A row is a linear constraint and asks for a vector satisfying every row. Check that you can distinguish one, none, and infinitely many exact solutions; include vertical lines and zero rows; and verify a candidate in the original equations. II.14 develops this reasoning into general Gaussian elimination.