Rotation Matrices

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:

I^2=\begin{bmatrix}1&0\\0&1\end{bmatrix}

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:

R_z^2(\theta)=\begin{bmatrix}\cos \theta&-\sin \theta\\\sin \theta&\cos \theta\end{bmatrix}

The name, R_z^2(\theta) identifies it as a Rotation 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 θ:

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:

R_z^2(0)=\begin{bmatrix}1&0\\0&1\end{bmatrix}

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

The other three matrices look like this:

R_z^2(90)= \begin{bmatrix}0&-1\\+1&0\end{bmatrix} R_z^2(180)= \begin{bmatrix}-1&0\\0&-1\end{bmatrix} R_z^2(270)= \begin{bmatrix}0&+1\\-1&0\end{bmatrix}

Of course, other angles result in real values.

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

R_z^2(10)=\begin{bmatrix}+0.9848&-0.1736\\+0.1736&+0.9848\end{bmatrix}

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


3D

The 3D identity matrix:

I^3=\begin{bmatrix}1&0&0\\0&1&0\\0&0&1\end{bmatrix}

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

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

R_x^3(\theta)=\begin{bmatrix}1&0&0\\0&\cos \theta&-\sin \theta\\0&\sin \theta&\cos \theta\end{bmatrix}

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

R_x^3(90)=\begin{bmatrix}+1&0&0\\0&0&-1\\0&+1&0\end{bmatrix} R_x^3(180)=\begin{bmatrix}+1&0&0\\0&-1&0\\0&0&-1\end{bmatrix} R_x^3(270)=\begin{bmatrix}+1&0&0\\0&0&+1\\0&-1&0\end{bmatrix}

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

R_y^3(\theta) = \begin{bmatrix}\cos\theta&0&-\sin\theta\\0&1&0\\\sin\theta&0&\cos\theta\end{bmatrix}

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

R_z^3(\theta) = \begin{bmatrix}\cos\theta&-\sin\theta&0\\\sin\theta&\cos\theta&0\\0&0&1\end{bmatrix}

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


4D

The 4D identity matrix:

I^4=\begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&1\end{bmatrix}

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

R_{yz}^4(\theta) = \begin{bmatrix}\cos\theta&0&0&-\sin\theta\\0&1&0&0\\0&0&1&0\\\sin\theta&0&0&\cos\theta\end{bmatrix}

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:

R_{x}^3(\theta) = \begin{bmatrix}\cos\theta&0&0\\0&1&0\\0&0&1\end{bmatrix}

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:

R_{xz}^4(\theta) = \begin{bmatrix}1&0&0&0\\0&\cos \theta&0&-\sin \theta\\0&0&1&0\\0&\sin \theta&0&\cos \theta\end{bmatrix}

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:

R_{xy}^4(\theta) = \begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&\cos \theta&-\sin \theta\\0&0&\sin \theta&\cos \theta\end{bmatrix}

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


One response to “Rotation Matrices

And what do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: