Learn

Like with vectors, there are fundamental operations we can perform on matrices that enable the linear transformations needed for linear algebra. We can again both multiply entire matrices by a scalar value, as well as add or subtract matrices with equal shapes.

$2 \begin{bmatrix} a_{1} & b_{1} \\ a_{2} & b_{2} \end{bmatrix} + 3 \begin{bmatrix} c_{1} & d_{1} \\ c_{2} & d_{2} \end{bmatrix} = \begin{bmatrix} 2a_{1} + 3c_{1} & 2b_{1} + 3d_{1} \\ 2a_{2} + 3c_{2} & 2b_{2} + 3d_{2} \end{bmatrix}$

A new and important operation we can now perform is matrix multiplication. Matrix multiplication works by computing the dot product between each row of the first matrix and each column of the second matrix. For example, in computing AB = C, element (1,2) of the matrix product C will be the dot product of row 1 of matrix A and column 2 of matrix B. The animation to the right walks through the multiplication of two matrices showing the dot product between each row and column.

An important rule about matrix multiplication is that the shapes of the two matrices AB must be such that the number of columns in A is equal to the number of rows in B. With this condition satisfied, the resulting matrix product will be the shape of rowsA x columnsB. For example, in the animation to the right, the product of a 2x3 matrix and a 3x2 matrix ends up being a 2x2 matrix.

Based on how we compute the product matrix with dot products and the importance of having correctly shaped matrices, we can see that matrix multiplication is not commutative, AB BA. However, we can also see that matrix multiplication is associative, A(BC) = (AB)C.

### Instructions

Here are some optional matrix algebra practice questions!

$\begin{bmatrix} 1 & 6 \\ 3 & 2 \end{bmatrix} + \begin{bmatrix} 2 & 1 \\ 5 & 6 \end{bmatrix}$
Click to see answer Scalar Multiplication Practice Question

$2 \cdot \begin{bmatrix} 3 & 5 \\ -2 & 12 \end{bmatrix}$
Click to see answer Matrix Multiplication Practice Question

$\begin{bmatrix} 1 & 6 \\ 3 & 2 \end{bmatrix} \cdot \begin{bmatrix} 2 & 1 \\ 5 & 6 \end{bmatrix}$
Click to see answer 