# How to find the components of a perpendicular vector

The question states that...

Given the vectors $\mathbf p=[-1,3,0]$ and $\mathbf s=[1,-5,2]$, find the components of a vector perpendicular to each other.

You're supposed to find a vector that is perpendicular to both $\mathbf p$ and $\mathbf s$, we're supposed to use the dot product to find the answer but I don't understand how you can get the coordinates.

Let vector $\mathbf a$ be perpendicular to both $\mathbf p$ and $\mathbf s$

This means that... $\mathbf a\cdot \mathbf p =0$ and $\mathbf a\cdot \mathbf s=0$

$$\mathbf a\cdot \mathbf p= -a_1 +3a_2 \\ \mathbf a\cdot \mathbf s= a_1 -5a_2 +2a_3 \\ \text{etc...}$$

How do you resolve this?

Your system of equations $$-a_1+3a_2=0 \\ a_1-5a_2+2a_3=0$$ has solution: $$a_1=3a_2 \ \ \ \ \ a_3=a_2$$ thus any vector $(3x,x,x)$, $\ \forall x\in\mathbb{R}$, will be the solution to your problem. In fact the vectors $(3x,x,x)$, $\ \forall x\in\mathbb{R}$, belong to a $1d$ subspace of the Euclidean $3d$ space, which is the perpendicular direction to the plane defined by $\mathbf{p}$ and $\mathbf{s}$.

You have $$-n_1+3n_2=0$$ $$n_1-5n_2+2n_3=0$$

Choose one of the three variables freely (but not zero) and solve the remaining system.

It can happen that the remaining system does not have a unique solution (not the case here, no matter which variable you choose).

Bue even this is no problem because in this case you can choose a second variable freely (even $0$).

\begin{align} q\cdot(-1,3,0)=0&\implies-q_1+3q_2=0\\ q\cdot(1,-5,2)=0&\implies q_1-5q_2+2q_3=0 \end{align} If $q_2=t$, then $q_1=3t$ and $q_3=t$. Therefore, $q=(3,1,1)t$. That is, $$q\parallel(3,1,1)$$

The automatic answer is the cross-product $\mathbf p\times\mathbf s$, or any collinear vector. Its coordinates are the minors of order $2$ of the $3\times 2$ matrix : $$M_1=\begin{vmatrix}3& -5\\0&2\end{vmatrix}=6,\quad M_2=-\begin{vmatrix}-1&1\\0&2\end{vmatrix}=2,\quad M_3=\begin{vmatrix}-1&1\\3& -5\end{vmatrix}=2$$ We'll take the simplified vector $\;\mathbf a=\begin{bmatrix}3 \\1\\1\end{bmatrix}.$

In general, to find a vector that’s orthogonal to some set of vectors $\{\mathbf v_1, \dots, \mathbf v_k\}$ you need to solve the system of linear equations $\mathbf v_i\cdot\mathbf x=0$, $i=1..k$. This amounts to computing the kernel (nullspace) of the matrix that has these vectors as rows.

In $\mathbb R^3$ you also have the simple option of taking the cross product of two vectors to find a third vector orthogonal to them both. Of course, any scalar multiple of this product will also be orthogonal. Note, though, that this method fails if the given vectors are linearly dependent i.e., scalar multiples of each other, since the cross product will vanish. The zero vector is indeed trivially orthogonal to them, but there’s an entire orthogonal plane that it misses.