I am calculating the normal vector to a plane ax+by+cz+d=0

According to the book:

The normal vector N is often normalized to unit length because in that case the equation

d = N ⋅Q + D 

gives the signed distance from the plane to an arbitrary point Q. If d = 0, then the point Q lies in the plane. If d > 0, we say that the point Q lies on the positive side of the plane since Q would be on the side in which the normal vector points.

How to get the N (Normal vector)? Thank you


From MathWorld:

Given the plane

enter image description here

Then the normal vector is

enter image description here

The normal unit vector n is given by:

enter image description here

Therefore, for the plane 5x+2y+3z-1=0,

The normal vector N is

N = [5,2,3]

The magnitude |N| is

|N| = sqrt(5^2 + 2^2 + 3^2)

|N| = 6.1644

The normal unit vector n is therefore approximately:

n = N / |N|

n = [0.8111, 0.3244, 0.4866]

which you can check by measuring the length of n.


import math

def mag(V):
  return math.sqrt(sum([x*x for x in V]))
def n(V):
  v_m = mag(V)
  return [ vi/v_m for vi in V]

In an interactive python shell:

>>> N = [5,2,3]
>>> mag(N)
>>> n(N)
[0.8111071056538127, 0.3244428422615251, 0.48666426339228763]
>>> mag(n(N))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.