# Checking whether the line is parallel to the plane

I have tried to write a code to check whether a line is parallel to the plane in Mathematica. Using that a plane has the normal vector of $$\vec{n}=(a,b,c)$$ and a line has a direction vector $$\vec{L}=(l,m,n),$$ the condition is $$\vec{n}\cdot\vec{L} = a \,l + b \, m + c \, n = 0$$. I have tried writing the following code:

{a, b, c, d} = {1, 2, 3, 4};
plane = ImplicitRegion[a x + b y + c z + d == 0, {x, y, z}];
{x0 , y0 ,z0} = {2, 1, 4};
{l , m , n} = {3, 1, 9};
line = ImplicitRegion[(x-x0)/l==(y-y0)/m==(z-z0)/n , {x,y,z}];
If[(al + bm +cn == 0),Return("parallel"),Return("not parallel")];


However, it doesn't seem to work. What are the mistakes?

• al is a single symbol; if you want to multiply a and l you use a*l or a l. Also, don't use Return unless you know what it's for; then, use it with square brackets Return[...] instead of round brackets. – Roman Apr 17 '19 at 17:10

You can give vector-values to variables and use scalar products:

planenormal = {1, 2, 3};
linedirection = {3, 1, 9};
planenormal.linedirection == 0


False

You could use RegionDisjoint:

RegionDisjoint[plane, line]


False

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

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

{x0, y0, z0} = {2, 1, 4};

{l, m, n} = {3, 1, 9};

line = ImplicitRegion[(x - x0)/l == (y - y0)/m == (z - z0)/n, {x, y,
z}];

If[(a*l + b*m + c*n == 0), Return["parallel"],
Return["not parallel"]];