# Dinatural transformations

To kick off my first blog post I thought I’d write a short technical post about a specific category theory topic I’ve recently learned about. Namely, I’ll tell you about *dinatural transformations* and how you could have arrived at the definition found on Wikipedia yourself! I’ll assume you understand categories, functors, natural transformations, commutative diagrams, and notions of covariance/contravariance. This isn’t meant to highlight any uses or convince you to start thinking about dinatural transformations. The goal of this short post is merely to paint an intuitive picture of why the definition is the way it is. So let’s dive right in!

Let’s first recall what a *natural* transformation is. It’s a map between *functors*. If we’ve got two categories and two functors , then a natural transformation is a map that can be drawn as

This will be the setting for the rest of this blog post – and the setting where a *dinatural* transformation can be defined. Unlike a natural transformation, which can be defined between functors whose domain and codomain are *any* two categories, a *dinatural* transformation is a map that can only be defined between functors whose domain is a *specific* type of category – the product of a category and its opposite .^{1}

This is an important detail. When we restrict to this setting, we’ll see how dinatural transformations between functors are generalizations of natural transformations between functors of that same type. That is, in this setting every natural transformation is also a dinatural transformation, but not vice-versa.

Okay, so let’s actually understand what a dinatural transformation is. To do so, we need to understand the functors it maps between. To understand those functors, we need to understand the categories at hand. So let’s take a step back. Let’s first understand , the product of the category and its opposite.

This is a category that has a simple property: given any morphism in the *original* category , the following square in commutes:^{2}

What this means is that, starting at the top-left corner , using just (and identity maps) it does not matter which of the three ways we use to arrive at the bottom-right corner . We can first go in one direction and then in the other direction, vice-versa, or going both direction at the same time (this diagonal arrow isn’t drawn). It does not matter which of these we choose - they’re all equivalent.

Now we can move on to a functor . Since every functor has to preserve commutative diagrams, the previously mentioned simple property can be extended. This means that, given any morphism in and a functor , the following square in commutes:

Simple enough! Now let’s move on to a *natural* transformation. A natural transformation to every object in assigns a morphism such that the following square commutes:

In our case, we have commutative squares for the two of our functors , since their domain is a product category. Let’s draw out in detail the entire commutative diagram. This diagram will turn out to be a cube! That is, given a morphism in , the following cube has to commute:

We are getting quite close! Dinatural transformations are a mere step away, but we first need to understand what we have done so far. We’ve taken two ingredients 1) two functors whose domain is and 2) a natural transformation . We’ve combined these ingredients into the commutative cube above. The edges of this cube are indexed by objects in our domain , i.e. by pairs of objects in . What’s going to happen now is that we’re going to remove some pieces of this cube. Which ones? The non-diagonal naturality morphisms! I’ll show the new diagram and then explain what’s going on.

What happened here is two things. First, since our base is a square – we’ve taken the opportunity to index *by the diagonal* of that square, instead of by its area. This is where the name *di*natural transformation comes in. Since we removed all the non-diagional naturality morphisms, the only naturality morphisms that remained are those of type , for any object in . This means that we can leave out the second index in – we refer to the dinaturality component with just a single subscript.

The story is almost complete. A *dinatural* transformation between two functors is a map which to every object in associates a map such that… what commutes? This new naturality condition now has some loose ends. Let’s see what is going on. Naturality condition is supposed to equate different path choices in a graph that *contain the naturality morphisms*. Observe that some morphisms (colored blue) are not part of any new paths that contain the new naturality morphisms (that is, you can’t find a path that contains both red and blue morphisms).

This means that we can safely remove the blue morphisms, since they do not play any role in our dinatural transformation.

After doing so, we end up with a new, hexagonal diagram. But that is just the usual the usual hexagon diagram found as found on Wikipedia or nLab! If you look closely you will see it is just a rotated version of the one I’ve drawn here. This really means that if you were confused by the rationale for having such a hexagonal diagram in the definition of a dinatural transformation – it’s because the rest of the cube isn’t drawn. But it’s good to draw it when learning, and to understand where the diagram comes from.

And this is it, we have defined a dinatural transformation! A *dinatural* transformation between two functors is a map which to every object in associates a map such that the diagram above commutes. The main takeaway from this post should be that the hexagonal diagram is just a diagram of the commutative cube with some morphisms removed.