# Generating Perpendicular Basis Vectors in a Plane

This is an easier/less computationally expensive method compared to the one described in Points in a plane using null space. This is based on Cross Product By Matrix Multiplication.

We start with the unit vector $\mathbf{u}$, normal to the plane of interest. We compute the cross product matrix $U_\times$ as:

$$U_\times = \begin{bmatrix} 0 & -u_3 & u_2\\ u_3 & 0 & -u_1\\ -u_2 & u_1 & 0 \end{bmatrix}$$

where $u_1$, $u_2$ and $u_3$ are the components of $\mathbf{u}$. Since $\mathbf{u}$ is a non-null unit vector, either the first or the second column of $U_\times$ will be a non-null vector. This vector will also be perpendicular to $\mathbf{u}$. This can be verified by the dot product:

\begin{align*} (\text{Column 1}) \cdot \mathbf{u} &= u_3 u_2 - u_2 u_3 = 0 \\ (\text{Column 2}) \cdot \mathbf{u} &= -u_3 u_1 + u_1 u_3 = 0 \\ \end{align*}

We pick either the first or second column of $U_\times$ and convert it into a unit vector, depending on whichever one is non-null. This will be the first of the orthogonal unit vectors, $\mathbf{v}$. The second orthogonal unit vector is computed as:

$$\mathbf{w} = \frac{\mathbf{u} \times \mathbf{v}}{|\mathbf{u} \times \mathbf{v}|}$$

Linear combinations of $\mathbf{v}$ and $\mathbf{w}$ can be used to generate vectors in the plane normal to $\mathbf{u}$.