Steve writes:

The scalar product between two vectors is the sum of the product of the components. Let
$${\bf u} =\pmatrix{x\cr y\cr z}$$
Since the components of $\bf v$ are all non-zero I can choose anything for $y$ and $z$ so long as I choose $x= -(2y+3z)$. This is the equation of a plane $P: x+2y+3z=0$, which is perpendicular to the vector ${\bf v}$. This makes sense: the scalar product of two vectors is zero if and only if they are perpendicular to each other.

Next, taking a cross product between two vectors always gives a vector which is perpendicular to the original two vectors. So, I should be able to make any vector perpendicular to ${\bf v}$ by taking cross products. These are all vectors lying in the plane $P$.

To decide which vectors ${\bf u}$ solve ${\bf u}\cdot {\bf v}=0$ for a given vector ${\bf v}$ I need to decide which vectors are perpendicular to ${\bf v}$.

To do this, I could take any linear combination of ${\bf i \times v}, {\bf j \times v}$ and ${\bf j \times v}$

$${\bf w} \times {\bf i} = \pmatrix{4\cr 5\cr 6}\times \pmatrix{1\cr 0\cr 0}=\begin{vmatrix} \mathbf{i}&\mathbf{j}&\mathbf{k}\\ 4&5&6\\ 1&0&0\\ \end{vmatrix} = \begin{pmatrix} 0\\ 6\\ -5\ \end{pmatrix}$$
etc.

From this it seems that I just need to switch 2 non-zero components and change the sign of one of them to make a vector perpendicular to a given vector. In hindsight, this is obvious!

Doug writes:

Solution 2:

Dot $\begin{pmatrix} 1\\ 2\\ 3\\ \end{pmatrix}$ with a general vector $\begin{pmatrix} a\\ b\\ c\\ \end{pmatrix}$ and you want to find a,b,c such that a + 2b + 3c = 0, so for example a = -2b - 3c, so there are an infinite number of solutions. Pick any 2 and find the other one, for example c=1,b=1,a=-5.

For the 2nd part, again cross $\mathbf{v}$, using a general vector, and find with the "determinant method":
$$\begin{vmatrix} \mathbf{i}&\mathbf{j}&\mathbf{k}\\ 1&2&3\\ a&b&c\\ \end{vmatrix} = \begin{pmatrix} 2c-3b\\ 3a-c\\ b-2a\\ \end{pmatrix},$$ so again you can choose a,b,c such that this is satisfied, and there are an infinite number of possibilities.

To quickly create a vector $\mathbf{u}$ such that $\mathbf{u}\cdot\mathbf{v} = \mathbf{0}$, I first looked at the general case with vectors $\begin{pmatrix} a\\ b\\ c\\ \end{pmatrix}$ and $\begin{pmatrix} d\\ e\\ f\\ \end{pmatrix}$ so ad+be+cf = 0, so I could choose any 2 numbers e & f, then calculate $d = \frac{-(be+cf)}{a}$. But we want to do this "quickly", so we might simplify $e=f=-1$, which gives $$\mathbf{u} = \begin{pmatrix} x\\ -1\\ -1\\ \end{pmatrix},$$ where $x = \frac{b+c}{a}$.

However, when I tried this solution on the examples given, I found that with the final example, there was a divide by zero error.

To get round this, we instead add a caveat to the algorithm to swap a,b,c to ensure that there is a non-zero denominator. So in the final case, we set $y = \frac{a+c}{b} = 0 \Rightarrow \begin{pmatrix} 0\\ 1\\ 0\\ \end{pmatrix}\cdot\begin{pmatrix} -1\\ 0\\ -1\\ \end{pmatrix} = 0$.

In general, the cross product of two vectors is: $$\begin{pmatrix} a\\ b\\ c\\ \end{pmatrix}\times\begin{pmatrix} d\\ e\\ f\\ \end{pmatrix} = \begin{pmatrix} bf-ce\\ cd-af\\ ae-bd\\ \end{pmatrix}$$ so if we let f=e=0, and d=1, then $\mathbf{w} = \begin{pmatrix} 0\\ c\\ -b\\ \end{pmatrix}$ is always the result of crossing $\mathbf{v}$ with $\begin{pmatrix} 1\\ 0\\ 0\\ \end{pmatrix}$, for example, which is probably the most efficient method of calculating this.

Solution 1:

Under development

${\bf u}\cdot {\bf v}=\pmatrix {u_1\cr u_2\cr u_3}\cdot\pmatrix{1\cr 2\cr 3}$= $u_1 + 2u_2 + 3u_3$ =0

We therefore have 1 independent equation and 3 unknows which results in an infinite number of solutions.

One vector which satisifies this relationship is ${\bf u} = \pmatrix {0\cr0\cr0}$

If we take a general vector ${\bf z} = \pmatrix {z_1\cr z_2\cr z_3}$ then:

