# Matrix multiplication

Matrix multiplication is the process of multiplying two matrices together. Given two matrices, A and B, the product of the two matrices, AB, can be calculated by multiplying the rows of matrix A by the columns of matrix B.

In order for matrix multiplication to be possible, the number of columns in matrix A must be equal to the number of rows in matrix B.

The resulting matrix will have the same number of rows as matrix A and the same number of columns as matrix B.

Here is the general formula for matrix multiplication:

Given two matrices A and B, where A is an n x m matrix and B is an m x p matrix, the product matrix C is an n x p matrix, where C(i,j) is given by:

C(i,j) = sum(A(i,k) * B(k,j)), where the summation is over k from 1 to m.

In other words, to calculate the value of the element in the i-th row and j-th column of matrix C, you need to multiply the elements of the i-th row of matrix A with the elements of the j-th column of matrix B and sum the products.

The resulting value is the element in the i-th row and j-th column of matrix C.

Note that matrix multiplication is not commutative, which means that AB is not necessarily equal to BA.