Search 75,738 tutors
FIND TUTORS

Matrix Multiplication

Matrix Multiplication by Scalar Constant

Matrices can be multiplied by scalar constants in a similar manner to multiplying any number of variable by a scalar constant. A scalar constant refers to any number; real or imaginary; positive or negative; whole or fractional, but not a variable.

When a matrix is multiplied by a scalar constant, the constant multiplies every entry in the matrix equally, for example, given a matrix A

find xA where x is a scalar constant

solution:

As you can see in the above example, x multiplies throughout matrix A affecting all entries in A

For example: Given matrix M find

solution:

Matrix Multiplication

Other than being multiplied by scalar constants, matrices can also be multiplied by other matrices. However, matrix multiplication is not as straight forward as regular multiplication, certain rules must be followed and certain conditions must be met.

Properties of Matrix Multiplication

  • The first rule you should know is that matrix multiplication is NOT commutative, i.e.

    For two matrices A and B

    We shall see the reason for this is a little while.

  • Matrix multiplication is associative; for example, given 3 matrices A, B and C, the following identity is always true

    But since we already said that matrix multiplication is not commutative, the following is NOTtrue

    or any other permutation of the sort. The matrices must maintain their order.

  • Matrix Multiplication is distributive across addition

    Note, however, that the order still does matter, the above is not the same as

    The above is not true, but the following is true

  • Multiplying a scalar constant across matrix multiplication is commutative in the following form;

There are a few more properties of matrix multiplication and we shall see these in a little while.

Rule for Matrix Multiplication

Two matrices A and B can only be multiplied in the form AB if and only if their sizes take on the following form:

Matrix A is of size n x m and matrix B is of size m x x

In other words, in matrix multiplication, the number of columns in the matrix on the left must be equal to the number of rows in the matrix on the right.

For example; given that matrix A is a 3 x 3 matrix, for matrix multiplication AB to be possible, matrix B must have size 3 x m where m can be any number of columns. This, as we shall see in a moment, is because of the way matrices are multiplied. This rule is the reason why matrix multiplication is not commutative.

A neat way of checking if 2 matrices can be multiplied it to observe their sizes side by side. For example, Given that you are asked to multiply matrices A and B where A is of size n x m and B is of size p x q

For AB to be possible, place the sizes side by side as follows and observe

if you see that m = p then you can conclude that AB is possible and proceed with the multiplication. If that is not the case, then don't bother with it, just say its not possible. We shall see in a moment that the resulting matrix from multiplying A and B has size n x q

For BA to be possible, place the sizes side by side as follows and observe

similarly, if you see that q = n then you can conclude that BA is possible and proceed with the multiplication. If that is not the case, then don't bother with it, just say its not possible. The resulting matrix in this case will be of size p x m.

Algorithm for Matrix Multiplication

Matrix multiplication follows the same algorithm as multiplying vectors. Recall that a vector can be a row or a column such as

where D is a column vector and E is a row vector.

Now that we have established this, you can also think of D and E as matrices where D is a matrix of size 4 x 1 and E is a matrix of size 1 x 4. So if this is the case, then let us try to multiply D and E.

D is a 4 x 1 matrix while E is a 1 x 4 matrix, so by the rule we stated above, the following products are possible:

  • DE because the number of columns in D is equal to the number of rows in E
  • ED because the number of columns in E is equal to the number of rows in D

Now that we have seen that both DE and ED are possible, lets move forward to actually carrying out the computation.

Always start off by arranging the matrices as required, do not mix up their order. So then the question becomes what to do next!

Matrix multiplication is done by multiplying rows by columns. In this case we only have one row but we have four columns.

The way we do is this is by multiplying all the rows by all the columns as such:

We add because each entry in the resulting matrix is the sum of multiplying the entries in the row and column for that position. For the above example, the resulting matrix is of size 1 x 1.

You should observe now that this is the same as the number of rows in E and number of columns in D. Therefore, we can now say as a rule that when you multiply two matrices, their product will have the same number of rows as the matrix on the left and the same number of columns as the matrix on the right.

For example, if AB = C , where A has size n x m and B has size p x q then C will have size n x q. This is always true for any matrix multiplication.

Let us return to multiplying D and E. We have already seen ED, so now lets take a look at DE

So now we have four rows and four columns. Taking a look at the sizes of D and E

we can see that the resulting matrix should have size 4 x 4.

Each row multiplied each column and that gives one entry that corresponds to that position. Having seen the results from DE and ED you should see the reason why matrix multiplication is not commutative, as stated in the first property: The result are not the same!

Lets now take a look at another example to further illustrate matrix multiplication:

Given matrices A and B where

and

Since A and B satisfy the rule for matrix multiplication, the product AB can be found as follows.

Matrix AB is a 2 x 2 matrix.

From the above two examples, we can observe the following for the matrix multiplication AB = C

  • Matrix C has the same number of rows as matrix A and the same number of columns as matrix B
  • The entries in matrix C are obtained as follows

    where the above means that the entries in C in position denoted by (i,j) are the result of multiplying the ith row of A by the jth column of B

It takes a while to get used to the whole process of multiplying matrices but the trick is to do as many examples as possible. Below are a few worked examples.

Matrix Multiplication Examples

Example 1

Find C given that AB = C and that

Step 1

The first step is to look at the sizes of A and B to check whether they can be multiplied, and also to determine the size of C

from the above you can see that AB is possible and that size of C

Next we perform the actual multiplication

Step 3

Example 2

Find the A2 given that

Step 1

Since A is 2 x 2 matrix, AA is possible and the result will also be a 2 x 2

Step 2

Step 3

Example 3

Find BA given that

.

Step 1

From the sizes of A and B, you can see that the resulting matrix AB will be of size 3 x 3

Step 2

Example 4

Find ABC given that

Step 1

This particular question involves multiplying matrices more than once so we need to break it up into two but we must keep the order of the matrices intact.

First we multiply A and B, then we multiply their product AB by C to end up with ABC

Before we perform the computations, we need to compare their sizes to find out if the multiplication is actually possible:

  • First for A and B

    thus we can see that its feasible and the result AB will have size 2 x 2

  • Next we compare AB with C

    from which we see that it is possible to compute ABC and the resulting matrix will have a size 2 x 2

Step 2

Then we perform the computation, by first multiplying A and B then multiplying the resulting matrix by C

Step 3

Step 4

Step 5