Products of data matrices
A product of two data matrices gives totals when the columns of the first matrix and the rows of the second matrix stand for the same categories, listed in the same order. Each entry of the answer then belongs to a row of the first matrix and a column of the second.
Method
Example: one price column for each shop
Two families buy rice (kg) and eggs (trays). Shop X and Shop Y charge different prices.
| Quantity | Rice (kg) | Eggs (trays) |
|---|---|---|
| Family A | 4 | 3 |
| Family B | 2 | 5 |
| Price (dollars) | Shop X | Shop Y |
|---|---|---|
| Rice, per kg | 2.50 | 2.80 |
| Eggs, per tray | 4.00 | 3.50 |
\(Q=\begin{pmatrix}4&3\\ 2&5\end{pmatrix}\) (rows: Family A, Family B; columns: rice, eggs) \(P=\begin{pmatrix}2.50&2.80\\ 4.00&3.50\end{pmatrix}\) (rows: rice, eggs; columns: Shop X, Shop Y)
The columns of \(Q\) and the rows of \(P\) are both rice, eggs, so \(QP\) has order \((2\times2)(2\times2)\to2\times2\).
\(QP=\begin{pmatrix}4(2.50)+3(4.00)&4(2.80)+3(3.50)\\ 2(2.50)+5(4.00)&2(2.80)+5(3.50)\end{pmatrix}=\begin{pmatrix}22.00&21.70\\ 25.00&23.10\end{pmatrix}\)
The unit is kilograms (or trays) times dollars per kilogram (or per tray), which gives dollars. Comparing along each row, both families pay less at Shop Y.
Totals with a row of ones
A row of ones on the left adds the entries in each column: \(\begin{pmatrix}1&1\end{pmatrix}Q=\begin{pmatrix}1&1\end{pmatrix}\begin{pmatrix}4&3\\ 2&5\end{pmatrix}=\begin{pmatrix}6&8\end{pmatrix}\), so the two families buy 6 kg of rice and 8 trays of eggs altogether. In the same way, \(\begin{pmatrix}1&1\end{pmatrix}(QP)=\begin{pmatrix}47.00&44.80\end{pmatrix}\): the two orders together cost 47.00 dollars at Shop X and 44.80 dollars at Shop Y. A column of ones on the right adds the entries in each row instead.
Check
List the prices in the same order as the categories. If the rows of \(P\) were eggs then rice, \(QP\) would multiply kilograms of rice by the price of a tray of eggs, and every entry would be wrong even though the product still exists.
\(PQ\) also exists here, because both matrices are \(2\times2\), but it would pair the shops (columns of \(P\)) with the families (rows of \(Q\)), so it has no meaning. Choose the order of multiplication from the categories, not only from the orders.
Create a free account to practise similar questions.
Need help? Join our E-Maths tuition for O-Level success.
Learn more