5 Computing transformations with matrices

 

This chapter covers

  • Writing a linear transformation as a matrix
  • Multiplying matrices to compose and apply linear transformations
  • Operating on vectors of different dimensions with linear transformations
  • Translating vectors in 2D or 3D with matrices

In the culmination of chapter 4, I stated a big idea: any linear transformation in 3D can be specified by just three vectors or nine numbers total. By correctly selecting these nine numbers, we can achieve rotation by any angle about any axis, reflection across any plane, projection onto any plane, scaling by any factor in any direction, or any other 3D linear transformation.

The transformation expressed as “a rotation counterclockwise by 90° about the z-axis” can equivalently be described by what it does to the standard basis vectors e1 = (1, 0, 0), e2 = (0, 1, 0), and e3 = (0, 0, 1). Namely, the results are (0, 1, 0), (−1, 0, 0), and (0, 0, 1). Whether we think of this transformation geometrically or as described by these three vectors (or nine numbers), we’re thinking of the same imaginary machine (figure 5.1) that operates on 3D vectors. The implementations might be different, but the machines still produce indistinguishable results.

Figure 5.1 Two machines that do the same linear transformation. Geometric reasoning powers the machine on the top, while nine numbers power the one on the bottom.

5.1 Representing linear transformations with matrices

5.1.1 Writing vectors and linear transformations as matrices

5.1.2 Multiplying a matrix with a vector

5.1.3 Composing linear transformations by matrix multiplication

5.1.4 Implementing matrix multiplication

5.1.5 3D animation with matrix transformations

5.1.6 Exercises

5.2 Interpreting matrices of different shapes

5.2.1 Column vectors as matrices

5.2.2 What pairs of matrices can be multiplied?

5.2.3 Viewing square and non-square matrices as vector functions

5.2.4 Projection as a linear map from 3D to 2D