How i can rotate a $m$ dimensional vector?

1.1k Views Asked by At

I have an $m \ge5$ dimensional vector $x$. How i can construct a rotation matrix $A$ s.t: $x \cdot A$ would be a vector rotated by $\theta$ angle. This is trivial for 2 dimensions, but what for this case? For instance will it work if A is this: $A = \begin{bmatrix} cos \theta & -\sin\theta&0&0&0 \\ \sin\theta&-\cos\theta&0&0&0\\ 0 & 0&cos \theta & -\sin\theta&0\\ 0 & 0&sin \theta & cos \theta&0\\ 0&0&0&0&1\\ \end{bmatrix}$

and i work in 5 dimensions? This matrix i assume that is says rotate with respect to the first plane of the two first dimensions by $\theta$ then rotate again with the same $\theta$ the other two. But what about the last one? Also what if i want to combine dimension 1 and 4 in order to rotate with respect to this plane?

2

There are 2 best solutions below

1
On

A rotation in the plane $\mathbb{R}^2$ is determined by a fixed point and a rotation angle around that point. A rotation in 3-dimensional space $\mathbb{R}^3$ is determined by a fixed line and a rotation angle around that line. The common generalization of this is that a rotation in $m$-dimensional space is determined by a fixed $m-2$ dimensional affine subspace and a rotation angle around that subspace. So just specifying a vector and a rotation angle is not enough information to determine the rotation. What you need to specify is the fixed subspace and the rotation angle.

Also, you ask for a rotation of the form $x \cdot A$, and this means that the fixed $m-2$ dimensional subspace is a linear subspace $V$. Let's say that you specify $V$ and the rotation angle $\theta$. Here's how to derive the matrix $A$.

Let $e_1,\ldots,e_m$ be the standard basis for $\mathbb{R}^m$ (written as column vectors). Let $b_1,\ldots,b_m$ be any orthonormal basis for $\mathbb{R}^m$ (again written as column vectors) such that $V = Span\{b_3,\ldots,b_m\}$ (however $V$ is specified you'll have to compute this basis $b_1,\ldots,b_m$, perhaps by the Gram-Schmidt process). Putting this basis in the columns of a matrix $M$ you get a linear transformation that maps the $n-2$ dimensional subspace $Span\{e_3,\ldots,e_m\}$ to the subspace $V$. Let $R$ be the $m \times m$ matrix that you get from the identity matrix by replacing the upper left $2 \times 2$ submatrix by the standard rotation matrix $(\cos(\theta),\sin(\theta);\sin(\theta),\cos(\theta))$, so this $R$ represents the rotation of angle $\theta$ with fixed subspace $Span\{e_3,\ldots,e_m\}$.

Then the matrix you want is $$A = M R M^{-1} $$ Geometrically this works because this formula says: map $R$ back to $Span\{e_3,\ldots,e_m\}$, rotate around that by $\theta$, and them map $Span\{e_3,\ldots,e_m\}$ back to $R$; the result is a rotation of angle $\theta$ around $R$.

3
On

It's relatively easy to construct such a rotation map using clifford algebra; the hardest part is probably learning the clifford algebra itself. However, if you can wrap your head around it, it's a very powerful tool to use for geometric problems in higher dimensions.


Clifford, or geometric algebra, is built upon a geometric product of vectors that obeys the following properties. Let $e_1, e_2, e_3, e_4, e_5$ be a standard, orthonormal basis, let $i, j \in \{1, 2, 3, 4, 5\}$. The geometric product has at its most basic form

$$e_i e_j = \begin{cases} 1, & i = j \\ -e_j e_i, & i \neq j \end{cases}$$

Along with associativity, distributivity over addition, and so on.

A key concept in GA is that of grading. Like exterior algebra, GA assigns whole sets of geometric products of vectors a grade, based on reducing any pairs of the same vectors. For instance, the geometric product $e_1 e_3 e_4 e_1 e_5 e_2 e_2$ is said to be grade-3. Observe:

$$\color{red}{e_1} e_3 e_4 \color{red}{e_1} e_5 \color{blue}{e_2 e_2} = (-1)\color{red}{e_1} e_3 \color{red}{e_1} e_4 e_5 \color{blue}{(1)} = (-1)(-1)\color{red}{e_1 e_1} e_3 e_4 e_5 = \color{red}{(1)}e_3 e_4 e_5$$

This cannot be reduced through annihilation of basis vectors any further, so it is grade-3, called a trivector. A geometric product actually consists of several grades. Consider two vectors $a$ and $b$ in a 2d space:

$$\begin{align*}ab &= a^1 b^1 e_1 e_1 + a^2 b^2 e_2 e_2 + a^1 b^2 e_1 e_2 + a^2 b^1 e_2 e_1 \\ &= (a^1 b^1 + a^2 b^2) + (a^1 b^2 - a^2 b^1) e_1 e_2 \\ &\equiv \langle ab \rangle_0 + \langle ab \rangle_2\end{align*}$$

You'll note that $\langle ab \rangle_0$ is precisely the dot product, while $\langle ab \rangle_2$ is similar to a cross product in terms of its components. For this reason, the geometric product of two vectors is also often written as

$$ab = a \cdot b + a \wedge b$$

The wedge product being similar to a cross product, but inspired more by its exterior algebra counterpart.


With the geometric product in hand, there is a handy rotation formula. Let $\hat B$ be a normalized bivector describing the rotation plane. (This can be done through a geometric product of orthonormal vectors in the plane.) The rotation of a vector $c$ is

$$\underline R(c) = c \cos \theta - \hat B \langle \hat B c\rangle_3 (1 - \cos \theta) - \langle \hat B c \rangle_1 \sin \theta$$

This is exactly an analogue of the Rodrigues rotation formula. I will work an example.

Let $\hat B$ be the plane spanned by the vectors $e_1$ and $(e_3 + e_4)/\sqrt{2}$. Then $\hat B = e_1(e_3 + e_4)/\sqrt{2}$, or $(e_1 e_3 + e_1e_4)/\sqrt{2}$.

You could be very vanilla here and only input basis vectors for $c$ so you can eventually extract a matrix, but I'll do something harder and input $c = e_2 + e_4$ just for fun.

First we compute $\hat B c$:

$$\hat B c = \frac{e_1 e_3 + e_1 e_4}{\sqrt{2}} (e_2 + e_4) = \frac{1}{\sqrt{2}} (e_1 e_3 e_2 + e_1 e_3 e_4 + e_1 e_4 e_2 + e_1)$$

The first three terms make up $\langle \hat B c \rangle_3$, so now we compute $\hat B$ multiplied with them.

$$\begin{align*}\hat B \langle \hat B c\rangle_3 &= \frac{1}{2} (e_1 e_3 + e_1 e_4)(e_1 e_3 e_2 + e_1 e_3 e_4 + e_1 e_4 e_2) \\ &= \frac{1}{2} (-e_2 - e_4 + e_3 - e_2) \\ &= -e_2 + \frac{e_3 - e_4}{2}\end{align*}$$

This allows us to compute, then, for any angle $\theta$, the overall rotation to be

$$\underline R(e_2 + e_4) = (e_2 + e_4) \cos \theta - \left(-e_2 + \frac{e_3 - e_4}{2} \right)[1-\cos \theta] - \frac{1}{\sqrt{2}} e_1 \sin \theta$$

I hope this example has convinced you that geometric algebra is a useful tool for doing geometric problems, whether in 3d or beyond. There's a lot of stuff involved in just proving that extension of the Rodrigues formula, all made possible through the geometric product. You can most certainly extract a matrix from these expressions by inputting basis vectors and looking at components.