# Find closest point on a plane to a given point. Discrepancy with normal vector.

I have a point $(9,5,0)$ and a triangle with points $(1,1,0), (3,3,1), (6,1,0)$, let's label them as $A,B,C$ respectively. In order to get the normal vector, I do the cross product of two vectors. If I do $AB \times AC$ I get $n = \left\langle 0,-5,10\right\rangle$. With this I determine the equation of the plane is $5y - 10z - 5 = 0$. If I project my point onto the plane with this normal vector in mind, the point on the plane I find is $(9, 21/5, 8/5)$. HOWEVER, if I initially choose to cross two different vectors, I get something different.

Example: If I instead choose to do $BA \times BC$ I get $n = \left\langle 0,5,-10\right\rangle$. Now this in a way makes sense to me since it is the inverse of the other normal I found. Basically the other half of the line through the plane, right? If I continue, I find the equation of the plane to be $-5y + 10z + 5 = 0$. This leads me to a projected point of $(9, -29/5, -8/5)$. Why do I get two different points based on which normal vector I choose to solve with? I know the correct answer to this problem, one is right and one is wrong. I am trying to program a general solution to this type of problem. How do I choose the correct normal vector?

Please let me know if I am doing something wrong.

$\vec{AB} = <2,2,1> \quad \quad \vec{AC} = <5,0,0>$.

So, $\vec{AB} \times \vec{AC} = <0,5,-10>$

Then, the plane equation is something like $5y -10z = C$ for some constant $C$.

Plug (for example) the point $(1,1,0)$ into the plane equation to get $C=5$.

Hence, the plane equation is $5y -10z -5 =0$ or equivalently $-5y +10z+5=0$ which is slightly different from the one you found.

Edit: Let's continue with a different approach. The vector $\vec{n} = <0,5,-10>$ is perpendicular to the plane. The line that passes through our point $(9,5,0)$ which is parallel to $\vec n$ is $$x=9, \quad y=5+5t, \quad z=0-10t, \quad t \in \mathbb R$$

Now let's find where this line cuts the plane. Pick an arbitrary point from the line and put into the plane equation:

$$0= 5y-10z-5 =5(5+5t)-10(0-10t)-5$$

$$125t + 25 -5=0 \quad \implies \quad t=-\frac{4}{25}$$

So, the answer is $(9,5+5t,0-10t)=(9,-\frac{21}{5},\frac{8}{5})$.

Edit2: Now we do the projection. Choose an arbitrary point on the plane, say $A(1,1,0)$ and consider the vector $\vec{AP}$ where $P=P(9,5,0)$. $\vec{AP}=<8,4,0>$.

Then,

\begin{align*} proj_{\ \vec n \ } \vec{AP} &= |\vec{AP}| \cdot \cos \alpha \cdot \frac{\vec n}{| \vec n |} \\ &= |\vec{AP}| \cdot \frac{\vec{AP} \bullet \vec n}{|\vec{AP}| \cdot |\vec n|} \cdot \frac{\vec n}{| \vec n |} \\ &= \text{ calculations ... find the projection vector} \\ &= \vec u \end{align*}

Now, the point you are looking for is the point $K$ such that $\vec{KP} = \vec u$

• Ah, I typed it in wrong. You are correct, but the question of the discrepancy still stands. I will edit the post. Can you continue to carry out the projection and see if you get the same results as I did? – kvcwahley Jul 20 '15 at 17:36
• I think you forgot the -5 constant in your last calculation. It should be 125t + 25 = 5. This gives t=-4/25. My answer is then (9,21/5, 8/5). – kvcwahley Jul 20 '15 at 17:54
• Theoretically, should I be getting the same answer? – kvcwahley Jul 20 '15 at 17:54
• @kvcwahley Thanks I edited and got the answer. Now I will edit my answer again and add projection to get the same answer. – ThePortakal Jul 20 '15 at 17:59
• If you solve it with cross product of BA x BC, do you get the same answer? – kvcwahley Jul 20 '15 at 18:03

"I have a point $(9,5,0)$ and a triangle with points $(1,1,0), (3,3,1), (6,1,0),$ let's label them as $A,B,C$ respectively. In order to get the normal vector, I do the cross product of two vectors."

So you mean a normal vector to the plane determined by the three points.

"If I do $AB \times AC$ I get $n = <0,-5,10>$. With this I determine the equation of the plane is $5y - 10z + 5 = 0.$"

No, that does not contain $(1, 1, 0)$ because $0(1)+ 5(1)- 10(0)+ 5= 10$, not 0. The equation of the plane is $0(x- 1)-5(y- 1)+ 10z= 0$ or $5y- 10z- 5= 0$. Perhaps you meant $5y- 10z= 5$.

"If I project my point onto the plane with this normal vector in mind, the point on the plane I find is $(9, 21/5, 8/5)$. HOWEVER, if I initially choose to cross two different vectors, I get something different.

Example: If I instead choose to do $BA \times BC$ I get $n = <0,5,-10>$. Now this in a way makes sense to me since it is the inverse of the other normal I found. Basically the other half of the line through the plane, right? If I continue, I find the equation of the plane to be $-5y + 10z -5 = 0.$"

Which, again, is wrong. The cross product of $BA \times BC$, as you say is $<0, 5, -10>$ and, since the plane contains the point $(1, 1, 0)$, the plane has the equation $0(x- 1)- 5(y- 1)+ 10(z- 0)= -5y+ 10z+ 5= 0$, not $-5y+ 10z- 5$.

"This leads me to a projected point of $(9, -29/5, -8/5)$. Why do I get two different points based on which normal vector I choose to solve with?"

You don't say how you got two different points. Since you have exactly the same equation for the plane in both cases (although wrong!), and the same point, you should be doing exactly the same calculations in both cases.

"I know the correct answer to this problem, one is right and one is wrong. I am trying to program a general solution to this type of problem. How do I choose the correct normal vector?

Please let me know if I am doing something wrong."

Yes, if you get different answers projecting the same point onto the same plane, you must have done something wrong! But since you don't show what you did, it is impossible to say what you might have done wrong.

• You are correct with my equations being wrong. I initially typed them in incorrectly. I have edited the post to show the correct equations. Theoretically, should I be getting the same point? – kvcwahley Jul 20 '15 at 18:00
• Please start using LaTeX, see this guide: meta.math.stackexchange.com/questions/5020/… Almost all of your posts need heavy editing – Hirshy Aug 5 '15 at 8:42