Category of matrices

In mathematics, the category of matrices, often denoted

, is the category whose objects are natural numbers and whose morphisms are matrices, with composition given by matrix multiplication.

, we can form the matrix multiplication

, and in that case the resulting matrix is of dimension

In other words, we can only multiply matrices

matches the number of columns of

One can keep track of this fact by declaring an

matrix to be of type

matrix to be of type

the two arrows have matching source and target,

, and can hence be composed to an arrow of type

This is precisely captured by the mathematical concept of a category, where the arrows, or morphisms, are the matrices, and they can be composed only when their domain and codomain are compatible (similar to what happens with functions).

is constructed as follows: More generally, one can define the category

of matrices over a fixed field

, such as the one of complex numbers.