# Concrete representation of coend in linear algebra

$$\require{AMScd}$$Teaching coend calculus to a PhD student led me to this "elementary" computation that I would like to perform explicitly.

Consider the functor $$F : (\mathbb N,\le)^\text{op}\times (\mathbb N,\le) \to \mathrm{Vect}$$ sending a pair of natural numbers $$(n,m)$$ to the vector space $$\hom(\mathbb R^n,\mathbb R^m)$$ (so: choosing a basis, real valued $$m\times n$$ matrices).

$$F$$ acts on inequalities $$p\le q$$ by suitable pre- and post-composition with the inclusions $$i_{p\le q} : \mathbb R^p \to \mathbb R^q$$ "padding $$q-p$$ zeroes at the end of the vector $$(a_1,\dotsc,a_p)$$".

What is the coend of $$F$$?

An instructive unraveling of the definition tells us that we have to compute the cokernel of the map $$\begin{CD} \bigoplus_{n\le m} M_{m,n}(\mathbb R) @>>> \bigoplus_p M_p(\mathbb R) \end{CD}$$ defined at the component $$n\le m$$ sending a linear function $$H : \mathbb R^m\to\mathbb R^n$$ to $$H\circ i - i\circ H$$ (this is slightly imprecise, but the abuse of notation is harmless: both compositions are defined, and the difference is taken padding the smaller matrix with zeroes until it reaches the same dimension of the other). Up to this padding operation, this is a sort of commutator of $$H$$ with the inclusion $$i_{n\le m}$$.

The vector space I am interested now arises by killing the image of this commutator map in $$\bigoplus_p M_p(\mathbb R)$$; I would like to understand this quotient in terms of some concrete representation (for example regarding said cokernel inside the $$\mathbb R$$-algebra of all linear operators $$\mathbb R^{\mathbb N} \to \mathbb R^{\mathbb N}$$), but at the moment I can only gather a number of sparse, inconclusive observations. For example:

• I believe there is a "simpler" expression for $$\int^n F(n,n)$$ in terms of a filtered colimit of cokernels of the partial maps $$\bigoplus_{n\le m} M_{mn}(\mathbb R) \to \bigoplus_p M_p(\mathbb R)$$, because they factor through $$\bigoplus_{p=1,\dotsc,m} M_p(\mathbb R)$$ and have a cokernel $$Q_m$$ in a chain $$Q_1\to Q_2\to Q_3\to\dotsb$$.
• $$\bigoplus_p M_p(\mathbb R)$$ seems to be a filtered $$\mathbb R$$-algebra (given two matrices, pad zeroes to let the dimension match, and perform operations there). Is it the case then that $$\int^n F(n,n)$$ inherit some filtration and compatible algebra structure?

I think some advanced linear algebra is enough to answer the question, so please, don't be scared if you're not familiar with coends or even with category theory.

You're attempting to understand the coend $$\int^n \hom(\mathbb R^n,\mathbb R^n)$$. By dualizability of finite dimensional vector spaces, the dual of this vector space is none other than the end of the same thing : $$\hom(\mathbb R^p,\mathbb R^q)^*\cong \hom(\mathbb R^q,\mathbb R^p)$$.

But now this end is rather easy to compute: it's natural transformations $$\mathbb R^\bullet\to \mathbb R^\bullet$$, i.e. upper triangular infinite matrices.

Now, computing the dual may not be enough. Luckily, we can map into an arbitrary $$V$$ and apply a similar method: $$\hom(\mathbb R^p,\mathbb R^q)^*\otimes V\cong\hom(\mathbb R^q,\mathbb R^p\otimes V)$$ and so maps from our coend into $$V$$ are the same as natural transformations $$\mathbb R^\bullet\to \mathbb R^\bullet\otimes V\cong V^\bullet$$, which are now $$V$$-valued infinite upper triangular matrices.

This indicates that $$\int^n\hom(\mathbb R^n,\mathbb R^n)\cong \bigoplus_{i\leq j}\mathbb R$$. The instructive thing is, I guess, to write down exactly the map $$\hom(\mathbb R^n,\mathbb R^n)\to \bigoplus_{i\leq j}\mathbb R$$ which witnesses this. To make this possible, I'll call $$T_{i,j}$$ the $$(i\leq j)$$-indexed basis element of $$\bigoplus_{i\leq j}\mathbb R$$, and $$e_i$$ the $$i$$th element in the canonical basis of $$\mathbb R^n$$ (say indexed by $$i\in\{1,\dotsc,n\}$$).

So this is the map which is dual to $$\mathbb R^n\to\mathbb R^n\otimes \bigoplus_{i\leq j}\mathbb R$$, the value at $$n$$ of the universal upper triangular infinite matrix. If I'm not making a mistake, I believe this is given by $$e_j\mapsto \sum_{i\leq j}e_i\otimes T_{i,j}$$.

