Title: Default for 7.2 Matrix Multiplication
Course: HELM Workbooks 2023-2024

Multiplying row matrices and column matrices together

Let \(A\) be a \(1\times 2\) row matrix and \(B\) be a \(2\times 1\) column matrix: \[ A = \begin{bmatrix} a & b \end{bmatrix},\qquad B=\begin{bmatrix} c \\ d \end{bmatrix} \] The product of these two matrices is written \(AB\) and is the \(1\times 1\) matrix defined by: \[ AB = \begin{bmatrix} a & b \end{bmatrix}\cdot \begin{bmatrix} c \\ d \end{bmatrix} = \begin{bmatrix} ac + bd \end{bmatrix} \] Note that corresponding elements are multiplied together and the results are then added together. For example \[\begin{bmatrix} 2 & -3 \end{bmatrix} \cdot \begin{bmatrix} 6 \\ 5 \end{bmatrix} = \begin{bmatrix} 12-15 \end{bmatrix} = \begin{bmatrix} -3 \end{bmatrix} \] This matrix product is easily generalised to other row and column matrices. For example if \(C\) is a \(1\times 4\) row matrix and \(D\) is a \(4\times 1\) column matrix: \[ C = \begin{bmatrix} 2 & -4 & 3 & 2 \end{bmatrix} \qquad D = \begin{bmatrix} 3 \\ 3 \\ -2 \\ 5 \end{bmatrix} \] then we define the product of \(C\) with \(D\) as \[ CD = \begin{bmatrix} 2 & -4 & 3 & 2 \end{bmatrix}\cdot \begin{bmatrix} 3 \\ 3\\ -2\\ 5 \end{bmatrix} = \begin{bmatrix} 6-12-6+10 \end{bmatrix} = \begin{bmatrix} -2 \end{bmatrix} \] The only requirement is that the number of entries in the row matrix is the same as the number of entries in the column matrix.

Multiplying two \(2\times2\) matrices

If \(A\) and \(B\) are two matrices then the product \(AB\) is obtained by multiplying the rows of \(A\) with the columns of \(B\) in the manner described above. This will only be possible if the number of elements in the rows of \(A\) is the same as the number of elements in the columns of \(B\). In particular, we define the product of two \(2\times 2\) matrices \(A\) and \(B\) to be another \(2\times 2\) matrix \(C\) whose elements are calculated according to the following pattern: \[ \begin{array}{ccccc} \begin{bmatrix} a & b \\ c & d \end{bmatrix} &\cdot & \begin{bmatrix} w & x \\ y & z \end{bmatrix} & = & \begin{bmatrix} aw + by & ax + bz \\ cw + dy & cx + dz \end{bmatrix} \\ A & \cdot & B & = & C \end{array}\]

Henceforth, rather than writing \(A \cdot B\), we omit the \(\cdot\). Thus we write \(AB\) for the matrix product. The rule for calculating the elements of the product \(C\) is described in the following Key Point.

Key Point

Matrix Product

\(AB=C\)

The element in the \(i^{\text{th}}\) row and \(j^{\text{th}}\) column of \(C\) is obtained

by multiplying the \(i^{\text{th}}\) row of \(A\) with the \(j^{\text{th}}\) column of \(B\).

We illustrate this construction for the abstract matrices \(A\) and \(B\) given above: \[ \begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} w & x \\ y & z\end{bmatrix} = \begin{bmatrix} \begin{bmatrix} a & b\end{bmatrix} \begin{bmatrix} w \\ y \end{bmatrix} & \begin{bmatrix} a & b \end{bmatrix} \begin{bmatrix} x \\ z \end{bmatrix}\\ \\ \begin{bmatrix} c & d \end{bmatrix} \begin{bmatrix} w \\ y\end{bmatrix} & \begin{bmatrix} c & d \end{bmatrix} \begin{bmatrix} x \\ z \end{bmatrix}\end{bmatrix} = \begin{bmatrix} aw+by & ax+bz \\ cw+dy & cx+d \end{bmatrix} \]

