advanced34 min studyLesson 532 in Mathematics

Functors and natural transformations

Preserve categorical structure and test compatibility across every arrow of a diagram.

On this page

What you’ll understand

  • Check preservation of identities and composition by a proposed functor.
  • Write and solve a naturality square with all components correctly typed.
  • Distinguish a componentwise family of maps from a natural transformation.

A functor translates a whole category, including its permitted transformations. A natural transformation compares two such translations in a way that respects every original arrow. The word natural therefore imposes an equation, rather than expressing aesthetic approval. Small diagram categories let us solve those equations explicitly. We will see both a family that fails the compatibility test and a familiar coordinate operation whose compatibility follows from one general calculation.

Functoriality includes arrows

A covariant functor F:C→DF:\mathcal C\to\mathcal D chooses an object F(A)F(A) for every object and an arrow F(f):F(A)→F(B)F(f):F(A)\to F(B) for every f:A→Bf:A\to B. It must preserve identity arrows and composites. Giving only an object assignment is insufficient: choosing dimensions of vector spaces, for example, does not by itself specify what should happen to all linear maps. A functor can identify different objects or different arrows, but any identifications must respect the composition laws.

The opposite category reverses arrows and reverses their composition order. A contravariant functor on C\mathcal C is an ordinary covariant functor on Cop\mathcal C^{\mathrm{op}}. For instance, fixing an object AA makes C(A,−)\mathcal C(A,-) covariant by postcomposition, whereas C(−,A)\mathcal C(-,A) is contravariant by precomposition. Reading source and target types before writing a formula prevents these two Hom constructions from being interchanged.

F(idA)=idF(A),F(g∘f)=F(g)∘F(f).F(\mathrm{id}_A)=\mathrm{id}_{F(A)},\qquad F(g\circ f)=F(g)\circ F(f).
A functor carries a composable path to the corresponding composable path in its target category.↔ Scroll wide equations horizontally.

Naturality is a simultaneous compatibility condition

For parallel functors F,G:C→DF,G:\mathcal C\to\mathcal D, a natural transformation α:F⇒G\alpha:F\Rightarrow G consists of components αA:F(A)→G(A)\alpha_A:F(A)\to G(A). For every arrow f:A→Bf:A\to B, following the component and then G(f)G(f) must agree with following F(f)F(f) and then the component at BB. Choosing components independently usually fails. Even when the component sets have the same cardinality, naturality can force particular values or prohibit a family altogether.

When the source is an arrow category with just two objects and one nonidentity arrow, a single square controls naturality. For a larger category, all arrows are required; it is enough to check generators only after their relations and the functor laws are established. Natural transformations compose componentwise. If every component is an isomorphism, their inverses are also natural, as follows by multiplying the naturality equation by inverses on the appropriate sides.

G(f)∘αA=αB∘F(f),f:A→B.G(f)\circ\alpha_A=\alpha_B\circ F(f),\qquad f:A\to B.
Both sides are arrows from F(A) to G(B); checking these endpoint types fixes the order.↔ Scroll wide equations horizontally.

A construction can commute with every function

Consider the functor QQ on Set that sends XX to X×XX\times X and sends a function ff to its coordinatewise application. The swap maps τX(x1,x2)=(x2,x1)\tau_X(x_1,x_2)=(x_2,x_1) form a natural transformation from QQ to itself. Applying a function to both coordinates and swapping produces exactly the same pair as swapping first and applying the function afterward. This argument works for arbitrary sets and functions, including noninjective maps and empty sets.

Testing a few finite functions can reveal a mistake, but it cannot replace the general calculation establishing naturality on Set. By contrast, in a genuinely finite source category, enumerating every component and every arrow is a complete test. The distinction matters in applications: a coordinate-dependent recipe may accidentally commute with a restricted family of maps while failing for a larger family. The category of allowed transformations is part of the claim being made.

Q(f)(τX(x1,x2))=(f(x2),f(x1))=τY(Q(f)(x1,x2)).Q(f)\bigl(\tau_X(x_1,x_2)\bigr)=(f(x_2),f(x_1))=\tau_Y\bigl(Q(f)(x_1,x_2)\bigr).
The equality proves the swap is natural for every function f from X to Y.↔ Scroll wide equations horizontally.

Solve a finite naturality square

