Can someone explain the Yoneda Lemma to an applied mathematician?

Roughly speaking, the Yoneda lemma says that one can recover an object $X$ up to isomorphism from knowledge of the hom-sets $\text{Hom}(X, Y)$ for all other objects $Y$. Equivalently, one can recover an object $X$ up to isomorphism from knowledge of the hom-sets $\text{Hom}(Y, X)$.

As I have said before on math.SE, there is a meta-principle in category theory that to understand something for all categories, you should first understand it for posets, regarded as categories where $a \le b$ if and only if there is a single arrow $a \to b$, and otherwise there are no morphisms from $a$ to $b$. For posets, Yoneda's lemma says that an object is determined up to isomorphism by the set of objects less than or equal to it (equivalently, the set of objects greater than or equal to it). In other words, it is determined by a Dedekind cut! In other other words, Yoneda's lemma for posets says the following:

$a \le b$ if and only if for all objects $c$ we have $c \le a \Rightarrow c \le b$.

This is a surprisingly useful idea in real analysis. More generally it leads to the idea that Yoneda's lemma, among other things, embeds a category into a certain "completion" of that category: in fact the standard contravariant Yoneda embedding embeds a category into its free cocompletion, the category given by "freely adjoining colimits."

As far as examples go, it turns out that in many categories one can restrict attention to a few specific objects $Y$. For example:

  • In $\text{Set}$ one can completely recover an object $S$ from $\text{Hom}(1, S)$.
  • In $\text{Grp}$ one can completely recover an object $G$ from $\text{Hom}(\mathbb{Z}, G)$. This is because a homomorphism from $\mathbb{Z}$ is freely determined by where it sends $1$, and one can recover the multiplication because $\mathbb{Z}$ is naturally a cogroup object, which is equivalent to the claim that $\text{Hom}(\mathbb{Z}, G)$ naturally carries a group structure (that of $G$).
  • In $\text{CRing}$ (the category of commutative rings) one can completely recover an object $R$ from $\text{Hom}(\mathbb{Z}[x], R)$. The story is similar to that above; it is explained in this blog post. Geometrically this means that one can completely recover an affine scheme $\text{Spec } R$ from $\text{Hom}(\text{Spec } R, \mathbb{A}^1(\mathbb{Z}))$, the ring of functions on it.
  • In $\text{Top}$ (the category of topological spaces) one can completely recover an object $X$ from $\text{Hom}(1, X)$ (the points of $X$) and $\text{Hom}(X, \mathbb{S})$, where $\mathbb{S}$ is the Sierpinski space. The latter precisely gives you the open sets of $X$, and together with knowledge of the composition map $\text{Hom}(1, X) \times \text{Hom}(X, \mathbb{S}) \to \text{Hom}(1, \mathbb{S})$ you can recover the knowledge of which points sit inside which open sets.

I think there are two important questions.

A. Why does it work?

When you have an object $A$, then you may think of any object $X$ as of a "perspective" from which the object $A$ is seen. Then a morphism $X \rightarrow A$ corresponds to a particular point of view from a given perspective $X$. In this sense, ordinary sets have one global perspective (a singleton, or a "terminal" set) that describes all aspects of a particular set --- namely morphisms $1 \rightarrow A$ correspond to the elements of $A$, and sets having the same elements are "the same". On the contrary in a category like $\mathbf{Grp}$, the global perspective says exactly nothing about objects.

Yoneda lemma works, because (in general) watching objects from all perspectives give you all (important, that is external) information about the objects. That is: $$\mathit{hom}(-, A) \approx \mathit{hom}(-, B) \Rightarrow A \approx B$$

B. What does it mean?

Almost everything, but I like, and do think is the most important, the following. You may think of a functor $F \colon \mathbb{C}^{op} \rightarrow \mathbf{Set}$ as of a kind of a generalized algebra over signature $\mathbb{C}$ --- objects of $\mathbb{C}$ correspond to "sorts" whereas morphisms to "operations"; then functor $F$ gives just an interpretation for every "sort" (a set), and for every morphism (a function between sets); it is easy to see that then natural transformations between such functors are generalizations of algebra homomorphisms in the usual sense.

Yoneda lemma says that every category can be thought as a full subcategory of generalized algebras over generalized signatures. Particularly, categories are given as merely generalized graphs satisfying some equations; thanks to Yoneda lemma, we may think of these abstract nodes (objects) as of "real structures" (algebras), and of edges (morphisms), as of "real functions" preserving that structures.

Put it another way. The standard mathematics starts from "elements" formed into structures. This is the "internal view". Then we define "mappings" that preserve structures, and we are (mostly) willing to forget about specific elements --- what becomes important is how these structures look from the perspective of "mappings" (for example, we do not want to distinguish isomorphic structures, despite the fact that their "elements" may be far different). This is the "external view".

So the standard mathematics starts from the "internal view" and then switches to the "external view", whilst category theory starts from the "external view" --- and due to Yoneda lemma --- we know that the "internal view" exists as well.

One may also say that the difference between the standard mathematics and category theory is just like the difference between Aristotelian physics and Galilean physics. Take for example the concept of velocity. In Aristotelian physics we may say that an object moves at a certain velocity (the concept of a velocity is an internal property of an object). By contrast, such a statement does not make any sense in Galilean physics --- in the later we may only say that an object moves at a certain velocity with respect to another object (the concept of a velocity is an external aspect of some objects, it is not a property of a single object). However, in Galilean physics, we may "internalize" the concept of velocity by saying what are the velocities of an object in respect to all possible objects (such a collection of velocities indexed by objects would be its internal property).


I view the Yoneda lemma as a generalization of Cayleys theorem. http://en.wikipedia.org/wiki/Cayley%27s_theorem . This interpretation is useful if you are somewhat comfortable with groups.

Suppose we are given a group $G$, e.g. $\mathbb{Z}/{3\mathbb{Z}}$. Then we can study how the elements of this group act on itself, via left multiplication. For example, multiplying all elements in the example group by the element $\overline{2}$ does the following to the elements

$\overline{0}\mapsto \overline{2}$

$\overline{1}\mapsto \overline{0}$

$\overline{2}\mapsto \overline{1}$

Note that this map is a permutation of the elements of the group (i.e. we attached an permutation of the group elements to the element $\overline{2}$). What we construct here is a homomorphism $G\rightarrow S_{G}$. The group on the right hand side is the group of all permutations on elements of $G$. This map is injective. The first isomorphism theorem now shows that $G$ is isomorphic to a subgroup of $S_G$. Hence all groups are subgroups of symmetric groups. This is Cayley's theorem.

The Yoneda lemma shows that this also works for categories. Any subcategory can be viewed as a subcategory of presheaves. Presheaves play the role of permutations.