# 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 , and .

### Multiplying a matrix by a scalar

Simply by coefficients, e.g:

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 -th row and -th column we write the result of multiplication of -th row of the first matrix with the -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.:

Matrix multiplication is associative, which means that for any , . 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.