The source category has objects 0,10,1 and one nonidentity arrow u:0→1u:0\to1. Let F(0)={a,b}F(0)=\{a,b\}, F(1)={0,1}F(1)=\{0,1\}, and let F(u)F(u) be constant zero. Let G(0)={∗}G(0)=\{*\}, G(1)={L,R}G(1)=\{L,R\}, and G(u)(∗)=LG(u)(*)=L. Count natural transformations from FF to GG.

  1. The component α0\alpha_0 is forced because its target is a singleton: both aa and bb go to ∗*. Before imposing naturality, there are four functions available for α1:{0,1}→{L,R}\alpha_1:\{0,1\}\to\{L,R\}.

  2. Along the route using G(u)G(u), either element of F(0)F(0) reaches LL. Along the other route, either element first reaches zero, then reaches α1(0)\alpha_1(0). Hence naturality requires exactly α1(0)=L\alpha_1(0)=L.

  3. The value at one is unrestricted, since one is outside the image of F(u)F(u). Choosing it to be LL or RR gives two transformations. Neither is a natural isomorphism because the component from a two-element set to a singleton is not invertible.

α1(0)=L,α1(1)∈{L,R},∣Nat⁡(F,G)∣=2.\alpha_1(0)=L,\qquad \alpha_1(1)\in\{L,R\},\qquad |\operatorname{Nat}(F,G)|=2.
The compatibility square constrains only the image of the source arrow.↔ Scroll wide equations horizontally.
The result

Two of the four componentwise choices extend to natural transformations; neither is a natural isomorphism.

Explore the model

Interactive lab

Interactive lab · modular

Check a commuting translation square

Pause and Reset, then set modulus to 5 and additive step to 2. After two Steps the residue is 4. Define a separate translation T(r)=r+1 modulo 5 on paper. Predict T(4+2) and T(4)+2; both reduce to 2. Verify the orbit additions in the instrument. This is a commuting square for translations in a cyclic action, not a display of all natural transformations. For a fresh run use Pause, Reset, then set both controls; editing one control keeps the old clock.

Check a commuting translation squareAddition modulo m starts at zero: rₙ = na mod m. Playback advances two additions per second. The orbit has period m/gcd(m,a), including period one for a = 0. This is not a cryptographic security test or a primality algorithm. Current readings: Residue r0: 0; Orbit period · m/gcd(m,a): 12; Distinct residues visited: 1 of 12. All parameters are adjustable with the labeled controls below.Repeated addition modulo 12: the current residue is 0, and the orbit period is 12.01234567891011+ 5mod 12An additive orbitn = 0rₙ = 0Period = 12Cycle starts at 0:0 → 5 → 10 → 3 →8 → 1 → 6 → 11 →4 → 9 → 2 → 7 → 0Exact residues · two additions per second
Additive orbitCurrent residue / next edge
Residue r0
0
Orbit period · m/gcd(m,a)
12
Distinct residues visited
1 of 12
t = 0 s

Addition modulo m starts at zero: rₙ = na mod m. Playback advances two additions per second. The orbit has period m/gcd(m,a), including period one for a = 0. This is not a cryptographic security test or a primality algorithm. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forCompatibility with an operation becomes an equality between two routes around a square.

Check your understanding

For a natural transformation α:F⇒G and an arrow f:A→B, which equation has the correct types?

Try it yourself

Let f:{0,1,2}→{a,b}f:\{0,1,2\}\to\{a,b\} send zero to a and both one and two to b. Check the swap naturality equation on the pair (0,2)(0,2), then explain why the same equality holds for every pair and every function.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Write the ordered pair after each individual operation. A symbolic pair proves more than the numerical example.

Compare with the solution

Swapping first gives (2,0)(2,0) and then applying ff coordinatewise gives (b,a)(b,a). Applying ff first gives (a,b)(a,b) and then swapping again gives (b,a)(b,a). For any pair (x1,x2)(x_1,x_2), both routes give (f(x2),f(x1))(f(x_2),f(x_1)). This formula proves naturality without assuming that ff is injective or surjective.

Take it with you

  • A functor specifies images of both objects and arrows.
  • Naturality compares two correctly typed composites for every source arrow.
  • Componentwise invertibility makes a natural transformation a natural isomorphism.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.