Primers · Math

Rotation Matrices at Work

A sixteen second video from The Math Flow made the rounds in October 2026: three rotation matrices typeset on the left, three cubes spinning on the right, one angle driving all of it. This primer rebuilds that video live in your browser, every cube below rendered by the very matrix printed beside it, then goes where a video cannot: the sign trap hiding in the middle matrix, why the order of two rotations changes where things land, why spinning objects quietly drift, and the live research argument over what should replace the matrix.

Researched October 2026MathEngineering
Ink illustration of a three dimensional coordinate frame with red, green, and blue axes, each circled by a colored ring suggesting rotation about that axis, beside a faint three by three matrix grid

The brief

Every 3D object on every screen you have ever looked at got there by being multiplied by a rotation matrix. Games, CAD (computer-aided design), robot arms, the map that turns as you drive: underneath, the same nine numbers, arranged three by three, answering one question. Where does each axis go? The Math Flow video is a perfect specimen of the idea because it hides nothing: the matrix is on the left, its effect is on the right, and a single angle, theta, feeds both. When theta moves, the cosines and sines in the matrix move, and the cube obeys.

What a video cannot do is let you grab the machinery. So this page rebuilds the specimen as a working bench. Figure 1 is the video itself, except the cubes are rendered fresh by your browser from the matrices on screen, sixty times a second, with no video file and no graphics library. Figure 2 multiplies one cube corner by hand, every product shown. Figure 3 is the lab a researcher would build next: two rotations composed in both orders, both results rendered at once, with the distance between them measured. The disagreement at the end is real and current: matrices, quaternions, rotors, and learned representations are all still fighting over this nine-number job.

Figure 1: the video, rebuilt live

One angle drives all three matrices and all three cubes, exactly as in the original. Drag theta, or press play and watch the sweep. Each matrix is rebuilt from theta alone on every frame.

Rx(θ)
Ry(θ)
Rz(θ)

Rendered on a plain 2D canvas with the recipe from card 5 below: rotate the eight corners by the matrix, project flat (orthographic, the way the video reads), sort the six faces back to front, shade each by its normal against a fixed light. The colored arrow is the axis that stays pinned; the dashed circle is the path one corner travels.

$$R_x(\theta)=\begin{pmatrix}1&0&0\\0&\cos\theta&-\sin\theta\\0&\sin\theta&\cos\theta\end{pmatrix}\quad R_y(\theta)=\begin{pmatrix}\cos\theta&0&\sin\theta\\0&1&0\\-\sin\theta&0&\cos\theta\end{pmatrix}\quad R_z(\theta)=\begin{pmatrix}\cos\theta&-\sin\theta&0\\\sin\theta&\cos\theta&0\\0&0&1\end{pmatrix}$$

θ (theta) is the rotation angle. cos θ and sin θ are the cosine and sine of that angle. Each matrix is read in columns: column one is where the x axis lands, column two where the y axis lands, column three where the z axis lands, for a vector written as a column and multiplied on the left, v′ = R v, in a right handed coordinate system.

How it works

Six mechanisms: how to read the matrix, how it is built, where it traps you, how rotations compose, how a frame gets drawn, and how the whole scheme fails when pushed.

$$\mathbf{v}_{\mathrm{rot}}=\mathbf{v}\cos\theta+(\mathbf{k}\times\mathbf{v})\sin\theta+\mathbf{k}\,(\mathbf{k}\cdot\mathbf{v})\,(1-\cos\theta)$$

Rodrigues' formula (1840), the general case behind the three matrices above. v is the vector being rotated. k is the unit vector along the rotation axis. × is the cross product, · the dot product. Read it in three pieces: the part of v that survives scaled by cos θ, a push sideways from the cross product scaled by sin θ, and a correction along the axis for the part of v that points along k and should not move at all. Set k to (1, 0, 0), (0, 1, 0), or (0, 0, 1) and this collapses into the three matrices in Figure 1.

Figure 2: one corner, multiplied by hand