For example,

\[ \begin{bmatrix} 2 & -1 \\ 3 & -2 \end{bmatrix} \begin{bmatrix} 2 & 4 \\ 6 & 1 \end{bmatrix} = \begin{bmatrix} \begin{bmatrix} 2 & -1 \end{bmatrix} \begin{bmatrix}2 \\ 6 \end{bmatrix} & \begin{bmatrix} 2 & -1\end{bmatrix} \begin{bmatrix} 4 \\ 1 \end{bmatrix} \\ \\ \begin{bmatrix} 3 & -2\end{bmatrix} \begin{bmatrix}2 \\ 6\end{bmatrix} & \begin{bmatrix} 3 & -2 \end{bmatrix} \begin{bmatrix} 4 \\ 1 \end{bmatrix} \end{bmatrix} = \begin{bmatrix}-2 & 7 \\ -6 & 10 \end{bmatrix} \]

Exercise

Find the product \(AB\) where \(A = [value]\) and \(B = [value].\)

First write down row 1 of \(A\), column 2 of \(B\) and form the first element in product \(AB\):

   \(=\)

Now repeat the process for row 2 of \(A\), column 1 of \(B\):

   \(=\)

Finally find the other two elements of \(C=AB\) and hence write down the matrix \(C\):
Feedback: We are given the matrices \(A = [value]\) and \(B = [value]\) and are asked to compute their product \(AB\). We first compute the entry in the first row, second column of \(AB\). To do this, we must multiply the first row of \(A\) with the second column of \(B\): \[ \begin{bmatrix} [value] & [value]\end{bmatrix} \cdot \begin{bmatrix} [value] \\ [value]\end{bmatrix} = ([value]) \cdot ([value]) + ([value]) \cdot ([value]) = [value] \] Next we compute the entry in the second row, first column of \(AB\). To do this, we must multiply the second row of \(A\) with the first column of \(B\): \[ \begin{bmatrix} [value] & [value]\end{bmatrix} \cdot \begin{bmatrix} [value] \\ [value]\end{bmatrix} = ([value]) \cdot ([value]) + ([value]) \cdot ([value]) = [value] \] Finally, we compute the last two entries and perform the multiplication: \[AB = [value] = [value]\]

It is clear that \(AB\) and \(BA\) are not in general the same. In fact it is the exception that \(AB=BA.\) In the special case in which \(AB=BA\) we say that the matrices \(A\) and \(B\) commute.

Exercise

Calculate \(AB\) and \(BA\) where \(A = [value]\) and \(B=[value]\).

\(AB=\)

\(BA=\)
Feedback: We are given the matrices \(A = [value]\) and \(B = [value]\), and are asked to compute the products \(AB\) and \(BA\). \[AB = [value] = [value]\] \[BA = [value] = [value]\]

The zero matrix

We call \(B=\begin{bmatrix}0 & 0 \\ 0 & 0 \end{bmatrix}\) the \(2 \times 2\) zero matrix written \(\underline{0}\) so that \(A \cdot \underline{0} = \underline{0} \cdot A = \underline{0}\) for any matrix \(A.\)

Now in the multiplication of numbers, the equation \(ab = 0\) implies that either \(a\) is zero or \(b\) is zero or both are zero. The following task shows that this is not necessarily true for matrices.

Exercise

Carry out the multiplication \(AB\) where \(A = [value]\) and \(B=[value]\).

\(AB=\)
Feedback: We are given the matrices \(A = [value]\) and \(B = [value]\), and are asked to compute the product \(AB\). \[AB = [value] = [value]\]

Exercise

Find the product \(AB\) where \(A = [value]\) and \(B=[value]\).

