The Tesseract, Projected
After reading this you will know how a four-dimensional cube is built from 16 vertices, how a 4D rotation lives in a plane rather than about an axis, and why the shadow of a spinning tesseract turns itself inside out.
What a tesseract is, and the inside-out trick
A tesseract is the 4D analogue of a cube. Follow the pattern by counting dimensions. A point has one vertex. Drag it a unit distance and you sweep out a segment: 2 vertices, 1 edge. Drag the segment sideways and you get a square: 4 vertices, 4 edges. Drag the square up and you get a cube: 8 vertices, 12 edges. Drag the cube along a fourth axis, call it w, and you get a tesseract: 16 vertices, 32 edges, 24 square faces, 8 cubic cells.
You cannot see a 4D object directly, so this tool shows you its shadow. The famous picture is a small cube sitting inside a large cube, with the corners joined. That inner cube is not really smaller. It only looks smaller because it sits farther away in the w direction, and the projection shrinks whatever is far off. When the tesseract rotates through the fourth dimension, the inner cube swings outward and the outer cube swings inward. The whole figure turns inside out, then repeats. That single motion is the hook. Once you see it, the fourth dimension stops being mystical and becomes bookkeeping.
The 16 vertices and how edges connect
Place the tesseract with its center at the origin and side length 2. Then every vertex is one of the sign choices of (\pm 1, \pm 1, \pm 1, \pm 1). There are 2^4 = 16 of them. That matches the vertex count exactly.
Two vertices are joined by an edge when they differ in exactly one coordinate. Take (1, 1, 1, 1). It connects to (-1, 1, 1, 1), (1, -1, 1, 1), (1, 1, -1, 1), and (1, 1, 1, -1). That is 4 edges per vertex. Multiply: 16 \times 4 = 64, then divide by 2 because each edge is counted from both ends, giving 32 edges. The same logic applied to a cube gives 8 \times 3 / 2 = 12, which is correct.
The count of cells generalizes too. A cube has 6 square faces. A tesseract has 8 cubic cells, one for each choice of a coordinate held fixed at +1 or -1 while the other three range freely. Four axes times two signs is 8.
Rotation happens in a plane, not about an axis
In 3D you rotate about an axis. That works only because in three dimensions a plane of rotation and its one perpendicular axis are two ways of naming the same thing. The honest statement is that a rotation acts inside a plane and leaves the perpendicular directions fixed.
In 4D there is no single perpendicular axis, so you name the plane directly. A rotation in the xy plane spins the x and y coordinates and leaves z and w untouched. The six planes are xy, xz, yz, xw, yw, and zw. The first three are ordinary 3D rotations that you have seen before. The last three, the ones involving w, are the genuinely four-dimensional ones. They mix a spatial coordinate with the fourth coordinate, and they are what makes the shadow turn inside out. This tool gives you a speed slider for each of the three w planes.
The formula: rotate in 4D, then project twice
A rotation by angle \theta in the xw plane keeps y and z fixed and transforms the other two coordinates like an ordinary 2D rotation:
Here x and w are the old coordinates, x' and w' the new ones, and \theta is the angle turned so far. The yw and zw planes use the same pair of lines with y or z in place of x.
Once the point has been rotated in 4D you drop it to 3D by perspective projection along the w axis. Pick a viewer distance d in the fourth dimension and scale by how far the point sits from the viewer:
The factor s is the shrink. When w is large and positive the point is close, d - w is small, and s is large, so the point spreads outward. When w is negative the point is far, s is small, and the point crowds toward the center. That is why one cube looks inner and one looks outer, and why they trade places as w changes sign. The resulting 3D figure is then projected to your screen the ordinary way.
A worked example with the demo settings
The demo starts from the default vertices and rotates only in the xw plane. Use viewer distance d = 3. Track a single vertex, (1, 1, 1, 1), through a quarter turn.
One vertex through a 90 degree xw rotation
- Start: (x, y, z, w) = (1, 1, 1, 1). Projection scale s = 3 / (3 - 1) = 1.5, so the 3D point is (1.5, 1.5, 1.5).
- Turn \theta = 45^\circ. Then \cos\theta = \sin\theta \approx 0.7071. New x' = 0.7071 - 0.7071 = 0 and w' = 0.7071 + 0.7071 \approx 1.4142.
- Project: s = 3 / (3 - 1.4142) \approx 1.8918, giving 3D point (0, 1.8918, 1.8918). The vertex has swung close and spread outward.
- Turn to \theta = 90^\circ. Now \cos\theta = 0, \sin\theta = 1. New x' = -1 and w' = 1. Wait: that is x' = 0\cdot 1 - 1 \cdot 1, so x' = -1, and w' = 1 \cdot 1 + 1 \cdot 0 = 1. Scale returns to s = 1.5, giving (-1.5, 1.5, 1.5).
The vertex has moved from x = +1.5 to x = -1.5 while its w value rose to about 1.41 and returned to 1. Over the full turn w for this vertex sweeps up and back down, so its projected size pulses. Do this for all 16 vertices and the two nested cubes trade roles.
xw turn, with d = 3. When the vertex is near the viewer the scale peaks above 3; when it is far it drops toward 1.15. That pulse is the inside-out motion seen from one corner.Reading the shadow correctly
The single most useful habit is to stop trusting size as depth in the ordinary sense. In this shadow, smaller means farther in w, not farther in your normal line of sight. The inner cube is the set of vertices with the most negative w at that instant.
Watch the edges rather than the vertices. Straight lines in 4D stay straight after both projections, but the eight cubic cells look badly distorted: only two of them appear as recognizable cubes at any moment, and the other six look like flat-topped frustums (a cube with one face shrunk). That distortion is honest. It is the price of squeezing four dimensions into two. A cube's shadow on a wall has the same problem: its six square faces rarely all look square at once.
To feel the difference between real 4D rotation and a fake, turn on one w plane at a time. The xy, xz, and yz rotations only spin the whole shadow rigidly. Only the xw, yw, and zw rotations make cubes grow and shrink and swap. If nothing turns inside out, you are watching a 3D rotation.
Common mistakes and misreadings
Three errors come up again and again.
- Thinking the inner cube is a separate, smaller object
- It is not. All 16 vertices sit on a hypersphere of radius \sqrt{4} = 2 from the center, since \sqrt{1^2 + 1^2 + 1^2 + 1^2} = 2. Every vertex is the same distance out. The size difference is pure perspective.
- Expecting an axis of rotation
- A 4D rotation fixes a plane, not a line. A generic double rotation, say
xwandyzat once, can leave no direction fixed at all. There is nothing to point at. - Reading the flat frustum cells as damaged
- Nothing is damaged. Rigid 4D shapes project to skewed 3D shapes exactly as rigid 3D shapes project to skewed 2D shapes. Measuring angles on the shadow tells you about the projection, not about the tesseract.
A fourth trap is numerical. If you set viewer distance d below the largest possible w, then d - w can hit zero or go negative and the scale blows up or flips sign. Keep d comfortably larger than 1, the maximum w of any vertex, so the figure never passes through the viewer.
Related tools
If projecting between dimensions interests you, several other simulations touch it. For plain 3D rotation done with an axis and angle, see the Quaternion rotation visualizer, and for the algebra of any linear map on a grid see the Linear transformation playground. The Platonic solids explorer checks Euler's formula on the 3D cousins of the tesseract, and the Map projection distortion tool shows the same "you cannot flatten without lying" problem for the sphere. The Hyperbolic tiling explorer also packs a space that will not fit into a flat drawing. For rotation built from stacked circles, the Fourier epicycles tool uses the same sine-and-cosine machinery you saw in the rotation formula.
Frequently asked questions
Why does the tesseract look like a cube inside a cube?
Because perspective projection shrinks whatever is far away in the fourth dimension. The eight vertices with negative w project to a small central cube and the eight with positive w project to a large outer cube. All 16 are the same distance from the center in 4D, so the nesting is an illusion of depth.
How many edges and cells does a tesseract have?
32 edges and 8 cubic cells, along with 16 vertices and 24 square faces. You can check the edges by counting 4 edges at each of 16 vertices and dividing by 2: 16 \times 4 / 2 = 32.
What is the difference between an axis and a plane of rotation?
In 3D a rotation fixes a line and spins the plane perpendicular to it, so people name the line. In 4D a rotation fixes a plane and spins the other plane, so you must name the plane directly. The xw, yw, and zw planes have no 3D counterpart.
Is the tool showing a real four-dimensional object?
It shows a faithful shadow of one. The 4D coordinates and rotations are computed exactly; the loss happens only in the final projection, exactly as a photograph loses one dimension of a real cube. Nothing about the animation requires the fourth dimension to physically exist.
Why does the shape distort so much while turning?
Perspective projection is not rigid: it scales near parts up and far parts down. During a w rotation each vertex changes its w value continuously, so its projected size pulses and the cells stretch. Only two cells ever look like true cubes at once.