Getting 2 perpendicular vectors from 1 vector

303 Views Asked by At

Disclaimer: I know very little about vectors, but think I know trig fairly well. My calculus is very limited so far, so I would appreciate a solid explanation.

I am trying to draw a spiral around a vector with given amplitude, frequency, shifting, whatever. I am fairly confident with trig, so I could do this no problem in 2 dimensions. In 3 dimensions, I am having some trouble.

After some work drawing this out on paper, I believe I can draw this spiral if I have 2 perpendicular vectors looking like this: 3d plane Where y is the vector I want to draw a spiral around and x and z are the perpendicular vectors. If I can get this vectors, I should be able to use the magnitude of the vectors to make the spiral.

My issue is that I don't know how to get the x and z vectors. My research online has led me to dot product, which allows me to figure out if 2 vectors are perpendicular or parallel, which should help me.
Note: I am not trying to get the x or z axis. I want to get x and z in relation to y, which may be "pointing" anywhere.

So my question: How can I find these 2 perpendicular vectors

2

There are 2 best solutions below

0
On

Approach 1.

Suppose you have your vector $y = (y_1, y_2, y_3)$. A vector $x$ is perpendicular to it if $$x_1 y_1 + x_2 y_2 + x_3 y_3 = 0.$$ Pick some $x$ that satisfies this equation. (You could pick some arbitrary $x_1$ and $x_2$, and then choose $x_3$ to make sure the equation is satisfied.)

Next, you want $z$ to be perpendicular to both $x$ and $y$, so you need it to satisfy \begin{align} z_1 x_1 + z_2 x_2 + z_3 x_3 &= 0 \\ z_1 y_1 + z_2 y_2 + z_3 y_3 &= 0 \end{align} (You could pick some arbitrary $z_1$, and then solve the two equations for the two unknowns $z_2$ and $z_3$.)


Approach 2. More generally, the Gram-Schmidt process can be used to produce an orthonormal basis. If you start with some vector $y$, then the result is an orthonormal basis that includes $y$.

0
On

The problem is that the $x$ and$z$ axis are not unique. Take a book. Say that the long axis is $y$. Then the remaining two are $x$ and $z$. Now put the book on a table, so that $y$ point up. Then $x$ and $z$ are in the plane of the table. Now rotate a little the book around the vertical axis. Your new $y$ axis is the same as the old one, the new $x$ and $z$ axis are still defining the horizontal plane, but the new $x$ and $z$ axes are not the same as the old ones. So you need to put one more condition to make these axis unique.

Let's suppose that you just want to find some axes perpendicular to the original direction (you don't care which). Let's call the original direction $\vec v=(x_v,y_v,z_v)$. You can create a perpendicular vector to it using cross product with some vector $\vec a$, as long as $\vec a$ is not collinear with $\vec v$. How to find such a vector? Take the original $x$, $y$, and $z$ axes, described by $(1,0,0)$, $(0,1,0)$ and $(0,0,1)$. You can choose the one which is the closest to being perpendicular to $\vec v$. For that, look at the scalar product. The one closest in absolute value to $0$ is the "most perpendicular". The scalar products between $\vec v$ and the axes are $x_v$, $y_v$, and $z_v$. The reason to choose the most perpendicular is for numerical calculation errors. For now, let's suppose that $x_v$ is the closest in absolute value to $0$. Then $$\vec v_{\perp,1}=\vec v\times (1,0,0)$$ is perpendicular to $\vec v$. The second one would be $$\vec v_{\perp,2}=\vec v\times \vec v_{\perp,1}$$