\(AB=\)
Feedback: We are given the matrices \(A = [value]\) and \(B = [value]\) and are asked to compute their product \(AB\). \[AB = [value] = [value]\]

The identity matrix

The matrix \(\begin{bmatrix}1 & 0 \\ 0 & 1\end{bmatrix}\) is called the identity matrix or unit matrix of order 2, and is usually denoted by the symbol \(I.\) (Strictly we should write \(I_{2},\) to indicate the size.) The matrix \(I\) plays the same role in matrix multiplication as the number \(1\) does in number multiplication.

Hence, just as \[ a \times 1 = 1 \times a = a \qquad \text{ for any number } a, \] so \[ AI = IA = A \qquad \text{ for any matrix } A. \]

Multiplying two \(3\times3\) matrices

The definition of the product \(C=AB\) where \(A\) and \(B\) are two \(3\times 3\) matrices is as follows \[ C =\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} \begin{bmatrix} r & s & t \\ u & v & w \\ x & y & z \end{bmatrix} = \begin{bmatrix} ar + bu + cx & as + bv + cy & at + bw + cz \\ dr + eu + fx & ds + ev + fy & dt + ew + fz \\ gr + hu + ix & gs + hv + iy & gt + hw + iz \end{bmatrix} \]

This looks a rather daunting amount of algebra but in fact the construction of the matrix on the right-hand side is straightforward if we follow the simple rule that the element in the \(i^{\rm th}\) row and \(j^{\rm th}\) column of \(C\) is obtained by multiplying the \(i^{\rm th}\) row of \(A\) with the \(j^{\rm th}\) column of \(B\).

For example, to obtain the element in row 2, column 3 of \(C\) we take row 2 of \(A\): \(\begin{bmatrix} d & e & f \end{bmatrix}\) and multiply it with column 3 of \(B\) in the usual way to produce \(\begin{bmatrix}dt + ew + fz\end{bmatrix}\).

By repeating this process we obtain every element of \(C\).

The \(3\times 3\) unit matrix is: \[ I = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \] and as in the \(2\times 2\) case this has the property that \( AI = IA = A \) for all matrices \(A\).

The \(3\times 3\) zero matrix is \[ \underline{0} = \begin{bmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix} \]

Multiplying non-square matrices together

So far, we have just looked at multiplying \(2\times 2\) matrices and \(3\times 3\) matrices. However, products between non-square matrices may be possible.

Key Point

General Matrix Products

The general rule is that an \(n \times p\) matrix \(A\) can be multiplied by a \(p \times m\) matrix \(B\) to form an \(n \times m\) matrix \(AB = C.\)

In words:

For the matrix product \(AB\) to be defined the number of columns of \(A\) must equal the number of rows of \(B\).

The elements of \(C\) are found in the usual way:

The element in the \(i^{\text{th}}\) row and \(j^{\text{th}}\) column of \(C\) is obtained by multiplying the \(i^{\text{th}}\) row of \(A\) with the \(j^{\text{th}}\) column of \(B\).

Exercise

Obtain the product \(AB\) if \(A=[value]\) and \(B=[value].\)

\(AB=\)
Feedback: We are given the matrices \(A = [value]\) and \(B = [value]\) and are asked to compute their product \(AB\). First note that this product is well-defined, because the number of columns of \(A\) is equal to the number of columns of \(B\). \[\begin{aligned} AB &= [value] \\ &= [value] \end{aligned}\]

The rules of matrix manipulation

It is worth noting that the process of multiplication can be continued to form products of more than two matrices.

Although two matrices may not commute (i.e. in general \(AB\neq BA\)) the associative law always holds i.e. for matrices which can be multiplied, \[A( BC)=( A B)C.\] The general principle is keep the left to right order, but within that limitation any two adjacent matrices can be multiplied.

It is important to note that it is not always possible to multiply together any two given matrices.

