# Rotation matrix in $n$ dimension along $n$ dimensional vector

I want to construct a Rotation matrix in general $$n$$ dimension along $$n$$ dimensional vector $$\vec{p}$$.

First I know how to construct $$n=3$$ case : consider $$n=3$$ rotation along $$3$$ dimensional vectork $$\vec{k}$$, then

Rotation matrix $$R$$ is given by \begin{align} \mathbf{R} = \mathbf{I} + \sin(\theta) \mathbf{K} + (1-\cos(\theta)) \mathbf{K} \end{align} where \begin{align} \mathbf {K} =\left[{\begin{array}{ccc}0&-k_{z}&k_{y}\\k_{z}&0&-k_{x}\\-k_{y}&k_{x}&0\end{array}}\right] \end{align}

How about a general $$n$$ dimensional case?

Is a similar formula exists? then What is it?

I suspect a close-form formula may be hard to come by. However, there is a general prescription for constructing such matrices, though actually doing the construction by hand may not be possible.

Taking as definition that by "rotation" we mean a matrix which leaves the inner product of two vectors $$x,y$$ invariant: $$x^{\prime T}y^\prime=x^\prime R^TRy^\prime=x^Ty,$$ where $$x^\prime = Rx$$ for some rotation matrix $$R$$, and similarly for $$y^\prime$$. Such matrices are known as the defining representation of the group $$SO(n)$$ where the dimension of the vectors is $$n$$.

There are general results about Lie groups (of which $$SO(n)$$ is an example) which tell us that there exist so-called generators of the group which when exponentiated give the elements of the group: $$R(\theta)=e^{\theta^a\omega_a}$$ where $$\theta^a$$ are the parameters determining the rotation (for example, the Euler angles in $$n=3$$) and the $$\omega_a$$ are some collection of yet-to-be-determined matrices.

Now, we took $$R^TR=I$$ to be the determining relation for our rotations. Let's expand this requirement to first order in $$\theta^a$$ to find $$1=(1+\theta^a\omega_a^T)(1+\theta^a\omega_a)=1+\theta^a(\omega_a^T+\omega_a).$$ Since this must be the case for all (small values of) $$\theta^a$$, it must be the case that each of the generators $$\omega_a$$ must satisfy $$\omega_a=-\omega_a^T,$$ and hence they must all be antisymmetric matrices.

So the result of all this is: in order to generate a rotation in $$n$$ dimensions, pick some linear combination of antisymmetric $$n\times n$$ matrices and exponentiate it.

Edit: Let me also add, because I notice you also asked specifically about rotating about a given vector: in order to demand that a given vector $$v$$ be left invariant by the rotation (so the rotation is about $$v$$), we are demanding $$R(\theta)v=v$$ and hence, expanding again to first order in $$\theta$$, we must have $$(1+\theta^a\omega_a)v=v.$$ This necessitates $$\theta^a\omega_a v=0$$. So the collection of rotations which leaves a given vector invariant (rotates about that vector) will be all those rotations formed by an antisymmetric matrix (the linear combination $$\theta^a\omega_a$$) which contain $$v$$ in the kernel.