Line–line intersection

Consider the two lines defined by

`vec r = vec r_0 + tvec m qquad and qquad vec s = vec s_0 + pvec n`.

These lines may or may not intersect. In `RR^2`, their are three cases:

collinear (`infty`)
The two lines are equal. Formally, `AA t\ EE p` such that `vec r = vec s`. This implies that `vec m = kvec n`, meaning the direction vectors are scalar multiples of each other. The initial points need not be equal, but each must lie on the other line: there must exist values of t and s such that `vec s_0 = vec r` and `vec r_0 = vec s`. There are `infty` points of intersection.
parallel (0)
The two lines are parallel, so `vec m = kvec n`, but they are not collinear. For all combinations of values of t and p, `vec r != vec s`. The lines never intersect.
nonparallel (1)
All other systems fall into this category. The lines are nonparallel, so `vec m != kvec n`. There is exactly one point of intersection.
xy−2−2−112−112xy−2−2−112−112xy−2−2−112−112
Collinear, parallel, and nonparallel pairs of lines in two-space

In `RR^3`, there is one more possibility: skew lines. These are lines that are nonparallel but do not intersect. To see how this is possible, simply point your arms in different directions. Unless you deliberately put them on the same plane, they will not intersect even when extended to infinity.

Finding the point of intersection for two lines in two-space in `y = mx + b` form is easy: all you have to do is solve a linear system. With these new types of equations, it’s a bit more work. To find the point(s) of intersection of two lines in `RR^3`, follow these steps:

  1. Express both lines with parametric equations using different variables for the free parameters, such as t and p.
  2. Set the right-hand sides of the x equations equal. Do the same for y and z. Now you have a system of three equations.
  3. Choose two of the equations and solve the system for t and p. You will be unable to do this if the lines are collinear or parallel.
  4. Perform an LS/RS verification of the as yet unused equation with the values of t and p that you just found.
  5. If `"LS" = "RS"`, the system is consistent. If not, the system is inconsistent and the line are skew.
  6. If the system was consistent, substitute the value of t or p into the parametric equations of its line to find the point of intersection.
  7. For extra verification, substitute the other free parameter into the other line equations and make sure you get the same point.