Tutorials › Linear Algebra › Columns Of A Product As Linear Combinations

Matrix Operations and Algebra · Tutorial 64 of 1000

Columns Of A Product As Linear Combinations

See how to read each column of a matrix product as a linear combination of the left-hand matrix’s columns, and use the formula to understand the product’s column space.

Beginner 9 min read

What You'll Learn

  • Identify the dimensions required for a product of matrices.
  • Match each column of the product with the corresponding column of the right-hand matrix.
  • Use the entries of that column as coefficients in a linear combination.
  • Verify product columns by computing matrix-vector products.
  • Prove that every column of a product lies in the column space of the left-hand matrix.
  • Recognize when a nonzero coefficient column produces a zero product column.

The Columns of a Product

Matrix multiplication can be read one column at a time. When \(\mathbf{A}\mathbf{B}\) is defined, each column of the product is built from the columns of \(\mathbf{A}\). The coefficients for that combination are not chosen from a row of \(\mathbf{B}\): they come, in order, from the corresponding column of \(\mathbf{B}\). This gives a direct way to interpret a product and to check its columns.

Suppose \(\mathbf{A}\) has \(m\) rows and \(n\) columns, and \(\mathbf{B}\) has \(n\) rows and \(p\) columns. The shared dimension \(n\) means the product \(\mathbf{A}\mathbf{B}\) is defined, and the product has size \(m\times p\). Write the columns of \(\mathbf{A}\) as \(\mathbf{a}_1,\dots,\mathbf{a}_n\), and write the \(j\)th column of \(\mathbf{B}\) as \(\mathbf{b}_j\). The entries of \(\mathbf{b}_j\) are \(b_{1j},\dots,b_{nj}\), so it is the column vector \((b_{1j},\dots,b_{nj})^{\top}\).

Theorem (Columns of a product): Let \(\mathbf{A}\in\mathbb{R}^{m\times n}\) have columns \(\mathbf{a}_1,\dots,\mathbf{a}_n\), and let \(\mathbf{B}\in\mathbb{R}^{n\times p}\) have columns \(\mathbf{b}_1,\dots,\mathbf{b}_p\). For each \(j=1,\dots,p\), the \(j\)th column of \(\mathbf{A}\mathbf{B}\) is $$ (\mathbf{A}\mathbf{B})_j =b_{1j}\mathbf{a}_1+b_{2j}\mathbf{a}_2+\cdots+b_{nj}\mathbf{a}_n =\mathbf{A}\mathbf{b}_j. $$ Here \((\mathbf{A}\mathbf{B})_j\) denotes the \(j\)th column of the product.

Proof. Fix a column index \(j\) with \(1\le j\le p\). For each row index \(i\) with \(1\le i\le m\), the entry in row \(i\), column \(j\) of the product is \(\sum_{k=1}^{n}a_{ik}b_{kj}\), by the entry formula for matrix multiplication. The \(i\)th entry of \(b_{1j}\mathbf{a}_1+\cdots+b_{nj}\mathbf{a}_n\) is also \(\sum_{k=1}^{n}b_{kj}a_{ik}\), because the \(i\)th entry of \(\mathbf{a}_k\) is \(a_{ik}\). These sums are equal term by term. Thus every entry of column \(j\) of \(\mathbf{A}\mathbf{B}\) equals the corresponding entry of that linear combination, so the columns are equal. Also, by the definition of the matrix-vector product, \(\mathbf{A}\mathbf{b}_j=b_{1j}\mathbf{a}_1+\cdots+b_{nj}\mathbf{a}_n\). This proves both displayed equalities for every \(j\). \(\square\)

The formula specifies a simple matching rule: use column \(j\) of \(\mathbf{B}\) to form column \(j\) of the product. Its first entry weights \(\mathbf{a}_1\), its second entry weights \(\mathbf{a}_2\), and so on. The order is important: coefficient \(b_{kj}\) always multiplies column \(k\) of \(\mathbf{A}\). Since there are \(p\) columns in \(\mathbf{B}\), the formula produces \(p\) columns in the product.

Reading the Formula in a Worked Product

Worked Example: Two Matrices with Three Product Columns

Let \(\mathbf{A}\in\mathbb{R}^{3\times2}\) and \(\mathbf{B}\in\mathbb{R}^{2\times3}\) be

