Homogeneous Systems
A system is homogeneous when every constant term is zero: . Such a system always has at least one solution, and its solutions have a beautiful structure: you can add them and scale them and still get solutions. That structure explains the shape of every linear system's solution set.
Always consistent
For , the zero vector is always a solution, called the trivial solution. So the only question is whether there are non-trivial solutions as well.
After row reduction, the right-hand column stays all zeros (row operations cannot create a non-zero entry from zeros), so a row with can never appear. Therefore:
- if every variable has a pivot, the trivial solution is the only one;
- if some variable is free, there are infinitely many solutions.
Note: A homogeneous system with more unknowns than equations always has non-trivial solutions. There are at most as many pivots as rows (equations), so with more columns than rows some variable must be free.
Adding and scaling solutions
If and solve and is any number, then
so and are solutions too. The solution set of a homogeneous system is closed under addition and scalar multiplication; later this will be called a subspace (the null space of , see Column Space, Row Space and Null Space).
Basic solutions
From the RREF, set one free variable to 1 and the others to 0; this gives one basic solution per free variable. Every solution is a combination of the basic solutions.
SymPy computes the basic solutions with nullspace():
from sympy import Matrix
A = Matrix([[1, 2, 0, -1],
[2, 4, 1, 1],
[3, 6, 1, 0]])
print("RREF:", A.rref()[0].tolist())
basis = A.nullspace()
for v in basis:
print("basic solution:", list(v), " A*v =", list(A * v))
combo = 5 * basis[0] - 2 * basis[1]
print("5*v1 - 2*v2 =", list(combo), " A*combo =", list(A * combo))RREF: [[1, 2, 0, -1], [0, 0, 1, 3], [0, 0, 0, 0]]
basic solution: [-2, 1, 0, 0] A*v = [0, 0, 0]
basic solution: [1, 0, -3, 1] A*v = [0, 0, 0]
5*v1 - 2*v2 = [-12, 5, 6, -2] A*combo = [0, 0, 0]
Non-homogeneous systems: particular + homogeneous
Now the key structural fact. Suppose is one solution of (a particular solution). Then:
Why? If , then , so is a homogeneous solution. Conversely if , then .
So the solution set of is the homogeneous solution set shifted by : a line, plane or higher flat that does not (in general) pass through the origin. This also settles the question from the geometric view: if a system has two different solutions and , then solves , and so does every ; hence is a solution for every , infinitely many.
from sympy import Matrix, symbols
A = Matrix([[1, 2, 0, -1], [2, 4, 1, 1], [3, 6, 1, 0]])
b = Matrix([3, 7, 10])
p = Matrix([3, 0, 1, 0])
print("A*p == b:", A * p == b)
s, t = symbols("s t")
h = s * A.nullspace()[0] + t * A.nullspace()[1]
x = p + h
print("general solution:", list(x))
print("A*x - b =", list((A * x - b).expand()))A*p == b: True
general solution: [-2*s + t + 3, s, 1 - 3*t, t]
A*x - b = [0, 0, 0]
The check returns zeros for symbolic and , which proves the formula works for all values at once.
In software
- Null spaces in ML: if a feature matrix has non-trivial solutions to , then adding any such to a model's weights does not change its predictions. That is multicollinearity: the weights are not identifiable, and regularization is needed to pick one.
- Graphics and robotics: the null space of a robot arm's Jacobian is the set of joint motions that keep the hand still, which inverse-kinematics solvers use for secondary goals.
- Balancing chemical equations is a homogeneous system, see the chemistry application.
Exercises
Exercise 1: Trivial only?
Does , have non-trivial solutions? What about , ?
Answer
First: only the trivial solution. Second: yes, infinitely many, e.g. .
Solution
Exercise 2: Basic solutions by hand
Find the basic solutions of (one equation, three unknowns).
Answer
and .
Solution
Exercise 3: Particular plus homogeneous
One solution of is . Use Exercise 2 to write the general solution, and find the solution with , .
Answer
; with , : .
Solution
Exercise 4: Null space in code
Use SymPy to find the null space of and verify each basis vector.
Answer
Two basic solutions: and .
Solution
RREF is , so and with free.
from sympy import Matrix
A = Matrix([[1, 1, 1, 1], [1, -1, 1, -1]])
for v in A.nullspace():
print(list(v), list(A * v))[-1, 0, 1, 0] [0, 0]
[0, -1, 0, 1] [0, 0]
Test yourself
A homogeneous system has 5 equations and 7 unknowns. Which is true?
- It may be inconsistent
- It has only the trivial solution
- It has infinitely many solutions
- It has exactly 2 solutions
If solves and solves , what does solve?
- Nothing in general
Why can a homogeneous system never be inconsistent?
- Because its matrix is square
- Because is always a solution
- Because it has no free variables
- Because its determinant is non-zero