For example if \(A=\begin{bmatrix}1 & 2\\ 3 & 4\end{bmatrix}\) and \(B=\begin{bmatrix}a & b & c\\ d & e & f\end{bmatrix}\) then \[AB=\begin{bmatrix} a+2d & b+2e & c+2f\\ 3a+4d & 3b+4e & 3c+4f\end{bmatrix}\]

However \(BA=\begin{bmatrix}a & b & c\\ d & e & f\end{bmatrix}\begin{bmatrix}1 & 2\\ 3 & 4\end{bmatrix}\) is not defined since each row of \(B\) has three elements whereas each column of \(A\) has two elements and we cannot multiply these elements in the manner described.

Consider the following matrices: \[A=[value], B=[value], C=[value]\]

For each row in the table below, state whether the given product is defined by choosing "true" or "false" from the drop-down list, and if it is defined, then state the size (\(n\times m\)) of the product. (If it is not defined, then you should just leave those boxes blank.)

Product | Defined? | Size (if defined)?
\[AB\] |  | \(\times\)
\[BA\] |  | \(\times\)
\[BC\] |  | \(\times\)
\[CB\] |  | \(\times\)
\[CA\] |  | \(\times\)
\[AC\] |  | \(\times\)
\[(AB)C\] |  | \(\times\)
\[A(CB)\] |  | \(\times\)
Feedback: Recall that the product \(XY\) of two matrices \(X\) and \(Y\) is only defined if the number of columns of \(X\) is equal to the number of rows of \(Y\). In that case, if \(X\) is \(n \times p\) and \(Y\) is \(p \times m\), then \(XY\) is an \(n \times m\) matrix. Product | Defined? | Size (if defined)? \[ \begin{matrix} A & B \\ ([value]\times[value]) & ([value]\times[value]) \end{matrix}\] | \[[value]\] | \[[value]\] \[ \begin{matrix} B & A \\ ([value]\times[value]) & ([value]\times[value]) \end{matrix}\] | \[[value]\] | \[ [value]\] \[\begin{matrix} B & C \\ ([value]\times[value]) & ([value]\times[value]) \end{matrix}\] | \[[value]\] | \[[value]\] \[\begin{matrix} C & B \\ ([value]\times[value]) & ([value]\times[value]) \end{matrix}\] | \[[value]\] | \[[value]\] \[\begin{matrix} C & A \\ ([value]\times[value]) & ([value]\times[value]) \end{matrix}\] | \[[value]\] | \[[value]\] \[\begin{matrix} A & C \\ ([value]\times[value]) & ([value]\times[value]) \end{matrix}\] | \[[value]\] | \[[value]\] \[\begin{matrix} (A & B) & C \\ ([value]\times[value]) & ([value]\times[value]) & ([value]\times[value]) \end{matrix}\] | \[[value]\] | \[[value]\] \[\begin{matrix} A & (C & B) \\ ([value]\times[value]) & ([value]\times[value]) & ([value]\times[value]) \end{matrix}\] | \[[value]\] | \[[value]\]

We now list some properties of matrix multiplication and compare them with corresponding properties for multiplication of numbers.

Key Point

\( \begin{array}{ccc} \textbf{Matrix algebra} && \textbf{Number algebra} \\ A(B+C) = AB+AC && a(b+c)=ab+ac \\ AB\neq BA\text{ in general} && ab=ba \\ A(BC)=(AB)C && a(bc)=(ab)c \\ AI = IA = A && 1\cdot a=a\cdot1=a \\ A\underline{0} = \underline{0}A=\underline{0} && 0\cdot a=a\cdot0=0 \\ AB\text{ may not be defined} && ab\text{ is always defined} \\ AB=\underline{0}\text{ does not imply }A=\underline{0}\text{ or }B=\underline{0} && ab=0\text{ implies }a=0\text{ or }b=0 \end{array} \)

Application of matrices to networks

A network is a collection of points (nodes) some of which are connected together by lines (paths). The information contained in a network can be conveniently stored in the form of a matrix.

