# Normal equation of plane through a point and line

I need to find the normal vector of the form Ax+By+C=0 of the plane that includes the point (6.82,1,5.56) and the line (7.82,6.82,6.56) +t(6,12,-6), with A=1.

Of course, this is easy to do by hand, using the cross product of two lines and the point. There's supposed to be an automated way of doing it, though, and I can't find it. Any ideas on an efficient way of doing it?

• Are you looking for the normal vector of the plane or the standard equation of the plane? Jan 27 at 22:17
• Missing z-part in your plane equation! Jan 27 at 22:22

We have a point

pt1 = {6.82, 1, 5.56};


And we have a line

ln = {7.82, 6.82, 6.56} + t {6, 12, -6};


We can get two more points from the line

pt2 = ln /. t -> 0;
pt3 = ln /. t -> 1;


Then we can borrow the example in the Mathematica help files for the Cross[] function (ref/Cross)

u = pt2 - pt1;
v = pt3 - pt1;
w = Cross[u, v]
n = w/Norm[w]
Graphics3D[{Black, Arrow[Tube[{pt1, pt2}]], Arrow[Tube[{pt1, pt3}]],
Red, Arrow[{pt1, pt1 + 5 n}], White, InfinitePlane[{pt1, pt2, pt3}],
InfiniteLine[{pt2, pt3}]}, Axes -> True, PlotRangePadding -> 2]


And get that the unit normal vector is {-0.8757, 0.223964, -0.427772} and a plot showing the plane, the line, and the vectors. (n multiplied by 5 for visibility)

Also, I should point out, you don't need to assign values to t0 and t1 to get the unit normal vector because they will cancel out when we normalize.

pt2 = ln /. t -> t0;
pt3 = ln /. t -> t1;
u = pt2 - pt1;
v = pt3 - pt1;
w = FullSimplify[Rationalize[Cross[u, v]],
t0 \[Element] Reals && t1 \[Element] Reals && t0 != t1 && t0 < t1]
n = FullSimplify[Rationalize[w/Norm[w]],
t0 \[Element] Reals && t1 \[Element] Reals && t0 != t1 && t0 < t1]
n = SetPrecision[N[n], 3]
Graphics3D[{Black, Arrow[Tube[{pt1, pt2}]], Arrow[Tube[{pt1, pt3}]],
Red, Arrow[{pt1, pt1 + 5 n}], White, InfinitePlane[{pt1, pt2, pt3}],
InfiniteLine[{pt2, pt3}]}, Axes -> True, PlotRangePadding -> 2]

{(1173 (t0 - t1))/25, 12 (-t0 + t1), (573 (t0 - t1))/25}

{-(391/Sqrt[199362]), 50 Sqrt[2/99681], -(191/Sqrt[199362])}

{-0.876, 0.224, -0.428}

• I like this answer since it just uses the basic principles of geometry. Jan 28 at 9:42
• Very nice! Thank you!!
– Orm
Jan 28 at 11:21

RegionWithin can be use to express "the plane that includes the point and the line".

Clear["Global*"];
pt = {6.82, 1, 5.56};
lineeq = {7.82, 6.82, 6.56} + t {6, 12, -6};

line = ParametricRegion[lineeq // Rationalize, t];
plane = Hyperplane[{a, b, c}, d];
eqs = RegionWithin[plane, line] &&
RegionWithin[plane, Point[Rationalize@pt]];
sol = Reduce[eqs, Reals];
instance = FindInstance[sol && a == 1, {a, b, c, d}, Reals, 1][[1]];
normal = {a, b, c} /. instance
Show[Region[line, BaseStyle -> {Red}],
Graphics3D[{Yellow, plane /. instance, Blue, PointSize[Large],
Point[pt], Green, Arrow[{pt, pt + 20 normal}]}],
ViewPoint -> {2.5, -.5, -1.5}]



{1, -(100/391), 191/391}

SubtractSides[RegionConvert[plane /. instance, "Implicit"][[1]]] /.
Thread[{\[FormalX], \[FormalY], \[FormalZ]} -> {x, y, z}]


The plane equation is

181429 - 19550 x + 5000 y - 9550 z == 0

• Replace plane and eqs as below also work.
plane=ImplicitRegion[a*x+b*y+c*z==d,{x,y,z}]
eqs=Rationalize@pt∈plane&&ForAll[{x,y,z},{x,y,z}∈line,{x,y,z}∈plane];

• Interesting! And yielded the results too! Thank you so much.
– Orm
Jan 28 at 11:22

Slightly different:

p0 = {6.82, 1, 5.56};
p1 = {7.82, 6.82, 6.56};
p2 = p1 + t {6, 12, -6};
plane = InfinitePlane[{p0, p1, p2}];
SubtractSides[
Reduce[RegionMember[plane, {x, y, z}], Reals]] // TraditionalForm
(* x-0.255754 y+0.488491 z-9.28026==0. *)


n = {1, b, c}; (* unknown normal with a=1 *)
p = {x, y, z}; (* free point on the plane *)
coeff = SolveAlways[n.(p-pt) == 0 /. {Thread[p -> pt], Thread[p -> lineeq]}, t]
(*  {{b -> -0.255754, c -> 0.488491}}  *)

n . (p - pt) == 0 /. First[coeff] // Expand
(*  -9.28026 + x - 0.255754 y + 0.488491 z == 0  *)

• If it is unknown that a = 1 is allowed, then use the following alterations: Set n = {a, b, c} and get the equation of the plane with n . (p - pt) == 0 /. First[coeff] /. Thread[n -> 1] // Expand. SolveAlways will return a solution for two coefficients in terms of a free parameter, probably c, b, or a, the first in that order that is not required to be zero. Thread[n -> 1] will set to 1 whichever parameter remains. Jan 28 at 23:39

Based on this answer, we find the equation of a plane through three points with

p1 = {6.82, 1, 5.56};
p2 = {7.82, 6.82, 6.56};
d2 = {6, 12, -6};

v = First@NullSpace[Append[#, 1] & /@ {p1, p2, p2 + d2}]
(*    {-0.106949, 0.0273527, -0.0522436, 0.992514}    *)


As you want the first coefficient to be 1, divide all coefficients by the first:

w = v/v[[1]]
(*    {1., -0.255754, 0.488491, -9.28026}    *)


The equation of the plane you are looking for is

w . {x, y, z, 1} == 0
(*    1. x - 0.255754 y + 0.488491 z - 9.28026 == 0    *)
`