TITLE: Natural isomorphism of hom functors imply isomorphism of objects
QUESTION [6 upvotes]: Let $\mathcal{C}$ be a category. Let $A$ and $B$ be objects of $\mathcal{C}$. If we have an isomorphism natural in $-$: $\mathcal{C}(-,A)\cong\mathcal{C}(-,B)$; does that imply $A\cong B$?

REPLY [4 votes]: Yes (as the other answer points out). But here's a proof that does not invoke Yoneda.
It is given that $\mathcal C(-, A) \cong \mathcal C(-, B)$ naturally in $-$.
Plugging in $A$: $\mathcal C(A, A) \cong \mathcal C(A, B)$ naturally in $A$.
But $1_A$ is an element of $\mathcal C(A, A)$, and is an isomorphism, and the natural isomorphism from $\mathcal C(A, A)$ to $\mathcal C(A, B)$ must map this to an isomorphism in $\mathcal C(A, B)$, which means $A \cong B$.
To prove that last claim, let $\alpha \colon \mathcal C(-, A) \Rightarrow \mathcal C(-, B)$ be a natural isomorphism, and $\alpha^{-1} \colon \mathcal C(-,B) \to \mathcal C(-, A)$ its inverse. Let $f = \alpha_A(1_A) \in \mathcal C(A, B)$. The naturality square is then as given below.
$\require{AMScd}$
\begin{CD} 
\mathcal C(A, A) @>{\alpha_A}>> \mathcal C(A, B)\\
@A(-\circ f)AA @AA(- \circ f)A \\
\mathcal C(B,A) @>>{\alpha_B}> \mathcal C(B, B)
\end{CD}
Here $- \circ f$ is the function $\mathcal C(f, A)$ (and also $\mathcal C(f, B)$) whose action is to take a morphism from $\mathcal C(A,A)$ (or $\mathcal C(A,B)$) and compose it with $f$.
We must find an inverse $g \colon B \to A$ for $f$, and an obvious choice is $g = \alpha_B^{-1}(1_B) \in \mathcal C(B, A)$. So now we just need to verify that these are inverses.
First, observe from the naturality square that
\begin{equation*}
\alpha_A \circ (- \circ f) = (- \circ f) \circ \alpha_B = (\alpha_B(-)) \circ f.
\end{equation*}
Applying these functions to $g$ (which is an element of $\mathcal C(B, A)$), we get \begin{align*}
\alpha_A(g \circ f) &= \alpha_B(g) \circ f\\
&= 1_B \circ f\\
&= f.
\end{align*}
Then $g \circ f = \alpha_A^{-1}(f) = 1_A$.
Similarly, $f \circ g = 1_B$.