Example

Petrol is delivered to terminals \(T_1\) and \(T_2\). They distribute the fuel to \(3\) storage depots \((S_1, S_2, S_3).\) The network diagram below shows what fraction of the fuel goes from each terminal to the three storage depots. In turn the \(3\) depots supply fuel to \(4\) petrol stations \((P_1, P_2, P_3, P_4)\) as shown in the figure below:

[Image: A network with 3 rows of vertices. Top row: T_1 and T_2. Middle row: S_1, S_2 and S_3. Bottom row: P_1, P_2, P_3 and P_4]

Show how this situation may be described using matrices.

Solution

Denote the amount of fuel, in litres, flowing from \(T_1\) by \(t_1\) and from \(T_2\) by \(t_2\) and the quantity being received at \(S_i\) by \(s_i\) for \(i=1,2,3\). This situation is described in the following diagram:

[Image: A network with 2 rows of vertices. First row: T_1 and T_2. Second row: S_1, S_2 and S_3. Each vertex in first row has di]

From this diagram we see that \[\begin{matrix} s_1&=&0.4t_1+0.5t_2\\ s_2&=&0.4t_1+0.2t_2\\ s_3&=&0.2t_1+0.3t_2\\ \end{matrix}\] or, in matrix form: \[ \begin{bmatrix} s_1\\ s_2\\ s_3\end{bmatrix}=\begin{bmatrix} 0.4&0.5\\ 0.4&0.2\\ 0.2&0.3\end{bmatrix} \begin{bmatrix} t_1\\ t_2\\ \end{bmatrix} \] In turn the 3 depots supply fuel to 4 petrol stations as shown in the next diagram:

[Image: A network with 2 rows of vertices. First row: S_1, S_2 and S_3. Second row: P_1, P_2, P_3 and P_4. Each vertex in first]

If the petrol stations receive \(p_1, p_2, p_3, p_4\) litres respectively then from the diagram we have: \[\begin{matrix} p_1&=&0.6s_1+0.2s_2\\ p_2&=&0.2s_1+0.5s_2\\ p_3&=&0.2s_1+0.2s_2+0.4s_3\\ p_4&=&0.1s_2+0.6s_3\\ \end{matrix}\] or, in matrix form: \[\begin{bmatrix} p_1\\ p_2\\ p_3\\ p_4\end{bmatrix}=\begin{bmatrix} 0.6&0.2&0\\ 0.2&0.5&0\\ 0.2&0.2&0.4\\ 0&0.1&0.6\end{bmatrix} \begin{bmatrix} s_1\\ s_2\\ s_3 \end{bmatrix}\]

Combining the equations by substituting the expressions for \(s_1,s_2,s_3\) in the equations for \(p_1,p_2,p_3,p_4\) we get: \begin{align*} p_1&= 0.6s_1+0.2s_2\\ &= 0.6(0.4t_1+0.5t_2)+0.2(0.4t_1+0.2t_1)\\ &= 0.32t_1+0.34t_2 \end{align*} with similar results for \(p_2, p_3\) and \(p_4\). This is equivalent to combining the two networks.

The results can be obtained more easily by multiplying the matrices:

