Rotation in 2D by an angle $t$ can be performed using $$R=\begin{pmatrix}\cos(t) &-\sin(t) \\ \sin(t) & \cos(t)\end{pmatrix}$$ matrix. But, if I want to rotate a point or vector in 4D, is there any rotation matrix in explicit form?

I have read rotation about planes in 4D (Rotating two planes while the other two planes remains constant), but I am interested in rotation around an axis. More specifically the Quaternion 4D rotation matrix.

Kindly help me out.

  • 2
    $\begingroup$ In 4D you need a pair of quaternions to get all of $SO(4)$. See this thread for example (I think there's a better one, but my search-fu is weak today). $\endgroup$ Commented Aug 19, 2015 at 7:46

4 Answers 4


The reason you haven't read about "rotation about an axis" in 4D is that there is no such thing. Perhaps I should say "the reason is that any rotation that leaves fixed a single axis also leaves fixed another axis orthogonal to it, and hence leaves fixed an entire plane." You were probably hoping to find something with the property that $$ Rv = v $$ for any $v$ in the "axis" $L$, and the property that $$ Rw \cdot w = \cos \theta $$ for any vector $w$ orthogonal to $L$, i.e., all vectors $w$ in the plane orthogonal to $L$ are rotated by an angle of $\theta$. But, alas, there is no such thing.

The trick is to understand that our standard way of describing rotations in 3-space is slightly flawed: instead of saying that "we rotated 20 degrees about the $z$ axis", for instance, we could say "we rotated in the $xy$-plane by $20$ degrees" (i.e., naming the plane of rotation rather than the single axis that happens to be orthogonal to the plane). If we did the latter, then generalizing would work fine: we could talk (in 4-space) about rotating in the $xy$-plane, which leaves two perpendicular dimensions ($z$ and $w$) fixed. Such rotations are relatively easy to write down, but they do not describe all possible rotations in 4-space: there are also ones that rotate by some amount in a plane spanned by vectors $v_1, v_2$, and by some (possibly different) amount in a plane spanned by vectors $u_1, u_2$, with the $u$s orthogonal to the $v$s.

It's not too tough to write down proofs of these claims, at least if you know about eigenvalues and eigenvectors; if you want, I can expand my answer to do so. But I think the main contribution that I can make is to help you understand that you're looking for something that (provably) does not exist, and perhaps you should attempt to gain a different understanding.

Post-comment additions: @Widawensen asked that I expand a bit on my remarks, so I'll do so, giving proofs for a few things I've said.

First: Throughout, $R$ will be a rotation in $4$-space, or the $4 \times 4$ matrix of this rotation with respect to the standard basis.

Claim 1: If, for some nonzero vector $v$, we have $Rv = v$, then there's another vector $w$ orthogonal to $v$ with $Rw = w$. In other words: if a rotation fixes all points on a single axis (the span of the vector $v$), then it actually fixes all points on an entire plane.

Proof: A rotation matrix preserves lengths, so its eigenvalues must all be complex (or real numbers) of absolute-value 1. We know, since $Rv = v$ and $v$ is nonzero, that one of the eigenvalues is 1. So the eigenvalues are $1, a, b, c$. Either all of $a,b, c$ are real (in which case they're all $\pm 1$), or some of them are complex. In the real case, since the determinant of a rotation is $+1$, we must have $abc = +1$, hence either 0 or two are $-1$.

  • Case 1: all four eigenvalues are $+1$: then $R$ is the identity, and any vector orthogonal to $v$ can be chosen as $w$ and we're done.

  • Case 2: The evalues are $+1, +1, -1, -1$. Since $+1$ is an eigenvalue twice, the eigenspace $E$ corresponding to $+1$ is two-dimensional$^{**}$, and it evidently contains $v$. Extending $v$ to an orthogonal basis $ \{v, w\}$ of $E$ via Gram-Schmidt, we get our vector $w$ and we're done.

If there are complex eigenvalues, the situation is similar to the second case: Because the characteristic polynomial is a real polynomial (no imaginary numbers!) the complex eigenvalues occur in complex conjugate pairs, so we have

  • Case 3: The evalues are $1, a, p + iq, p - iq$, where $p^2 + q^2 = 1$ because all eigenvalues must have length 1 for a rotation. The determinant is then $1 \cdot a \cdot (p^2 + q^2) = a$. But we know the det of a rotation is $1$, so $a = 1$. Hence the eigenspace for $1$ is again 2-dimensional, and the analysis for Case 2 applies.

Claim 2: Rotations that fix all points of some plane in 4-space do not actually exhaust all rotations of 4-space: there are rotations of 4-space that move the points of every 2D plane.

Proof: Look at the matrix \begin{bmatrix} -1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & c & -s \\ 0 & 0 & s & c \end{bmatrix} where $c = s = \cos \frac{\pi}{4} = \frac{\sqrt{2}}{2}$.

The eigenvalues of this matrix are $-1, -1, c+is, c-is$. In particular, the number $1$ is not an eigenvalue, so there is no vector $v$ with $Rv = v$.

Claim 3: Every rotation $R$ in 4-space is a product $R = ST$, where $S$ is a rotation that fixes all points of a plane $A$, and $T$ is a rotation that fixes all points of a plane $B$, and the planes $A$ and $B$ are orthogonal, in the sense that for any vectors $a \in A$ and $b \in B$, we have $A \cdot b = 0$.

Proof: Again this is by cases, based on the eigenvalue structure. The five possible eigenvalue sets are $(1,1,1,1)$, $(1,1,-1, -1)$, $(-1, -1, -1, -1)$, $(1, 1, a+bi, a-bi)$ (where $b \ne 0$ and $a^2 + b^2 = 1)$, $(a+bi, a-bi, c+di, c-di)$, where $b, d \ne 0$ and $a^2 + b^2 = c^2 + d^2 = 1$. We'll examine these one at a time:

Case 1: $(+1, +1, +1, +1)$. $R$ is the identity, and can be factored as $I$ \cdot $I$, where the first $I$ fixes all points of the $xy$-plane, and the second fixes all points of the $zw$-plane, so that these two planes serve the roles of $A$ and $B$.

Case 2: $(+1, +1, -1, -1)$. The eigenspace for $+1$ is 2-dimensional, so pick an orthonormal basis $v_1, v_2$ for it. Extend this, by Gram Schmidt, to an orthonormal basis for 4-space, $v_1, v_2, v_3, v_4$. Because the eigenspaces for $+1$ and $-1$ must be orthogonal, the span of $v_3, v_4$ must be the eigenspace for $-1$. Let $M$ be the matrix whose columns are $v_1, v_2, v_3, v_4$, and $D$ be the diagonal matrix with diagonal entries $-1, -1, +1, +1$. Then $S = M D M^t$ negates $v_1$ and $v_2$ and fixes $v_3$ and $v_4$. Picking $T = I$, we have $R = S T$, and we're done.

Case 3: $(+1, +1, a+bi, a-bi)$. The eigenspace for $+1$ is 2-dimensional, so pick an orthonormal basis $v_1, v_2$ for it. Extend this, by Gram Schmidt, to an orthonormal basis for 4-space, $v_1, v_2, v_3, v_4$. Let $M$ be the matrix whose columns are $v_1, v_2, v_3, v_4$. Look at $$ Q = M R M^t $$ This matrix fixes $e_1$ and $e_2$ and has the same eigenvalues as $R$ (because $M$ is a rotation). Since it's a rotation, its columns must be orthogonal. That means that $Q$ must have the form $$ \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & * & * \\ 0 & 0 & * & * \end{bmatrix} $$ where the $2 \times 2$ block at the lower right is actually an 2D rotation. That means it has the form \begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix} for some $\theta$ and has eigenvalues $\cos \theta \pm i ~ \sin \theta$. But we know that its eigenvalues must be $a \pm bi$. So the actual form of $Q$ must be $$ Q = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & a & -b \\ 0 & 0 & b & a \end{bmatrix} $$ (or its transpose).

This matrix factors into $I \cdot Q$, where $I$ fixes the $zw$-plane, and where $Q$ fixes all points of the $xy$ plane. So we have

$$ M R M^t = IQ $$ Conjugating by $M$, we get \begin{align} M^t (M R M^t) M &= M^t (IQ) M \\ (M^t M) R (M^t M) &= M^t (IMM^tQ) M \\ R &= (M^t IM) (M^tQ M) \end{align} which shows that $R$ is a product of something that fixes the $v_3, v_4$ plane (namely $M^t I M = I$) and something that fixes the $v_1, v_2$ plane (namely $M^t Q M = R$). The key point is that $M^t M = M M^t = I$, because its columns forma an orthonormal basis for 4-space.

Case 3: $(-1, -1, -1, -1)$. In this case, $R$ is just the negative identity, and factors nicely as $$ R = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix} \begin{bmatrix} -1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}. $$

