# 05. Matrix multiplication, 2

## 05. Matrix multiplication, 2

### Examples

We're going to do some examples of matrix multiplication.

Example:

Consider the 90 degree rotation matrix M equals 0, minus 1; 1, 0. We have M squared equals 0, minus 1; 1, 0 times 0, minus 1; 1, 0, which equals minus 1, 0; 0, minus 1.

This makes sense: two 90 degree rotations compose to give a 180 degree rotation, which sends every point x, y to its opposite point minus x, minus y.

Example:

More generally, if R alpha = cos alpha, minus sine alpha, sine alpha, cos alpha and R beta = cos beta, minus sine beta, sine beta, cos beta are two rotations then the composite is R alpha times R beta equals cos alpha, minus sine alpha, sine alpha, cos alpha times cos beta, minus sine beta, sine beta, cos beta, which equals cos alpha cos beta minus sine alpha sine beta, minus cos alpha sine beta minus sine alpha cos beta; sine alpha cos beta plus cos alpha sine beta, minus sine alpha sine beta plus cos alpha cos beta, which equals cos (alpha + beta), minus sine (alpha + beta); sine (alpha + beta), cos (alpha + beta), which equals R (alpha + beta) (using trigonometric addition formulas). This is what we expect, of course: rotating by beta and then alpha amounts to rotating by alpha + beta.

Example:

Let I equals 1, 0; 0, 1 be the identity matrix and M be any matrix. Then I M equals 1, 0; 0, 1 times M_{1 1}, M_{1 2}; M_{2 1}, M_{2 2}, which equals M_{1 1}, M_{1 2}; M_{2 1}, M_{2 2}, which equals M. Similarly, M I = M. As you can see, the identity matrix really plays the role of the number 1 here.

Example:

Let A be the matrix 1, 0; 0, 0 and B be the matrix 0, 1; 0, 0 . Then A B equals 0, 1; 0, 0 but B A equals 0, 0; 0, 0 This shows that the order in which we multiply matrices matters: A B is not equal to B A. So matrix multiplication is not commutative!

As an exercise, can you think of a matrix B which does not commute with A equals 1, 1; 0, 1?