TITLE: If $\operatorname{Hom}(X,-)$ and $\operatorname{Hom}(Y,-)$ are isomorphic, why are $X$ and $Y$ isomorphic?
QUESTION [13 upvotes]: Suppose you have a locally small category $\mathcal{C}$ and objects $X$ and $Y$ such that $\operatorname{Hom}(X,-)$ and $\operatorname{Hom}(Y,-)$ are isomorphic as covariant functors. How can you best see that $X$ and $Y$ are isomorphic in $\mathcal{C}$?
By Yoneda Lemma, we know
$$
\operatorname{Hom}(\operatorname{Hom}(X,-),\operatorname{Hom}(Y,-))\cong\operatorname{Hom}(Y,X).
$$
By assumption, there exists an isomorphism of functors $\Phi\colon\operatorname{Hom}(X,-)\to\operatorname{Hom}(Y,-)$, which by Yoneda lemma corresponds to some $f=\Phi_X(\operatorname{id}_X)\in\operatorname{Hom}(Y,X)$. Again by Yoneda Lemma, we have an isomorphism $\Phi^{-1}\colon\operatorname{Hom}(Y,-)\to\operatorname{Hom}(X,-)$, which  corresponds to some $g=\Phi^{-1}_Y(\operatorname{id}_Y)\in\operatorname{Hom}(X,Y)$.
My suspicion is $f\circ g=\operatorname{id}_X$ and $g\circ f=\operatorname{id}_Y$, to give the conclusion. But I'm getting completely bogged down trying to show that. Does anyone have an explicit computation or something to give the conclusion? Thanks.

REPLY [2 votes]: In the proof of the Yoneda Lemma we show that natural transformations $\text{Hom}(X,-)\to K(-)$ are in bijection with elements of $KX$. An element $e\in KX$ corresponds to the transformation $\eta$ which sends $g\in\text{Hom}(X,Y)$ to $(Kg)(e)\in KY$.
In particular, if $K(-)=\text{Hom}(Y,-)$, then an arrow $f\in\text{Hom}(Y,X)$ corresponds to the natural transformation 
$$f^*:\text{Hom}(X,-)\to\text{Hom}(Y,-)\\ g\mapsto gf$$ 
sending $g\in\text{Hom}(X,Z)$ to $(Kg)(f)=\text{Hom}(Y,g)(f)=gf\in\text{Hom}(Y,Z)$.
It is trivial to show that $f^*$ is injective for each object $Z$ iff $f$ is epic, and it's also not difficult to show that $f^*$ is always surjective iff $f$ is a section (i.e. it has a left inverse).
Corollary: If $\text{Hom}(X,-)\cong\text{Hom}(Y,-)$, then $X\cong Y$.
Proof: A natural isomorphism $\sigma:\text{Hom}(X,-)\cong\text{Hom}(Y,-)$ is induced by $\sigma(1_X)=:f\in\text{Hom}(Y,X)$, so $\sigma=f^*$. Since $f^*$ is an isomorphism, it is bijective, hence $f$ is an epic and also a section, which implies that $f$ is an isomorphism.