Case 4: Like case 2. $R$ is (up to conjugation by a matrix $M$ whose columns are its eigenvectors) just the matrix of "Claim 2" above.

Case 5: Similar, except that there's no single plane that's either pointwise fixed or pointwise negated: instead, there are two perpendicular planes that are each rotated by some non-multiple-of-$\pi$ amount.

Footnote: $^{**}$ FShrike points out that it's not obvious that just having $+1$ as an eigenvalue twice means that there are two eigenvectors with eigenvalue $1$. After all, consider the matrix $\pmatrix{1 & 1 \\ 0 & 1}$, right? In general, all we can say is that the generalized eigenspace for $\lambda = +1$ is two-dimensional. That gives us an eigenvector $v$ (which we might as well adjust to have length 1) for the eigenvalue $+1$, and a second independent vector $u$ for which (1) $Au \in span \{v, u\}$, (2) $(A-I)u$ may be nonzero, but (3) $(A-I)^2 u$ is zero. By applying Gram-Schmidt to the pair $\{v, u\}$, we get a pair $\{v, w\}$, where the three properties above also hold for $w$.

By item 1, we know that $Aw = cv + dw$ for some $c, d$, so $(A-I)w = cv + (d-1)w$. Applying this a second time gives us \begin{align} (A-I)^2 w &= c (A-I)v + (d-a)(A-I)w \\ &= 0 + (d-1)[cv + (d-1)w]\\ &= c(d-1)v + (d-1)^2w \end{align} which must be $0$, and because $v$ and $w$ are independent, we see that $(d-1)^2 = 0$, i.e. $d = 1$. Now look at $Aw = cv + w$. Because $A$ is orthogonal (which means length-preserving), the left-hand side has length $\|Aw\| = \|w\| = 1$. The right-hand side (remember that $v$ and $w$ are orthogonal and unit length, because of Gram Schmidt) has length $\sqrt{c^2 + 1}$. Hence $c = 0$, and we've shown that the second generalized eigenvector, $w$, is actually an eigenvector, so we're done.

