liveBook · Manning

Linear dependence

As explained in Geometry for Programmers

Linear dependence is a relationship in which one equation, vector, or other linear object can be expressed as a linear combination of others.

Linear dependence means that one linear equation, vector, or related object can be expressed using a linear combination of others. In a system, dependent equations do not add an independent constraint: they may describe the same hyperplane, permit infinitely many solutions, or reveal that the geometry has collapsed. section 3.2.1 section 6.3.1

Recognize linear dependence through its practical consequences:

  • In an overspecified system, coincident or dependent hyperplanes can allow a solution even when there are more equations than variables; numerical methods may also use redundant measurements to reduce error. section 3.2.1
  • For polynomial interpolation, a point lying on the line determined by two others creates a dependent equation, allowing a lower-degree polynomial to fit more points than usual. section 6.3.1
  • In ray-triangle intersection, a zero divisor signals dependence caused by a ray parallel to the triangle’s plane, a degenerate triangle, or a zero-length direction vector. section 3.8.3

Ray-triangle intersection

Write the ray and triangle equations as a three-variable linear system for t, u, and v. The common denominator div measures whether the system is independent enough to solve. Check div before computing the parameters; if div is zero, return no intersection. Otherwise, accept the result only when t ≥ 0, u ≥ 0, v ≥ 0, and u + v ≤ 1. section 3.8.3

Listing 3.1 Solving the ray-triangle intersection symbolically
from sympy import *
 
Px, Py, Pz = symbols('Px Py Pz')           #1
dx, dy, dz = symbols('dx dy dz')           #2
Ax, Ay, Az = symbols('Ax Ay Az')           #3
ABx, ABy, ABz = symbols('ABx ABy ABz')     #4
ACx, ACy, ACz = symbols('ACx ACy ACz')     #5
t, u, v = symbols('t u v')                 #6
 
solution = solve([
    Px +t*dx - (Ax + ABx*u + ACx*v),
    Py +t*dy - (Ay + ABy*u + ACy*v),
    Pz +t*dz - (Az + ABz*u + ACz*v)
], (t, u, v))
 
print (pycode(solution))

A SymPy listing constructs and solves the ray-triangle linear system symbolically, exposing the shared divisor used to detect dependence before parameter computation. section 3.8.3

How Geometry for Programmers covers it

How deep it goes
Explains geometric consequences and implementation checks, but defers formal rank theory and floating-point error analysis.
Examples
Uses coincident hyperplanes, collinear interpolation points, degenerate triangles, parallel rays, and symbolic SymPy equations.
What you can do after
Diagnose geometric degeneracy by checking a system’s divisor before calculating intersection parameters.
How it connects
Connects linear systems, overspecified systems, polynomial interpolation, Vandermonde matrices, and ray-triangle intersection.

Also explained in

Compare how 2 books explain linear dependence →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.