# Why natural transformations?

*This post is aimed primarily at people who know what a category is in the extremely broad strokes, but aren't otherwise familiar or comfortable with category theory.*

One of mathematicians' favourite activities is to describe compatibility between the structures of mathematical artefacts. Functions translate the structure of one set to another, continuous functions do the same for topological spaces, and so on... Many among these "translations" have the nice property that their character is preserved by composition. At some point, it seems that some mathematicians noticed that they:

1\. kept defining intuitively similar properties for these different structures

2\. had wayyyyyy too much time on their hands

So they generalised this concept into a unified theory. Categories consist of *objects* $x \in C$  and *morphisms* $f \in C(x,y)$ connecting objects. Morphisms are closed by composition. As in our opening examples, we will think of objects as sets and of morphisms as functions, even though the language of categories is strictly more expressive than that. Once we have categories, we reflexively wish to define a "morphism of categories". Given categories C, D a *functor* F sends objects $x \in C$ to objects $Fx \in D$ and morphisms $f \in C(x,y)$ to morphisms $Ff \in D(Fx, Fy)$ such that *composition* of morphisms can be done inside the category C or inside D after applying the functor: $F(f \circ g) = Ff \circ Fg$.

Still possessing of some time, you might next wonder how to define a morphism between two functors. This is where, in my experience, there ceases to be an "obvious" thing to do. All the morphisms we have considered thus far are functions, but it's not even clear from where to where a candidate function should go, since functors are not themselves sets.

To make the idea of a natural transformation seem not-entirely-crazy, it's worth taking a slightly different perspective on what more "preservation of structure" could mean. Consider the category of metric spaces with morphisms defined as continuous functions between them. One can think of continuity as being about the induced topologies, but metric spaces have additional properties that allow for a more specific interpretation. Notably, this includes the uniqueness of limits, which defines an operation on some sequences which takes that limit. This operation is completely integral to the abstract appeal of metric spaces. Moreover, the key characteristic of continuous functions is that they give us the right to permute when we perform this operation. Given a continuous function $f : X \rightarrow Y$ and a sequence $(x_n)_{n \in \mathbb{N}} \subset X$ with a limit $x$, we have $\lim_{n \rightarrow \infty}(f(x_n)) = f(\lim_{n \rightarrow \infty}(x_n)) = f(x)$. This makes continuous functions a satisfying concept for defining morphisms because they afford execution of the fundamental operation on metric spaces in either the source or the target (whichever is most convenient).

Abstracting away to categories, the conceptual appeal of a functor is that it respects the structure of morphisms between objects. Consequently, a good "morphism" between functors F and G (both between categories C and D) would allow us to disregard whether for any morphism $f \in C(x,y)$, we use $Ff$ or $Gf$ for calculations inside D. That is, we need enough semantic content in the morphism to always commute the following diagram[^uxzeynty9cf]:

![image.png](https://res.cloudinary.com/lesswrong-2-0/image/upload/v1775079903/lexical_client_uploads/te5dwk3g8ojgwndvxdcu.png)

This motivates the definition of natural transformations as families of maps $\eta_{x(x \in C)}$, where $\eta_x \in D(Fx, Gx)$, such that each diagram of the above type is commuted. Reassuringly, the functors from C to D as objects, equipped with natural transfomations between these functors as morphisms, themselves form a category!

[^uxzeynty9cf]: "commuting diagrams" is standard terminology in category theory that encodes the ability to permute, replace or swap out operations.