Tesseract 4D Rotation Visualizer

Turn a tesseract in any of the six planes of 4D space and read the live 4×4 rotation matrix. Only the planes that contain w make the shadow stretch: with the eye at w = 3, its edges already range from 65% to 150% of their true length.

colour = w, the 4th coordinate
w −2w +2
3.0
0%
Shortest edge in the 3D shadow—
Longest edge in the 3D shadow—
Longest ÷ shortest—
Angles between edges at a vertex—
Mean angle error vs 4D—
Total edge length: shadow / 4D—
Rotation type (from the matrix)—
Vertices · edges · faces · cells—

Edge lengths are measured after the 4D → 3D step only, as a percentage of the true 4D length. Dragging the picture turns the 3D camera, which happens afterwards and never changes these numbers.

Warm edges have large w: in perspective they are nearer the 4D eye and are drawn larger and thicker. Drag the picture (or use the arrow keys) to turn the 3D camera.

How to use this 4D rotation tool

  1. Pick a preset, or move one of the six sliders. Each slider is the angular speed of one plane in degrees per second; the box beside it shows that plane's current angle, and you can type an angle into it (typing pauses the animation).
  2. Choose the 4D → 3D projection. Perspective puts an eye on the w axis at w = d; orthographic simply drops w. Drag the picture to turn the 3D camera.
  3. Read the 4×4 matrix and copy it as tab-separated text, NumPy, MATLAB or LaTeX. Save the current frame as a PNG, record a 6-second WebM (in browsers that support recording), or copy a link that reopens exactly this view.

Six planes, not three axes

In 3D we say "rotate about the z axis", but what turns is the xy plane. In 4D, turning the xy plane leaves the whole zw plane still, so there is no single axis to name. Rotations are named by the plane that turns, and there are C(4, 2) = 6 of them: XY, XZ, XW, YZ, YW and ZW.

Each one is the identity matrix with a 2×2 rotation block placed in two rows and columns. For the XW plane, with a positive angle turning x towards w:

R_XW(θ) = | cos θ   0   0   −sin θ |
          |   0     1   0     0    |
          |   0     0   1     0    |
          | sin θ   0   0    cos θ |

This page multiplies the six in a fixed order, R = R_XY · R_XZ · R_XW · R_YZ · R_YW · R_ZW, acting on column vectors, so ZW is applied first. The order matters: two planes that share an axis do not commute. Only three pairs share no axis — XY & ZW, XZ & YW, XW & YZ — and those do commute, which is why double rotations are built from them. Under the matrix the page prints det R and the largest entry of |RᵀR − I|. The verification script for this page checked 2,000 random sets of six angles: every matrix was orthogonal with determinant +1, both to within 7 × 10⁻¹⁶.

Why only the w-planes make the tesseract stretch

The Japanese experiment behind this page (also available in English) turned the tesseract through 360° in each of the six planes, one at a time, and measured all 32 edges after an orthographic projection to 3D. The result split cleanly in two. For XY, YZ and XZ, not one projected edge changed length, to four decimal places, and the total stayed at 48.000. For XW, YW and ZW, every affected edge swung between 0 and 2, and the total oscillated between 48.000 and 54.627 with a period of 90°, peaking at 45°, 135°, 225° and 315°.

The reason is one line of trigonometry. In an XW rotation by θ, an edge along x projects to length 2|cos θ| and an edge along w to 2|sin θ|, while the y and z edges are untouched. With eight edges in each direction the total is 32 + 16(|cos θ| + |sin θ|): 48 at 0°, and 32 + 16√2 = 54.627 at 45°, where 16 of the 32 edges are exactly √2 long. Press YW rotation, orthographic and type 45 into the YW box: the total-length readout shows 54.627 / 64.000, the second number being the true total of 32 edges of length 2.

The same fact explains the famous inside-out motion in perspective. The eye sits on the w axis, so the scale d / (d − w) depends on w alone. A rotation that mixes w into x changes which cube has the large w, so the inner and outer cubes trade places; a rotation that leaves w alone just turns the shadow as a rigid 3D object.

Double and isoclinic rotations

However a 4D rotation is built, it turns some pair of orthogonal planes by two angles, α and β. If β = 0 it is a simple rotation and a whole plane stays fixed. If both are non-zero it is a double rotation and only the centre stays put. If α = β it is isoclinic, and every point moves by the same angle. The Rotation type readout recovers α and β from the matrix alone: its eigenvalues are e±iα and e±iβ, so cos α + cos β = tr R / 2 and cos α · cos β = (e₂ − 2) / 4, where e₂ is the sum of the six principal 2×2 minors. The script compared this formula with an independent eigenvalue computation on 1,000 random rotations and found agreement to better than 10⁻¹⁰ degrees.

