In this Part 2 of our brief look into Linear Algebra, we’ll learn about matrix addition and subtraction, as well as matrix-scalar multiplication.
Matrix Addition and Subtraction
Matrices Addition and Subtraction are element-wise. This means that one simply adds or subtracts each corresponding element.
Note that two matrices can only be added or subtracted if they have the same dimension; i.e the same number of rows and columns.
$$ \begin{bmatrix} 2&3&2 \\ 3&4&5 \end{bmatrix} + \begin{bmatrix} 4&3&2 \\ 1&0&4 \end{bmatrix} = \begin{bmatrix} 6&6&4 \\ 4&4&9 \end{bmatrix} $$
The same way, (matrix C) minus (matrix A) equals (matrix B):
$$ \begin{bmatrix} 6&6&4 \\ 4&4&9 \end{bmatrix} - \begin{bmatrix} 2&3&2 \\ 3&4&5 \end{bmatrix} = \begin{bmatrix} 4&3&2 \\ 1&0&4 \end{bmatrix} $$
Matrix-Scalar Multiplication
Matrix-Scalar Multiplication is the product of a real number and a matrix. The given scalar multiplies each entry in the matrix. For example, given a
$$ matrix A = \begin{bmatrix} 2&3&2 \\ 3&4&5 \end{bmatrix} $$
As we see, (3), which is the given scalar, multiplies each entry.
In Matrix-Scalar Division, we also divide each entry by the given scalar. For example, given our
$$ matrix B = \begin{bmatrix} 6&9&6 \\ 9&12&15 \end{bmatrix} $$
Continue with “The Flow of Tensors” series in [The Flow of Tensors] — Linear Algebra for Machine Learning (Part 3 of 4).