10

In 3 dimensions it is possible to find a vector c (one of infinitely many) perpendicular to two vectors a and b using the cross product. Is there any way of extending this to 4 dimensions, i.e. given three vectors a, b, and c finding a vector d perpendicular to all of them?

I realize that this can be done by solving the equation system:

dot(a, d) = 0
dot(b, d) = 0
dot(c, d) = 0

and imposing an additional constraint, for instance setting the length of d to or one of its components to 1, but is there a way of doing this that does not involve solving an equation system?

Andreas Brinck
  • 267
  • 1
  • 2
  • 7

3 Answers3

16

If $\mathbf{u} = (x_1, y_1, z_1, t_1)$, $\mathbf{v} = (x_2, y_2, z_2, t_2)$ and $\mathbf{w} = (x_3, y_3, z_3, t_3)$, then the vector: $$ \mathbf{x} = \left|\begin{array}{c c c c} \mathbf{e}_1 & \mathbf{e}_2 & \mathbf{e}_3 & \mathbf{e}_4 \\ x_1 & y_1 & z_1 & t_1 \\ x_2 & y_2 & z_2 & t_2 \\ x_3 & y_3 & z_3 & t_3 \end{array}\right|$$ is orthogonal to $\mathbf{u,v}$ and $\mathbf{w}$. Here, $\{\mathbf{e}_i\}_{i = 1}^4$ is the canonical basis for $\Bbb R^4$. If you want a vector orthogonal to the first three, with length $d$, consider $\frac{d}{\|\mathbf{x}\|}\mathbf{x}$. Given $n - 1$ vectors in $\Bbb R^n$, the above gives you one last vector orthogonal to all the given vectors.

Ivo Terek
  • 77,665
  • Very useful. I use this to determine which side of a hyperplane a point is on. The dot product of the point and the normal is positive for one side, negative for the other side, and zero if coplanar. – Tom Karzes Apr 13 '20 at 16:03
  • 1
    how did you implement this? I need to do something similar, but I can't find a standard name for this operation, did you have to use a sign alternating for loop computing 4 independent determinants? – peng yu Mar 07 '21 at 15:34
  • How do you compute e? – Aaron Franke Dec 16 '23 at 18:04
5

Let $P_1$, $P_2$ and $P_3$ the endpoints of the three vectors (thought to be applied in $O$) and let $$ aw+bx+cy+dz=0 $$ the equation of the hyperplane ($3$-dimensional space) through them and $O$ (I'm assuming the three vectors are linearly independent).

Then the vector $(a,b,c,d)$ is perpendicular to all three.

This generalizes to any number of dimensions.

Andrea Mori
  • 26,969
  • Yes, I realize this, but the question is if there is a way of finding one set of a, b, c, and d without solving an equation system. In 3D, one can use the cross product, is there an analogy in 4D? – Andreas Brinck Aug 20 '14 at 16:07
  • Well, of course you can define a $4$-dimensional cross-product by mimicking the usual (3-D) definition. The point is how to compute it quickly. – Andrea Mori Aug 20 '14 at 16:42
2

Yes, in general this is done by finding the null space of the matrix of vectors. when solving for $d$ you are finding the solutions to the matrix equation:

$\vec{0} = \left(\begin{array}{c}{a \\ b \\ c}\end{array}\right).d$

It doesn't matter the number of dimensions, except that with more than three dimensions you will have lotsa solutions (infinite).

amcalde
  • 4,674