\begin{align*} \begin{bmatrix} p_1\\ p_2\\ p_3\\ p_4 \end{bmatrix} & = \begin{bmatrix} 0.6 & 0.2 & 0 \\ 0.2 & 0.5 & 0 \\ 0.2 & 0.2 & 0.4 \\ 0 & 0.1 & 0.6 \end{bmatrix} \begin{bmatrix} s_1 \\ s_2 \\ s_3 \end{bmatrix} \\ & = \begin{bmatrix} 0.6 & 0.2 & 0 \\ 0.2 & 0.5 & 0 \\ 0.2 & 0.2 & 0.4 \\ 0 & 0.1 & 0.6 \end{bmatrix} \begin{bmatrix} 0.4 & 0.5 \\ 0.4 & 0.2 \\ 0.2 & 0.3 \end{bmatrix} \begin{bmatrix} t_1 \\ t_2 \\ \end{bmatrix} \\ & = \begin{bmatrix} 0.32 & 0.34 \\ 0.28 & 0.20 \\ 0.24 & 0.26 \\ 0.16 & 0.20 \end{bmatrix} \begin{bmatrix} t_1 \\ t_2 \\ \end{bmatrix} = \begin{bmatrix} 0.32 t_1 + 0.34 t_2 \\ 0.28 t_1 + 0.20 t_2 \\ 0.24 t_1 + 0.26 t_2 \\ 0.16 t_1 + 0.20 t_2 \end{bmatrix} \end{align*}

Example

Communication network

Problem in words

The figure below represents a communication network. Vertices \(a, b, f\) and \(g\) represent offices. Vertices \(c, d\) and \(e\) represent switching centres. The numbers marked along the edges represent the number of connections between any two vertices. Calculate the number of routes from \(a\) and \(b\) to \(f\) and \(g.\)

[Image: A network with 7 vertices, separated into 3 columns. Column 1: a, b. Column 2: c, d, e. Column 3: f, g. In each column,]
A communication network where \(a\), \(b\), \(f\) and \(g\) are offices and \(c\), \(d\) and \(e\) are switching centres

Mathematical statement of the problem

The number of routes from \(a\) to \(f\) can be calculated by taking the number via \(c\) plus the number via \(d\) plus the number via \(e\). In each case this is given by multiplying the number of connections along the edges connecting \(a\) to \(c\), \(c\) to \(f\) etc. This gives the result: \[\text{Number of routes from }a\text{ to }f = 3\times2 + 4\times 6 + 1\times 1=31.\] The nature of matrix multiplication means that the number of routes is obtained by multiplying the matrix representing the number of connections from \(ab\) to \(cde\) by the matrix representing the number of connections from \(cde\) to \(fg\).

Mathematical analysis

The matrix representing the number of routes from \(ab\) to \(cde\) is: \[ \begin{matrix} & \begin{matrix} c & d & e \end{matrix}\\ \begin{matrix} a \\ b\end{matrix}\!\!\!\!\! & \begin{bmatrix} 3 & 4 & 1 \\ 2 & 1 & 3 \end{bmatrix}\end{matrix}\] The matrix representing the number of routes from \(cde\) to \(fg\) is: \[\begin{matrix} & \begin{matrix} f & g \end{matrix} \\ \begin{matrix} c \\ d \\ e \end{matrix}\!\!\!\!\! & \begin{bmatrix} 2 & 1 \\ 6 & 3 \\ 1 & 2 \end{bmatrix} \end{matrix}\] The product of these two matrices gives the total number of routes: \begin{align*} \begin{bmatrix} 3 & 4 & 1 \\ 2 & 1 & 3 \end{bmatrix}\begin{bmatrix} 2 & 1 \\ 6 & 3 \\ 1 & 2 \end{bmatrix} & = \begin{bmatrix} 3\times 2+4\times 6+1\times1 & 3\times 1+4\times 3+1\times 2 \\ 2\times2+1\times 6+3\times 1 & 2\times 1+1\times 3+3\times 2 \end{bmatrix} \\ & = \begin{bmatrix} 31 & 17 \\ 13 & 11 \end{bmatrix} \end{align*}

Interpretation

We can interpret the resulting (product) matrix by labelling the columns and rows: \[\begin{matrix} & \begin{matrix} f & g \end{matrix} \\ \begin{matrix} a \\ b \end{matrix}\!\!\!\!\! & \begin{bmatrix} 31 & 17 \\ 13 & 11 \end{bmatrix} \end{matrix}\] Hence there are \(31\) routes from \(a\) to \(f\), \(17\) from \(a\) to \(g\), \(13\) from \(b\) to \(f\) and \(11\) from \(b\) to \(g\).

