n Dimensional Rotation Matrix 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$ dimensions > 3?
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.
 A: As explained by 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, 


*

*$||Ax||=||x||, \forall x\in X$

*$<Ax, Ay>=<x,y>, \forall x,y\in X$
In fact, we can introduce the following additional conditions,


*$A^*A=I$

*$AA^*=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 


*$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^{th}$ column of $I$ denoted $I_j$ to $v$ (with $||v||=1$ obviously). Assuming $<I_j, v>\neq 0$, then what you can do is 


*

*Move $I_j$ to the first column and replace it with $v$

*Perform Gram-Schmidt orthogonalization on the resulted matrix, starting from the $2^{nd}$ column

*Swap the $1^{st}$ column and the $j^{th}$ column to resume the original order


The resulted matrix $A$ satisfies $A^*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.
A: 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$.