The worked example. Take the cube corner v = (1, 1, 1) and spin it 30 degrees about z. Five steps, every product shown, the plot drawn from above (the z axis points out of the page at you, so the corner's height never changes).

1 / 5

Tap the card, swipe, or use the arrows.

$$R_z(30^\circ)\begin{pmatrix}1\\1\\1\end{pmatrix}=\begin{pmatrix}0.866&-0.5&0\\0.5&0.866&0\\0&0&1\end{pmatrix}\begin{pmatrix}1\\1\\1\end{pmatrix}=\begin{pmatrix}0.866\times1-0.5\times1+0\times1\\0.5\times1+0.866\times1+0\times1\\0\times1+0\times1+1\times1\end{pmatrix}=\begin{pmatrix}0.366\\1.366\\1\end{pmatrix}$$

cos 30° is 0.866 (exactly the square root of 3 over 2) and sin 30° is 0.5. Each entry of the answer is one row of the matrix dotted with the vector: multiply across, add up. The corner swings from (1, 1) to (0.366, 1.366) in the top view, the same distance from the origin, exactly 30 degrees around.

Figure 3: the composition lab

Two rotations, both orders, rendered at once. The solid cube follows the order you pick; the wireframe ghost follows the other. Start at 90 and 90, where the disagreement is total, then slide one angle to zero and watch the two cubes merge back into one.

The probe test

Point the probe vector (0, 0, 1) through both products.

Distance between the orders

The distance is the Frobenius norm of the difference of the two product matrices: square every entry of (A minus B), add, take the root. Two rotation matrices can differ by at most 2 times the square root of 2, about 2.83; at 90 and 90 degrees these two orders sit at 2.45, most of the way to the maximum, and the probe lands a full right angle apart.

The road here

Landmarks only: three centuries of learning how to say "turn it this much" precisely.

1 / 9

Tap the card, swipe, or use the arrows.

Key voices

The people who taught the world to read these nine numbers, and the ones now arguing about their replacements.

Grant Sanderson (3Blue1Brown)
The columns reading, Essence of Linear Algebra, 2016

A matrix is a record of where the basis vectors land: the columns are the destinations of the x, y, and z axes after the transformation, and every other point follows by the same proportions. His three dimensional chapter works exactly the example this page's Figure 2 does by hand. It is the single most effective piece of rotation pedagogy ever published, and the reason a generation now reads matrices in columns without thinking about it.

Ken Shoemake
Quaternion curves, SIGGRAPH 1985

Interpolating Euler angles independently gives ugly, nonuniform motion; the fix is to hold orientation as a unit quaternion and interpolate along the sphere (slerp, spherical linear interpolation), which yields smooth, automatic inbetweening. Forty years later his settlement still runs production animation: quaternions for blending, matrices for rendering. His paper is three pages of math and four decades of consequences.

Freya Holmer
Math for game developers; Quaternions talk, Nordic Game Jam 2025

Quaternions are the accepted best answer and are still taught as an arcane black box, which is a pedagogy failure, not a math failure. Her talks unpack them visually for working game developers, deriving the machinery instead of handing down rules. That she was still giving this talk in 2025, forty years after Shoemake, tells you the teaching problem is nowhere near solved.

Marc ten Bosch
"Let's remove Quaternions from every 3D Engine", 2019

The dissenter. Rotations happen in a plane, not around an axis, and the honest algebraic object is the rotor from geometric algebra: a scalar plus a bivector. Quaternions are rotors in disguise, restricted to three dimensions, carrying sign conventions that confuse everyone (his essay is also the clearest published untangling of the Ry sign trap in card 3). His ask is total: phase quaternions out of engines entirely. The establishment has not taken him up on it, which is itself data for the camps below.

Yi Zhou and coauthors
On the Continuity of Rotation Representations, CVPR 2019

When a neural network has to output a rotation, the representation becomes a learning problem: every representation with four or fewer numbers (Euler angles, axis-angle, quaternions) is discontinuous somewhere, so networks train badly on them. Their fix is a 6D representation, two columns of the matrix, rebuilt into a full rotation by Gram-Schmidt. The matrix stops being the input and becomes the output, and it still has to be continuous to be learnable.

Jake Levinson and coauthors
An analysis of SVD based rotation representations, NeurIPS 2020

The counter to Zhou: predict all nine numbers and project back to the nearest rotation by SVD (singular value decomposition) orthogonalization. A 2024 hitchhiker's guide to this literature reports the 9D approach often beats 6D in practice, because Gram-Schmidt privileges the first predicted column while the SVD projection spreads the error across all three. Same goal, two projections, no settled winner.

Where leaders think this goes

As of October 2026. The camps below answer different questions (how to render, how to blend, how to learn, how to teach), which is most of why none of them has won.

Where they agree
The matrix stays the substrate

Whatever wins above it, everything still consumes a 3 by 3 matrix at render time. Zhou's 6D output is converted into a matrix before use; ten Bosch's rotors are converted into matrices before use; every engine, GPU (graphics processing unit), and graphics API (application programming interface) is matrix shaped. Nobody in any camp proposes rendering without one.

Quaternions stay the interpolator in production

Shoemake's 1985 settlement still holds inside engines and animation tools: store and blend orientations as unit quaternions, convert to matrices to draw. Holmer's 2025 teaching tour exists precisely because this stack is entrenched enough that every new game developer has to climb it.

Where they split
Should rotors replace quaternions and matrices in engines?
Side A: yes, rotors are the true object (ten Bosch; Dorst and Lasenby; De Keninck and the bivector.net school)

Rotation is something that happens in a plane; rotors say so directly, generalize to any dimension, and remove the sign traps. The school has serious venues: Dorst, Fontijne, and Mann's textbook (2007), Dorst and Lasenby's Guide to Geometric Algebra in Practice (Springer, 2011), and the SIGGRAPH course line running from the 2019 projective geometric algebra course to SIGGRAPH 2024's "Look, ma, no matrices!"

Side B: no capability gain, real switching cost (the production world's standing verdict)

The counter is practical, not mathematical, and ten Bosch's own essay supplies its key fact: in three dimensions rotors and quaternions are isomorphic and equally efficient, so an engine that switches gains nothing it lacks. Against that, forty years of tooling, file formats, and trained intuition win by default. Adoption since 2019 has been in teaching and niche tools, not in a major engine.

What should a neural network output when it predicts a rotation?
Side A: 6D plus Gram-Schmidt (Zhou et al., CVPR 2019)

Predict two columns, orthogonalize. Continuous everywhere, compact, and the representation that started the modern literature. Its known wart, pressed by the other side: Gram-Schmidt treats the first column as truth and bends the rest to fit.

Side B: 9D plus SVD (Levinson et al., NeurIPS 2020; the 2024 hitchhiker's guide)

Predict the whole matrix, project to the nearest true rotation by SVD. The error spreads evenly across all three columns instead of cascading from the first, and the 2024 survey of this literature finds 9D ahead on several benchmarks. The matrix, notably, is the native object again.

Takeaways

Nine numbers run the visual world, and they are simpler than their reputation: three columns saying where three axes land. Everything else in this primer is the fine print of that one idea: an angle feeds the cosines and sines, order changes the answer, accumulated arithmetic drifts, and the current research fight is entirely about which wrapper should feed the matrix, never about replacing what it does.

Keep exploring

Sources