Every vector a\vec a can be decomposed into the sum of a part parallel to a given direction b\vec b and a part perpendicular to it. It is the mechanism underlying the computation of the point–line distance.

Property — Parallel and perpendicular component

a=abb2b,a=aa.\vec a_\parallel = \frac{\vec a\cdot\vec b}{|\vec b|^2}\,\vec b, \qquad \vec a_\perp = \vec a - \vec a_\parallel. The distance of a\vec a from the direction of b\vec b is a|\vec a_\perp|.

Example

Let us decompose a=(7;0;2)\vec a = (-7;0;2) with respect to the unit vector v^(0,371;0,557;0,742)\hat v\approx(0{,}371;\, 0{,}557;\, -0{,}742) (unit vector of (2;3;4)(2;3;-4)).

Scalar projection: av^=70,371+0+2(0,742)=2,5971,4844,08.\vec a\cdot\hat v = -7\cdot 0{,}371 + 0 + 2\cdot(-0{,}742) = -2{,}597 - 1{,}484 \approx -4{,}08. Hence a=4,08v^\vec a_\parallel = -4{,}08\cdot\hat v and a=aa\vec a_\perp = \vec a - \vec a_\parallel; the length d=ad = |\vec a_\perp| is the distance from the point to the line with direction v\vec v.

Using the unit vector v^\hat v directly (of modulus 11) the formula simplifies to a=(av^)v^\vec a_\parallel = (\vec a\cdot\hat v)\,\hat v.

Topics: Analytic geometry in space
Concepts: Parallel component · Scalar product · Vector
Skills: Analytic geometry · Using formulae