From a Point to Its Nearest Point on a Line
A line in three-dimensional space extends indefinitely in two directions. Given a point that may not lie on the line, we can ask which point on the line is closest to it. The answer is the perpendicular foot: the point where the perpendicular from the given point meets the line.
This construction turns a geometric question into a calculation with vectors. The line’s direction determines which point on it makes the connecting vector perpendicular to the line, and the length of that connecting vector is the distance we seek.
Line, Foot, and Distance
Suppose a line \(L\) passes through a point \(A\) and has a nonzero direction vector \(\mathbf{v}\). Every point on the line has the form \(A+t\mathbf{v}\), where \(t\) is a real number. Let \(P\) be the given point. We seek the point \(H\) on \(L\) for which the vector from \(H\) to \(P\) is perpendicular to the line’s direction.
Perpendicularity can be tested with a dot product: two vectors are perpendicular exactly when their dot product is zero. Since \(H=A+t\mathbf{v}\), the foot must satisfy \((P-H)\cdot\mathbf{v}=0\). Solving this condition gives the formula below.
The denominator is nonzero because \(\mathbf{v}\ne\mathbf{0}\), so \(\mathbf{v}\cdot\mathbf{v}=\|\mathbf{v}\|^2>0\). The vector \(P-A\) goes from the specified point on the line to the given point. Its dot product with the line direction determines how far along the line the foot lies.
Why the Formula Gives the Perpendicular Foot
Write any candidate point on the line as \(A+t\mathbf{v}\). If it is the foot, the connecting vector \(P-(A+t\mathbf{v})\) must be perpendicular to \(\mathbf{v}\). Thus its dot product with \(\mathbf{v}\) must equal zero. Expanding and solving gives the unique possible parameter:
This establishes that the formula finds a point on the line whose connecting vector is perpendicular to the line. It also explains why this point is the nearest one. If \(H=A+t_0\mathbf{v}\) is the calculated foot and \(X=A+s\mathbf{v}\) is any other point on the line, then \(X-H=(s-t_0)\mathbf{v}\). The vectors \(P-H\) and \(X-H\) are perpendicular. Since \(P-X=(P-H)-(X-H)\), the Pythagorean identity gives:
Lengths are nonnegative, so this inequality shows \(\|P-X\|\geq\|P-H\|\) for every point \(X\) on the line. Equality holds only when \(X=H\). Therefore, the perpendicular foot is the unique point on the line that minimizes the distance to \(P\).
Worked Examples
Worked Example: Find the Foot and Distance in Three Dimensions
Let \(L\) pass through \(A=(1,-1,2)\) with direction vector \(\mathbf{v}=(2,1,-2)\). Find the perpendicular foot from \(P=(4,3,1)\) and the distance from \(P\) to \(L\).
First calculate the vector from \(A\) to \(P\):
Now calculate the two dot products in the formula:
Therefore \(t_0=12/9=4/3\). Substituting into the line gives the foot:
The vector from the foot to \(P\) is \(P-H=(1/3,8/3,5/3)\). Its length is:
Check perpendicularity by taking the dot product with the line direction:
The check confirms that the connecting vector is perpendicular to the line. The foot is \((11/3,1/3,-2/3)\), and the distance is \(\sqrt{10}\).
Worked Example: A Foot with a Noninteger Parameter
Let \(L\) pass through \(A=(0,2,-1)\) in direction \(\mathbf{v}=(1,-2,2)\), and let \(P=(-2,1,3)\). Find the foot and distance.
The vector from \(A\) to \(P\) is:
Compute the numerator and denominator:
Hence \(t_0=8/9\). The foot is:
Subtract the foot from \(P\) to obtain the connecting vector, then calculate its length:
For the check, dot the connecting vector with the line direction:
Thus the calculated point lies on the line and the connecting vector is perpendicular to its direction. The distance is \(5\sqrt{5}/3\).
Worked Example: When the Given Point Lies on the Line
Let \(L\) pass through \(A=(2,0,-1)\) with direction \(\mathbf{v}=(1,2,2)\), and take \(P=(5,6,5)\). Apply the same formula to determine the foot and distance.
First, find \(P-A\), then the dot products:
The parameter is \(t_0=27/9=3\), so:
Consequently \(P-H=(0,0,0)\), and \(d=\|P-H\|=0\). The check is \((P-H)\cdot\mathbf{v}=(0,0,0)\cdot(1,2,2)=0\). Since the given point is already on the line, the foot is the point itself and the distance is zero.
Common Error: Omitting the Denominator
A frequent mistake is to use \((P-A)\cdot\mathbf{v}\) directly as the line parameter. That shortcut works only when \(\mathbf{v}\cdot\mathbf{v}=1\), meaning that the direction vector is a unit vector. For a general direction vector, the denominator is essential.
In the first example, the numerator is \(12\), but \(\mathbf{v}\cdot\mathbf{v}=9\). If we incorrectly set \(t=12\), the proposed point is:
The vector from this incorrect point to \(P\) is \((-21,-8,23)\), and:
So the proposed point does not give a perpendicular connection. The correct parameter includes the denominator: \(t_0=12/9=4/3\). Always calculate both dot products before finding the foot.
A Reliable Calculation Sequence
To avoid mixing up points, vectors, and lengths, use the following order:
Identify a point \(A\) on the line and its nonzero direction vector \(\mathbf{v}\), so points on the line have the form \(A+t\mathbf{v}\).
Calculate \(P-A\), not \(A-P\), to use the stated formula directly.
Evaluate \(t_0=((P-A)\cdot\mathbf{v})/(\mathbf{v}\cdot\mathbf{v})\), then substitute it into \(H=A+t_0\mathbf{v}\).
Find \(P-H\), compute its length, and verify that \((P-H)\cdot\mathbf{v}=0\).
Interpreting the Result
The parameter \(t_0\) tells where the foot falls relative to the chosen point \(A\) and direction \(\mathbf{v}\). It need not be between zero and one: the line continues beyond \(A\) in both directions. A negative parameter places the foot in the direction opposite to \(\mathbf{v}\), while a positive parameter places it along \(\mathbf{v}\). The foot and distance do not depend on choosing a unit direction vector; the formula accounts for the length of any nonzero direction vector through its denominator.
Keep the two final quantities distinct. The foot \(H\) is a point on the line, while the distance is the nonnegative scalar \(\|P-H\|\). The vector \(P-H\) points from the foot to the given point; its length, not the vector itself, is the distance.
Check Your Understanding
Try each question by identifying the line point, direction vector, and connecting vector before applying the formula.
- For a line through \(A\) with nonzero direction vector \(\mathbf{v}\), what condition characterizes the perpendicular foot \(H\) from \(P\)?
- Why must the denominator \(\mathbf{v}\cdot\mathbf{v}\) be positive for the formula to apply?
- If \(t_0\) is negative, what does that tell you about the location of the foot relative to \(A\) and \(\mathbf{v}\)?
- What dot-product calculation checks that a proposed foot is correct?
- Why is the perpendicular foot the unique point on the line closest to \(P\)?