Up Main page

The \((i,j)\)-entry of the product of two matrices

Given a matrix \(A\), the \((i,j)\)-entry of \(A\) is the entry in row \(i\) and column \(j\) of \(A\) and is normally denoted by \(A_{i,j}\).

Let \(A\) be an \(m\times p\) matrix and let \(B\) be a \(p \times n\) matrix. Let \(Q\) denote the product \(AB\).

Row \(i\) of \(Q\) is given by \(a_i B\) where \(a_i\) denotes the \(i\)th row of \(A\).

For example, if \(A = \begin{bmatrix} 2 & 1 \\ 0 & 3 \\ 4 & 0 \end{bmatrix}\) and \(B = \begin{bmatrix} -1 & 1 \\ 0 & 3 \end{bmatrix}\), then the second row of \(AB\) is given by \(\begin{bmatrix} 0 & 3 \end{bmatrix} \begin{bmatrix} -1 & 1 \\ 0 & 3\end{bmatrix} = \begin{bmatrix} 0 & 9 \end{bmatrix}\).

Recall from the definition of matrix product that column \(j\) of \(Q\) is given by \(A B_j\) where \(B_j\) denotes the \(j\)th column of \(B\).

Therefore, \(Q_{i,j}\), which is given by column \(j\) of \(a_iB\), is \(a_i B_j = A_{i,1} B_{1,j} + A_{i,2} B_{2,j} + \cdots + A_{i,p}B_{p,j}\).

For the example above, the \((3,2)\)-entry of the product \(AB\) is given by \(\begin{bmatrix} 4 & 0 \end{bmatrix} \begin{bmatrix} 1 \\ 3\end{bmatrix} = 4\).

Matrix multiplication is associative

Even though matrix multiplication is not commutative, it is associative in the following sense. If \(A\) is an \(m\times p\) matrix, \(B\) is a \(p \times q\) matrix, and \(C\) is a \(q \times n\) matrix, then \[A(BC) = (AB)C.\] This important property makes simplification of many matrix expressions possible. In particular, we can simply write \(ABC\) without having to worry about the order in which multiplication is performed.

To see this, first let \(a_i\) denote the \(i\)th row of \(A\). Let \(P\) denote the product \(BC\).

The \((i,j)\)-entry of \(A(BC)\) is given by \(a_iP_j = A_{i,1} P_{1,j} + A_{i,2} P_{2,j} + \cdots + A_{i,p} P_{p,j}.\)

But \(P_j = BC_j\). Thus \(P_{s,j} = B_{s,1} C_{1,j} + B_{s,2} C_{2,j} + \cdots + B_{s,q} C_{q,j}\), giving \begin{eqnarray} a_i P_j & = & A_{i,1} (B_{1,1} C_{1,j} + B_{1,2} C_{2,j} + \cdots + B_{1,q} C_{q,j}) \\ & & + A_{i,2} (B_{2,1} C_{1,j} + B_{2,2} C_{2,j} + \cdots + B_{2,q} C_{q,j}) \\ & & \vdots \\ & & + A_{i,p} (B_{p,1} C_{1,j} + B_{p,2} C_{2,j} + \cdots + B_{p,q} C_{q,j}) \\ & = & (A_{i,1} B_{1,1} + A_{i,2} B_{2,1} + \cdots + A_{i,p} B_{p,1}) C_{1,j} \\ & & + (A_{i,1} B_{1,2} + A_{i,2} B_{2,2} + \cdots + A_{i,p} B_{p,2}) C_{2,j} \\ & & \vdots \\ & & + (A_{i,1} B_{1,q} + A_{i,2} B_{2,q} + \cdots + A_{i,p} B_{p,q}) C_{q,j} \\ & = & (a_i B_1) C_{1,j} + (a_i B_2) C_{2,j} + \cdots + (a_i B_q) C_{q,j}. \end{eqnarray}

Now, let \(Q\) denote the product \(AB\). Then \(Q_{i,r} = a_i B_r\). Hence, the \((i,j)\)-entry of \((AB)C\) is given by \[Q_{i,1} C_{1,j} + Q_{i,2} C_{2,j} + \cdots + Q_{i,q} C_{q,j} =(a_iB_1) C_{1,j} + (a_iB_2) C_{2,j} + \cdots + (a_iB_q) C_{q,j} = a_i P_j.\]

Hence, the \((i,j)\)-entry of \(A(BC)\) is the same as the \((i,j)\)-entry of \((AB)C\). It follows that \(A(BC) = (AB)C\).

Quick Quiz

Exercises

Give the \((2,2)\)-entry of each of the following.

  1. \(\begin{bmatrix} 2 & 1 \\ 0 & 3 \end{bmatrix} \begin{bmatrix} 2 & -1 \\ -1 & 2 \end{bmatrix}\)

  2. \(\begin{bmatrix} 1 \\ 2 \\ 3 \\ 4 \end{bmatrix} \begin{bmatrix} 0 & 1 & 2 & 3 \end{bmatrix}\)