[As @FShrike notes, if you know the spectral theorem, this is all a good deal easier.]

  • 2
    $\begingroup$ I think this is a great response and I actually don't get the downvote to the original q. $\endgroup$ Commented Aug 19, 2015 at 7:31
  • 2
    $\begingroup$ yeah @luegofuego , its a bad attitude to have disdain for curiosity. After all that is the reason many people have interest in mathematics. I had the exact question and this question allowed me to quickly access the pertinent knowledge that this answer imparted. $\endgroup$
    – MNKY
    Commented Sep 17, 2015 at 3:52
  • $\begingroup$ Glad to have been of help. $\endgroup$ Commented Sep 17, 2015 at 10:08
  • $\begingroup$ @JohnHughes It's a pity however that you didn't extend your answer as you were going to. It would have been very enlightening for MSE users as your written already text. $\endgroup$
    – Widawensen
    Commented Jul 26, 2016 at 11:51
  • $\begingroup$ See updated answer. $\endgroup$ Commented Jul 27, 2016 at 20:28

Right from the creation of the universe things have always seemed complicated except if simplified especially in rotating and expanding cosmos like earthlings are used too.

Plane Of Rotation

When the rotation of an object takes place about the z-axis in 3D for example, the plane of rotation is the xy/yx plane i.e. x,y coordinates transform as the object turns about the z-axis thus points on the z-axis are free/do not partake in the turning therefore the plane of rotation rather than the axis that happens to be perpendicular to the plane is where rotation really happens

Hence for 3D(x,y,z):

xy/yx plane rotation => z axis is free
xz/zx plane rotation => y axis is free
yz/zy plane rotation => x axis is free

PS: Usually when humans (I am a Cyborg from 2050 on a quest to retrieve the timestone from the earth's core ) say they are rotating the object about the z-axis in 3D, the plane of rotation is xy/yx and the object's transformation would be idle about the free axis(the z-axis)

So for 4D(x,y,z,w):

xy/yx plane rotation => z axis & w axis are free
xz/zx plane rotation => y axis & w axis are free
yz/zy plane rotation => x axis & w axis are free
xw/wx plane rotation => y axis & z axis are free
yw/wy plane rotation => x axis & z axis are free
zw/wz plane rotation => x axis & y axis are free

$$Rotation Transforms$$ 3D Rotation Matrix: anti-clockwise order($xy,yz,zx$)

z-axis rotation $$Rxy = \begin{pmatrix} cos(\theta)&-sin(\theta)&0\\ sin(\theta)&cos(\theta)&0\\ 0&0&1\\ \end{pmatrix}$$

x-axis rotation $$Ryz = \begin{pmatrix} 1&0&0\\ 0&cos(\theta)&-sin(\theta)\\ 0&sin(\theta)&cos(\theta)\\ \end{pmatrix}$$

y-axis rotation $$Rzx = \begin{pmatrix} cos(\theta)&0&sin(\theta)\\ 0&1&0\\ -sin(\theta)&0&cos(\theta)\\ \end{pmatrix}$$

4D Rotation Matrix: no clock order

zw-axis rotation $$Rxy = \left[\begin{matrix} cos(\theta) & -sin(\theta) & 0 & 0 \\ sin(\theta) & cos(\theta) & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{matrix}\right]$$

yw-axis rotation $$Rxz = \left[\begin{matrix} cos(\theta) & 0 & -sin(\theta) & 0 \\ 0 & 1 & 0 & 0 \\ sin(\theta) & 0 & cos(\theta) & 0 \\ 0 & 0 & 0 & 1 \end{matrix}\right]$$

yz-axis rotation $$Rxw = \left[\begin{matrix} cos(\theta) & 0 & 0 & -sin(\theta) \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ sin(\theta) & 0 & 0 & cos(\theta) \end{matrix}\right]$$

xw-axis rotation $$Ryz = \left[\begin{matrix} 1 & 0 & 0 & 0 \\ 0 & cos(\theta) & -sin(\theta) & 0 \\ 0 & sin(\theta) & cos(\theta) & 0 \\ 0 & 0 & 0 & 1 \end{matrix}\right]$$

xz-axis rotation $$Ryw = \left[\begin{matrix} 1 & 0 & 0 & 0 \\ 0 & cos(\theta) & 0 & -sin(\theta) \\ 0 & 0 & 1 & 0 \\ 0 & sin(\theta) & 0 & cos(\theta) \end{matrix}\right]$$

xy-axis rotation $$Rzw = \left[\begin{matrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & cos(\theta) & -sin(\theta) \\ 0 & 0 & sin(\theta) & cos(\theta) \end{matrix}\right]$$

The reason why 4D Rotations can't have Ryzw, Rxzw, Rxyw, Rxyz is because generally rotation is the circular movement about a fixed point/pivot and it requires at least/only two axis for transformation in our 2-biased-state-universe (including the imaginary multiverses too, given our scope hasn't travelled ♧D and beyond).

so that in 2D to rotate a square about a pivot a 0D point is at least stationary/invariant

also in 3D to rotate a cube about a pivot for a specific plane a 1D line passing through the pivot is stationary/invariant

and finally in 4D to rotate a tessaract about a pivot for a specific plane a 2D rect containing the pivot is at least stationary/invariant e.t.c.

I guess the multiverses decided the trend must be 0D point, 1D line, 2D rect...

visit the universe and the multiverses

Preparing the JetPack Vortex Experience 2.0:


Note how the Rotation Transform Hash seems to portray rotation only as a 2-axes phenomenon (R## from 2D - 5D) and how its red hashes seem analogous to the invariant pivot element.

The fundamental property of rotations:
To simply put in human understandable terms "a point if truly rotated, maintains a constant distance to its turning point (Pivot)" i.e. rotating a shape is only possible with each point in the shape maintaining a constant distance to the pivot. E.g. When a 3D point is rotated along the z axis (as humans would have it) two coordinates (x,y) would transform hence Rxy denotes this because x and y axis values change and together remain equidistant to the turning point. With that said, if a point transforms in x,y,z values while remaining equidistant to a pivot should that not imply Rxyz is possible? Yes but what one discovers would be that

Rxyz = Rxy . Rxz or
Rxyz = Rxy . Ryz


Rxyz = (z-axis and y-axis)rotation or
Rxyz = (z-axis and x-axis)rotation

This is the reason it is argued Rxyz isn't possible by humans (which I strongly disagree with). The same applies to rotations in all other environments with extra dimensions. So to discredit what the chief Cyborg said earlier (a little bit) Rxyz is possible in a 4D environment and beyond because It's still a 2axes-biased-rotation-universe (You may interpret this to mean the angular velocity of Spiderman's web-flinging in the MCU may fail if he gets permitted into the DCEU (heard the Bat only permits heroes with capes outta the stargate). I had a tachyon-skype call a few days back with Aquaman from the mariana trench at the other side and he said the word on the street nowadays is that they can rotate themselves when flying with their stomachs inside out (there were rumours of some alien crustaceans flying and swimming inside their waters too, I mean how should any normal thing fly inside water?) but I suspect it's a 3axes-biased-rotation-universe given the quantum-belly experience is astonishingly different, with that said one could only imagine if DCEU rotation sucks or not but this doesn't mean one would love the MCU more, although their characters are so much cooler (don't blame me the DCEU Bat has always been a Joker (pun intended), I mean he's supposed to use his big ears to navigate while flying but all he does is open his eyes as wide as possible)).


  • 1
    $\begingroup$ Wow! Profound approach. Genius! $\endgroup$ Commented Aug 27, 2019 at 23:49
  • 2
    $\begingroup$ While I like it if an answer lightens the mood, here the main point got a little lost at times due to the "story time". Maybe you could improve the answer by having some paragraphs more serious and others less and indicate which ones are which. However, the answer is still pretty good=understandable (thus +1) - especially the "4D Rotation Matrix"-section. One question though: In higher dimensional space: Do I always add further rows/columns that just contain 0s and 1s? Did I get this right? $\endgroup$
    – Make42
    Commented Apr 5, 2021 at 14:17
  • 1
    $\begingroup$ It all happened as the spirit led, really sorry about that :) Yes with matrices for whatever dimension you are operating in, since basically rotations are transforms about 2 axis i.e. an identity matrix merged with a box of "cos -sin sin cos functions of theta". check out the clock order link for more expanation if that helps (ↈ_ↈ) $\endgroup$
    – linker
    Commented Apr 6, 2021 at 20:26

Rotations in 2-D space rotate around a point (rotation center) which remains invariant under the rotation. Rotations in 3-D space rotate around a line (rotation axis) which remains invariant under the rotation. In 4-D space there are two sorts of rotations: a) Single rotations around a plane which remains invariant under the rotation, and b) Double rotations around a point (rotation center), which remains invariant under the rotation. General double rotations have two mutually independent rotation angles. Isoclinic rotations are double rotations wherein both rotation angles have the same absolute value; they can, however, still differ in relative sign, giving rise to left-isoclinic and right-isoclinic rotations.

