Why are linear functions between finite-dimensional vector spaces representable by matrices? And why does matrix multiplication compose the corresponding linear maps? There’s geometric intuition for this, e.g. presented by 3Blue1Brown. I will alternatively present a category-theoretic analysis. The short version is that, in the category of vector spaces and linear maps, products are also coproducts (hence biproducts); and in categories with biproducts, maps between biproducts decompose as (generalized) matrices. These generalized matrices align with traditional numeric matrices and matrix multiplication in the category of vector spaces. The category-theoretic lens reveals matrices as an elegant abstraction, contra The New Yorker.
I’ll use a standard notion of a vector space over the field . A vector space has addition, zero, and scalar multiplication defined, which have the standard commutativity/associativity/distributivity properties. The category has as objects vector spaces (over the field ), and as morphisms linear maps. A linear map between vector spaces U, V satisfies and . (Advanced readers may see nlab on Vect.)
Clearly, is a vector space, as is 0 (the vector space with only one element, which is zero). 0 is both an initial and a terminal object. Any linear map from 0 must always return the zero vector; and so must any linear map into 0. Therefore, by definition 0 is a category-theoretic zero object.
If U and V are vector spaces, then the direct sum , which has as elements pairs (u, v) with , and for which addition and scalar multiplication are element-wise, is also a vector space. The direct sum is both a product and a coproduct.
To show that the direct sum is a product, let U and V be vector spaces, and let and be the projections of the direct sum onto its elements. Let us suppose a third vector space T and linear maps and . Let be defined as . Now uniquely commutes:
To show that the direct sum is a coproduct, let U and V be vector spaces, and let be defined as , and similarly let be defined as . Let us suppose a third vector space W and linear maps and . Let be defined as . Now uniquely commutes:
The upshot is that the direct sum is both a product and a coproduct. Let be a zero function; since the direct sum also satisfies the identities , by definition it is a biproduct. We can now abstract from the category to semiadditive categories, which are by definition categories with a zero object and all pairwise biproducts. Let C stand for any semiadditive category, with biproduct .
Biproducts enable powerful decomposition of morphisms (such as linear maps). Given (in C), we may uniquely decompose it as for some and , specifically . And similarly, we may uniquely decompose as for some and , specifically .
Biproducts generalize from binary to n-ary. Suppose n is natural and is an object for natural . Now the n-ary biproduct is . We take the empty biproduct to be 0. We can also generalize the projections , the injections , the “row-wise” combination , and the “column-wise” combination , from binary to n-ary.
This generalization to n-ary biproducts enables conceiving of matrices categorically. Let m, n be natural, and let and be objects in C, for natural and . Suppose . We first decompose h “row-wise”, as where . Then we decompose each row “column-wise”, as where . We can now write h in matrix style, as ; the notation can be visualized as vertical matrix concatenation, and can be visualized as horizontal matrix concatenation.
This is the core abstract idea, but how to apply it more concretely? Back in , we can form the Euclidean space . Now a map decomposes as a matrix of linear maps . This is not quite a traditional matrix, but note that linear maps of type are always multiplication by a constant real slope. Representing each by its slope yields a more traditional numeric matrix.
We can generalize matrix representation of linear maps to finite-dimensional vector spaces (which by definition have finite bases), by noting that each of these is isomorphic to for some natural n. Specifically, if a space U has a basis , then the linear map defined as is an isomorphism. Hence, matrix representation extends to maps between finite-dimensional vector spaces.
So far, we have a treatment of matrix-vector multiplication, but not matrix-matrix multiplication. We would like to show that composition of linear maps leads to the matrix representations multiplying in the expected way. Let be natural, and let be objects in C (for naturals ). Suppose we have maps and . We can write f in matrix form (), and similarly g ().
Now we wish to find the matrix form of the composition . We fix i, k and consider the entry . Now note and . Therefore
This expression is a row-column matrix multiplication, similar to a vector dot product. In the case of , we can more explicitly write:
Since in , the set of linear maps from U to V, naturally forms a vector space, can also be written:
In the case where each is , this aligns with traditional matrix multiplication; composing linear maps of type multiplies their slopes.
There is a way to generalize the row-column matrix multiplication to semiadditive categories in general; for details, see Wikipedia on additive categories.
To summarize general lessons about semiadditive categories:
A map between biproducts can be represented in matrix form as with .
If we have maps and , the matrix entry of the composition is the row-column multiplication .
And in the case of , these imply the standard results:
Linear maps between finite-dimensional vector spaces, with fixed bases, are uniquely represented as numeric matrices.
The matrix representation of a composition of linear maps equals the product of the matrices representing these maps.
This is a nice way of showing the standard results, and the abstract results generalize to other semiadditive categories, such as the category of Abelian groups. For more detailed category-theoretic study of linear algebra, see Filip Bár’s thesis, “On the Foundations of Geometric Algebra”. For an even more abstract treatment, see “Graphical Linear Algebra”.
Cool stuff! I had previously seen that Vect has a biproduct structure, but never even considered that matrices could be appropriately generalized using it.
One thought I had was about handling potentially infinite-dimensional vector spaces. In that case, if V has a basis {vi:i∈I}, we still get a decomposition into a direct sum of copies of R:
V≅⨁i∈IR,However, when the indexing set I is infinite, the coproducts and products in Vect differ, so the argument from the post doesn’t go through verbatim. But it still feels like we have a (perhaps less useful) notion of matrix here: if V has basis {vi:i∈I} and U has basis {uj:j∈J}, then a linear map T:V→U is still fully determined by the collection {ai,j:(i,j)∈I×J}⊆R, where T(vi)=∑j∈Jai,juj and, for any fixed i∈I, ai,j vanishes for all but finitely many j∈J. Conversely, any collection {ai,j:(i,j)∈I×J}⊆R with the aforementioned condition on the vanishing of the ai,j uniquely defines a linear map T:V→U. In the finite-dimensional case, when V has dimension m and U has dimension n, I={1,…,m} and J={1,…,n}.
This feels like it still captures the notion of “linear maps are in bijection with indexed collections of scalars” (now with an extra vanishing condition) that makes matrices useful for computing in the finite-dimensional case, although infinite collections are not as nice to work with (induction becomes an issue, for example). The category theory part of my brain wants to figure out the appropriate categorical structure that enables this, which would be something weaker than products and coproducts coinciding but instead maybe that they interact well. I might be asking for too much, though, since infinite-dimensional vector spaces are usually appearing in areas / approached using tools which, in my experience, aren’t purely algebraic (e.g. functional analysis).
Here’s a basic problem with infinite bases. Suppose f:R→Rω duplicates its argument ω times. And suppose g:Rω→R sums all ω entries. Now g∘f is not a sensible function.
So you really need to have some restriction. Like for example, maybe we interpret Rω as requiring all but a finite number of entries to be zero. That would at least rule out f. Now Rω is not a “true infinite product” in the category-theory sense. But we would still have Rω≅R⊕Rω (“first” and “rest” of infinite list). Which might enable induction. I’m not sure.
Alternatively we could have Rω be unrestricted, but then g can’t be defined. Either way there’s an issue with allowing functions to or from Rω to be represented by arbitrary infinite matrices.
EDIT: another framing of this is that “infinite product” (Rω unrestricted) and “infinite coproduct” (Rω restricted to all but finite being zero) come apart in Vect. So there isn’t strictly an infinite biproduct.
I believe
h=⟩f11⟩[g11|⋯f1n⟩[g1n|⋮⋱⋮fn1⟩[gn1|⋯fnn⟩[gnn|⎡⎢ ⎢⎣is the main idea. [gij| (row/down vector) contracts many values down to one while |fji⟩ (column/up vector) expands one value back up to many, linearly.
I don’t understand the notation; it looks like bra/ket except not quite?
Yeah, bra/ket but not quite. I was trying to match your notation where ⟨⋅,⋅⟩ is the expander and [⋅,⋅] is the contractor. I think I mixed up the bracket directions, and it makes more sense as
h=⟨[h11⟩⋯[h1n⟩⋮⋱⋮[hn1⟩⋯[hnn⟩⎤⎥ ⎥⎦
that way we can think of it as one big contraction
[h11⟩,h12⟩,…,hnn⟩]
or expansion
⟨[h11,[h12,…,[hnn⟩
I believe bra/ket is for row and column vectors. I don’t think it applies here, because in the general case (semiadditive categories), you have arbitrary linear maps as the hj,i entries. And in the Rm→Rn case, they’re reals, not row or column vectors.
It is true that you can decompose as either ⟨[…]…[…]⟩ or [⟨…⟩…⟨…⟩]. To be clear I’m using ⟨⟩ and [] from category theory product/coproduct notation, it’s not meant to match linear algebra or bra/ket notation.