What use is the Yoneda lemma?
Although I know very little category theory, I really do find it a pretty branch of mathematics and consider it quite useful, especially when it comes to laying down definitions and unifying diverse concepts. Many of the tools of category theory seem quite useful to me, such as Mitchell's embedding theorem, which allows one to prove theorems in any abelian category using diagram chasing. It lets me the ability to treat lots of objects I would not otherwise feel comfortable with as if they were modules over some ring; in essence, I feel like I've gained some tools from it.
However, I simply cannot see where to apply the Yoneda lemma to some useful end. This is not to say that I don't think it is a very pretty lemma, which I do, or that I do not appreciate the aesthetic of being able to study an object in a category by looking at the morphisms from that object, which I also do. And I do find it useful to consider the modules over a ring rather than the ring itself when studying that ring, or to treat groups as subgroups of permutation groups, which are the two applications I've heard of the Yoneda lemma. The problem is that I already knew these things could be done. Essentially, I don't feel like I've gained any tools from the Yoneda lemma.
My question is this: how can the Yoneda lemma be applied to make problems more approachable, other than in cases like those I have listed above which can easily be treated without a general result like the Yoneda lemma? Basically, what new tools does it give us?
Solution 1:
Some elaboration on Dylan Moreland's comment is in order. Consider the gadget $\text{GL}_n(-)$. What sort of gadget is this, exactly? To every commutative ring $R$, it assigns a group $\text{GL}_n(R)$ of $n \times n$ invertible matrices over $R$. But there's more: to every morphism $R \to S$ of commutative rings, it assigns a morphism $\text{GL}_n(R) \to \text{GL}_n(S)$ in the obvious way, and this assignment satisfies the obvious compatibility conditions. That is, $\text{GL}_n(-)$ defines a functor $$\text{GL}_n(-) : \text{CRing} \to \text{Grp}.$$
Composing this functor with the forgetful functor $\text{Grp} \to \text{Set}$ gives a functor which turns out to be representable by the ring $$\mathbb{Z}[x_{ij} : 1 \le i, j \le n, y]/(y \det_{1 \le i, j \le n} x_{ij} - 1).$$
Now, this ring itself only defines a functor $\text{CRing} \to \text{Set}$. What extra structure do we need to recover the fact that we actually have a functor into $\text{Grp}$? Well, for every ring $R$ we have maps $$e : 1 \to \text{GL}_n(R)$$ $$m : \text{GL}_n(R) \times \text{GL}_n(R) \to \text{GL}_n(R)$$ $$i : \text{GL}_n(R) \to \text{GL}_n(R)$$
satisfying various axioms coming from the ordinary group operations on $\text{GL}_n(R)$. These maps are all natural transformations of the corresponding functors, all of which are representable, so by the Yoneda lemma they come from morphisms in $\text{CRing}$ itself. These morphisms endow the ring above with the extra structure of a commutative Hopf algebra, which is equivalent to endowing its spectrum with the extra structure of a group object in the category of schemes, or an affine group scheme.
In other words, in a category with finite products, saying that an object $G$ has the property that $\text{Hom}(-, G)$ is endowed with a natural group structure in the ordinary set-theoretic sense is equivalent to saying that $G$ itself is endowed with a group structure in a category-theoretic sense. I discuss these ideas in some more detail, using a simpler group scheme, in this blog post.
Solution 2:
I think one of the classical examples of the Yoneda lemma in action was Serre's observation that "cohomology operations" (i.e. natural transformations $H^n(X; G) \to H^m(X; H)$ for some $n, m, G, H$) are entirely classified by elements in the cohomology $H^m( K(G, n); H)$ (in view of the fact that Eilenberg-MacLane spaces represent cohomology on the homotopy category). This is not a deep observation once you believe the Yoneda lemma, but it means that one can determine what all possible cohomology operations are by computing the cohomology rings of these spaces $K(G, n)$ (which Serre and others did using the spectral sequence).
This led to the development of the Steenrod algebra, which is the algebra $\mathcal{A}{}{}{}{}$ of all "stable" cohomology operations in mod 2 cohomology; as a result of Serre's observation and some computation, $\mathcal{A}$ can be explicitly written down via generators and relations. The use of algebraic methods with $\mathcal{A}$ to solve geometric problems is huge, a lot of which has to do with the Adams spectral sequence; this essentially lets one compute (in some favorable cases) stable homotopy classes of maps in terms of cohomology.
Serre's observation is literally a consequence of the statement of the Yoneda lemma, but I think the "philosophy" of the Yoneda lemma is also very important; namely, one can characterize an object by how other objects map into it. In algebraic geometry, for instance, many complicated schemes (such as the Hilbert scheme) are literally defined in terms of the functor they represent. This has the benefit that one can reason about an object without necessarily knowing much about its "internal" structure (which may be prohibitively complex); for instance, one can talk about the tangent space to the Hilbert scheme (or any scheme defined by a moduli problem) in a very concrete way, in terms of that moduli problem evaluated on $\mathrm{Spec} k[\epsilon]/\epsilon^2$.