Some surprising results

Exercise

We have already seen how to calculate a product \(AB\) where, for example, \[ A = [value], \qquad B = [value] \] In this case the product is \[AB = [value]\] In this exercise you will determine the product \(BA,\) i.e., with the matrices in the reverse order.

Form the products of:

row 1 of \(B\) and column 1 of \(A\)

row 1 of \(B\) and column 2 of \(A\)

row 2 of \(B\) and column 1 of \(A\)

row 2 of \(B\) and column 2 of \(A\)

Now enter the matrix \(BA\):
Feedback: We are given the matrices \(A = [value]\) and \(B = [value]\) and are asked to compute the product \(BA\). This is given by: \[BA = [value] = [value]\] Note how our result for \(BA\) is not equal to \(AB\).

Exercise

Calculate \(AB=[value][value].\)

First find the element in row 2 column 1 of the product:

Now complete the multiplication to find all the elements of the matrix \(AB\):
Feedback: We are given the matrices \(A = [value]\) and \(B = [value]\) and are asked to compute their product \(AB\). First we compute the entry in the second row, first column of \(AB\). To do this, we multiply the second row of \(A\) and the first column of \(B\). \[[value] \cdot [value] = [value] = [value]\] We then complete the product. \[\begin{aligned} AB &= [value] \\ &= [value] \end{aligned}\]

Exercise

If \(A = [value],\) \(B = [value]\), find \(AB\)

\(AB=\)
Feedback: \[A = [value], \qquad B = [value]\] Then: \[AB = [value] = [value]\]

Exercise

If \(A = [value],\) \(B = [value]\) and \(C=[value],\) find:

1. \(AB = \)
2. \(BC = \)
Feedback: We are given the matrices \(A = [value]\), \(B = [value]\) and \(C = [value]\), and are asked to find the following: 1. \[AB = [value] = [value]\] 2. \[BC = [value] = [value]\]

Exercise

Let \(A = [value]\) and \(B = [value]\).

1. Is it true that \(AB=BA\)?
2. GIven that \(AB = \begin{bmatrix}\cos{z} & \sin{z} \\ -\sin{z} & \cos{z}\end{bmatrix}\), what is \(z\) in terms of \(x\) and \(y\)?
Feedback: We are given the matrices \(A = [value]\) and \(B = [value]\). 1. First, we are asked whether \(AB = BA\), that is, whether \(A\) and \(B\) commute. In order to answer this question, we must find what \(AB\) and \(BA\) are. \[\begin{aligned} AB &= [value] \\ &= [value] \end{aligned}\] \[\begin{aligned} BA &= [value] \\ &= [value] \end{aligned}\] Checking each entry at a time, we see that \(AB\) is in fact equal to \(BA\). 2. We already computed the value of \(AB\) in part (a). However, it was not fully simplified. Recall the trigonometric identities for the sum of angles: \[\begin{aligned} \sin(x + y) &= \sin x \cos y + \sin y \cos x \\ \cos(x + y) &= \cos x \cos y - \sin x \sin y \end{aligned}\] Using these, we can rewrite our expression for \(AB\) as \[[value]\] Therefore, the value of \(z\) we are asked for is \(x + y\).

Exercise

Let \(A = [value]\) and \(B = [value].\) Compute the following matrices:

1. \((AB)^{T} = \)

2. \(B^{T}A^{T} = \)

What do you notice about the results?
Feedback: We are given the matrices \(A = [value]\) and \(B = [value]\) and are asked to compute the following: 1. \[\begin{aligned} (AB)^T &= \left([value]\right)^T \\ &= \left([value]\right)^T \\ &= [value] \end{aligned}\] 2. \[\begin{aligned} B^TA^T &= [value]^T [value]^T \\ &= [value] [value] \\ &= [value] \\ &= [value] \end{aligned}\] Note that we got the same answer for \((AB)^T\) and \(B^TA^T\). In fact, this is true in general.

