# Rotation

Rotations can be either left or right handend. In this parapgraph all roiations will be using the left handed rule and for demonstration purposes I’ll use 3x3 matrices. For real transformations we normally use 4D matrices to allow easy multiplication with different transformation matrices.

Lets start with rotation around the X axis:

The matrix to rotate around the Y axis is:

And last but not least. The Z axis:

Note that these matrices work in both the left and right handed cordinate system.

We can also rotate around an arbitary axis. We do this with the following matrix with x, y and z being the axis to rotate around:

# Scale

We can scale matrices both uniform and nonuniform. Scaling in a non arbitrary direction can be done by multiplying the M11, M22 and M33 values of a matrix by a scalar value.

# Reflection (Mirrorring)

Reflection flips or mirrors a matrix along a axis. This can be done my multiplying the scale values of a vector by -1

# Shearing (Skewing)

Shearing is a transformation that “skews” the coordinate space, stretching it nonuniformly. Angles are not preserved but the surface area will remain the same.This is quite hard to visualize so here is a image to help:

Shearing can be done my modifying the values M12, M21 and M31.

# Determinant

Square matrices have a special scalar called the determinant. The determinant of a $2 \times 2$ matrix is given by:

This can be quite hard to remember especially if you are working with larger matrices. But it is actually quite easy to remember if you visualize it with some lines.

Now we will calculate the determinant of a $3 \times 3$ matrix. Again I’ll start with the formula:

Sorry for the mess… But it will become more clear when I show you a diagram to remember the formula just like I did with the $2 \times 2$ matrix.

# Inverse

Square matrices can be inverted with the following formula:

But not every square matrix can be inverted. An example is a matrix with a row or column filled with zero’s. No matter what you multiply this matrix by the corrosponding row or column in the result will also be full of zero’s.

We can use the determinant of a matrix to test for invertibility. If the determinant is zero the matrix is nonsingular(not invertable) 4and if the determinant is the matrix is singular (invertable).

To visualize matrix invertion have a look at this image If we would invert the model matrix of this image this would be the result: