Explicitly represent a basis for the subspace perpendicular to $v ∈ ℝ^3$

linear algebravectors

I'm looking for an analytic way to explicitly represent two vectors which form a basis
for the space in $\mathbb{R}^{3}$ perpendicular to some vector $v$.

For example, my first thought was to do this:

\begin{align}
u &= v\times u', &
w &= v\times u.
\end{align}

The idea is that $u$ will be perpendicular to $v$ (and $u'$, but that choice is arbitrary and doesn't matter) and that $w$ will be perpendicular to $v$ and $u$.

The fact that both $u$ and $w$ are perpendicular to $v$ puts them in the correct subspace.

The fact that $u$ and $w$ are perpendicular to each other means they form an orthogonal basis.

The problem, of course, is that this fails when $v$ is parallel to $u'$. I'm looking for a fully general way to express $u$ and $w$.

There are many algorithms for doing this, but those are not useful to me at the moment. I'm looking for an explicit representation of the form

\begin{align}
u &= f(v), &
w &= g(v,u).
\end{align}

Any ideas?

Best Answer

What you’re really after is a method of producing a vector $u = f(v)$ orthogonal to $v$ which always works and which doesn’t involve any sort of ‘choice’. With that, getting the last vector is as easy as $w = f(v) × u$.

You could take $$ f(v) = \begin{cases} v × (1,0,0) & \text{if $v ≠ (1,0,0)$} \\ (0,1,0) & \text{otherwise} \end{cases} $$ but you’re probably wanting to exclude this kind of solution on the basis of the choice of $(1,0,0)$ as special.

But suppose we have a magic formula $f : ℝ^3 → ℝ^3$ which produces an orthogonal vector $f(v) \perp v$ as advertised. There are infinitely many possible answers, arranged with rotational symmetry in the plane $v^\perp$. The formula must have a way of picking out one of those vectors as distinct from the rest, so the formula itself cannot be symmetric — it must involve some choice of vector.

So you can’t get away with not making a choice. But if we take $v × u'$ for an initial guess $u'$, the formula will fail for $u' \parallel v$.

As a way of “disguising” the choice, you could generate two vectors, one of which may be zero, and then choosing the one that isn’t. For example, $$ f(v) ∈ \{v × (1,0,0), v × (0,1,0)\} .$$ Both of these are $\perp v$, and they can’t both vanish for the same $v ≠ 0$.


Arguably, the better way to handle the geometry of vectors and planes is to use a language with less redundancy: Instead of representing $v^\perp$ with an orthogonal basis, you can represent it as a bivector.

For example, if $v = v_x 𝒙̂ + v_y 𝒚̂ + v_z 𝒛̂$, then the normal plane is described by the bivector $$ v_x 𝒚̂ ∧ 𝒛̂ + v_y 𝒛̂ ∧ 𝒙̂ + v_z 𝒙̂ ∧ 𝒚̂ .$$

If this kind of ‘multilinear algebra’ interests you, I recommend reading about multivectors and geometric algebra.