The Rows of a Product
Matrix multiplication can be read in two complementary ways: a column of a product is built from columns of the first factor, while a row of a product is built from rows of the second factor. Here we focus on the row description. It gives a direct way to understand what the entries in a row of a product mean, and it provides a useful check when computing a product by hand.
Let \(\mathbf{A}\in\mathbb{R}^{m\times n}\) and \(\mathbf{B}\in\mathbb{R}^{n\times p}\). The product \(\mathbf{A}\mathbf{B}\) is defined because the number of columns of \(\mathbf{A}\) equals the number of rows of \(\mathbf{B}\). The product has \(m\) rows and \(p\) columns. For a matrix \(\mathbf{M}\), write \(\operatorname{row}_i(\mathbf{M})\) for its \(i\)-th row, viewed as a row vector. Thus \(\operatorname{row}_i(\mathbf{A})=(a_{i1},\dots,a_{in})\), and \(\operatorname{row}_k(\mathbf{B})\) has \(p\) entries.
Proof. Fix a row index \(i\) with \(1\le i\le m\). By the entry formula for matrix multiplication, the entry in row \(i\), column \(j\) of \(\mathbf{A}\mathbf{B}\) is \(\sum_{k=1}^{n}a_{ik}b_{kj}\), for each \(j=1,\dots,p\). The entry in column \(j\) of \(\sum_{k=1}^{n}a_{ik}\operatorname{row}_k(\mathbf{B})\) is also \(\sum_{k=1}^{n}a_{ik}b_{kj}\), because the \(j\)-th entry of row \(k\) of \(\mathbf{B}\) is \(b_{kj}\). Therefore the two row vectors have equal entries in every column \(j=1,\dots,p\). They are equal. Since \(i\) was arbitrary, the formula holds for every row of the product. \(\square\)
The indices are worth tracking carefully. The fixed index \(i\) chooses which product row we are finding, so the coefficients \(a_{i1},\dots,a_{in}\) all come from row \(i\) of \(\mathbf{A}\). The index \(k\) runs through the rows of \(\mathbf{B}\). Each coefficient \(a_{ik}\) multiplies row \(k\) of \(\mathbf{B}\). The column index \(j\) is used when checking a particular entry; it does not choose a row to combine.
Using the Formula in a Product
Worked Example: A Product with Two Rows and Three Rows
Compute the product and express each of its rows as a combination of rows of \(\mathbf{B}\), where
Let the rows of \(\mathbf{B}\) be \(\mathbf{b}_1=(1,2)\), \(\mathbf{b}_2=(-2,1)\), and \(\mathbf{b}_3=(3,0)\). The first row of \(\mathbf{A}\) is \((2,-1,3)\). By the row formula, row 1 of the product is \(2\mathbf{b}_1-\mathbf{b}_2+3\mathbf{b}_3\). Compute it term by term:
The second row of \(\mathbf{A}\) is \((0,4,1)\), so row 2 of the product is \(0\mathbf{b}_1+4\mathbf{b}_2+\mathbf{b}_3\):
Thus the product is \(\begin{bmatrix}13&3\\-5&4\end{bmatrix}\). Check the entries directly using the entry formula. Its first row is \((2\cdot1+(-1)(-2)+3\cdot3,\;2\cdot2+(-1)\cdot1+3\cdot0)=(13,3)\). Its second row is \((0\cdot1+4(-2)+1\cdot3,\;0\cdot2+4\cdot1+1\cdot0)=(-5,4)\), agreeing with both row combinations.
A coefficient of zero means that the corresponding row of \(\mathbf{B}\) contributes nothing to that particular product row. A negative coefficient means that a scalar multiple in the opposite direction is used. Neither situation changes the rule: the \(k\)-th coefficient in row \(i\) of \(\mathbf{A}\) always multiplies row \(k\) of \(\mathbf{B}\).
Worked Example: A Product with Three Rows
Compute \(\mathbf{A}\mathbf{B}\) and verify each row-combination description, with
Write the rows of \(\mathbf{B}\) as \(\mathbf{b}_1=(2,1,-1)\) and \(\mathbf{b}_2=(0,4,2)\). The first row of \(\mathbf{A}\) is \((1,2)\), giving \(\mathbf{b}_1+2\mathbf{b}_2\):
The second row is \((-1,0)\), giving \(-\mathbf{b}_1+0\mathbf{b}_2=(-2,-1,1)\). The third row is \((3,-2)\), giving \(3\mathbf{b}_1-2\mathbf{b}_2\):
Therefore the product is \(\begin{bmatrix}2&9&3\\-2&-1&1\\6&-5&-7\end{bmatrix}\). To check it by entries, the first row is \((1\cdot2+2\cdot0,\;1\cdot1+2\cdot4,\;1(-1)+2\cdot2)=(2,9,3)\). The second is \((-1\cdot2+0\cdot0,\;(-1)\cdot1+0\cdot4,\;(-1)(-1)+0\cdot2)=(-2,-1,1)\). The third is \((3\cdot2+(-2)\cdot0,\;3\cdot1+(-2)\cdot4,\;3(-1)+(-2)\cdot2)=(6,-5,-7)\).
Rows Can Combine to Give a Zero Row
A product row need not be nonzero just because some of its coefficients are nonzero. Different rows of \(\mathbf{B}\) may combine so that their contributions cancel. The row formula accounts for this automatically: the result depends on the entire indicated combination, not on any one coefficient or row in isolation.
Worked Example: Cancellation Between Rows
Find the product and explain why its first row is zero, using
Call the rows of \(\mathbf{B}\) \(\mathbf{b}_1=(1,2)\), \(\mathbf{b}_2=(3,1)\), and \(\mathbf{b}_3=(4,3)\). The first row of \(\mathbf{A}\) gives \(\mathbf{b}_1+\mathbf{b}_2-\mathbf{b}_3\). Evaluating in order,
The second row of \(\mathbf{A}\) gives \(2\mathbf{b}_1-\mathbf{b}_2+0\mathbf{b}_3\):
So \(\mathbf{A}\mathbf{B}=\begin{bmatrix}0&0\\-1&3\end{bmatrix}\). Directly checking the entries gives the first row \((1\cdot1+1\cdot3+(-1)\cdot4,\;1\cdot2+1\cdot1+(-1)\cdot3)=(0,0)\), and the second row \((2\cdot1+(-1)\cdot3+0\cdot4,\;2\cdot2+(-1)\cdot1+0\cdot3)=(-1,3)\). The row combination and entry calculation agree.
A Consequence for Row Spaces
The row space \(\operatorname{Row}\mathbf{B}\) is the set of all linear combinations of the rows of \(\mathbf{B}\). The row formula immediately locates every row of a product within this set. In fact, combinations of the product rows also remain in the row space of \(\mathbf{B}\).
Proof. By the row formula, for each \(i=1,\dots,m\), row \(i\) of \(\mathbf{A}\mathbf{B}\) is a linear combination of the rows of \(\mathbf{B}\). Hence each row of \(\mathbf{A}\mathbf{B}\) belongs to \(\operatorname{Row}\mathbf{B}\). An arbitrary element of \(\operatorname{Row}(\mathbf{A}\mathbf{B})\) is a linear combination of the rows of \(\mathbf{A}\mathbf{B}\). Each of those rows is itself a linear combination of rows of \(\mathbf{B}\); substituting these combinations and collecting the real coefficients expresses the arbitrary element as a linear combination of rows of \(\mathbf{B}\). Therefore it belongs to \(\operatorname{Row}\mathbf{B}\), proving the inclusion. \(\square\)
This conclusion is an inclusion, not necessarily an equality: the combinations selected by the rows of \(\mathbf{A}\) might not produce every possible linear combination of rows of \(\mathbf{B}\). The row formula tells us exactly how the rows of the product are built, while the corollary records one consequence for the sets of combinations those rows can generate.
A Reliable Calculation Routine
For a product \(\mathbf{A}\mathbf{B}\), the row-combination method can be organized as follows. First check the dimensions: if \(\mathbf{A}\) has \(n\) columns, \(\mathbf{B}\) must have \(n\) rows. Then treat one row of \(\mathbf{A}\) at a time. Its entries, in order, are the coefficients for rows \(1,\dots,n\) of \(\mathbf{B}\). Calculate the resulting row one coordinate at a time, keeping the same coefficient attached to the same row of \(\mathbf{B}\) in every coordinate. Finally, compare each result with the entry formula for the corresponding row.
Fix a row index \(i\) of \(\mathbf{A}\). The same index specifies row \(i\) of \(\mathbf{A}\mathbf{B}\).
Use \(a_{i1},\dots,a_{in}\), in order, as the coefficients of rows \(1,\dots,n\) of \(\mathbf{B}\).
Compute \(\sum_{k=1}^{n}a_{ik}\operatorname{row}_k(\mathbf{B})\), then check its entries using \((\mathbf{A}\mathbf{B})_{ij}=\sum_{k=1}^{n}a_{ik}b_{kj}\) for \(j=1,\dots,p\).
Common Mistake: Using the Wrong Coefficients
A common error is to use the entries of column \(i\) of \(\mathbf{A}\), rather than the entries of row \(i\), when finding row \(i\) of the product. For the first example, row 1 of \(\mathbf{A}\) is \((2,-1,3)\), so the correct first product row is \(2\mathbf{b}_1-\mathbf{b}_2+3\mathbf{b}_3=(13,3)\). A wrong calculation might use \((2,0)\), the first column of \(\mathbf{A}\), as if those were the coefficients, and write \(2\mathbf{b}_1+0\mathbf{b}_2\). That gives \((2,4)\), not \((13,3)\). The correction is to identify the row being computed first, then take all coefficients from that row of \(\mathbf{A}\). A direct entry check catches the error: the first entry must be \(2\cdot1+(-1)(-2)+3\cdot3=13\), not \(2\).
Another useful check is the output length. Each row of \(\mathbf{B}\) has \(p\) entries, so every linear combination of those rows has \(p\) entries. The product \(\mathbf{A}\mathbf{B}\) also has \(p\) columns. If a proposed product row has a different number of entries, the dimensions or the calculation have been mishandled.
Check Your Understanding
For each question, keep track of the dimensions and verify computed product rows using the entry formula.
- If \(\mathbf{A}\in\mathbb{R}^{2\times3}\) and \(\mathbf{B}\in\mathbb{R}^{3\times4}\), how many entries does each row of \(\mathbf{A}\mathbf{B}\) have?
- Suppose row 2 of \(\mathbf{A}\) is \((3,0,-2)\). Write row 2 of \(\mathbf{A}\mathbf{B}\) as a combination of the rows of \(\mathbf{B}\).
- Let the rows of \(\mathbf{B}\) be \((1,0)\), \((0,1)\), and \((1,1)\). What combination does the coefficient row \((1,1,-1)\) produce?
- Explain why every row of \(\mathbf{A}\mathbf{B}\) belongs to \(\operatorname{Row}\mathbf{B}\).
- For \(\mathbf{A}=\begin{bmatrix}2&-1\end{bmatrix}\) and \(\mathbf{B}=\begin{bmatrix}1&3\\4&2\end{bmatrix}\), compute the product row by a row combination and check both entries directly.