<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="description">
    <name>
      <text>7.3.11 (Matrix multiplication)</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<h3>Multiplying two matrices</h3>
<p>As well as multiplying a matrix by a scalar we can also multiply two matrices together. This is a more complicated process than either scalar multiplication or multiplication of numbers. In order to multiply two matrices we must multiply each row of the first matrix by each column in the second. To do this we multiply the entries of both matrices together, then add them together. In other words, we have to calculate the dot product of each row and each column. It is easier to understand this with an example.</p>
<br/>
<h3>Example</h3>

<p>Calculate the matrix multiplication 
\[ 
\begin{bmatrix} 1 &amp; 2 &amp; 3 \\ 
4 &amp; 5 &amp; 6 
\end{bmatrix} \times 
\begin{bmatrix} 
7 & 8
\\
9 & 10
\\
11 & 12
\end{bmatrix} 
\]</p>
<h3>Solution</h3>
<p>To calculate the first entry in the resulting matrix, we take the dot product of the first row of the first matrix with the first column of the second matrix. Consider the following diagram</p>
<p> </p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="@@PLUGINFILE@@/Matrix%20multiplication.png" alt="diagram of matrix multiplication" width="432" height="199" /></p>
<p> </p>
<p>We must consider every combination of the rows of the first matrix and columns of the second. Firstly consider the first (yellow) row and the first (yellow) column. Taking the dot product of these means that we multiply corresponding entries and then add them together. So the first entry of the new matrix is given by 
\[ 
1 \times 7 + 2 \times 9 + 3 \times 11 = 58.
 \] 
Next we do something similar for the first (yellow) row and the second (green) column. Thus second entry of the resulting matrix is given by 
\[ 
1 \times 8 + 2 \times 10 + 3 \times 12 = 64.
\]
We have now considered every possibility with the first row of the first matrix, therefore we move on to the combinations with the second (green) row. So we take the green row with the first (yellow) column of the second matrix to obtain 
\[ 
4 \times 7 + 5 \times 9 + 6 \times 11 = 139. 
\] 
Finally we take the green row with the green column to obtain 
\[ 
4 \times 8 + 5 \times 10 + 6 \times 12 = 154. 
\] 
Hence the result of multiplying these two matrices is:</p>
<p> </p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="@@PLUGINFILE@@/Matrix%20multiplication%202.png" alt="matrix multiplication example" width="616" height="198" /></p>
<br/>
<p>The highlights show where each value in the resultant matrix comes from. The yellow number on the rhs is the product of the yellow row of the first matrix with the yellow column of the second matrix. Similarly the green number on the rhs is the product of the green row of the first matrix with the green column of the second matrix. The other values come from a combination of the yellow and green rows and columns from each matrix.  </p>]]></text>
<file name="Matrix multiplication 2.png" path="/" encoding="base64">[encoded data, 89164 characters]</file>
<file name="Matrix multiplication.png" path="/" encoding="base64">[encoded data, 41600 characters]</file>
    </questiontext>
    <generalfeedback format="html">
      <text/>
    </generalfeedback>
    <defaultgrade>0</defaultgrade>
    <penalty>0</penalty>
    <hidden>0</hidden>
    <idnumber/>
  </question>
</quiz>