Quaternions are isoclinic rotation operators:

A unit quaternion $q = (q_0 + iq_1 + jq_2 + kq_3)$ can always be written as

$$q(\varphi)= \big(\cos(\varphi) + i u_1 \sin(\varphi) + j u_2 \sin(\varphi) + k u_3 \sin(\varphi)\big)$$

$u = (u_1, u_2, u_3)$ being a 3D unit vector, the axis of rotation; and $\varphi$ being the rotation angle around this axis $u$ .

Pre-multiplication of a 4-D point $P$ with a unit quaternion $q(\varphi)$ does, however, not only cause a 3D-rotation of $P$ by the angle $\varphi$ around $u$ ("curl") but also a "inward-outward" rotation of $P$ by the angle $\varphi$ along the fourth dimension ("source"). Taking the negative rotation angle $q(-\varphi)$ reverses the sense of both, "curl" and "source". Post-multiplication reverses the sense of the "curl" but not that of the "source".

To obtain a pure 3D-rotation by an angle $\varphi$, one can combine a premultiplication by $q(\varphi/2)$ with a post-multiplication by $q(-\varphi/2)$. The "curl"-rotations will then add up to the full rotation angle, whereas the "source"-rotations will mutually cancel each other.

  • 1
    $\begingroup$ Can these two types of rotation be described with a single 4x4 quaternion, or would two such quaternions be required? Does it depend on which type? $\endgroup$
    – Jack
    Commented Aug 2, 2018 at 18:41

