Matrix Multiplication: Linear Algebra Study Notes
October 11, 2026
🧮 Matrix Multiplication
Main Topics Covered
- Definition, size rule and notation of the matrix product
- Matrix times matrix, matrix times vector, vector times matrix, vector times vector
- Fundamental applications: linear maps, rotations, resource allocation, linear systems, bilinear forms
- General properties: non-commutativity, distributivity, scalar product, transpose, conjugate, associativity
- Computational cost of parenthesization and similarity transformations
- Square matrices: ring structure, inverses, determinant, powers
- Abstract algebra viewpoint
- Computational complexity (Strassen and beyond)
- Other types of matrix products
📌 Overview
Matrix multiplication is a binary operation that produces a matrix from two matrices. It is a basic tool of linear algebra.
- The number of columns in the first matrix must equal the number of rows in the second matrix.
- The resulting matrix, the matrix product, has the number of rows of the first and the number of columns of the second matrix.
- The product of matrices and is denoted .
- It was first described by the French mathematician Jacques Philippe Marie Binet in 1812, to represent the composition of linear maps that are represented by matrices.
- Applications span mathematics, applied mathematics, statistics, physics, economics and engineering.
- Computing matrix products is a central operation in all computational applications of linear algebra.
🔤 Notation
- Matrices: capital letters in bold, e.g. .
- Vectors: lowercase bold, e.g. .
- Entries of vectors and matrices: italic (numbers from a field), e.g. and .
- Index notation is often the clearest way to express definitions. The entry in row , column of is written , or .
- A single subscript, e.g. , selects a matrix (not an entry) from a collection of matrices.
📐 Definitions
Matrix times matrix
Let be an matrix and an matrix:
The product (written without multiplication signs or dots) is the matrix
such that
for and .
- Each entry is obtained by multiplying term by term the entries of the th row of and the th column of , then summing these products.
- In other words, is the dot product of the th row of and the th column of .
- Written out in full:
The product is defined if and only if the number of columns in equals the number of rows in , in this case .
Entries need not be numbers. They may be any mathematical objects for which an addition and a multiplication are defined, that are associative, and such that the addition is commutative and the multiplication is distributive with respect to the addition. In particular, the entries may be matrices themselves (block matrix).
Matrix times vector
- A vector of size can be identified with an column matrix , with .
- For an matrix , the product is a vector of size (the matrix ), with
- One way of looking at this is that the changes from "plain" vector to column vector and back are assumed and left implicit.
Vector times matrix
- A vector of size can also be identified with a (row) matrix.
- To make clear that a row vector is meant, it is customary to write it as the transpose of a column vector, as in .
- Useful identity: .
- For an matrix , with :
Vector times vector
A vector with components can be represented as a matrix (row vector) or an matrix (column vector).
| Product | Form | Result |
|---|---|---|
| Dot (inner) product of column vectors | a matrix | |
| Outer product | (column times row) | an matrix |
Illustration
Each entry of the product matrix corresponds to a row of and a column of . For a matrix times a matrix, giving a matrix, the highlighted entries are:
🛠️ Fundamental Applications
Matrix multiplication was introduced to facilitate and clarify computations in linear algebra. This relationship remains fundamental in mathematics, physics, chemistry, engineering and computer science.
Linear maps
- If a vector space has a finite basis, each vector is uniquely represented by a finite sequence of scalars, its coordinate vector. These coordinate vectors form a vector space isomorphic to the original one.
- A coordinate vector is commonly organized as a column matrix, so a column vector represents both a coordinate vector and a vector of the original space.
- A linear map from a space of dimension into a space of dimension maps a column vector onto the column vector
- The map is thus defined by the matrix and maps to .
- If is another linear map into a space of dimension , it is represented by a matrix . The matrix of the composite map is the matrix product .
- The definition of function composition, , is here a specific case of associativity of the matrix product:
Geometric rotations
In a Cartesian coordinate system in a Euclidean plane, rotation by an angle around the origin is a linear map. It maps a source point to its image by
The composition of the rotation by and the rotation by is:
Trigonometric identities are used for the second equality. The composition corresponds to the rotation by angle , as expected.
Resource allocation in economics
A fictitious factory uses 4 kinds of basic commodities to produce 3 kinds of intermediate goods , which in turn are used to produce 3 kinds of final products . The matrices
give the amount of basic commodities needed per intermediate good, and the amount of intermediate goods needed per final product, respectively.
- Example: to produce one unit of , one unit of , two units of , no units of and one unit of are needed (the first column of ).
- Multiplying gives the basic commodities needed per final good:
- The bottom left entry is : 11 units of are needed to produce one unit of . Indeed, one for , one for each of two , and 2 for each of four are needed for one .
- To produce 100 units of , 80 of and 60 of :
That is, 1000 of , 1820 of , 1180 of and 2180 of . The same can be reused for other final-good amounts.
System of linear equations
The general form of a system of linear equations is
With the notation above, such a system is equivalent to the single matrix equation .
Dot product, bilinear form and sesquilinear form
- The dot product of two column vectors is the unique entry of the matrix product (a matrix is identified with its unique entry).
- Any bilinear form over a finite-dimensional vector space may be expressed as the matrix product .
- Any sesquilinear form may be expressed as , where is the conjugate transpose of (conjugate of the transpose, or equivalently transpose of the conjugate).
⚖️ General Properties
Matrix multiplication shares some properties with usual multiplication. However, it is not defined if the number of columns of the first factor differs from the number of rows of the second, and it is non-commutative, even when the product remains defined after changing the order of the factors.
Non-commutativity
An operation is commutative if, given two elements and such that and are defined, .
For of size and of size :
- is defined iff ; is defined iff . If one product is defined, the other need not be.
- If , both are defined but have different sizes, so they cannot be equal.
- Only if (square matrices of the same size) are both products defined and of the same size. Even then, in general .
Example:
- This can be expanded to show: for an matrix over a field , for every matrix over if and only if with , where is the identity matrix.
- Over a ring instead of a field, one must add the condition that belongs to the center of the ring.
- A special case where commutativity does occur: two square diagonal matrices and of the same size satisfy (over a general ring, corresponding entries must also commute).
Distributivity
The product is distributive with respect to matrix addition. For matrices of sizes , , and (call them ):
- Left distributivity:
- Right distributivity:
These follow from distributivity for coefficients:
Product with a scalar
- For a matrix and scalar , and are obtained by left or right multiplying all entries of by . If scalars commute, .
- If is defined, then and .
- If scalars commute, all four matrices are equal. More generally, all four are equal if belongs to the center of a ring containing the entries, because then for all matrices .
- These properties result from the bilinearity of the product of scalars:
Transpose
If scalars commute, the transpose of a product is the product, in reverse order, of the transposes of the factors:
where T denotes the interchange of rows and columns. This identity does not hold for noncommutative entries, since the order between the entries of and is reversed when the definition is expanded.
Complex conjugate
If and have complex entries, then
where denotes the entry-wise complex conjugate. This follows because the conjugate of a sum is the sum of the conjugates and the conjugate of a product is the product of the conjugates.
Transposition acts on the indices of the entries, while conjugation acts independently on the entries themselves. Hence
where denotes the conjugate transpose.
Associativity
Given three matrices, and are defined iff the columns of equal the rows of and the columns of equal the rows of (so if one product is defined, so is the other). Then:
- Parentheses can be omitted, writing .
- This extends to any number of matrices with matching dimensions: if the columns of equal the rows of for , then
is defined and does not depend on the order of the multiplications, if the order of the matrices is kept fixed.
- These properties may be proved by straightforward but complicated summation manipulations. The result also follows from the fact that matrices represent linear maps, so associativity of matrices is a specific case of associativity of function composition.
Computational complexity depends on parenthesization
The result does not depend on the order of operation, but the computational complexity may depend dramatically on it.
Example: for of sizes , , :
| Order | Multiplications needed |
|---|---|
Algorithms exist for choosing the best order of products (matrix chain multiplication). As the number of matrices increases, the choice of the best order has been shown to have a complexity of .
Application to similarity
Any invertible matrix defines a similarity transformation on square matrices of the same size:
Similarity transformations map products to products: . Indeed,
⬛ Square Matrices
Let denote the set of square matrices with entries in a ring (in practice often a field).
- The product is defined for every pair of matrices in , making it a ring with the identity matrix (diagonal entries 1, all others 0) as identity element. It is also an associative -algebra.
- If , many matrices have no multiplicative inverse. For example, a matrix with a row (or column) of all zeros has no inverse.
- If it exists, the inverse of is denoted and satisfies
- A matrix with an inverse is invertible; otherwise it is singular.
- A product of matrices is invertible iff each factor is invertible, and then .
- When is commutative (in particular a field), the determinant of a product is the product of the determinants:
- Other matrix invariants behave less well with products. Still, if is commutative, and have the same trace, the same characteristic polynomial, and the same eigenvalues with the same multiplicities. The eigenvectors are generally different if .
Powers of a matrix
A square matrix can be raised to any nonnegative integer power by repeated multiplication:
- The trivial algorithm (repeated multiplication) needs times the cost of a single matrix multiplication.
- Exponentiation by squaring requires fewer than matrix multiplications, and is much more efficient.
- Easy case, a diagonal matrix: the product of diagonal matrices just multiplies corresponding diagonal elements, so the th power raises each entry to the power :
🧩 Abstract Algebra
- The definition of the matrix product requires that entries belong to a semiring, and does not require multiplication of the semiring's elements to be commutative.
- Often entries belong to a field; the tropical semiring is also a common choice for graph shortest path problems.
- Even over fields, the product is not commutative in general, although it is associative and distributive over matrix addition.
- Identity matrices (zero outside the main diagonal, 1 on it) are identity elements of the matrix product. So matrices over a ring form a ring, which is noncommutative except if and the ground ring is commutative.
- Over a commutative ring , a matrix has an inverse iff its determinant has a multiplicative inverse in . The determinant of a product of square matrices is the product of the determinants.
- The invertible matrices form a group under matrix multiplication; its subgroups are called matrix groups. Many classical groups (including all finite groups) are isomorphic to matrix groups, the starting point of group representation theory.
- Matrices are the morphisms of a category, the category of matrices. Objects are the natural numbers measuring matrix size; composition of morphisms is matrix multiplication. The source of a morphism is the number of columns, and the target is the number of rows.
⏱️ Computational Complexity
- The algorithm that follows the definition needs, in the worst case, multiplications and additions of scalars to multiply two matrices. Its complexity is therefore , in a model where scalar operations take constant time.
- Surprisingly, this is not optimal: in 1969 Volker Strassen gave an algorithm (Strassen's algorithm) with complexity
- Strassen's algorithm can be parallelized to further improve performance.
- As of January 2024, the best peer-reviewed algorithm, by Virginia Vassilevska Williams, Yinzhan Xu, Zixuan Xu and Renfei Zhou, has complexity .
- It is not known whether matrix multiplication can be done in time. That would be optimal, since one must read the elements of a matrix to multiply it with another.
- Because matrix multiplication underlies many algorithms, and many matrix operations have the same complexity up to a multiplicative constant, its complexity appears throughout numerical linear algebra and theoretical computer science.
🔗 Generalizations
Other types of products of matrices:
| Product | Description |
|---|---|
| Block matrix operations | Operations on matrices whose entries are matrices |
| Cracovian product | |
| Frobenius inner product | Dot product of matrices considered as vectors; equivalently the sum of the entries of the Hadamard product |
| Hadamard product | Entry-by-entry product of two matrices of the same size, giving a matrix of the same size |
| Kronecker (tensor) product | Generalization of the preceding to any size |
| Khatri-Rao product, face-splitting product | Further matrix products |
| Outer product (dyadic or tensor product) | Of two column matrices: |
| Scalar multiplication | Multiplying every entry by a scalar |