Equivalence of definitions of "group object" using the Yoneda lemma I have just started learning category theory and I am trying to get an understanding of how to think about the Yoneda lemma. Obvious applications are clear to me (Yoneda embedding is full and faithful,  for example), but I want to understand how one uses it in practical mathematics. In particular, I have the following question:
How exactly does Yoneda imply that the definition of a group object in a category with finite products (as an object $G$ together with a functor from that category to the category of groups such that the composite of it with the forgetful functor to the category of sets is represented by $G$) is equivalent to requiring the natural diagrams that give the group axioms to commute?
I am really searching for some intuition. Thanks for any help.
 A: Here is a way to see it. Let $\mathcal C $ be a category with finite products. By Yoneda, the functor $\mathfrak h \colon \mathcal C \to \widehat{\mathcal C}, c \mapsto \hom(-,c)$ is fully faithful. Moreover, it preserves finite products by definition. So

Lemma 1. An object $g$ in $\mathcal C$ is a group object with multiplication $m$, inverse $i$ and unit $e$ if and only if $\mathfrak h (g) = \hom(-,g)$ is a group object in $\widehat{\mathcal C}$ with mutiplication $\mathfrak h(m)$, inverse $\mathfrak h(i)$ and unit $\mathfrak h(e)$.

But $\widehat{\mathcal C}$ is a preasheaf category: if you want to check the commutativity of a diagram in it, just check the commutativity in each component. Which gives

Lemma 2. An object $G$ in $\widehat{\mathcal C}$ is a group object with multiplication $m$, inverse $i$ and unit $e$ if and only if for every $c \in \mathcal C$, $G(c)$ is a group (in the set theoretic sense) with multiplication $m(c)$, inverse $i(c)$ and unit $e(c)$.

Put the two lemma together to get that 

An object $g$ in $\mathcal C$ is a group object with multiplication $m$, inverse $i$ and unit $e$ if and only if for every $c \in \mathcal C$, $\hom(c,g)$ is a group with mutiplication $(x,y) \mapsto m \circ \langle x,y\rangle$, inverse $x \mapsto i\circ x$ and unit the unit $e \circ (c \to 1)$.

I let you see that the last condition is exactly the data of a functor ${\mathcal C}^{\rm op} \to \mathsf{Grp}$ factorizing $\hom(-,g)$ through the forgetful functor from groups to sets.
