Yoneda’s Lemma says that an object is determined by how every other object maps into it. Let C\mathcal{C} be a locally small category, let A∈CA \in \mathcal{C}, and let F:C→SetF : \mathcal{C} \to \mathbf{Set} be a functor. This is the covariant version; the contravariant form uses F:Cop→SetF : \mathcal{C}^{op} \to \mathbf{Set}.

The lemma gives a natural isomorphism:

Nat⁡(Hom⁡C(A,−),F)≅F(A).\operatorname{Nat}(\operatorname{Hom}_{\mathcal{C}}(A, -), F) \cong F(A).

The Map

Given a natural transformation η:Hom⁡C(A,−)⇒F\eta : \operatorname{Hom}_{\mathcal{C}}(A, -) \Rightarrow F, send it to Evaluating at idA\mathrm{id}_A picks out the element of F(A)F(A) represented by η\eta.

Φ(η)=ηA(idA)∈F(A).\Phi(\eta) = \eta_A(\mathrm{id}_A) \in F(A).

This defines a function

Φ:Nat⁡(Hom⁡C(A,−),F)→F(A).\Phi : \operatorname{Nat}(\operatorname{Hom}_{\mathcal{C}}(A, -), F) \to F(A).

Now go the other way. Given x∈F(A)x \in F(A), define a natural transformation Ψ(x):Hom⁡C(A,−)⇒F\Psi(x) : \operatorname{Hom}_{\mathcal{C}}(A, -) \Rightarrow F by specifying its component at each object BB:

Ψ(x)B(f)=F(f)(x)for f:A→B.\Psi(x)_B(f) = F(f)(x) \qquad \text{for } f : A \to B.

Naturality

We need to check that Ψ(x)\Psi(x) is natural. For a morphism g:B→Cg : B \to C, the naturality square asks for

F(g)(Ψ(x)B(f))=Ψ(x)C(g∘f).F(g)(\Psi(x)_B(f)) = \Psi(x)_C(g \circ f).

Using the definition of Ψ(x)\Psi(x) and functoriality of FF,

F(g)(Ψ(x)B(f))=F(g)(F(f)(x))=F(g∘f)(x)=Ψ(x)C(g∘f).F(g)(\Psi(x)_B(f)) = F(g)(F(f)(x)) = F(g \circ f)(x) = \Psi(x)_C(g \circ f).

So Ψ(x)\Psi(x) is indeed a natural transformation.

The Inverses

First, start with x∈F(A)x \in F(A). Then

Φ(Ψ(x))=Ψ(x)A(idA)=F(idA)(x)=x.\Phi(\Psi(x)) = \Psi(x)_A(\mathrm{id}_A) = F(\mathrm{id}_A)(x) = x.

So Φ∘Ψ=idF(A)\Phi \circ \Psi = \mathrm{id}_{F(A)}.

Now start with a natural transformation η\eta. Let

x=Φ(η)=ηA(idA).x = \Phi(\eta) = \eta_A(\mathrm{id}_A).

For any f:A→Bf : A \to B, naturality of η\eta for the morphism ff gives

F(f)(ηA(idA))=ηB(f∘idA)=ηB(f).F(f)(\eta_A(\mathrm{id}_A)) = \eta_B(f \circ \mathrm{id}_A) = \eta_B(f).

But the left side is exactly Ψ(x)B(f)\Psi(x)_B(f), so

Ψ(Φ(η))B(f)=ηB(f)\Psi(\Phi(\eta))_B(f) = \eta_B(f)

for every object BB and every morphism f:A→Bf : A \to B. Hence Ψ∘Φ\Psi \circ \Phi is the identity.

Therefore

Nat⁡(Hom⁡C(A,−),F)≅F(A).\operatorname{Nat}(\operatorname{Hom}_{\mathcal{C}}(A, -), F) \cong F(A).

This is Yoneda’s Lemma.