$${\bf v }\times{\bf z}=\pmatrix {1\cr 2\cr 3} \times \pmatrix{z_1\cr z_2\cr z_3}=\begin{vmatrix}\mathbf{i}&\mathbf{j}&\mathbf{k}\\1& 2& 3\\ z_1&z_2&z_3\end{vmatrix} =\pmatrix{ 2z_3 - 3z_2\cr 3z_1-z_3\cr z_2-2z_1} = \pmatrix{w_1\cr w_2\cr w_3}$$

This gives us a relationship between the components of ${\bf z}$ and ${\bf w}$ in the form of 3 simultaneous equations.
Solving equation 1 and equation 3 simultaneously:
from equation3 we find that $z_2 = w_3 +2z_2$
if we now sustitute $z_2$ into equation1 we find that $-6z_1 + 2z_3 = 3w_3 + w_1$
This result is actually equation2 but scaled which implies that there are actually only two independent equations but still 3 unknows $( z_1, z_2, z_3)$. We are therefore unable to find a unique solution, there are once again an infinite number of solutions.

An alternative method of deducing this result would be to rewrite the equations in matrix form, a 0 determinant to this matrix would indicate that there are an infinite number of solutions.

In matrix form:

$\left [{\begin{array}{cc} 0 & -3 & 2 \\ 3& 0 & -1\\ -2 & 1 & 0 \\ \end{array} } \right]$

If we now take the determinant by expanding by the top row.

Determinant = 0 - -3( 0 - (-1)(-2) ) + 2( (3)(1) - 0) = -6 +6 = 0

Note: The above matrix is anti-symmetric, an anti-symmetric matrix of this form always results from taking the cross product of two vectors, the determinant of an odd order (in this case 3 x 3) anti-symmetric matrx will always give a zero determinant.

Define any vector ${\bf V}$= $\pmatrix {v_1\cr v_2\cr v_3}$

${\bf v}\cdot {\bf u}=\pmatrix{u_1\cr u_2\cr u_3}\cdot\pmatrix{v_1\cr v_2\cr v_3}$= $u_1v_1 + u_2v_2 + u_3v_3$ =0

If ${\bf V}\cdot {\bf U}$ = 0 then the two vectors are orthogonal, to determine ${\bf u}$ we therefore need to find a vector which is perpendicular to ${\bf v}$

Define vector ${\bf z}$= $\pmatrix {z_1\cr z_2\cr z_3}$

The cross product of any 2 vectors will yield a vector perpendicular to both of the original vectors, the cross product of ${\bf v}$ and ${\bf z}$ will therefore give a vector which is perpendicular to ${\bf v}$ (and ${\bf z}$), hence the cross product gives a vector which satisfies the condition for ${\bf u}$.

${\bf V }x{\bf Z}$=$\pmatrix {v_1\cr v_2\cr v_3} x \pmatrix{z_1\cr z_2\cr z_3}$=$\left [{\begin{array}{cc} i & j&k \\ v_1& v_2& v_3\\ z_1&z_2&z_3 \\ \end{array} } \right]$ = $\pmatrix {u_1\cr u_2\cr u_3}$

then
$v_2z_3 - v_3z_2 = u_1$
$v_3z_1 - v_1z_3 = u_2$
$v_1z_2 - v_2z_1 =u_3$

${\bf u}= \pmatrix { v_2z_3 - v_3z_2\cr v_3z_1 - v_1z_3 \cr v_1z_2 - v_2z_1 }$

Note: ${\bf z}$ can be selected as any vector.

Example: Let${\bf z }= \pmatrix { 1\cr 5 \cr 11 }$ and ${\bf v}=\pmatrix { 1\cr 2 \cr 3 }$

Then from the above formula ${\bf u} = \pmatrix { 7\cr -8 \cr 3 }$

And ${\bf U}\cdot {\bf V} = 7 -16 + 9 = 0$

if we now need

${\bf V }x{\bf U }={\bf W}$

$v_2u_3 - v_3u_2 = w_1$
$v_3u_1 - v_1u_3 = w_2$
$v_1u_2 - v_2u_1 =w_3$

if we let $u_1 = k$, then:

$u_2 = \frac{w_3 - Kv_2}{v_1}$

$u_3 = \frac{-w_2 + Kv_3}{v_1}$

so ${\bf U} =\pmatrix {K\cr \frac{w_3 - Kv_2}{v_1}\cr \frac{-w_2 + Kv_3}{v_1}}$ (Valid when $v_1$ is non zero)

similarly by letting $u_2$ and $u_3$ = K in turn we find 2 further possibilities

${\bf U} =\pmatrix {\frac{-w_3 +Kv_1}{v_2} \cr K\cr \frac{w_1 + Kv_3}{v_2}}$ (Valid when $v_2$ is non zero)

${\bf U} =\pmatrix {\frac{w_2 +Kv_1}{v_3} \cr \frac{-w_1 + Kv_2}{v_3}\cr K}$ (Valid when $v_3$ is non zero)