Matrix Multiplication

The preceding section looked at multiplying a scalar and a matrix. The next logical step is to investigate the product of two matrices, or a matrix times another matrix. This process involves the dot product, so you might want to flip back to Chapter 4, “Vector Operations,” for a quick review of the dot product before proceeding.

You can multiply matrices by taking a series of dot products. Keep in mind two important aspects of the dot product:

  • The two vectors must have the same number of entries to take the dot product.

  • The dot product returns a scalar quantity (a single number).

Let's start by looking at two 2×2 matrices. Matrices to be multiplied don't have to be square and don't have to be the same size, but there are ...

Get Beginning Math and Physics for Game Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.