# Determining a perpendicular vector to two given vectors.

I am given two vectors:

u = [0, 2, 1]
v = [1, -1, 3]


I need to find a vector that is perpendicular to both vectors u and v.

So far, this is what I have:

let n = [x, y, z]
eqn 1: 0x + 2y + z = 0
eqn 2: x - y + 3z = 0

I have to use matrices to find the other vector since this is
a systems of eqns question.

[0 2  1 | 0]     ...
[1 -1 3 | 0]  ~  ...


I don't know what to do next...

You can simply use the cross product. $$u\times v = \begin{vmatrix} i & j & k \\ u_1 & u_2 & u_3 \\ v_1 & v_2 & v_3 \end{vmatrix} = (u_2v_3-v_2u_3)i-(u_1v_3-v_1u_3)j+(u_1v_2-v_1u_2)k.$$ Where $i,j,k$ are the components of your perpendicular vector $u\times v$.

• I understand that but we have not covered the cross product yet in my class. Is there another way to do it other than trial and error? – Ol' Reliable Sep 23 '13 at 2:20
• Sorry, I was unaware of that but what you are doing also works you can solve this system using elimination. The system will actually have infinitely many solutions since you have more unknowns than equations. – RDizzl3 Sep 23 '13 at 2:24

Note that your system of equations has an infinite number of solutions. So, to help narrow things down, let's introduce an extra constraint. Assume that $y = 1$ [NOTE: Any other value would also work!]. Then from the first equation, we have: $$2(1) + z = 0 \iff z = -2$$

Substitution into the second equation yields: $$x - (1) + 3(-2) = 0 \iff x = 7$$

So we may choose $n = (7,1,-2).$

You can also use the fact that dot product of vectors equals zero if they are perpendicular. Let u and v be as in the question and z be the perpendicular vector, we have system of two equations:

$$u * z=0$$ $$v * z=0$$

Solving for example for $z_1$ and $z_2$ wolfram alpha gives:

$$z_1 = \frac{z_3(u_3v_2-u_2v_3)}{u_2v_1-u_1v_2}$$

$$z_2 = \frac{z_3(u_3v_1-u_1v_3)}{u_1v_2-u_2v_1}$$

And $z_3$ can be chosen freely. This method works for higher dimensional vectors as well.

• This question was asked over three years ago haha. – Harnoor Lal Feb 24 '17 at 15:21
• @HarnoorLal I didn't realize that answering would bump the question up. Anyway, plenty of people still seem to have interest in it. – Dole Feb 24 '17 at 15:23

you can use null(n) in Matlab. for example n=[1 0 0 -1] answer is:

     0         0    0.7071
1.0000         0         0
0    1.0000         0
0         0    0.7071


Each of the columns are orthogonal.

• Though OP has not specifically stated, I think the OP want's an analytic answer – Shailesh Apr 27 '17 at 6:29

$(0,2,1) \times (1,-1,3)$, that is, take the cross product of the two vectors: $(2\cdot 3+1, 1-0, 0-2) = (7,1,-2)$

• Please try to format your posts, as a sample, I edited your post. – jgon Nov 7 '15 at 19:46