# The shortest distance problem by using Gram-Schmidt Process

I wish to find the shortest distance from the point $v=\langle1,1,2\rangle$ to the plane $x_1+x_2-x_3+1=0$, and it is obvious that the point $v$ is not on the plane. I first find the basis of the plane, whose vectors are $\langle-1,0,0\rangle,\langle-1,1,0\rangle,\langle1,0,1\rangle$. Next I use the Gram-Schmidt Process to find the orthonormal basis, which is $v_1=\langle-1,0,0\rangle,v_2=\langle0,1,0\rangle,v_3=\langle0,0,1\rangle$. Then, the shortest distance vector is $$v'=v-\sum_{k=1}^3 \langle v,v_k\rangle.$$

However, I kept getting the result to be 0. I really do not know where went wrong. Any help, please.

• why does your two-dimensional plane need three basis vectors? Sep 16, 2013 at 2:36
• @James S. Cook In fact this is a point I feel confused. If I solve the equation of the plane the solution set is spanned by the three vectors. But yes this is a two dimensional plane. I feel confused here. Could you please explain this part for me? Sep 16, 2013 at 2:41
• Do you have to use the GS process? It can be done without. Sep 16, 2013 at 2:44
• Yes, I have to. Sep 16, 2013 at 2:45
• Well, you don't need to blindly apply GS. Let $d$ be the normal to the plane. Then project $v$ onto $d$, the other components orthogonal to $d$ do not matter. Projecting $v$ onto $d$ is basically the GS process (you can normalize $d$ first if you care). Sep 16, 2013 at 3:11

The plane is $H = \{ x | \langle d, x \rangle = \alpha \}$, where $d=(1,1,-1)^T$, and $\alpha = -1$. Let $v = (1,1,2)^T$.

The nearest point on $H$ to $v$ can be found by solving $\langle d, v+\lambda d \rangle = \alpha$, which gives $\lambda = \frac{\alpha-\langle d, v \rangle}{\|d\|^2}$.

The shortest distance is given by $\|v-(v+\lambda d) \| = |\lambda| \|d \| = | \frac{\alpha-\langle d, v \rangle}{\|d\|} | = \frac{1}{\sqrt{3}}$.

Addendum: To see why this is basically the Gram Schmidt process (or part thereof):

Let $b_2,b_3$ be any two vectors such that $d,b_2,b_3$ span $\mathbb{R}^3$. Apply the Gram Schmidt process to get $n_1,n_2,n_3$. We have $n_1 = \frac{d}{\|d\|}$, of course, and since $n_2 \bot d$ and $n_3 \bot d$, we see that $n_2,n_3$ lie on the plane $\langle d , x \rangle = 0$. Furthermore, we see that the point $\frac{\alpha}{\|d\|} n_1$ lies on the plane $H$ above. Hence every point $p$ on the plane is give by $p=\frac{\alpha}{\|d\|} n_1 + \beta_2 n_2 + \beta_3 n_3$, where $\beta_i$ are arbitrary.

Now project $v$ onto $n_1,n_2,n_3$ to get $v = \gamma_1 n_1 + \gamma_2 n_2 + \gamma_3 n_3$. Then the distance (or rather distance squared) from $v$ to a point on the plane is given by $\|v-p\|^2 = |\gamma_1-\frac{\alpha}{\|d\|}|^2+ |\gamma_2-\beta_2|^2 + |\gamma_3-\beta_2|^2$, from which we see that the minimum distance (choosing $\beta_2, \beta_3$ appropriately) is $|\gamma_1-\frac{\alpha}{\|d\|}|$. Since $\gamma_1 = \langle v, n_1 \rangle = \langle v, \frac{d}{\|d\|} \rangle$, we obtain the value $| \frac{\alpha-\langle d, v \rangle}{\|d\|} |$ as above.

Since we do not need to compute the nearest point, we only need compute $\gamma_1$, hence we only need the first step of the Gram Schmidt process applied to $d$ followed by the projection of $v$ onto this first element.

Another way is given by finding the minimum of $d(v,H)^2$ (we use the fact that for any point on $H$, $x_3=x_1+x_2+1$): $$d(v,H)^2=(x_1-1)^2+(x_2-1)^2+(x_1+x_2-1)^2,$$ $$\frac{\partial d(v,H)^2}{\partial x_1}=2(2x_1+x_2-2),$$ $$\frac{\partial d(v,H)^2}{\partial x_2}=2(x_1+2x_2-2),$$ so by annihilating partial derivatives we get that the projection of $v$ on $H$ is the point $P: (2/3,2/3,7/3)$ having distance $1/\sqrt{3}$ from $v$. Still another way to find the distance is to operate a translation in order to bring $v$ in the origin and $H$ in the plane having equation: $$(x_1-1)+(x_2-1)-(x_3-2)+1 = x_1+x_2-x_3+1 = 0,$$ that is $H$ again, for instance. Now $d(v,H)$ is equal to the distance between the origin and the plane through $(-1,0,0),(0,-1,0),(0,0,1)$, i.e. the height of a right tetrahedron. In general, the distance of the plane $$a x_1 + b x_2 + c x_3 = d$$ from the origin is exactly equal to $\frac{|d|}{\sqrt{a^2+b^2+c^2}}$.