To answer the question "I am interested in rotation around an axis".

Rotation is an inherently $2$-D operation: rotate the vector $<x,y>$ by an angle $\theta$. So, strictly speaking, there is never an "axis of rotation". In fact what happens is that there is a rotation about a point in the plane of rotation; either the origin, or some other point. Everything is within the plane.

For rotations in $3$-D space and above - all you need to do is specify the $2$-D plane of rotation within the space.

If you want to talk about "axes of rotation" in a non-formal way, to help you understand things in $3$-D space, or spaces above that, then starting from $2$-D space upwards:

In $2$-D space, there is no "axis of rotation".
In $3$-D space, there is a $1$-D "axis of rotation"; a line.
In $4$-D space, there is a $2$-D "axis of rotation"; a plane.
In $5$-D space, there is a $3$-D "axis of rotation"; a $3$-D space.
and so on ...

Following on from @JohnHughes ' answer, although one cannot write, in $n$-D space, where $n > 3$, that for rotation about "an axis" $L$, that for any vector $v$ in the "axis" $L$, $Rv = v$, and that for any vector $w$ orthogonal to the "axis" $L$, $Rw \cdot w = \cos \theta$, as there are more than one $1$-D axes orthogonal to the $2$-D surface (plane) (in which the rotation occurs); in such spaces, one can say:

Take $S$ as the $2$-D surface (plane) in which the rotation occurs,
Take $S'_{i=1..m}$ as all the $2$-D surfaces (where the two orthogonal axes of $S'_i$ are each orthogonal to $S$) - where $m = \frac{(n-2)!}{2!((n-2)-2)!}$


  1. for any $v$ in $S$, $Rv \cdot v = \cos \theta$, and
  2. for any $w$ in $S'_i$, $Rv = v$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .