TExcelTAD
Home › Linear Algebra & Matrix Theory › Homogeneous Systems

Homogeneous Systems

A system is homogeneous when every constant term is zero: Ax=0A\mathbf{x} = \mathbf{0}. 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 Ax=0A\mathbf{x} = \mathbf{0}, the zero vector x=(0,0,…,0)\mathbf{x} = (0, 0, \ldots, 0) 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 [0 … 0∣c][0\ \ldots\ 0 \mid c] with c≠0c \ne 0 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 u\mathbf{u} and v\mathbf{v} solve Ax=0A\mathbf{x} = \mathbf{0} and cc is any number, then

A(u+v)=Au+Av=0+0=0A(c⋅u)=c⋅(Au)=c⋅0=0\begin{aligned} A(\mathbf{u} + \mathbf{v}) &= A\mathbf{u} + A\mathbf{v} = \mathbf{0} + \mathbf{0} = \mathbf{0} \\ A(c \cdot \mathbf{u}) &= c \cdot (A\mathbf{u}) = c \cdot \mathbf{0} = \mathbf{0} \end{aligned}

so u+v\mathbf{u} + \mathbf{v} and c⋅uc \cdot \mathbf{u} 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 AA, 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.

x1+2x2−x4=0x3+3x4=0RREF: [120−1000130]\begin{aligned} x_1 + 2x_2 - x_4 &= 0 \\ x_3 + 3x_4 &= 0 \end{aligned} \qquad \text{RREF: } \left[\begin{array}{rrrr|r} 1 & 2 & 0 & -1 & 0 \\ 0 & 0 & 1 & 3 & 0 \end{array}\right]
free: x2=s, x4=tx=s⋅(−2,1,0,0)+t⋅(1,0,−3,1)\begin{aligned} &\text{free: } x_2 = s,\ x_4 = t \\ &\mathbf{x} = s \cdot (-2, 1, 0, 0) + t \cdot (1, 0, -3, 1) \end{aligned}

SymPy computes the basic solutions with nullspace():

python · try it yourself
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 p\mathbf{p} is one solution of Ax=bA\mathbf{x} = \mathbf{b} (a particular solution). Then:

every solution of Ax=b=p+(a solution of Ax=0)\text{every solution of } A\mathbf{x} = \mathbf{b} \quad = \quad \mathbf{p} + (\text{a solution of } A\mathbf{x} = \mathbf{0})

Why? If Ax=bA\mathbf{x} = \mathbf{b}, then A(x−p)=b−b=0A(\mathbf{x} - \mathbf{p}) = \mathbf{b} - \mathbf{b} = \mathbf{0}, so x−p\mathbf{x} - \mathbf{p} is a homogeneous solution. Conversely if Ah=0A\mathbf{h} = \mathbf{0}, then A(p+h)=b+0=bA(\mathbf{p} + \mathbf{h}) = \mathbf{b} + \mathbf{0} = \mathbf{b}.

So the solution set of Ax=bA\mathbf{x} = \mathbf{b} is the homogeneous solution set shifted by p\mathbf{p}: 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 p\mathbf{p} and q\mathbf{q}, then h=q−p≠0\mathbf{h} = \mathbf{q} - \mathbf{p} \ne \mathbf{0} solves Ah=0A\mathbf{h} = \mathbf{0}, and so does every t⋅ht \cdot \mathbf{h}; hence p+t⋅h\mathbf{p} + t \cdot \mathbf{h} is a solution for every tt, infinitely many.

python · try it yourself
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 ss and tt, which proves the formula works for all values at once.

In software

  • Null spaces in ML: if a feature matrix XX has non-trivial solutions to Xw=0X\mathbf{w} = \mathbf{0}, then adding any such w\mathbf{w} 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 x+y=0x + y = 0, x−y=0x - y = 0 have non-trivial solutions? What about x+y+z=0x + y + z = 0, x−y=0x - y = 0?

Answer

