What is the nature of the identity mapping in categories. A property of any category $\mathfrak{C}$ is that there exists a morphism $1_B:B\to B$, where $B$ is any object in $\mathfrak{C}$, such that if $f:A\to B$ and $g:B\to A$, then $1_B\circ f=f$ and $g\circ 1_B=g$. 
Is this $1_B$ in any way more general then the identity mapping of $B$? And if it is just the identity mapping, why is such notation used instead of just saying $\forall b\in B, 1_B (b)=b$?
Thanks in advance!
 A: To elaborate on the comment of Marc van Leeuwen, a morphism in a category must not necessarily be a function, and also an object of a category does not necessarily have "elements". Here are a couple of examples:


*

*A group $G$ can be seen as a category with only one object where all arrows are invertible (the elements of the group are the arrows). The identity morphism here corresponds to the unit element (composition with the identity is the multiplication by the unit).

*The category $\mathrm{nCob}$ is the category with (oriented) $n$-manifolds as objects and cobordisms as morphisms. If $M$ is an $n$-manifold, then $\mathrm{id}_M=M\times[0,1]$.


As you can see, in both cases arrows are not mappings, and objects are not composed by distinct elements.
A: Yes, it's more general. Part of the point of category theory is to do math without assuming that objects are sets. So when you say $\forall b \in B$, you're assuming $B$ is a set and that $b\in B$ makes sense. But for example, the objects in the category could be the positive integers, with arrows $n \rightarrow m$ corresponding to the relation "m is divisible by n". Then the identity arrow $5\rightarrow 5$ is just the relation "5 is divisible by 5", not a function at all.
A: In an arbitrary category, there is a generalized notion of "element": an element of $X$ is any morphism with codomain $X$. Similarly, there are generalized "coelements" of $X$: any morphism with domain $X$.
If $x$ is a generalized element of $X$, and $f : X \to Y$, then the notation $f(x)$ means the generalized element $f \circ x$. I've not seen coelements used, but I imagine if $e$ is a generalized coelement of $Y$, then $f^*(y)$ is the generalized coelement $y \circ f$ of $X$.
In this language, the defining property of identity morphisms does indeed reduce to $f(x) = x$ and $f^*(y) = y$ for all generalized elements $x \in X$ and generalized coelements $y \in X$.
Note that if $x$ is the generalized element corresponding to $1_X$, then in some sense $x$ the "most generic" generalized element of $X$ -- simply proving $f(x) = x$ proves $f$ to be the identity morphism of $X$.
