Project 31: Geometric Optimization Projects

Previous project Next project

The distance between lines, between curves, between a curve and a surface, etc. is a multidimensional minimization problem. "The distance" means the shortest distance as the points vary over both objects. Most calculus books do not treat this topic, because the solution of the equations resulting in the critical point step is too hard to do by hand. The computer can help you solve these deep geometrical problems.

The linear cases of these distance problems can usually be solved with vector geometry and justified by the Pythagorean theorem, but it is worthwhile seeing the calculus solutions even in these cases.

31.1 Distance between Lines

Two lines are given by parametric equations as follows:


Find the distance between these lines; that is, minimize the distance between a point on line 1 and a point on line 2. Analytically, we have the question,

FIND: The minimum of |Y[s]-X[t]| for all values of s and t.

Since the square is an increasing function, we may as well solve the easier problem of minimizing the square of the distance


The partial derivatives of D are given by the chain rule

The critical point condition is the system of equations

with single solution (s,t)=(2,-1). The point X[2]=(2,0,0) is nearest to the point Y[-1]=(2,2,-1) at the distance .

Notice that the critical point condition for lines is a system of two linear equations in s and t. Solving this is a high school algebra problem.

  • Why is the only critical point a minimum?

    You could use geometric or analytical reasoning to answer the last question. Analytically, we could introduce a "fake" compact set for the (s,t) domain, say and with both S and T huge. How large is D[s,t] on the boundary of the fake domain? Why does D[s,t] have both a max and min on the fake domain? Why is the min inside?

    Example 31.1 Geometry of the Critical Point

    The vector V pointing from X[2]=(2,0,0) to Y[-1]=(2,2,-1) is perpendicular to both lines,


    The direction of line 1 is V1=(1,0,0) and the direction of line 2 is V2=(1,1,2)

    Why must this perpendicularity be true?

  • Critical Points