# Operations of Matrices

### Matrices Addition

In order to add two matrices **A** and **B**, they must have the same number of rows and columns. Each element of the first matrix a_{ij} is added with the corresponding element of the second matrix b_{ij} and the result is an element c_{ij} in the same position in the resulting matrix.

And a numerical example:

### Matrices Subtraction

In order to subtract two matrices **A** and **B**, they must have the same number of rows and columns. Each element of the second matrix b_{ij} is subtracted from the corresponding element of the first matrix a_{ij} and the result is an element c_{ij} in the same position in the resulting matrix.

And a numerical example:

### Matrices Multiplication

In order to multiply two matrices **A** and **B**, the number of columns of the first matrix **A** must be equal to the number of rows of the second **B**. The resulting matrix **C** will have the number of rows of the first matrix **A** and the number of columns of the second matrix **B**.

Each element c_{ij} of the resulting matrix is calculated as the summation of the product of each element of row i of matrix **A**, by the corresponding element of the column j of matrix **B**.

This is quite complex and can be clarified by the following example:

The first row of the resulting matrix **C**:

1X1+2X3+3X5=22

1X2+2X4+3X6=28

The second row of the resulting matrix **C**:

4X1+5X3+6X5=49

4X2+5X4+6X6=64

### Matrices Scalar Multiplication

A matrix **A** can be multiplied by a number k, multiplying each element of the matrix by this number.

### Matrices Division

In order to divide two matrices **A** and **B**, we have to calculate the inverse of the second matrix and then multiply them.

### Matrices Scalar Division

A matrix **A** can be divided by a number k, dividing each element of the matrix by this number. Actually we scalar multiply matrix **A** by the inverse of the number k.