Linear Algebra
4.49 min read

The Entry Perspective: Dot Products

The computational formula for matrix multiplication: the (i,j)(i,j) entry of C=ABC = AB is the dot product of row ii of AA with column jj of BB: cij=kaikbkjc_{ij} = \sum_k a_{ik} b_{kj}.

This is the "two-finger rule" — point one finger at row ii of AA and the other at column jj of BB, multiply corresponding entries, and sum. Slide fingers to compute each entry.

While this formula is less geometric than the column perspective, it is essential for computation and for understanding why the time complexity is O(n3)O(n^3): there are mpmp entries to compute, each requiring a dot product of length nn.

Formal View

Theorem 4.4 (Entry Form)
For C=ABC = AB with ARm×nA \in \mathbb{R}^{m \times n}, BRn×pB \in \mathbb{R}^{n \times p}:
cij=k=1naikbkj=aibjc_{ij} = \sum_{k=1}^n a_{ik} b_{kj} = \mathbf{a}_{i \cdot} \cdot \mathbf{b}_{\cdot j}
where ai\mathbf{a}_{i\cdot} is row ii of AA and bj\mathbf{b}_{\cdot j} is column jj of BB.
Remark 4.4 — Complexity
Computing C=ABC = AB naively requires O(mnp)O(mnp) multiplications. For square n×nn \times n matrices, this is O(n3)O(n^3). Strassen's algorithm achieves O(n2.81)O(n^{2.81}); current theoretical best is O(n2.37...)O(n^{2.37...}).

Why This Matters

The entry formula is the basis for all numerical linear algebra implementations.

  • BLAS (Basic Linear Algebra Subprograms) implements this formula with SIMD optimizations
  • GPU matrix multiplication runs the entry formula in massively parallel fashion
  • Understanding O(n3)O(n^3) cost helps design algorithms that avoid recomputing products

Quiz

Question 1

For C=ABC = AB with AR2×3A \in \mathbb{R}^{2 \times 3} and BR3×2B \in \mathbb{R}^{3 \times 2}, the entry c21c_{21} is computed as:

Common Mistakes

  • Using the wrong row/column pairing — cijc_{ij} is row ii of AA dotted with column jj of BB.
  • Forgetting to sum over the inner index kk from 1 to nn.