# 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=\begin{pmatrix}0&-1\\ 1&0\end{pmatrix}$ . We have $M^{2}=\begin{pmatrix}0&-1\\ 1&0\end{pmatrix}\begin{pmatrix}0&-1\\ 1&0\end{pmatrix}$ $=\begin{pmatrix}-1&0\\ 0&-1\end{pmatrix}.$

This makes sense: two 90 degree rotations compose to give a 180 degree rotation, which sends every point $\begin{pmatrix}x\\ y\end{pmatrix}$ to its opposite point $\begin{pmatrix}-x\\ -y\end{pmatrix}$ .

Example:

More generally, if $R_{\alpha}=\begin{pmatrix}\cos\alpha&-\sin\alpha\\ \sin\alpha&\cos\alpha\end{pmatrix}\,\qquad R_{\beta}=\begin{pmatrix}\cos\beta&% -\sin\beta\\ \sin\beta&\cos\beta\end{pmatrix}$ are two rotations then the composite is $R_{\alpha}R_{\beta}=\begin{pmatrix}\cos\alpha&-\sin\alpha\\ \sin\alpha&\cos\alpha\end{pmatrix}\begin{pmatrix}\cos\beta&-\sin\beta\\ \sin\beta&\cos\beta\end{pmatrix}$ $=\begin{pmatrix}\cos\alpha\cos\beta-\sin\alpha\sin\beta&-\cos\alpha\sin\beta-% \sin\alpha\cos\beta\\ \sin\alpha\cos\beta+\cos\alpha\sin\beta&-\sin\alpha\sin\beta+\cos\alpha\cos% \beta\end{pmatrix}$ $=\begin{pmatrix}\cos(\alpha+\beta)&-\sin(\alpha+\beta)\\ \sin(\alpha+\beta)&\cos(\alpha+\beta)\end{pmatrix}$ $=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=\begin{pmatrix}1&0\\ 0&1\end{pmatrix}$ be the identity matrix and $M$ be any matrix. Then $IM=\begin{pmatrix}1&0\\ 0&1\end{pmatrix}\begin{pmatrix}M_{11}&M_{12}\\ M_{21}&M_{22}\end{pmatrix}$ $=\begin{pmatrix}M_{11}&M_{12}\\ M_{21}&M_{22}\end{pmatrix}$ $=M.$ Similarly, $MI=M$ . As you can see, the identity matrix really plays the role of the number $1$ here.

Example:

Let $A=\begin{pmatrix}1&0\\ 0&0\end{pmatrix}$ and $B=\begin{pmatrix}0&1\\ 0&0\end{pmatrix}$ . Then $AB=\begin{pmatrix}0&1\\ 0&0\end{pmatrix}$ but $BA=\begin{pmatrix}0&0\\ 0&0\end{pmatrix}.$ This shows that the order in which we multiply matrices matters: $AB\neq BA$ . So matrix multiplication is not commutative!

As an exercise, can you think of a matrix $B$ which does not commute with $A=\begin{pmatrix}1&1\\ 0&1\end{pmatrix}$ ?