Matrix Multiplication and Dot Products

Matrix multiplication combines two matrices by taking dot products of rows with columns. For matrices (size ) and (size ), the product is an matrix whose entry is the dot product of row of with column of . Where it applies: linear systems, geometric transformations, computer graphics, statistics, machine learning. Who/when: formalized by Arthur Cayley (1858), building on work by Jacques Binet and Gotthold Eisenstein.

The dot product takes two vectors of equal length and returns a single number: multiply corresponding entries and add. Matrix multiplication generalizes this by arranging many dot products into a grid. Given of size and of size , their product exists only when the inner dimensions match (), and the result has size . This operation matters because it encodes the composition of linear transformations — applying one transformation after another corresponds to multiplying their matrices. The surprising fact: matrix multiplication is not commutative; and are usually different, and one may not even exist while the other does.

The Core Insight

A matrix is a machine that transforms vectors. Multiplying matrices means chaining machines together. Each entry of the product is a dot product — a measure of how much one row "agrees" with one column. The dot product is the atom; matrix multiplication is the molecule built from many such atoms arranged in rows and columns.

Formal Statement

Dot Product

Given two vectors of the same length ,

1
⟳A vector is just an ordered list of numbers; both must have the same number of components for the dot product to be defined.

their dot product (or scalar product) is the single number

2
⟳Multiply each pair of matching entries, then add all the products together — the result is a scalar, not a vector.

A second, geometric formula relates the dot product to lengths and the angle between the vectors:

3
⟳Apply the Law of Cosines to the triangle formed by , , and , then expand using equation [2].

where is the length (magnitude) of .

Matrix Multiplication

Let be an matrix with entries and an matrix with entries . The product is the matrix whose entries are

4
⟳The entry in row , column of the product is the dot product of row of with column of — sum over the shared index .

Symbols:
  • = number of rows of (and of ).
  • = number of columns of = number of rows of (the inner dimension, which must match).
  • = number of columns of (and of ).
  • = entry of in row , column .
  • = entry of in row , column .
  • = entry of the product in row , column .

Compatibility and Size Rule

The product is defined if and only if the number of columns of equals the number of rows of . In that case:

5
⟳The inner dimensions ( and ) must cancel; the outer dimensions ( and ) survive as the result's size.

Computing one entry of a matrix product as a row–column dot product

Row 2 of A [ 3 1 2 ] Col 1 of B 4 0 5 c = (3)(4) + (1)(0) + (2)(5) = 12 + 0 + 10 = 22 Pair up, multiply, then sum — one dot product gives one entry.

Why It Holds / Derivation

Why Matrix Multiplication Composes Transformations

Matrix multiplication is defined the way it is so that applying transformation , then transformation , equals applying the single matrix .

Step 1. Treat a matrix () as a function that sends a vector (length ) to a new vector (length ), where each component is a dot product:
6
⟳This is just equation [4] specialized to the case where the second factor is a single column ().
Step 2. Now apply matrix () to , producing :
7
⟳Same dot-product rule, now applied to the intermediate vector .
Step 3. Substitute equation [6] into equation [7]:
8
⟳Swap the order of summation (a finite sum lets you do this freely), then group the inner sum.
Step 4. The bracketed quantity is exactly from equation [4]. Therefore , proving that the matrix product encodes the composition of the two transformations.

Arthur Cayley | 1821–1895

A British mathematician and trained lawyer, Cayley published A Memoir on the Theory of Matrices (1858), giving the first abstract treatment of matrices as objects in their own right. He defined matrix addition, multiplication, and the identity, and noted that matrix multiplication is non-commutative — a radical departure from ordinary arithmetic. Cayley also stated (and verified in small cases) what is now the Cayley–Hamilton theorem. Remarkably prolific, he produced nearly 1,000 papers, many while practicing law for 14 years before becoming Sadleirian Professor at Cambridge.

Building Intuition

Think of the dot product as a similarity score: when two vectors point in the same direction, and the dot product is large and positive; when perpendicular, and the dot product is exactly zero; when opposite, it is negative. This is why orthogonality (perpendicularity) and "zero dot product" mean the same thing.

For matrix multiplication, picture as a stack of row-detectors and as a set of column-inputs. Entry measures how strongly row responds to column . Another lens: each column of is a combination of the columns of , weighted by a column of . The matrix tells you how to mix the columns of .

The Dot Product in Physics