Double rotation XW + YZ shows both angles, because those two planes are orthogonal. Isoclinic rotation shows them equal; the script applied isoclinic rotations to 2,000 random points and every point moved by the same angle to within a millionth of a degree. For a less obvious case, pause, then type 30 into both XW and ZW: the readout says simple, 42.2°. Two rotations that share the w axis combine into one simple rotation in a tilted plane, not a double rotation.

The Japanese article did not measure double rotations (it turned one plane at a time), so none of its numbers cover them.

Perspective or orthographic: what the shadow gets wrong

All 32 edges of a tesseract are 2 long and the four edges at each vertex meet at 90°, so any spread in the shadow is made by the projection. With the eye at w = 3, a scale of 3 / (3 − w), the article measured three classes of edge: the outer cube at 3.0 (150% of the true length), the inner cube at 1.5 (75%) and the eight bridges between them at 1.299 (65%), a 2.31× spread. The right angles scattered over 54.7°–125.3°, 17.6° away from 90° on average. The orthographic shadow kept 24 edges at exactly 2 and every surviving angle at 90°, but crushed the 8 edges along w to zero, so 8 pairs of vertices land on the same point.

Press Article setup: 65%–150% and the readouts show the same five numbers: 65.0%, 150.0%, 2.31×, 54.7°–125.3° and 17.6°. That is the unrotated view; once the shape turns, the range widens. Over a full XW turn with the eye at w = 3, this page's shortest edge fell to 62.9% and its longest reached 189.2% (measured by the verification script in 0.1° steps). Moving the eye further away does not simply reduce the distortion: unrotated, w = 6 gives 29.7%–120.0% and w = 12 gives 14.5%–109.1%, heading towards the orthographic picture in which the bridges vanish. The angles stay at 54.7°–125.3° at every distance, because each bridge still points along a diagonal of the cube.

Which shadow is more faithful? Over all 120 pairs of vertices the article found the orthographic one kept the distances better: a Kruskal stress-1 of 0.217 against 0.250 for perspective, and a Spearman rank correlation of 0.830 against 0.654. Perspective spreads a little error over every pair; orthographic puts all of it on 8 edges.

Other regular 4D shapes

The shape menu adds three more regular polytopes, each scaled to a circumradius of 2: the 5-cell (5 vertices, 10 edges, 10 triangles, 5 tetrahedral cells), the 16-cell (8, 24, 32, 16) and the 24-cell (24, 96, 96, 24), which has no counterpart among the 3D Platonic solids. The verification script counts the faces from the edge graph and checks V − E + F − C = 0 for all four. For these shapes the angle readout compares each projected angle with that shape's own 4D angle rather than with 90°.

The net: eight cubes in a cross

Unfold into the net opens the tesseract into its best-known net, the cross of eight cubes that Salvador Dalí painted in Corpus Hypercubus. It is done with genuine 4D rotations, not an animation trick. Each of the six arm cubes turns 90° about the square it shares with the centre cube, in the plane made by its own axis and w; the eighth cube rides on the lower arm and turns 180° in total. At 100% everything lies flat in the hyperplane w = +1, and at 0% the cubes close up exactly onto the tesseract's eight cells, which the script confirms vertex by vertex. The colours say which cell each cube becomes.

What the picture on your screen loses

The canvas shows a shadow of a shadow: 4D → 3D, then 3D → 2D through the camera you drag, and the readouts measure only the first step. The article also embedded the 16 vertices straight into 2D. The best method, MDS, still had a stress-1 of 0.300 and reversed the near/far order of 21.8% of the vertex pairs. PCA did worse than chance: the four eigenvalues of the tesseract's covariance are all exactly 1.0667, so no direction is preferred, and its 2D picture (stress-1 0.371, only 7 of the 16 points visible) lost to every one of the 200 random orthogonal projections the article tried, which scored 0.312–0.368.

Limits

What will you try next?

READ THE EXPERIMENT

Tesseract Shadow: Interactive 4D Hypercube Projection

Read the results and discussion
Share this tool

Part of Shake AI Lab — interactive experiments in mathematics and machine learning. · More tools · 日本語の解説記事