n Dimensional Rotation Matrix

2.6k Views Asked by At

So the rotation matrix for 2D is:

\begin{bmatrix} \cos(\theta) & \sin(\theta) \\ -\sin(\theta) & \cos(\theta) \end{bmatrix}

and one of three BASIC rotation matrices for 3D is:

\begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos(\theta) & \sin(\theta) \\ 0 & -\sin(\theta) & \cos(\theta) \end{bmatrix}

but what is the general form of a rotation matrix for $N>3$ dimensions?

Assuming the pattern stays the same, on of the possible $n$-rotation matrices for an $N$-dimensional rotation matrix could be: \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \cos(\theta) & \sin(\theta) \\ 0 & 0 & -\sin(\theta) & \cos(\theta) \end{bmatrix}

Does this even seem right? I need to be able to rotate any possible $N$-by-$N$ matrix by the $N$-dim. rotation matrix through any angle.

2

There are 2 best solutions below

2
On

The distance preserving linear maps $T:\mathbb R^n\to \mathbb R^n$ are precisely the ones which satisfy $T^*T=I$. It would be appropriate to call distance preserving linear maps as 'rotations.' If one wants to further preserve orientation then one would in addition demand $\det(T) > 0$ (note that this forces $\det(T) = 1$).

In matrix language, an $n\times n$ real matrix $M$ is a rotation matrix if $M^tM=I$, where $M^t$ is the transpose of $M$.

2
On

As explained by a previous answer, what you want is a linear transformation $A:X\rightarrow X$ on finite dimensional inner product space $X$ that preserves amplitude of vectors, and angle between vectors. Namely,

  1. $\|Ax\|=\|x\|,\ \forall x\in X$
  2. $\langle Ax, Ay\rangle=\langle x,y\rangle,\ \forall x,y\in X$

In fact, we can introduce the following additional conditions,

  1. $A^\ast A=I$
  2. $AA^\ast=I$

and show that 1, 2, 3 and 4 are equivalent (see Theorem 2.9 in Functional Analysis by Bachman and Narici, Dover Publication, 2000).

This happen to be the definition of the unitary matrix. Note that the determinant of unitary matrix could be $1$ or $-1$. The only extra condition to throw in to exclude “flipping” so that we are left with “rotation” only is

  1. $\det(A)=1$.

So back to your question, how can one generate a matrix that rotates the underlying vector space by an arbitrary angle? Here is an idea.

Start with the identity matrix $I$, and suppose the desired rotation rotates the $j^\text{th}$ column of $I$ denoted $I_j$ to $v$ (with $\|v\|=1$ obviously). Assuming $\langle I_j, v\rangle\neq 0$, then what you can do is

  1. Move $I_j$ to the first column and replace it with $v$
  2. Perform Gram-Schmidt orthogonalization on the resulted matrix, starting from the $2^\text{nd}$ column
  3. Swap the $1^\text{st}$ column and the $j^\text{th}$ column to resume the original order

The resulted matrix $A$ satisfies $A^\ast A=I$ by the nature of Gram-Schmidt process, therefore is a rotation. And it transforms $I_j$ to $v$, thus giving you the desired rotation.