An object is completely determined, up to isomorphism, by the pattern of every arrow pointing into it from everywhere else in the category — the Yoneda lemma turns that observation into a precise bijection, and its corollary that the embedding A↦Hom(−,A) is fully faithful is the single fact that makes "study objects by their maps" a rigorous method rather than a slogan.
IntuitionAn object is what it does
To know an electronic component completely, you do not need to look inside it — it is enough to know, for every possible surrounding circuit, exactly how the component could be wired into it. In a category, the analogous fact is that an object A is completely pinned down, up to isomorphism, by knowing Hom(X,A) — the set of ways to map intoA — for every single object X at once.
Interactive diagram of a network of objects with all morphisms pointing toward one distinguished object A.
Every arrow from every object X into A, collected at once — the data the presheaf hA records.
UndergraduateRepresentable presheaves
Definition: The presheaf hA
For an object A of C, the representable presheafhA=HomC(−,A) assigns to every object X the set hA(X)=HomC(X,A), and to every morphism g:X→Y the precomposition map hA(g):Hom(Y,A)→Hom(X,A),f↦f∘g. This makes hA a functor Cop→Set — contravariant, because composing on the right with g reverses the direction of the assignment.
hA(X)=HomC(X,A)
Given any functor F:Cop→Set, the Yoneda lemma says the natural transformations from hA to F are in bijection with the elements of the single set F(A): Nat(HomC(−,A),F)≅F(A). The bijection is built from two maps, Φ and Ψ, going in opposite directions.
Nat(HomC(−,A),F)≅F(A)
The two directions of the Yoneda bijection
Map
Direction
Formula
Φ
Nat(hA,F)→F(A)
Φ(η)=ηA(1A)
Ψ
F(A)→Nat(hA,F)
Ψ(x)X(f)=F(f)(x)
AdvancedThe bijection, proved step by step
Φ evaluates a natural transformation η:hA⇒F at the most economical possible input — the identity 1A∈hA(A)=Hom(A,A) — producing the element ηA(1A) of F(A). In the reverse direction, Ψ starts from an element x∈F(A) and reconstructs, for every object X and every f∈Hom(X,A), an element of F(X) by pushing x forward along F(f): Ψ(x)X(f)=F(f)(x). Naturality of η is exactly what makes Ψ(Φ(η)) recover η, and this is what the next theorem proves in full.
For every functor F:Cop→Set and object A, the maps Φ and Ψ above are mutually inverse, so Nat(HomC(−,A),F)≅F(A) as a genuine bijection of sets.
Why is it true?
This is what lets category theorists trade an infinite, hard-to-grasp family of natural transformations for a single concrete element of F(A) — every question about maps out of the representable presheaf hA collapses to a question about one set.
Proof
We first check Φ(Ψ(x))=x for every x∈F(A). Unwind the definitions: Ψ(x)A(1A)=F(1A)(x) by the formula for Ψ, specialized to X=A, f=1A. Since F is a functor, it sends the identity morphism 1A to the identity function on F(A), so F(1A)(x)=x. Therefore Φ(Ψ(x))=Ψ(x)A(1A)=x, exactly as required — this direction uses nothing but the functor identity law.
Now we check the harder direction, Ψ(Φ(η))=η for every natural transformation η:hA⇒F. Both sides are natural transformations hA⇒F, so it suffices to show their components agree at every object X and every element f∈hA(X)=Hom(X,A).
Unwind Ψ(Φ(η))X(f) using the formula for Ψ with x:=Φ(η)=ηA(1A): this equals F(f)(ηA(1A)).
Now invoke naturality of η itself, in the form ηY(f∘g)=F(g)(ηX(f)) with g:=f:X→A and the other variable set to A: taking f:=1A∈hA(A) in that naturality square gives exactly ηX(1A∘f)=F(f)(ηA(1A)), i.e. ηX(f)=F(f)(ηA(1A)), since 1A∘f=f.
Combining the last two displays: Ψ(Φ(η))X(f)=F(f)(ηA(1A))=ηX(f). Since X and f were arbitrary, the two natural transformations agree everywhere, so Ψ(Φ(η))=η. Together with the first paragraph, Φ and Ψ are mutually inverse bijections.
The Yoneda embedding y:C↪[Cop,Set], y(A)=hA, is fully faithful: for every A,B∈C, Nat(hA,hB)≅HomC(A,B), and this bijection sends a morphism f:A→B to the natural transformation hA⇒hB given by postcomposition with f.
Why is it true?
Full faithfulness is exactly the guarantee that the translation A↦hA loses no information whatsoever: distinct morphisms of C become distinct natural transformations, and every natural transformation between two representable presheaves comes from an actual morphism of C, which is what justifies studying objects purely through the maps into them.
Proof
Apply the Yoneda lemma with the target functor set to F:=hB. The lemma gives a bijection Nat(hA,hB)≅hB(A), and unwinding the definition hB(A)=HomC(A,B) gives exactly Nat(hA,hB)≅HomC(A,B).
It remains to identify what morphism of C a natural transformation η:hA⇒hB corresponds to under this bijection, and to check it is postcomposition. By the formula for Φ, η corresponds to the element Φ(η)=ηA(1A)∈Hom(A,B); call this morphism f.
Now use Ψ(Φ(η))=η (the theorem above, applied with F=hB) to recover every component of η from f: for any object X and any g∈hA(X)=Hom(X,A), Ψ(f)X(g)=hB(g)(f). Unwinding the contravariant action of hB on morphisms — precomposition — gives hB(g)(f)=f∘g. So ηX(g)=f∘g: every component of η is literally postcomposition with f.
Because Φ and Ψ are mutually inverse bijections (proved above) and postcomposition with f is exactly Ψ(f), the assignment sending f to postcomposition with f is itself a bijection Hom(A,B)→Nat(hA,hB) — which is precisely the statement that y is fully faithful.
UndergraduateApplications: moduli spaces and continuation-passing style
In algebraic geometry, a moduli space for some kind of geometric object (curves, vector bundles, ...) is defined by first writing down a functor F sending a test object X to the set of families of that geometric structure over X; the moduli space, if it exists, is an object M representing F, i.e. F≅hM. The Yoneda embedding being fully faithful is exactly why such an M, when it exists, is unique up to a unique isomorphism — Grothendieck's "functor of points" philosophy treats every scheme as nothing more than its representable presheaf. In functional programming, the type ∀r.(a→r)→r of continuation-passing style functions is, by construction, the type of natural transformations from the covariant Hom-functor Hom(a,−) to the identity functor; the (covariant, dual) Yoneda lemma says exactly ∀r.(a→r)→rconga, matching the everyday fact that a CPS-transformed value is nothing more than a repackaged ordinary value.
Example: Checking the bijection on a two-object category
Let C have two objects 0,1, identities, and one non-identity morphism ι:0→1. Take A=1 and F=h1 itself. Verify by direct enumeration that Nat(HomC(−,A),F)≅F(A) for this F, i.e. that Nat(h1,h1) has exactly as many elements as h1(1)=Hom(1,1).
Solution
First compute h1 explicitly: h1(0)=Hom(0,1)={ι} (one element) and h1(1)=Hom(1,1)={11} (one element, since C has no other morphism ending at 1 from 1). So F(A)=h1(1) has exactly one element, 11.
By the Yoneda lemma, Nat(h1,h1) should also have exactly one element. Check this directly: a natural transformation η:h1⇒h1 needs components η0:{ι}→{ι} and η1:{11}→{11}. Each of these sets has one element, so there is exactly one possible function at each object — the identity function — giving exactly one candidate η overall.
One must still check this candidate satisfies naturality (it automatically does here, since the naturality square forces η0(ι)=η0(11∘ι)=h1(ι)(η1(11))=h1(ι)(11)=11∘ι=ι, which holds since there is only one available value anyway).
So Nat(h1,h1)={idh1} has exactly one element, matching F(A)={11} having exactly one element — the bijection Nat(HomC(−,A),F)≅F(A) holds concretely, and Φ(idh1)=(idh1)1(11)=11 recovers the single element directly.
Example: Continuation-passing style as Yoneda
In a functional language, a value of type ∀r.(a→r)→r is a function k that, given any way of consuming an a (a function a→r), produces an r. Show k is completely determined by, and recovers, an ordinary value of type a.
Solution
Identify C=Set (or the category of types and functions), fix the object a, and let F=Id be the identity functor. A value k:∀r.(a→r)→r is, by definition, a choice of function kr:(a→r)→r for every type r — exactly a natural transformation from the covariant functor Hom(a,−) to Id (naturality here is exactly the parametricity that "for all r" enforces).
Apply Φ from the (covariant, dual) Yoneda lemma: Φ(k)=k(ida) evaluates k at r:=a on the identity function ida:a→a, producing an ordinary value of type a. This is the direction "continuation determines a value".
Apply Ψ in reverse: given a value n:a, define Ψ(n)r(g)=g(n) for every r and every g:a→r — that is, Ψ(n)r(g)=g(n), the standard CPS-transform of a value: "the continuation that, given any consumer g, hands n to it".
By the Yoneda lemma applied to F=Id, these two constructions are mutually inverse: Φ(Ψ(n))=Ψ(n)a(ida)=ida(n)=n recovers the value, and Ψ(Φ(k))=k by the naturality argument from the theorem above, specialized to F=Id. Hence ∀r.(a→r)→rconga, confirming that continuation-passing style values carry exactly the information of an ordinary value, no more and no less.
What does Φ do to a natural transformation η:hA⇒F?
The uniqueness step in Ψ(Φ(η))=η relies on which property of η?
In continuation-passing style, the type ∀r.(a→r)→r is naturally isomorphic to which type?
The Yoneda embedding being fully faithful lets us conclude that a representing object M for a moduli functor F is: