Matrix Multiplication Formula

The Formula

(AB)_{ij} = \sum_{k=1}^{n} a_{ik} \cdot b_{kj}

When to use: Imagine each row of A as a question and each column of B as an answer key. You 'grade' each row against each column by multiplying corresponding entries and summing. This is why column count of A must match row count of Bโ€”the question and answer key must have the same length.

Quick Example

\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} = \begin{bmatrix} 1 \cdot 5 + 2 \cdot 7 & 1 \cdot 6 + 2 \cdot 8 \\ 3 \cdot 5 + 4 \cdot 7 & 3 \cdot 6 + 4 \cdot 8 \end{bmatrix} = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix}

Notation

AB means multiply A by B (row-by-column). Dimensions: (m \times n)(n \times p) = (m \times p). The inner dimensions must match.

What This Formula Means

To multiply matrices A (m \times n) and B (n \times p), each entry of the result is the dot product of a row from A with a column from B. The number of columns in A must equal the number of rows in B, and the result is an m \times p matrix.

Imagine each row of A as a question and each column of B as an answer key. You 'grade' each row against each column by multiplying corresponding entries and summing. This is why column count of A must match row count of Bโ€”the question and answer key must have the same length.

Formal View

For A \in \mathbb{R}^{m \times n}, B \in \mathbb{R}^{n \times p}: (AB)_{ij} = \sum_{k=1}^{n} a_{ik} b_{kj}, yielding AB \in \mathbb{R}^{m \times p}. Matrix multiplication is associative (A(BC) = (AB)C) but not commutative (AB \neq BA in general).

Worked Examples

Example 1

medium
Compute \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix}.

Solution

  1. 1
    Step 1: Entry (1,1): 1 \cdot 5 + 2 \cdot 7 = 5 + 14 = 19.
  2. 2
    Step 2: Entry (1,2): 1 \cdot 6 + 2 \cdot 8 = 6 + 16 = 22.
  3. 3
    Step 3: Entry (2,1): 3 \cdot 5 + 4 \cdot 7 = 15 + 28 = 43.
  4. 4
    Step 4: Entry (2,2): 3 \cdot 6 + 4 \cdot 8 = 18 + 32 = 50.
  5. 5
    Result: \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix}

Answer

\begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix}
Each entry (i,j) of the product is the dot product of row i of the first matrix with column j of the second matrix. Matrix multiplication is not commutative: AB \neq BA in general.

Example 2

hard
Compute \begin{bmatrix} 2 & 0 & -1 \\ 1 & 3 & 2 \end{bmatrix} \begin{bmatrix} 1 \\ 4 \\ -1 \end{bmatrix}.

Common Mistakes

  • Multiplying entry by entry (that is the Hadamard product, not standard matrix multiplication)
  • Forgetting to check that inner dimensions match: (m \times n)(n \times p) works, (m \times n)(m \times p) does not
  • Assuming AB = BAโ€”matrix multiplication is not commutative

Why This Formula Matters

Matrix multiplication represents composition of linear transformations. It is the workhorse of computer graphics (rotating/scaling objects), neural networks, and solving systems of equations.

Frequently Asked Questions

What is the Matrix Multiplication formula?

To multiply matrices A (m \times n) and B (n \times p), each entry of the result is the dot product of a row from A with a column from B. The number of columns in A must equal the number of rows in B, and the result is an m \times p matrix.

How do you use the Matrix Multiplication formula?

Imagine each row of A as a question and each column of B as an answer key. You 'grade' each row against each column by multiplying corresponding entries and summing. This is why column count of A must match row count of Bโ€”the question and answer key must have the same length.

What do the symbols mean in the Matrix Multiplication formula?

AB means multiply A by B (row-by-column). Dimensions: (m \times n)(n \times p) = (m \times p). The inner dimensions must match.

Why is the Matrix Multiplication formula important in Math?

Matrix multiplication represents composition of linear transformations. It is the workhorse of computer graphics (rotating/scaling objects), neural networks, and solving systems of equations.

What do students get wrong about Matrix Multiplication?

Matrix multiplication is NOT commutative. AB and BA can give completely different results, or one might not even be defined when the other is.

What should I learn before the Matrix Multiplication formula?

Before studying the Matrix Multiplication formula, you should understand: matrix operations, matrix definition.

Want the Full Guide?

This formula is covered in depth in our complete guide:

Solving Systems of Equations: Substitution, Elimination, and Matrices โ†’