2

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.

Rócherz
  • 4,241
notMyName
  • 202
  • 2
  • 8
  • What precisely, does "rotation matrix" mean here, and what does rotating a matrix mean? – kimchi lover May 31 '20 at 00:47
  • @kimchilover https://en.wikipedia.org/wiki/Rotation_matrix – notMyName May 31 '20 at 01:34
  • “One of three rotation matrices...” There are many other rotations in 3-D—an infinite number of them, in fact—besides rotations about the standard coordinate axes. The situation becomes even more complex in higher-dimensional spaces. – amd May 31 '20 at 07:09
  • @amd The three 'Basic' 3D rotation matrices https://en.wikipedia.org/wiki/Rotation_matrix – notMyName May 31 '20 at 16:45
  • 3
    This paper may help. It looks like it presents an algorithm for constructing n-dimensional rotation matrices. http://wscg.zcu.cz/wscg2004/Papers_2004_Short/N29.pdf – Bob Jenkins Jun 24 '21 at 13:40

2 Answers2

7

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.

Rócherz
  • 4,241
Tian He
  • 302
  • Do you know any methods of creating rotation matrices using the same form I gave in my question, with various 'cos', 'sin' ? – notMyName May 31 '20 at 16:47
  • Only when the rotation is strictly in 2-dimension can you use $cos(\theta)$ and $sin(\theta)$ to represent it nicely. A rotation in 3-dimension in general cannot be represented by a single angle. Did you try the method I showed? It's quite elementary. – Tian He May 31 '20 at 18:38
4

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$.

Rócherz
  • 4,241