$$ \mathbf{A}= \begin{bmatrix} 1&2\\ 0&-1\\ 3&1 \end{bmatrix}, \qquad \mathbf{B}= \begin{bmatrix} 2&0&-1\\ 1&4&2 \end{bmatrix}. $$

The columns of \(\mathbf{A}\) are \(\mathbf{a}_1=(1,0,3)^{\top}\) and \(\mathbf{a}_2=(2,-1,1)^{\top}\). The columns of \(\mathbf{B}\) are \((2,1)^{\top}\), \((0,4)^{\top}\), and \((-1,2)^{\top}\). Apply the formula separately to each one:

$$ (\mathbf{A}\mathbf{B})_1 =2\mathbf{a}_1+\mathbf{a}_2 =2\begin{bmatrix}1\\0\\3\end{bmatrix} +\begin{bmatrix}2\\-1\\1\end{bmatrix} =\begin{bmatrix}4\\-1\\7\end{bmatrix}, $$
$$ (\mathbf{A}\mathbf{B})_2 =0\mathbf{a}_1+4\mathbf{a}_2 =\begin{bmatrix}0\\0\\0\end{bmatrix} +\begin{bmatrix}8\\-4\\4\end{bmatrix} =\begin{bmatrix}8\\-4\\4\end{bmatrix}, $$
$$ (\mathbf{A}\mathbf{B})_3 =-\mathbf{a}_1+2\mathbf{a}_2 =\begin{bmatrix}-1\\0\\-3\end{bmatrix} +\begin{bmatrix}4\\-2\\2\end{bmatrix} =\begin{bmatrix}3\\-2\\-1\end{bmatrix}. $$

Putting these columns next to one another gives

$$ \mathbf{A}\mathbf{B} = \begin{bmatrix} 4&8&3\\ -1&-4&-2\\ 7&4&-1 \end{bmatrix}. $$

Check: Directly using the entry formula, the first row of the product is \((1\cdot2+2\cdot1,\;1\cdot0+2\cdot4,\;1\cdot(-1)+2\cdot2)=(4,8,3)\). The second row is \((0\cdot2+(-1)\cdot1,\;0\cdot0+(-1)\cdot4,\;0\cdot(-1)+(-1)\cdot2)=(-1,-4,-2)\). The third row is \((3\cdot2+1\cdot1,\;3\cdot0+1\cdot4,\;3\cdot(-1)+1\cdot2)=(7,4,-1)\). These rows give the same product matrix.

The check also illustrates why each linear combination has two terms in this example: \(\mathbf{A}\) has two columns, so each coefficient column from \(\mathbf{B}\) has two entries. In general, the number of terms in the combination is the number of columns of \(\mathbf{A}\), which must equal the number of entries in each column of \(\mathbf{B}\) for the product to be defined.

Worked Example: A Product with Three Columns in the Left Factor

Let

$$ \mathbf{A}= \begin{bmatrix} 1&2&-1\\ 0&1&2 \end{bmatrix}, \qquad \mathbf{B}= \begin{bmatrix} 1&2\\ 0&-1\\ 2&1 \end{bmatrix}. $$

Write the columns of \(\mathbf{A}\) as \(\mathbf{a}_1=(1,0)^{\top}\), \(\mathbf{a}_2=(2,1)^{\top}\), and \(\mathbf{a}_3=(-1,2)^{\top}\). Column 1 of \(\mathbf{B}\) is \((1,0,2)^{\top}\), so it gives the combination

$$ (\mathbf{A}\mathbf{B})_1 =\mathbf{a}_1+0\mathbf{a}_2+2\mathbf{a}_3 =\begin{bmatrix}1\\0\end{bmatrix} +\begin{bmatrix}0\\0\end{bmatrix} +\begin{bmatrix}-2\\4\end{bmatrix} =\begin{bmatrix}-1\\4\end{bmatrix}. $$

Column 2 of \(\mathbf{B}\) is \((2,-1,1)^{\top}\), so

$$ (\mathbf{A}\mathbf{B})_2 =2\mathbf{a}_1-\mathbf{a}_2+\mathbf{a}_3 =\begin{bmatrix}2\\0\end{bmatrix} +\begin{bmatrix}-2\\-1\end{bmatrix} +\begin{bmatrix}-1\\2\end{bmatrix} =\begin{bmatrix}-1\\1\end{bmatrix}. $$

Therefore, \(\mathbf{A}\mathbf{B}=\begin{bmatrix}-1&-1\\4&1\end{bmatrix}\). Check: multiplying the first row of \(\mathbf{A}\) by the columns of \(\mathbf{B}\) gives \((1\cdot1+2\cdot0+(-1)\cdot2,\;1\cdot2+2\cdot(-1)+(-1)\cdot1)=(-1,-1)\). The second row gives \((0\cdot1+1\cdot0+2\cdot2,\;0\cdot2+1\cdot(-1)+2\cdot1)=(4,1)\), confirming both columns.

What the Product’s Column Space Can Contain

The span of a list of vectors is the set of all their linear combinations. The column space of a matrix is the span of its columns. Thus \(\operatorname{Col}\mathbf{A}=\operatorname{span}\{\mathbf{a}_1,\dots,\mathbf{a}_n\}\), and \(\operatorname{Col}(\mathbf{A}\mathbf{B})\) is the span of the columns of the product. The column formula gives an immediate relationship between these two spaces.

Theorem: If \(\mathbf{A}\in\mathbb{R}^{m\times n}\) and \(\mathbf{B}\in\mathbb{R}^{n\times p}\), then \(\operatorname{Col}(\mathbf{A}\mathbf{B})\subseteq\operatorname{Col}\mathbf{A}\).

Proof. Let \(\mathbf{y}\) be any vector in \(\operatorname{Col}(\mathbf{A}\mathbf{B})\). By the definition of column space, \(\mathbf{y}\) is a linear combination of the columns of \(\mathbf{A}\mathbf{B}\). Each such column, by the columns-of-a-product formula, is itself a linear combination of the columns of \(\mathbf{A}\). Substituting those combinations into the expression for \(\mathbf{y}\) expresses \(\mathbf{y}\) as a linear combination of the columns of \(\mathbf{A}\). Therefore \(\mathbf{y}\in\operatorname{Col}\mathbf{A}\). Since this holds for every \(\mathbf{y}\in\operatorname{Col}(\mathbf{A}\mathbf{B})\), the stated inclusion follows. \(\square\)

This inclusion says that multiplying on the right can produce columns only from within the column space already available from \(\mathbf{A}\). It does not say that the two column spaces must be equal. For equality, the combinations selected by the columns of \(\mathbf{B}\) would need to generate all of \(\operatorname{Col}\mathbf{A}\); the product formula by itself guarantees only that the product columns stay within that space.

Worked Example: Nonzero Coefficients Can Give a Zero Column

Consider the matrices

$$ \mathbf{A}= \begin{bmatrix} 1&2\\ 0&0 \end{bmatrix}, \qquad \mathbf{B}= \begin{bmatrix} -2&2\\ 1&-1 \end{bmatrix}. $$

The columns of \(\mathbf{A}\) are \(\mathbf{a}_1=(1,0)^{\top}\) and \(\mathbf{a}_2=(2,0)^{\top}\). The first column of \(\mathbf{B}\) gives \(-2\mathbf{a}_1+\mathbf{a}_2=(-2,0)^{\top}+(2,0)^{\top}=\mathbf{0}\). The second gives \(2\mathbf{a}_1-\mathbf{a}_2=(2,0)^{\top}-(2,0)^{\top}=\mathbf{0}\). Hence

$$ \mathbf{A}\mathbf{B}= \begin{bmatrix} 0&0\\ 0&0 \end{bmatrix}. $$

Check: direct multiplication gives first row \((1\cdot(-2)+2\cdot1,\;1\cdot2+2\cdot(-1))=(0,0)\), and second row \((0,0)\). Although both coefficient columns of \(\mathbf{B}\) are nonzero, their combinations of the columns of \(\mathbf{A}\) cancel. Here \(\operatorname{Col}(\mathbf{A}\mathbf{B})=\{\mathbf{0}\}\), while \(\operatorname{Col}\mathbf{A}=\operatorname{span}\{(1,0)^{\top}\}\), so the inclusion can be strict.

A Useful Zero-Column Test

The same formula gives a precise way to decide whether a particular product column is zero. For this statement, the null space of \(\mathbf{A}\), written \(\operatorname{Nul}\mathbf{A}\), means the set of vectors \(\mathbf{x}\) satisfying \(\mathbf{A}\mathbf{x}=\mathbf{0}\). It records coefficient vectors whose combinations of the columns of \(\mathbf{A}\) cancel completely.

Proposition: With \(\mathbf{A}\in\mathbb{R}^{m\times n}\) and \(\mathbf{B}\in\mathbb{R}^{n\times p}\), column \(j\) of \(\mathbf{A}\mathbf{B}\) is \(\mathbf{0}\) if and only if column \(j\) of \(\mathbf{B}\) belongs to \(\operatorname{Nul}\mathbf{A}\).

Proof. Denote column \(j\) of \(\mathbf{B}\) by \(\mathbf{b}_j\). The columns-of-a-product formula states that column \(j\) of \(\mathbf{A}\mathbf{B}\) is \(\mathbf{A}\mathbf{b}_j\). If that product column is \(\mathbf{0}\), then \(\mathbf{A}\mathbf{b}_j=\mathbf{0}\), which is exactly the definition of \(\mathbf{b}_j\in\operatorname{Nul}\mathbf{A}\). Conversely, if \(\mathbf{b}_j\in\operatorname{Nul}\mathbf{A}\), then the definition gives \(\mathbf{A}\mathbf{b}_j=\mathbf{0}\), so column \(j\) of \(\mathbf{A}\mathbf{B}\) is zero. Both implications hold, proving the equivalence. \(\square\)

In the preceding example, the two coefficient columns \((-2,1)^{\top}\) and \((2,-1)^{\top}\) lie in \(\operatorname{Nul}\mathbf{A}\): multiplying either by \(\mathbf{A}\) gives \(\mathbf{0}\). The test is not a claim that the coefficient column itself must be zero. It is the result of applying \(\mathbf{A}\) to that column that determines whether the product column vanishes.

Common Pitfall: Using a Row for the Coefficients

A frequent indexing error is to take the coefficients from a row of \(\mathbf{B}\) rather than from its corresponding column. Return to the first worked example. The correct coefficients for product column 1 are the entries \(2\) and \(1\) in column 1 of \(\mathbf{B}\), so the answer is \(2\mathbf{a}_1+\mathbf{a}_2=(4,-1,7)^{\top}\). A wrong calculation might take the first row of \(\mathbf{B}\), whose entries are \(2,0,-1\), and use the first two of them as coefficients. That would give \(2\mathbf{a}_1+0\mathbf{a}_2=(2,0,6)^{\top}\), which is not column 1 of the product. The correction is to identify the desired product column first, then read the coefficient entries down the matching column of \(\mathbf{B}\).

Before computing, check the sizes: if \(\mathbf{A}\) has \(n\) columns, then \(\mathbf{B}\) must have \(n\) rows. Then keep the column labels visible and use this sequence:

  1. Choose product column \(j\).
  2. Read column \(j\) of \(\mathbf{B}\) as the coefficient vector.
  3. Use those entries, in order, to weight the columns of \(\mathbf{A}\).
  4. Check the resulting vector against column \(j\) from direct matrix multiplication.

Each step follows from the product’s dimensions and the column formula. Together, they make it possible to interpret a product column without losing track of where its coefficients come from.

Check Your Understanding

For each question, identify the relevant coefficient column before carrying out any matrix multiplication.

  1. If \(\mathbf{A}\) has \(4\) columns and \(\mathbf{B}\) has \(3\) columns, how many entries are in each column of \(\mathbf{B}\), and how many columns does \(\mathbf{A}\mathbf{B}\) have?
  2. Suppose the columns of \(\mathbf{A}\) are \(\mathbf{a}_1,\mathbf{a}_2,\mathbf{a}_3\), and column 2 of \(\mathbf{B}\) is \((1,-2,0)^{\top}\). Write column 2 of \(\mathbf{A}\mathbf{B}\) as a linear combination.
  3. Let \(\mathbf{a}_1=(1,2)^{\top}\), \(\mathbf{a}_2=(3,0)^{\top}\), and let column 1 of \(\mathbf{B}\) be \((2,-1)^{\top}\). Find column 1 of \(\mathbf{A}\mathbf{B}\).
  4. Why must \(\operatorname{Col}(\mathbf{A}\mathbf{B})\subseteq\operatorname{Col}\mathbf{A}\)? State the fact about individual product columns that justifies your answer.
  5. What condition on column \(j\) of \(\mathbf{B}\) is equivalent to column \(j\) of \(\mathbf{A}\mathbf{B}\) being zero?

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon