This page is partly a test of using WordPress LaTeX rendering to generate some math equations, in this case rotation matrices. For now, that’s *all* it is…

### 2D

Start with a 2D identity matrix:

The trick is look at the matrix as two vertical (column) vectors, called i-hat and j-hat. These start off as unit vectors along the x-axis and y-axis, respectively, and the matrix says where they end up.

A matrix describes a transformation of (in this case) the 2D plane. Such a transformation might be a scaling, a rotation, a shear, or some combination. In all cases, the origin stays the same.

In the case of the identity matrix, i-hat ends up at (1,0) and j-hat at (0,1), which is exactly where they started. That’s what makes the identity matrix the identity matrix. Nothing changes!

A 2D rotation matrix looks like this:

The name, identifies it as a **R**otation matrix. The superscript indicates that it’s a rotation in two dimensions, and the subscript that the rotation is about the z-axis. Also, **R** is a function that takes an angle, *θ* (*theta*).

The result is a matrix with four values based on the sine and cosine of *θ*. Given the following table, it’s easy to plug in values for four cases of angle *θ*:

0° | 90° | 180° | 270° | |

sin θ | 0 | +1 | 0 | -1 |

cos θ | +1 | 0 | -1 | 0 |

So the first rotation matrix, a rotation of zero degrees, looks like this:

Which is the identity matrix. A rotation of zero degrees does nothing.

The other three matrices look like this:

Of course, other angles result in real values.

For instance, a 10-degree rotation matrix looks like this:

The values are just *cos*(10) and *sin*(10) plugged into their appropriate spots.

### 3D

The 3D identity matrix:

That’s also the matrix for a rotation of zero about any axis.

The matrix for 3D rotation around the x-axis:

The three matrices for x-axis rotations of 90°, 180°, and 270°, look like:

The matrix for 3D rotation around the y-axis:

The matrix for 3D rotation around the z-axis:

The instances for specific rotations look much like the ones shown above.

### 4D

The 4D identity matrix:

The matrix for 4D rotation around the Y *and* Z axes:

The dual-axis rotation allows rotation of all orientations of cubes in 4D space.

In a tesseract, the four cubes with extent in X *or* W shift between extending in those axes, while the other four cubes (who have both X *and* W extent), rotate around either their Y or Z axis (depending on which they have).

In a (3D) cube, 4D rotation rotates the X extent into the W dimension and back (reversed), which allows “flipping” a cube. Consider what the above matrix in 3D:

This truncated version shifts the X extent into the W dimension, but that dimension is cut off and not shown. The effect is that the X dimension reduces to zero (at 90°), restores in the negative (reversed) direction (at 180°), reduces to zero (at 270°), and finally restores positively (at 360°).

The matrix for 4D rotation around the X and Z axes:

Which is the tesseract rotation that seems to move the cubes along the Y-axis (the second mode of rotation seen in the video).

The matrix for 4D rotation around the X and Y axes:

Which is the tesseract rotation that seems to move cubes along the Z-axis (the third mode of rotation seen in the video).

February 27th, 2019 at 8:53 am

And it works in comments, too: