# Distance between point and plane - why use the dot product?

So according to this, the signed distance between a point and a plane will be the dot product of the plane's normal vector (does it have to be a unit vector?) and the point-in-plane minus the point vector.

I searched everywhere and I can't find a good explanation on why does the dot product give the correct answer. I even studied a little bit more about the dot product itself and I came to know that the dot product of a * b is like multiplying the magnitudes of the vectors that go on the same direction. This still doesn't help me understand my problem.

If it matters, I encountered this problem as a programmer.

I assume you are referring to the shortest distance between a point in $\mathbb R^3$ and a plane. This is given by the orthogonal projection of a line into another line, i.e., projecting a line from the origin into the plane into the normal vector of the plane. The formula for this orthogonal projection uses the dot product.

Here is an example: http://mathinsight.org/distance_point_plane_examples

In this graph, you are projecting the vector $QP$ joining the yellow point $Q$ in the plane with the red point $P$ , into the normal vector $n$ of the plane. This projection gives you the shortest distance, and (the length of) this projection is given by the formula $$\frac {||n.P||}{||n||}$$, where $||(x,y,z)||:=\sqrt{(x^2+y^2+z^2)}$. This is where the dot product comes into play. For more on the ortho projection:

http://www.cuil.pt/r.php?cx=002825717068136152164%3Aqf0jmwd8jku&cof=FORID%3A10&ie=UTF-8&q=orthogonal+projection&sa=Search

• I find your second sentence confusing – Eric Tressler Jul 5 '15 at 17:22
• I just rewrote. I think I may link into a graph. – Gary. Jul 5 '15 at 17:25
• @EricTressler: Hopefully the edit clarified things. – Gary. Jul 5 '15 at 17:35

In elementary geometry, one sees the dot product of $a$ and $b$ is the signed product of the length of $a$ and the length of the orthogonal projection of $b$ onto a line directed by $a$.

Let $\vec n$ be a normal vector to the plane and $A$ be a point in the plane. Then for any point $M$ in $3$-space, if we let $H$ be its orthogonal projection on the plane, we have: $$\lvert\overrightarrow{AM}\cdot\vec n\rvert=AH\, \lVert \vec n\rVert,\quad\text{whence}\quad AH=\smash{\frac{\lvert\overrightarrow{AM}\cdot\vec n\rvert}{\lVert \vec n\rVert}}$$