Let A be an n\times m
real matrix, i.e. a matrix with n rows and m columns. Given a p\times q matrix B, we can form the
matrix multiplication BA or B\circ A only when q=n, and in that case the resulting matrix is of dimension p\times m. In other words, we can only multiply matrices A and B when the number of rows of A matches the number of columns of B. One can keep track of this fact by declaring an n\times m matrix to be of type m\to n, and similarly a p\times q matrix to be of type q\to p. This way, when q=n the two arrows have matching source and target, m\to n\to p, and can hence be composed to an arrow of type m\to p. 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). In detail, the category \mathbf{Mat}_\mathbb{R} is constructed as follows: • It has
natural numbers as
objects; • Given numbers m and n, a
morphism m\to n is an n\times m matrix, i.e. a matrix with n rows and m columns; • The
identity morphism at each object n is given by the n\times n
identity matrix; • The composition of morphisms A:m\to n and B:n\to p (i.e. of matrices n\times m and p\times n) is given by
matrix multiplication. More generally, one can define the category \mathbf{Mat}_\mathbb{F} of matrices over a fixed field \mathbb{F}, such as the one of
complex numbers. == Properties ==