Exercise

If \(A = [value],\) \(B = [value]\) and \(C=[value],\) compute the matrix \(ABC\):

\(ABC = \)
Feedback: \[A = [value], \qquad B = [value], \qquad C = [value]\] Method 1: First compute \(AB\), then multiply that on the right by \(C\). \begin{align*} AB & = [value] \\ & = [value] \\ & \\ ABC & = [value] \\ & = [value] \end{align*} Method 2: First compute \(BC\), then multiply that on the left by \(A\). \begin{align*} BC & = [value] \\ & = [value] \\ & \\ ABC & = [value] \\ & = [value] \end{align*} Note that we obtain the same result either way.

Exercise

If \(A\) is any matrix, then the matrix \(AA^{T}\) is symmetric. Verify this in the case \(A = [value]\) by computing \(AA^{T}\):

\(AA^{T} = \)
Feedback: We are given the matrix \(A = [value]\) and are asked to verify that \(AA^T\) is symmetric by computing it. First, we write down the tranpose of \(A\). \[A^T = [value]\] Now we perform the multiplication. \[\begin{aligned} AA^T &= [value] \\ &= [value] \end{aligned}\] Indeed, this matrix is symmetric about its main diagonal.

Example

Find the product \(AB\) if \(A = \begin{bmatrix} 1 & 2 & 2 \\ 2 & 3 & 4 \end{bmatrix}\) and \(B = \begin{bmatrix} 2 & 5 \\ 6 & 1 \\ 4 & 3 \end{bmatrix}\)

Solution

Since \(A\) is a \(2\times3\) matrix and \(B\) is a \(3\times2\) the product \(AB\) can be found and results in a \(2\times2\) matrix. \begin{align*} AB & = \begin{bmatrix} 1 & 2 & 2 \\ 2 & 3 & 4 \end{bmatrix}\begin{bmatrix} 2 & 5 \\ 6 & 1 \\ 4 & 3 \end{bmatrix} \\ & = \begin{bmatrix} \begin{bmatrix} 1 & 2 & 2\end{bmatrix} \begin{bmatrix} 2 \\ 6 \\ 4 \end{bmatrix} & \begin{bmatrix} 1 & 2 & 2 \end{bmatrix} \begin{bmatrix} 5 \\ 1 \\ 3 \end{bmatrix} \\ \\ \begin{bmatrix} 2 & 3 & 4 \end{bmatrix} \begin{bmatrix} 2 \\ 6 \\ 4 \end{bmatrix} & \begin{bmatrix} 2 & 3 & 4 \end{bmatrix} \begin{bmatrix} 5 \\ 1 \\ 3 \end{bmatrix} \end{bmatrix} \\ & = \begin{bmatrix} 22 & 13 \\ 38 & 25 \end{bmatrix}\end{align*}

Exercise

If \(A = [value],\) \(B = [value]\) and \(C=[value],\) find:

1. \(AB = \)

2. \(AC = \)

3. \((A+B)C = \)

4. \(AC+BC = \)

5. \(2A-3C = \)
Feedback: \[A = [value], \qquad B = [value], \qquad C = [value]\] \begin{align*} AB & = [value] \\ & = [value] \\ AC & = [value] \\ & = [value]\end{align*} It is always true that \((A+B)C=AC+BC\), so the answers to parts (c) and (d) must be the same. \begin{align*} (A+B)C & = AC+BC \\ & = [value] + [value] \\ & = [value] + [value] \\ & = \begin{bmatrix} [value] & [value] \\ [value] & [value] \end{bmatrix} \\ & = [value] \\ 2A-3C & = \begin{bmatrix} [value] & [value] \\ [value] & [value] \end{bmatrix} \\ & = [value]\\ \end{align*}