Physicists meet the dot product as work: , the force times the distance in the direction of motion. Only the component of force aligned with displacement does work, which is exactly what captures. Push perpendicular to motion and you do zero work — the dot product is zero. This single idea reappears as power (), magnetic flux, and the projection of one quantity onto another throughout mechanics and electromagnetism.

Worked Examples

Dot Product with a Geometric Check

Given: and . Step 1 — Algebraic formula (eq. [2]):
Step 2 — Interpret. A zero dot product means the vectors are perpendicular. Step 3 — Verify with the geometric formula (eq. [3]). Both lengths are , so

A 2×2 Matrix Product

Given:
Step 1 — Check sizes. is , is ; inner dimensions match, so is . Step 2 — Compute each entry as a dot product (eq. [4]):
Step 3 — Confirm non-commutativity. Computing instead gives . The order genuinely matters.

Common Misconceptions

Matrix multiplication is NOT element-wise. Beginners often try to multiply matching entries: . That element-wise operation (the Hadamard product) is a different, less common thing. The real product uses rows times columns and a sum, per equation [4]. Order matters. In general . Sometimes only one of the two products even exists, because dimensions must line up. Never silently swap factors. The identity is not "all ones." The multiplicative identity is the matrix with 1's on the diagonal and 0's elsewhere, satisfying . A matrix of all ones does something entirely different. Claim (false): "If (the zero matrix), then or ." With ordinary numbers this is true, but matrices break it. Take
Then
yet neither nor is the zero matrix. Matrices can have zero divisors, so you cannot "cancel" factors the way you do with real numbers.

Connections

The dot product is the seed of Vector Spaces: lengths, angles, and orthogonality are all defined through it, generalizing to the abstract inner product. Matrix multiplication realizes Linear Transformations concretely — every linear map between finite spaces is "a matrix," and composing maps is multiplying matrices. Solving Systems of Linear Equations is written compactly as , and the search for leads to the Matrix Inverse and the Determinant. The geometric side connects to Trigonometry through the formula in equation [3].

Real-World Applications

  1. Computer graphics & games. Rotating, scaling, and translating 3D models is done by multiplying transformation matrices; the GPU performs millions of such products per frame.
  2. Google's PageRank. The web's link structure is a giant matrix, and repeatedly multiplying it by a vector ranks pages by importance.
  3. Machine learning / neural networks. Each layer of a network multiplies the input vector by a weight matrix; training adjusts those matrices.
  4. Economics — Leontief input–output models. A matrix describes how industries consume each other's output; solving predicts production needs.
  5. Cryptography (Hill cipher). Messages are encoded as vectors and encrypted by multiplying with a key matrix; decryption uses its inverse.
  6. Robotics. Chaining joint rotations (forward kinematics) multiplies a sequence of transformation matrices to locate a robot's hand.
  7. Statistics. The normal equations for least-squares regression are built entirely from matrix products and dot products.

Historical Development

  • 1748 — Gabriel Cramer publishes Cramer's Rule using determinant-like arrays to solve linear systems.
  • 1812 — Jacques Binet and Augustin-Louis Cauchy independently study products of rectangular arrays (the Binet–Cauchy identity).
  • 1844 — Hermann Grassmann develops a general theory of "extensive quantities," anticipating vectors and bilinear products.
  • 1850 — James Joseph Sylvester coins the word "matrix" (Latin for womb) for a rectangular array from which determinants are born.
  • 1858 — Arthur Cayley's Memoir on the Theory of Matrices gives the first systematic algebra of matrices, defining multiplication and noting non-commutativity.
  • 1881 — J. Willard Gibbs and Oliver Heaviside formalize vector notation, popularizing the dot product in physics and engineering.
  • 1888 — Giuseppe Peano gives an axiomatic definition of a vector space, setting the abstract stage for these operations.
  • 1969 — Volker Strassen shocks the field by showing matrix multiplication can be done faster than the obvious operations, opening the study of its true complexity.

Subtleties & Limits

How fast can two matrices be multiplied? The schoolbook method for matrices costs about multiplications. Strassen (1969) lowered the exponent to , and successive breakthroughs have pushed it down — the current record exponent sits around (as of the early 2020s). The deep open question is whether , meaning matrices could be multiplied in essentially the time it takes just to read them. No one knows; the best lower bound is only slightly above , leaving a wide, famous gap that drives ongoing research in theoretical computer science.

See Also

Vectors and Scalars · Linear Transformations · Determinant · Matrix Inverse · Systems of Linear Equations · Eigenvalues and Eigenvectors · Cross Product

Before this

Where this leads