# Finding distance between a point and a plane

I was tasked with finding a distance between a plane of the form $ax+by+cz +d=0$ and a point say $(a,b)$. Now I know a way to show a plane in Mathematica is with

InfinitePlane[{{a, b}, {c, d}, {f, g}}]


but I dont know how to relate this to distance or anything of the sort..

any hints?

• If memory serves, the distance between a point $(x_0,y_0,z_0)$ and plane $ax+by+cz +d=0$ could be calculated via the following formula:$$d_0=\frac{\left|ax_0+by_0+cz_0+d\right|}{\sqrt{a^2+b^2+c^2}}$$
– xyz
Jun 12, 2016 at 9:35
• @ShutaoTANG Upvote that server. :)
– yode
Jun 12, 2016 at 10:09

You can use RegionDistance to find the distance from a point to a region.

{a, b, c, d} = {1, 2, 3, 4};

plane = ImplicitRegion[a x + b y + c z + d == 0, {x, y, z}];

RegionDistance[plane, {x0, y0, z0}] // Simplify

(* Sqrt[(4 + x0 + 2 y0 + 3 z0)^2]/Sqrt[14] *)


However it is probably a good idea to also read this to understand how to find the answer manually.

• It's a good suggestion, which does not however yield correct results Jun 12, 2016 at 11:40
• That's a bit vague, @Bak. Why not include an example of this incorrect result you speak of in your question? Jun 12, 2016 at 13:42
• @Bak1139, I've removed the PowerExpand - is that what you were referring to? Jun 12, 2016 at 13:49
• PowerExpand is alright, whenever I run the code I get different results all the time, so I suspect my copy of Mathematica is to blame. Jun 12, 2016 at 13:52
• note you can use InfintePlane here as well, Simplify@RegionDistance[ InfinitePlane[{{0, 1, -2}, {1, -1, -1}, {0, -2, 0}}], {x0, y0, z0}] -> same result. Jun 12, 2016 at 16:44