# How to do Matrix Multiplication

If we think about how to do matrix multiplication, it’s straightforward when we just want to multiply a matrix by a single number.

2 × \begin{bmatrix} 4 & 1 & 2 \\ 3 & 5 & 1 \end{bmatrix}   =   \begin{bmatrix} 2\times4 & 2\times1 & 2\times2 \\ 2\times3 & 2\times5 & 2\times1 \end{bmatrix}   =   \begin{bmatrix} 8 & 2 & 4 \\ 6 & 10 & 2 \end{bmatrix}

We just multiply each element of the matrix by the number.

Things are a little bit more complex when we want to multiply matrices together however.

## Multiplying Matrices Together

We can look at the case of multiplying a 2 x 2 matrix by another 2 x 2 matrix.

\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix}  ×  \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix}

=   \begin{bmatrix} a_{11}b_{11}+a_{12}b_{21} & a_{11}b_{12}+a_{12}b_{22} \\ a_{21}b_{11}+a_{22}b_{21} & a_{21}b_{12}+a_{22}b_{22} \end{bmatrix}

Now to see an example using numbers, with  .  representing multiplication, this looks like:

\begin{bmatrix} 1 & 3 \\ {\text{-}}4 & 1 \end{bmatrix}  ×  \begin{bmatrix} 5 & 2 \\ 1 & 3 \end{bmatrix}

=   \begin{bmatrix} 1.5+3.1 & 1.2+3.3 \\ {\text{-}}4.5+1.1 & {\text{-}}4.2+1.3 \end{bmatrix}   =   \begin{bmatrix} 8 & 11 \\ {\text{-}}19 & {\text{-}}5 \end{bmatrix}

The result of multiplying two 2 x 2 matrices together was another 2 x 2 matrix.

But generally the size of the new matrix resulting from the multiplication, depends on how many rows and columns are in the matrices being multiplied.
Along with the fact that matrices can only be multiplied together if one matrix has the same number of columns as the other does rows.

## How to do Matrix Multiplication, Steps

A matrix can be denoted by:

( ROWS × COLUMNS ).

So if we have 2 matrices  ( m × n )  and  ( p × q ),

and if we want to multiply them together,     ( m × n ) × ( p × q ).

The first step is to check that  n  and  p  are equal.

Which is checking that the number of columns in the first matrix equals the amount of rows in the second.
Then if this is satisfied, the matrices can be multiplied, and the resulting matrix from the multiplication will be of size  ( m × q ).

This will probably look a bit clearer with an example involving numbers.

Example

(1.1)

\begin{bmatrix} 2 & 4 & 3 \\ 1 & 2 & 1 \end{bmatrix}  ×  \begin{bmatrix} 2 & 4 \\ 3 & 1 \\ 5 & 4 \end{bmatrix}

Solution

This is a  ( 2 × 3 )  matrix multiplying a  ( 3 × 2 )  matrix.

So the first matrix has the same number of columns as the second matrix has rows, which is what we need.
We can also see that the resulting matrix from multiplication should be a  ( 2 × 2 )  matrix.

\begin{bmatrix} 2 & 4 & 3 \\ 1 & 2 & 1 \end{bmatrix}  ×  \begin{bmatrix} 2 & 4 \\ 3 & 1 \\ 5 & 4 \end{bmatrix}

=   \begin{bmatrix} 2.2+4.3+3.5 & 2.4+4.1+3.4 \\ 1.2+2.3+1.5 & 1.4+2.1+1.4 \end{bmatrix}

=   \begin{bmatrix} 4+12+15 & 8+4+12 \\ 2+6+5 & 4+2+4 \end{bmatrix}   =   \begin{bmatrix} 31 & 24 \\ 13 & 10 \end{bmatrix}

### NOTE: Matrix Order of Multiplication

It’s important to pay attention to order when learning how to do matrix multiplication.

As if you have two matrices  A  and  B,  generally   A×BB×A.

We can look at the same matrices that we multiplied above, but this time reverse the order.

\begin{bmatrix} 2 & 4 \\ 3 & 1 \\ 5 & 4 \end{bmatrix}  ×  \begin{bmatrix} 2 & 4 & 3 \\ 1 & 2 & 1 \end{bmatrix}

This order now gives us a  ( 3 × 2 ) × ( 2 × 3 )  matrix multiplication.

Which will produce a  ( 3 × 3 )  matrix.

\begin{bmatrix} 2 & 4 \\ 3 & 1 \\ 5 & 4 \end{bmatrix}  ×  \begin{bmatrix} 2 & 4 & 3 \\ 1 & 2 & 1 \end{bmatrix}

=   \begin{bmatrix} 2.2+4.1 & 2.4+4.2 & 2.3+4.1 \\ 3.2+1.1 & 3.4+1.2 & 3.3+1.1 \\ 5.2+4.1 & 5.4+4.2 & 5.3+4.1 \end{bmatrix}

=   \begin{bmatrix} 4+4 & 8+8 & 6+4 \\ 6+1 & 12+2 & 9+1 \\ 10+4 & 20+8 & 15+4 \end{bmatrix}   =   \begin{bmatrix} 8 & 16 & 10 \\ 7 & 14 & 10 \\ 14 & 28 & 19 \end{bmatrix}

( When practicing how to do matrix multiplication it’s handy to be able to quickly check your answers.

A handy matrix multiplication calculator is available to use at the matrix reshish website. )

## Identity Matrix Multiplication

A specific case to consider when learning how to do matrix multiplication, is that multiplication of a matrix with the identity matrix, regardless of order, results in the same matrix.

\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} × \begin{bmatrix} 4 & 3 \\ 1 & 9 \end{bmatrix}   =   \begin{bmatrix} 4+0 & 3+0 \\ 0+1 & 0+9 \end{bmatrix}

=   \begin{bmatrix} 4 & 3 \\ 1 & 9 \end{bmatrix}

\begin{bmatrix} 4 & 3 \\ 1 & 9 \end{bmatrix} × \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}   =   \begin{bmatrix} 4+0 & 0+3 \\ 1+0 & 0+9 \end{bmatrix}

=   \begin{bmatrix} 4 & 3 \\ 1 & 9 \end{bmatrix}

This example was just with a simple ( 2 × 2 ) matrix, but the result will be the same with larger matrices also.

## Properties of Matrix Multiplication

To round off this how to do matrix multiplication page we’ll display a short list of properties of matrix multiplication as a summary.

1)   A × ( BC )   =   AB × C         ( associative property )

2)   cA × B   =   A × cB         ( where c is a constant )

3)   AI  =  A     ,     IA  =  A         ( where I is the identity matrix )

1. Home
2.  ›
3. Algebra 2
4. › Matrix Multiplying