Dualizing back, this gives $$e_i^*\otimes e_j\mapsto \delta_{i\leq j} T_{i,j}$$, and so this sends a matrix $$M$$ to $$\sum_{i\leq j} M_{j,i}T_{i,j}$$ (note the switch between $$i,j$$ here).

So it seems like if you start from someone in $$M_p(\mathbb R)$$, what you should do is simply throw out anyone strictly above the diagonal, and identify your answer with any other matrix that is obtained by adding $$0$$'s.

Note that you can also see this from your $$H\circ i - i\circ H$$ perspective: if you take $$H:\mathbb R^m\to\mathbb R^n$$, $$n\leq m$$ and write it as a matrix, you'll see that this commutator looks like a strict upper triangular matrix. This is telling you that you should kill all these, i.e. only remember the lower triangular part.

• Very nice, I'm glad I keep learning! Oct 7, 2023 at 7:00

Let's compute more generally the abelian group $$\int^n \hom(A^n,B^n)$$ for objects $$A,B$$ of an additive category.

Let $$H := \hom(A,B)$$. For all $$m,n$$ there is an isomorphism $$\hom(A^n,B^m) \cong H^{m \times n}$$. Under this isomorphism, for $$m \leq n$$ the map $$\iota^* : \hom(A^n,B^m) \to \hom(A^m,B^m)$$ corresponds to the map $$H^{m \times n} \to H^{m \times m}, \quad (x ~ | ~ y) \mapsto x$$ which removes the last $$n-m$$ columns. Also, the map $$\iota_* : \hom(A^n,B^m) \to \hom(A^n,B^n)$$ corresponds to the map $$H^{m \times n} \to H^{n \times n}, \quad x \mapsto \small \begin{pmatrix} x \\ 0 \end{pmatrix}$$ which adds $$n-m$$ zero rows.

Thus, $$\int^n \hom(A^n,B^n) \cong \int^n H^{n \times n}$$ with these maps. But let us reduce the computation of the coend to the computation of an end instead. This turns out to be much simpler.

Let $$T$$ be any abelian group. We compute: $$\textstyle\hom(\int^n H^{n \times n},T) \cong \int_n \hom(H^{n \times n},T) \cong \int_n \hom(H,T)^{n \times n}$$ So we should first compute the end $$\int_n T^{n \times n}$$. In the last isomorphism we have dualized the maps. For $$m \leq n$$, the map $$T^{m \times m} \to T^{m \times n}$$ is given inserting $$n-m$$ zero columns, and the map $$T^{n \times n} \to T^{m \times n}$$ is given by removing the last $$n-m$$ rows.

It follows that $$\int_n T^{n \times n}$$ is the subgroup of $$\prod_n T^{n \times n}$$ that consists of all families of matrices $$(x^n)$$ with the following property $$(\ast)$$: If $$m \leq n$$, then $$(x^m ~ | ~ 0)$$ is $$x^n$$ without the last $$n-m$$ rows. Now draw a picture to see what this condition actually means, for $$(m,n) = (1,2), (2,3), \dotsc$$. The matrix $$x^n$$ sits inside the next matrix $$x^{n+1}$$ in the top left corner, the column parts next to it are zero. The part below can be arbitrary, but it has to appear in $$x^{n+2}$$, etc. So all these matrices can be glued together to form an infinite square matrix which is lower-triangular.

Formally, the property $$(\ast)$$ says that for all $$1 \leq i \leq m$$, $$1 \leq j \leq n$$: $$x^n_{ij} = \begin{cases} 0 & j > m \\ x^m_{ij} & j \leq m \end{cases}$$ Letting $$m=i$$ shows $$x^n_{ij} = 0$$ for all $$i < j$$, and letting $$m=n-1$$ and $$1 \leq i,j \leq n-1$$ shows that $$x^n_{ij} = x^{n-1}_{ij}$$, so the matrices are compatible. Then $$x_{ij} := x^n_{ij}$$ (for some $$n \geq i,j$$) defines a well-defined infinite square matrix with $$x_{ij} = 0$$ for $$i < j$$. And the process can be reversed as well.

This proves $$\int_n T^{n \times n} \cong \prod_{i \geq j} T$$.

Now we can continue our computation from above: $$\textstyle \hom(\int^n H^{n \times n},T) \cong \int_n \hom(H,T)^{n \times n} \cong \prod_{i \geq j} \hom(H,T) \cong \hom(\bigoplus_{i \geq j} H,T)$$ Of course, everything is natural in $$T$$, so that finally $$\textstyle\int^n \hom(A^n,B^n) \cong \int^n H^{n \times n} \cong \bigoplus_{i \geq j} H = \bigoplus_{i \geq j} \hom(A,B).$$ The same proof works for objects $$A,B$$ in $$R$$-linear additive categories, then we work with $$R$$-modules above.

The result is of course the same as in Maxime's answer, but much more general.