TITLE: Why do all objects have enough generalized elements?
QUESTION [6 upvotes]: I understand why in the category of sets two parallel morphisms $f, g: A \rightarrow B$ are identical iff for each element $x: 1 \rightarrow A$ it holds that $f\circ x = g \circ x$.
Awodey on p. 36 of Category Theory asks (as an exercise), why in any category two parallel morphisms $f, g: A \rightarrow B$ are identical iff for each generalized element $x: X \rightarrow A$ it holds that $f\circ x = g \circ x$.
Could someone please give me a hint how to prove this?

REPLY [2 votes]: There should be a way to see this using Yoneda's embedding, too; I post it because it has been mentioned in the comments.
Fix any category $\mathbf C$ and two arrows $f,g:C\to C'$. The Yoneda embedding $y:\mathbf C\to \mathbf{Set}$ is a fully faithful functor, hence $f=g$ if and only if $y(f)=y(g)$. By definition, $y(f):\mathbf C(-,C)\to \mathbf C(-,C')$ is the natural transformation whose component $y(f)_D:\mathbf C(D,C)\to \mathbf C(D,C')$, for every object $D$, sends any $h:D\to C$ to $f\circ h$; and similarly for $y(g)$. But $y(f)=y(g)$ if and only if $y(f)_D=y(g)_D$ for every object $D$, that is, $f\circ h=g\circ h$ for every generalized element $h:D\to C$.
Yoneda's lemma asserts that two natural transformations $\alpha,\beta$ from $\mathbf C(-,C)$ to any functor $\mathbf C\to \mathbf{Set}$ coincide  if and only if $\alpha_C(\operatorname{id}_C)=\beta_C(\operatorname{id}_C)$; thus, it is a way of seeing that $y(f)=y(g)$ if and only if $f\circ \operatorname{id}_C=g\circ \operatorname{id}_C$.