What is a formula to get a vector perpendicular to another vector?

MaiaVictor picture MaiaVictor · Jun 21, 2012 · Viewed 70.8k times · Source

What is a formula to get a three dimensional vector B lying on the plane perpendicular to a vector A?

That is, given a vector A, what is a formula f(angle,modulus) which gives a vector that is perpendicular to A, with said modulus and rotated through an angle?

Answer

Petar Minchev picture Petar Minchev · Jun 21, 2012

If the two vectors are perpendicular then their dot product is zero.

So: v1(x1, y1, z1), v2(x2, y2, z2).

=> x1 * x2 + y1 * y2 + z1 * z2 = 0

You know (x1, y1, z1). Put arbitrary x2 andy2 and you will receive the corresponding z2:

z1 * z2 = -x1 * x2 - y1 * y2
=> z2 = (-x1 * x2 - y1 * y2) / z1

Be aware if z1 is 0. Then you are in the plane.