Categorical description of equivalence relation generated by a relation? The notion of an equivalence relation generated by a relation is widespread and useful. How can one categorically describe it?
 A: A binary relation $R$ on a set $X$ is a subset of $X\times X$, represented categorically by a monomorphism $R\to X\times X$. By the categorical definition of products, that amounts to a (jointly monic) pair of morphisms $R\to X$.  Take the coequalizer $p:X\to Q$ of that pair.  Then take the kernel pair of $p$ (i.e., the pullback of $p$ along itself). That's a pair of morphisms $E\to X$, so you can combine them to constitute a morphism $E\to X\times X$. That morphism is monic, and the binary relation on $X$ that it represents is the equivalence relation generated by the original $R$.
A: You could consider the category ${\mathscr C}$ of sets which come equipped with a relation, and with morphisms in ${\mathscr C}$ being relation preserving maps of sets. Then the full subcategory of sets equipped with an equivalence relation (called setoids) is reflective in ${\mathscr C}$, with the left adjoint of the inclusion sending an object $(X,\sim)$ to $(X,\simeq)$ where $\simeq$ is the equivalence relation generated by $\sim$.