First: only the trivial solution. Second: yes, infinitely many, e.g. (1,1,−2)(1, 1, -2).

Solution
First: adding gives 2x=0, so x=0, y=0. Two pivots, two variables.Second: 3 unknowns, 2 equations→a free variable. x=y=t, z=−2t.t=1: (1,1,−2). Check: 1+1−2=0✓, 1−1=0✓\begin{aligned} &\text{First: adding gives } 2x = 0, \text{ so } x = 0,\ y = 0. \text{ Two pivots, two variables.} \\ &\text{Second: } 3 \text{ unknowns, } 2 \text{ equations} \to \text{a free variable. } x = y = t,\ z = -2t. \\ &t = 1\text{: } (1, 1, -2). \text{ Check: } 1 + 1 - 2 = 0 \checkmark,\ 1 - 1 = 0 \checkmark \end{aligned}

Exercise 2: Basic solutions by hand

Find the basic solutions of x1−x2+2x3=0x_1 - x_2 + 2x_3 = 0 (one equation, three unknowns).

Answer

(1,1,0)(1, 1, 0) and (−2,0,1)(-2, 0, 1).

Solution
x1=x2−2x3,free x2=s, x3=ts=1, t=0→(1,1,0)s=0, t=1→(−2,0,1)\begin{aligned} &x_1 = x_2 - 2x_3, \quad \text{free } x_2 = s,\ x_3 = t \\ &s = 1,\ t = 0 \to (1, 1, 0) \\ &s = 0,\ t = 1 \to (-2, 0, 1) \end{aligned}

Exercise 3: Particular plus homogeneous

One solution of x1−x2+2x3=4x_1 - x_2 + 2x_3 = 4 is (4,0,0)(4, 0, 0). Use Exercise 2 to write the general solution, and find the solution with x2=3x_2 = 3, x3=−1x_3 = -1.

Answer

x=(4,0,0)+s⋅(1,1,0)+t⋅(−2,0,1)\mathbf{x} = (4, 0, 0) + s \cdot (1, 1, 0) + t \cdot (-2, 0, 1); with s=3s = 3, t=−1t = -1: (9,3,−1)(9, 3, -1).

Solution
x2=s=3, x3=t=−1x=(4+3+2,3,−1)=(9,3,−1)Check: 9−3+2⋅(−1)=4✓\begin{aligned} &x_2 = s = 3,\ x_3 = t = -1 \\ &\mathbf{x} = (4 + 3 + 2, 3, -1) = (9, 3, -1) \\ &\text{Check: } 9 - 3 + 2 \cdot (-1) = 4 \checkmark \end{aligned}

Exercise 4: Null space in code

Use SymPy to find the null space of [11111−11−1]\begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & -1 & 1 & -1 \end{bmatrix} and verify each basis vector.

Answer

Two basic solutions: (−1,0,1,0)(-1, 0, 1, 0) and (0,−1,0,1)(0, -1, 0, 1).

Solution

RREF is [10100101]\begin{bmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \end{bmatrix}, so x1=−x3x_1 = -x_3 and x2=−x4x_2 = -x_4 with x3,x4x_3, x_4 free.

python · try it yourself
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?

  1. It may be inconsistent
  2. It has only the trivial solution
  3. It has infinitely many solutions
  4. It has exactly 2 solutions

If p\mathbf{p} solves Ax=bA\mathbf{x} = \mathbf{b} and h\mathbf{h} solves Ax=0A\mathbf{x} = \mathbf{0}, what does p+h\mathbf{p} + \mathbf{h} solve?

  1. Ax=0A\mathbf{x} = \mathbf{0}
  2. Ax=bA\mathbf{x} = \mathbf{b}
  3. Ax=2bA\mathbf{x} = 2\mathbf{b}
  4. Nothing in general

Why can a homogeneous system never be inconsistent?

  1. Because its matrix is square
  2. Because x=0\mathbf{x} = \mathbf{0} is always a solution
  3. Because it has no free variables
  4. Because its determinant is non-zero