# Matrix Multiplication

$$2\begin{bmatrix}a & b\\ c & d\end{bmatrix} =\begin{bmatrix}2a & 2b\\ 2c & 2d\end{bmatrix}$$

Two matrices can be multiplied only when the number of columns in the first equals the number of rows in the second. So when multiplying a matrix of size $(m n)$ by a matrix of size $(n p)$ this will result in a matrix of size $(m p)$. For multiplying matrices of different sizes, we use dot products:

$$\begin{bmatrix}a & b & c\\ d & e & f\end{bmatrix}\begin{bmatrix}g & h\\i & j\\k & l\end{bmatrix}$$ $$\begin{bmatrix}(a,b,c) \cdot (g,i,k) & (a,b,c) \cdot (h,j,l)\\ (d,e,f) \cdot (g,i,k) & (d,e,f) \cdot (h,j,l)\end{bmatrix}$$ $$\begin{bmatrix}a g+b i+c k & a h+b j+c l\\d g+e i+f k & d h+e j+l f\end{bmatrix}$$

Matrix multiplication is not commutitive.

$$AB \ne BA$$

$$\begin{bmatrix}1 & 2\\3 & 4\end{bmatrix}\begin{bmatrix}0 & 1\\0 & 0\end{bmatrix}\ne\begin{bmatrix}0 & 1\\0 & 0\end{bmatrix}\begin{bmatrix}1 & 2\\3 & 4\end{bmatrix}$$

$$\begin{bmatrix}0 & 1\\0 & 3\end{bmatrix}\ne\begin{bmatrix}3 & 4\\0 & 0\end{bmatrix}$$