Finding a unit vector perpendicular to another vector
Let $\vec{v}=x\vec{i}+y\vec{j}+z\vec{k}$, a perpendicular vector to yours. Their inner product (the dot product - $\vec{u}.\vec{v}$ ) should be equal to 0, therefore: $$8x+4y-6z=0 \tag{1}$$ Choose for example x,y and find z from equation 1. In order to make it's lengh equal to 1, calculate $\|\vec{v}\|=\sqrt{x^2+y^2+z^2}$ and divide $\vec{v}$ with it. Your unit vector would be: $$\vec{u}=\frac{\vec{v}}{\|\vec{v}\|}$$
Every answer here gives the equation $8a+4b-6c=0$. None mentions that this equation represents a plane perpendicular to the given vector. I am sure that the omission was an oversight of each respondent. But it deserves mention and emphasis. In the plane perpendicular to any vector, the set of vectors of unit length forms a circle. So answers will vary. The vectors $(-1,2,0)^t$ and $(2,0,3)^t$ can be chosen to be a basis for the solution space of the plane: solve for a, divide by 8, and let $2b$ and $3c$ be independent variables. You can divide each by its length $\sqrt{5}$ and $\sqrt{13}$ respectively, and take a trigonometric combination of them to get a general solution.
Congrats on 10'000+ views! I'd like to combine the above fine answers into an algorithm.
Given a vector $\vec x$ not identically zero, one way to find $\vec y$ such that $\vec x^T \vec y = 0$ is:
- start with $\vec y' = \vec 0$ (all zeros);
- find $m$ such that $x_m \neq 0$, and pick any other index $n \neq m$;
- set $y'_n = x_m$ and $y'_m = -x_n$, setting potentially two elements of $\vec y'$ non-zero (maybe one if $x_n=0$, doesn't matter);
- and finally normalize your vector to unit length: $\vec y = \frac{\vec y'}{\|\vec y'\|}.$
(I'm referring to the $n$th element of a vector $\vec v$ as $v_n$.)