Section 5.7 Projections in \(\R^2\) and \(\R^n\)
Subsection 5.7.1 Projections in \(\R^2\)
Start with two nonzero vectors \(\vec u\) and \(\vec v\text{.}\) Drop a perpendicular from \(\vec u\) to the line through \(\vec v\text{,}\) and use the point where this perpendicular hits the line to be the end of a new vector. Suppose that \(\theta\) is the angle between the vectors \(\vec u\) and \(\vec v\text{.}\) The picture of the construction is slightly different for \(\theta\) obtuse and \(\theta\) acute (the new vector is shown in red):
In each case the new vector is called the projection of \(\vec u\) along \(\vec v\) and is denoted \(\textrm{proj}_{\vec v} \vec u\text{.}\)
Since \(\textrm{proj}_{\vec v} \vec u\) and \(\vec v\) are collinear, we may write \(\textrm{proj}_{\vec v} \vec u=k\vec v\) for some real number \(k\text{.}\) We next determine the value of \(k\text{.}\)
In the left picture, we have
and so
In the right picture, \(\theta>\frac\pi2\text{,}\) and so \(\cos(\theta)\lt0\text{.}\) In addition, the direction of \(\textrm{proj}_{\vec v} \vec u\) implies that \(k\lt0\text{,}\) and \(|k|=-k\text{.}\) As a result, the equation is still valid:
We have seen in TheoremĀ 5.2.20 that \(\vec u\cdot\vec v = \|\vec u\|\,\|\vec v\|\cos(\theta)\text{,}\) and so
Theorem 5.7.1. Projection of \(\vec u\) onto \(\vec v\) in \(\R^2\).
If \(\vec u\) and \(\vec v\) are vectors in \(\R^2\) with \(\vec v\not= \vec0\text{,}\) then
Theorem 5.7.2. \(\vec u-\textrm{proj}_{\vec v} \vec u \) is orthogonal to \(\vec v\).
The vectors \(\vec v\) and \(\vec u-\textrm{proj}_{\vec v} \vec u \) are orthogonal.
Proof.
We compute the dot product:
Subsection 5.7.2 Examples of projections in \(\R^2\)
Suppose that \(\vec v=(1,0)\) and \(\vec u=(u_1,u_2)\text{.}\) Then the line through \(\vec v\) is simply the \(x\)-axis, and \(\|\vec v\|=1\text{,}\) and so \(\textrm{proj}_{\vec v} \vec u =\left((u_1,u_2)\cdot(1,0) \right) \vec v = (u_1,0)\text{.}\) This means that the projection of \((x_1,x_2)\) onto the \(x\)-axis is \((x_1,0)\text{,}\) just as would be expected.
Suppose \(\vec v=(1,1)\) and \(\vec u=(u_1,u_2)\text{.}\) Then the line through \(\vec v\) has equation \(y=x\text{,}\) and \(\|\vec v\|=\sqrt2\text{.}\) We then have \(\textrm{proj}_{\vec v} \vec u=\frac{(u_1,u_2)\cdot(1,1)}2 \vec v =\left(\frac{(u_1+u_2)}2,\frac{(u_1+u_2)}2\right)\)
Suppose we want to drop a perpendicular from the point \(\vec u=(m,-1)\) to the line \(y=mx\text{.}\) The vector \(\vec v=(1,m)\) is on that line. It then follows that \(\textrm{proj}_{\vec v} \vec u =\frac{(m,-1)\cdot(1,m)}{\|\vec v\|^2} \vec v=0\vec v=\vec 0\text{.}\) This implies that the line joining \((m,-1)\) and \((0,0)\text{,}\) which has slope \(-\frac1m\text{,}\) is perpendicular to the line with equation \(y=mx\text{.}\) This implies that the product of the slopes of two orthogonal lines is \(-1\text{.}\)
Suppose we want to drop a perpendicular from the point \(\vec u=(u_1,u_2)\) to the line \(y=mx\text{.}\) The vector \(\vec v=(1,m)\) is on that line, and \(\|\vec v\|=\sqrt{1+m^2}\text{.}\) It then follows that \(\textrm{proj}_{\vec v} \vec u =\frac{(u_1,u_2)\cdot(1,m)}{1+m^2} \vec v =\frac1{1+m^2}(u_1+mu_2, m(u_1+mu_2)) =\left(\frac{u_1+mu_2}{1+m^2},\frac{mu_1+m^2u_2}{1+m^2}\right)\)
The following figure illustrates these examples (note that the first examples are just the special cases of the last one).
Subsection 5.7.3 Application: distance from a point to a line
We want to compute the distance from a point \(\vec u\) to a line \(L\text{.}\) Let \(\vec u=(x_0,y_0)\text{,}\) the general equation of \(L\) be \(ax+by+c=0\) and \(D\) the desired distance. In addition, let \((x_1,y_1)\) and \((x_2,y_2)\) be two points on \(L\text{,}\) and \(\vec n=(x_1+a,y_1+b)\text{.}\) These are all included in the following figure:
Since \((x_1,y_1)\) and \((x_2,y_2)\) are both on \(L\text{,}\) we know that \(ax_1+by_1+c=ax_2+by_2+c=0\text{.}\) In addition, if we consider the two displacement vectors \(\vec v\) from \((x_1,y_1)\) to \((x_2,y_2)\) and \(\vec n\) from \((x_1,y_1)\) to \((x_1+a,y_1+b)\text{,}\) then the dot product
This implies that the quadrilateral with vertices \((x_1,y_1)\text{,}\) \(\proj_{\vec v}\vec u\text{,}\) \(\vec u\) and \(\proj_{\vec n}\vec u\) is in fact a rectangle, and so \(\|\proj_{\vec n}\vec u\|=D\text{.}\)
and so
Theorem 5.7.5. Distance from point to a line.
The distance \(D\) from a point \((x_0,y_0)\) to the line \(ax+by+c=0\) is
Subsection 5.7.4 Projections in \(\R^3\) and \(\R^n\)
Projections in \(\R^3\) to a plane and in \(\R^n\) to a hyperplane are remarkably similar to those in \(\R^2\text{.}\)
In \(\R^3\) the projection from the point \((x_0,y_0,z_0)\) to the plane \(ax+by+cz+d=0\) can be obtained by taking the line through \((x_0,y_0,z_0)\) orthogonal to the plane. Since the vector \(\vec n=(a,b,c)\) is orthogonal to the plane, the line consists of all points of the form \((x_0,y_0,z_))+t(a,b,c)\text{.}\) The value of \(t\) that give the point in the plane satisfies
and so
The distance to the plane is now easy to compute. If \(\vec x=(x_0,y_0,z_0)\) and \(\vec n=(a,b,c)\) then the distance from \(\vec x\) to \(\vec x+ t\vec n\) satisfies
and so the distance \(D\) from the point to the plane satisfies
Theorem 5.7.7. Distance from a point to a plane.
If \(D\) is the distance from a point \((x_0,y_0,z_0)\) to the plane with equation \(ax+by+cz+d=0\text{,}\) and \(\vec n=(a,b,c)\text{,}\) then
Compare this result with the one in \(\R^2\text{:}\) TheoremĀ 5.7.5
The distance from a point to a hyperplane in \(\R^n\) is computed analogously.