7. Operations on matrices

We will use the following operations of matrices:


To add two matrices they need to have the same size. We add matrices by their coefficients, e.g.:


Addition of matrices is associative and commutative, so for any matrices A,B,C, A+B=B+A and (A+B)+C=A+(B+C).

Multiplying a matrix by a scalar

Simply by coefficients, e.g:

    \[2\cdot \left[\begin{array}{ccc}2&3&1\\-1&2&3\end{array}\right]=\left[\begin{array}{ccc}4&6&2\\-2&4&6\end{array}\right]\]

Because of those operations it is easy to see that the set of matrices of given size is a linear space.

Matrix multiplication

To multiply matrices, the first has to have the same number of columns as the second one of rows. The resulting matrix will have as many rows as the first one, and as many columns as the second one. We multiply the rows of the first matrix by the columns of the second in the sense that in the resulting matrix in a place in i-th row and j-th column we write the result of multiplication of i-th row of the first matrix with the j-th column of the second one, where by multiplication of row and column we mean multiplication of pairs of subsequent numbers summed up. E.g.:


    \[=\left[\begin{array}{cc}2\cdot(-1)+3\cdot(-5)+1\cdot 0&2\cdot 4+3\cdot 2+1\cdot 1\\ (-1)\cdot(-1)+2\cdot(-5)+3\cdot 0&(-1)\cdot 4+2\cdot 2+3\cdot 1\\ 0\cdot(-1)+1\cdot(-5)+0\cdot 0&0\cdot 4+1\cdot 2+0\cdot 1\\ 1\cdot(-1)+0\cdot(-5)+(-2)\cdot 0&1\cdot 4+0\cdot 2+(-2)\cdot 1\end{array}\right]=\]

    \[=\left[\begin{array}{cc}-17&13\\ -9&3\\ -5&2\\ -1&2\end{array}\right]\]

Matrix multiplication is associative, which means that for any A,B,C, A\cdot(B\cdot C)=(A\cdot B)\cdot C. But is not commutative! Notice that if the matrices are not square it is impossible to multiply them conversely. If they are square the result may be different.