Two matrices can be multiplied if the number of columns in the first matrix is equal to the number of rows in the second.
If matrix A has dimensions m \times n and matrix B has dimensions n \times p then the dimensions of AB will be \left(m\times n\right)\times \left(n\times p\right)=\left(m\times p\right).
If the dimensions do not meet this criteria then we say that the matrix multiplication is undefined.
Unlike matrix addition and subtraction, matrix multiplication is not computed element by element.
Let's look at an example of multiplication before we generalise the result.
If we take each element in the first row, and multiply it by the corresponding element in the first column, then add the three results, we end up with a number that belongs in the spot occupying the first row and first column.
So 5\times 6+12\times 1+56\times 7=434 goes into the (1,1) entry.
\begin{bmatrix} 5 & 12 & 56 \\ 10 & 30 & 75 \end{bmatrix} \begin{bmatrix} 6 & 3 \\ 1 & 2\\ 7 & 2 \end{bmatrix} = \begin{bmatrix} 434 & . \\ . & . \end{bmatrix}
The next combination will be the first row and the second column. Find the sum of each elements in the first row multiplied by the corresponding element in second column.
So, 5\times 3+12\times 2+56\times 2=151 goes into the (1,2) entry.
\begin{bmatrix} 5 & 12 & 56 \\ 10 & 30 & 75 \end{bmatrix} \begin{bmatrix} 6 & 3 \\ 1 & 2\\ 7 & 2 \end{bmatrix} = \begin{bmatrix} 434 & 151 \\ . & . \end{bmatrix}
The next combination will be the second row and the first column. Take the sum of each element in the second row multiplied by the corresponding element in first column.
So 10\times 6+30\times 1+75\times 7=615 goes into the (2,1) entry.
\begin{bmatrix} 5 & 12 & 56 \\ 10 & 30 & 75 \end{bmatrix} \begin{bmatrix} 6 & 3 \\ 1 & 2\\ 7 & 2 \end{bmatrix} = \begin{bmatrix} 434 & 151 \\ 615 & . \end{bmatrix}
The final combination is the second row and the second column. Take the sum of each element in the second row multiplied by the corresponding element in second column.
So 10\times 3+30\times 2+75\times 2=240 goes into the (2,2) entry.
\begin{bmatrix} 5 & 12 & 56 \\ 10 & 30 & 75 \end{bmatrix} \begin{bmatrix} 6 & 3 \\ 1 & 2\\ 7 & 2 \end{bmatrix} = \begin{bmatrix} 434 & 151 \\ 615 & 240 \end{bmatrix}
In general, to compute element (i,j) in the matrix AB, we multiply the elements of the ith row in A with the elements in the jth column of B, and sum all the products. For a pair of 2\times 2 matrices, this looks like this: \begin{bmatrix} a&b\\ c&d \end{bmatrix} \begin{bmatrix} e&f\\ g&h \end{bmatrix} =\begin{bmatrix} ae+bg&af+bh\\ ce+dg&cf+dh \end{bmatrix}
ConsiderA = \begin{bmatrix} -1 & -3 \\ -9 & -4 \\ 4 & -5 \end{bmatrix} and B = \begin{bmatrix} 3 \\ -8 \end{bmatrix}
Is the product AB defined?
What are the dimensions of AB?
Determine the matrix AB.
An organic gardener produces lettuces and tomatoes. The following table indicates the time taken for the growing stages of each plant.
Stage 1 Germination from seed (days) | Stage 2 From sprout to seedling (days) | Stage 3 From seedling to maturity (days) | |
---|---|---|---|
Lettuce | 5 | 12 | 56 |
Tomato | 10 | 30 | 75 |
The amount of water per day needed for Stage 1 is 60 \text{ mL}, for Stage 2 is 40 \text{ mL}, and Stage 3 is 30 \text{ mL}.
Use matrix multiplication to calculate the amount of water needed for both the lettuce and tomato.
If matrix A has dimensions m \times n and matrix B has dimensions n \times p then the dimensions of AB will be \left(m\times n\right)\times \left(n\times p\right)=\left(m\times p\right).
To compute an element, multiply the row elements by the corresponding column elements and add their products.
The identity matrix, I, has similar properties to the number 1 in the real number system. When multiplying a matrix by the identity matrix, I, of the appropriate order, the result is the original matrix.
\begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} a & b \\ c & d \end{bmatrix}
The diagonal matrix, with 1's on the diagonal is the identity matrix. Use the symbol I, to represent the identity matrix.
\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = I
A special thing about the identity matrix is that the order of multiplication doesn't matter, i.e.
\text{ Let $A= \begin{bmatrix} a & b \\ c & d \end{bmatrix}$ and let $I= \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$ then $AI= IA = A$. }
Find the matrix that satisfies the following equation:
\begin{bmatrix} 6 & 1 \\ 5 & 9 \end{bmatrix} \times \begin{bmatrix} ⬚ & ⬚ \\ ⬚ & ⬚ \end{bmatrix} = \begin{bmatrix} 6 & 1 \\ 5 & 9 \end{bmatrix}
The multiplicative identity for matrices is the Identity matrix I. For any matrix A,
AI=IA=A
A matrix is transposed by interchanging its rows and columns.
We explore what happens if the matrix product is transposed. What is (AB)^T?
The product AB=C is obtained by finding all the elements of the matrix c_{i,j}, where we multiply the elements of the ith row of A with the jth column of B, and then sum the products.
The corresponding entry of C^T must be c_{j,i} and this is found by multiplying the elements of the jth row of B^T with the elements of the ith column of A^T, and then summing the products.
Therefore, C^T=B^TA^T. In other words:
\left(AB\right)^T=B^TA^T
For instance, consider the following matrices A and B as well as the matrix product AB.
A = \begin{bmatrix} 1 & 2 & 4 \\ 2 & 1 & 0 \end{bmatrix}, B = \begin{bmatrix} 1 & 2\\ 2 & 3\\ 3 & 1 \end{bmatrix}, AB = \begin{bmatrix} 17 & 12\\ 4 & 7 \end{bmatrix}
Then the transpose of the matrix product AB is given by interchanging the rows and columns:
(AB)^T = \begin{bmatrix} 17 & 4\\ 12 & 7 \end{bmatrix}
To find the matrix (AB)^T, we can also multiply the transpose of the matrices B and A.
We take the transposes of A and B and form the product B^TA^T.
B^T= \begin{bmatrix} 1 & 2 & 3 \\ 2 & 3 & 1 \end{bmatrix}, A^T = \begin{bmatrix} 1 & 2\\ 2 & 1\\ 4 & 0 \end{bmatrix}, B^TA^T = \begin{bmatrix} 17 & 4\\ 12 & 7 \end{bmatrix}
The matrix B^TA^T is the same as (AB)^T.
Consider the following questions below.
If A = \begin{bmatrix} -1 & 4 & 6 & -5 \\ -1 & -7 & -4 & -8 \end{bmatrix}, then A^T = \begin{bmatrix} ⬚ & ⬚ \\ ⬚ & ⬚ \\ ⬚ & ⬚ \\ ⬚ & ⬚ \end{bmatrix}.
The product A\times A^T exists. Is this statement true or false?
What is the order of the resulting matrix after evaluating A\times A^T?
Evaluate the matrix multiplication:
A\times A^T = \begin{bmatrix} ⬚ & ⬚ \\ ⬚ & ⬚ \end{bmatrix}
To find the transpose of a product of two matrices, take the tranpose of each matrix then multiply the transposed matrices.
For instance, (AB)^T=B^TA^T.
Any square matrix, let's call it A, can be multiplied by itself and the result is a square matrix of the same dimension, which we can call B.
So, we can write A_{n\times n}\times A_{n\times n}=B_{n\times n} or, more simply, A^2=B.
The process can be extended: A^3=A\times A^2=A^2\times A, and so on. If we have A multiplied by itself n times it does not matter which pairs of matrices is multiplied first or in what order all the other multiplications are carried out.
This is important to note because it contrasts with matrix multiplication generally, where AB is not necessarily the same as BA.
There are applications in which powers of matrices arise naturally. Suppose a process can be represented by a matrix multiplying a vector of coordinates. This is called a linear transformation.
For example, if a matrix A_{(n\times n)} multiplies a vector \mathbf{v}_{(n\times 1)} to give a vector \mathbf{u}_{(n\times 1)}, we would write the matrix equation A\mathbf{v}=\mathbf{u}.
It may then be of interest to apply the same transformation to the vector \mathbf{u}, and to go on repeatedly applying the transformation to the previous result. This generates a sequence of vectors:
A\mathbf{v},A\left(A\mathbf{v}\right),A\left(A\left(A\mathbf{v}\right)\right),...
The nth iteration of this process is just A^n\mathbf{v}.
In the transformation \mathbf{u}=B\mathbf{v}, the matrix B= \begin{bmatrix} \frac{\sqrt 3}{2} & -\frac 12\\ \frac 12 & \frac{\sqrt 3}{2} \end{bmatrix} has the effect of rotating a vector \mathbf{v} in the plane anticlockwise through an angle of 30\degree without changing the length of the vector.
We would expect that twelve applications of this transformation of vector \mathbf{v} should bring it back to its original position and therefore, B^{12} should be the identity matrix.
You should check by hand that
B = \begin{bmatrix} \frac{\sqrt 3}{2} & -\frac 12\\ \frac 12 & \frac{\sqrt 3}{2} \end{bmatrix}, B^2= \begin{bmatrix} \frac 12 & -\frac{\sqrt 3}{2}\\ \frac{\sqrt 3}{2} & \frac 12 \end{bmatrix}, B^3= \begin{bmatrix} 0 & -1\\ 1 & 0 \end{bmatrix}, B^6= \begin{bmatrix} -1 & 0\\ 0 & -1 \end{bmatrix},
and squaring B^6 gives B^{12}=I.
If you now carry out the calculation of B^{12} by calculator using the same sequence of matrix multiplications but with decimal approximations for the entries, does your device confirm that B^{12}=I?
Given the 4\times 4 matrix A, calculate A^{15}. Round each element to three decimal places.
A= \begin{bmatrix} 0 & 0.4 & 0.7 & -0.1 \\ 0.9 & 0.8 & -0.7 & 0.2 \\ -0.1 & 0.5 & 0.5 & 0.1 \\ 0 & 0.2 & 0.2 & 0.6 \end{bmatrix}
A matrix can only be raised to a power when it is square.
A square matrix of order n can be written as A_n.
It can be just as hard to know when to stop looking as it is to find them all. Instead, we are going to use the network's adjacency matrix to answer this for us. Let’s start by writing it out.
If two vertices are connected by an edge, there is a 1 in their corresponding row and column. If they are not connected, there is a 0 instead.
\begin{array}{cc} &\begin{array}{ccc} A&B&C&D&E&F&G \end{array} \\ \begin{array}{c} A \\ B \\ C \\D\\E\\F\\G \end{array} & \left( \begin{array}{ccc} 0&1&0&1&\,1&\,\,1&\,\,\,0\\ 1&0&1&0&\,0&\,\,0&\,\,\,0 \\ 0&1&0&0&\,0&\,\,1&\,\,\,1 \\ 1 &0&0&0&\,1&\,\,1&\,\,\,1 \\ 1&0&0&1&\,0&\,\,1&\,\,\,0 \\ 1&0&1&1&\,1&\,\,0&\,\,\,0 \\ 0&0&1&1&\,0&\,\,0&\,\,\,0 \end{array}\right) \end{array}
The number of routes of length n in a network from one vertex to another is equal to the entry in the start vertex’s row and end vertex’s column of the matrix M^n, where M is the adjacency matrix for the network.
Since we are asking about a route of length 3, we need to cube the matrix above.Using a calculator or an online tool we get the result:
\begin{array}{cc} & \begin{array}{ccc} A&B&C&D&E&F&G \end{array} \\ \begin{array}{c} A \\ B \\ C \\D\\E\\F\\G \end{array} & \left( \begin{array}{ccc} 6&6&3&9&8&10&4 \\ 6&0&5&4&3&2&1 \\ 3&5&0&3&4&8&5 \\ 9&4&3&6&8&10&6 \\ 8&3&4&8&6&8&3 \\ 10&2&8&10&8&6&2 \\ 4&1&5&6&3&2&0 \end{array}\right) \end{array}
This same idea works for directed networks as well. Consider the network below:
Find A^{4}, the matrix that represents all possible four-step paths between the towns. Use technology to calculate A^4.
How many four-step paths can be taken from Ashland to Dunham?
The number of routes of length n in a network from one vertex to another is equal to the entry in the start vertex’s row and end vertex’s column of the matrix M^n, where M is the adjacency matrix for the network.