# A relation between Initial Objects and retractions

I want to show that if $C$ is a category and $A\in\operatorname{object} C$ is an initial object and $f \in \operatorname{Mor}(D,A)$ for $D \in \operatorname{object} C$, then $f$ is a retraction morphism in $C$.

By definition of initial objects $\lvert\operatorname{Mor} (A,C)\rvert=1$ for all $A \in \operatorname{object} C$, then for $D\in \operatorname{object} C$ $\exists! g \in \operatorname{Mor}(A,D)$ s.t. $f\circ g\colon A\longrightarrow A$. How can i show that $f\circ g= I_{A}$?

-

Take $D=A$ in the claim about the existence of a unique arrow $A\to D$. Thus there is a unique arrow $A\to A$. Clearly, $I_A$ is that unique arrow. So, $f\circ g=I_A$.