# Matrix multiplication

Matrix multiplication consists of linearly combining two or more matrices by adding their elements depending on their location within the origin matrix, respecting the order of the factors.

In other words, the multiplication of two matrices is to unify the matrices in a single matrix by multiplying and adding the elements of the rows and columns of the source matrices, taking into account the order of the factors.

Recommended articles: operations with matrices, square matrix.

## Matrix multiplication

Given two matrices Z and Y of n rows and m columns:

Square matrices of order n.## Properties

- The dimension of the result matrix is the combination of the dimension of the matrices. In other words, the dimension of the result matrix will be the columns of the first matrix and the rows of the second matrix.

In this case, we will find that Zn (rows of Z) is equal to Ym (columns of Y) in order to multiply them. So, if they are equal, the result matrix will be:

Matrix multiplication.

Examples

The rows and columns that are the same are eliminated in the result matrix, and only the rows and columns that are different remain.- We will multiply matrices two by two.

We multiply the matrices two by two to preserve the dimensions of the original matrices and facilitate the process.

- Matrix multiplication is non-commutative.

## Commutative property scheme

The commutative property represents that well-known phrase: the order of the factors does not alter the result.

Commutative property.We find this property in ordinary addition and multiplication, that is, when we add and multiply any object that is not a matrix.

Given the above scheme, the commutative property tells us that if we first multiply the blue sun and then the yellow sun, we will get the same result (green sun) as if we multiply the yellow sun first and then the blue sun.

So, if the multiplication of matrices does not respect the commutative property, it implies that the order of the factors does affect the result. In other words, we will not get the green sun if we change the order of the yellow and blue suns.

## Procedure

We can multiply the previous matrices if the number of the rows of the matrix Z is equal to the number of columns of the matrix Y. That is, Zn = Ym.

Once it is determined that we can multiply the matrices, we multiply the elements of each row by each column and add them in such a way that only one number remains at the point where the previous blue ovals coincide.

Matrix multiplication scheme.First we find where the blue ovals coincide and then we do the sum of the multiplications of the elements.

- For the first element of the result matrix, we see that the ovals coincide where the element z11 is.

*General case of matrix multiplication.*

- For the last element of the result matrix, we see that the ovals coincide in the ynm element.

*General case of matrix multiplication.*

*General case of matrix multiplication.*

## Theoretical example

Given two square matrices D and E,

Square matrices of order 3.Multiply the previous matrices.

Matrix product.

We start by multiplying the first row of matrix D with the first column of matrix E. Then we do the same but keeping the row or column of each matrix depending on whether we want to multiply some elements or others. We repeat the procedure until we have filled in all the gaps.

Example of a matrix product.## Exercise

Prove that the commutative property is not fulfilled in the product of matrices.

**Tags: **
present economic-dictionary Spain