# Multiplication of Matrices

## Multiplication of Matrices

Arithmetic procedure used to calculate the product of two matrices A and B.

The product of two matrices can be defined only if the number of columns in the first matrix is the same as the number of rows in the second matrix, that is, if they are compatible.

Let the matrix:

A = $$\begin{pmatrix} a & e\\b & f\\c & g\\d & h\end{pmatrix}$$

Let the matrix:

B = $$\begin{pmatrix} j & k & l\\m & n & o\end{pmatrix}$$

Therefore:

A × B  = $$\begin{pmatrix} aj+em & ak+en & al+eo\\bj+bm & bk+bn & bl+bo\\cj+cm & ck+cn & cl+co\\dj+dm & dk+dn & dl+do\end{pmatrix}$$

### Example

Let the matrix:

A = $$\begin{pmatrix} 3 & -3\\5 & 1\\2 & -2\\6 & 9\end{pmatrix}$$

Let the matrix:

B = $$\begin{pmatrix} -5 & 7 & -6\\0 & -2 & 8\end{pmatrix}$$

Therefore:

A × B  = $$\begin{pmatrix} 3 × -5 + -3 × 0 & 3 × 7+ -3 × -2 & 3 × -6 + -3 × 8\\5 × -5 + 1 × 0 & 5 × 7 + 1 × -2 & 5 × -6 + 1 × 8 \\2 × -5 + -2 × 0 & 2 × 7 + -2 × -2 & 2 × -6 + -2 × 8 \\6 × -5 + 9 × 0 & 6 × 7 + 9 × -2 & 6 × -6 + 9 × 8 \end{pmatrix} = \begin{pmatrix} -15 & 27 & -42 \\-25 & 33 & -22 \\-10 & 18 & -28 \\-30 & 24 & 36 \end{pmatrix}$$