I spent a lot of time in this course explaining two big ideas:

* **Adjoint functors**. We've focused a lot on the simplest of categories: preorders. Pairs of adjoint functors between these are also called Galois connections, and we first met them in [Lecture 4](https://forum.azimuthproject.org/discussion/1828/lecture-4-chapter-1-galois-connections/p1). In [Lecture 6](https://forum.azimuthproject.org/discussion/1901/lecture-6-chapter-1-computing-adjoints/p1) we saw that a _left_ adjoint is a 'best approximation from above' to the possibly nonexistent inverse of a monotone function between preorders, while a _right_ adjoint is a 'best approximation from below'. Much later, starting in [Lecture 47](https://forum.azimuthproject.org/discussion/2253/lecture-47-chapter-3-adjoint-functors/p1), we looked at adjoint functors between categories in general. We saw that the pattern persists: left adjoints are 'liberal' while right adjoints are 'conservative'.

* **Compact closed categories.** In [Lecture 67](https://forum.azimuthproject.org/discussion/2303/lecture-67-chapter-4-feedback/p1), in our study of feasibility relations, we began looking at caps and cups. We saw these allow us to describe feedback, or, more generally, the process of 'bending back' an input to some process and turning it into an output - or vice versa. In [Lecture 71](https://forum.azimuthproject.org/discussion/2315/lecture-71-caps-and-cups-for-enriched-profunctors/p1) we saw that caps and cups exist - and obey the all-important snake equations - in any category of enriched profunctors. And in [Lecture 74](https://forum.azimuthproject.org/discussion/2338/lecture-74-compact-closed-categories/p1), we saw this works in any 'compact closed' category. Morphisms in a compact closed category can be drawn as string diagrams, which we can manipulate just like boxes with wires coming in and out! In particular, we can 'bend back' the wires.

These are both great ideas... but amazingly, they are _two aspects of the same idea!_

To see this, start with a pair of adjoint functors:

\[ F \colon \mathcal{A} \to \mathcal{B}, \quad G \colon \mathcal{B} \to \mathcal{A} \]

By definition, there's a bijection between these sets:

\[ \alpha_{a,b} \colon \mathcal{B}(F(a),b) \to \mathcal{A}(a,G(b)) \]

for any objects \\(a\\) in \\(\mathcal{A}\\) and \\(b\\) in \\(\mathcal{B}\\). Moreover this is a natural isomorphism.

What can we do with this? Not much until we know some elements of these sets! So let's take \\(b = F(a)\\):

\[ \alpha_{a,F(a)} : \mathcal{B}(F(a),F(a)) \to \mathcal{A}(a,G(F(a))) \]

There's an obvious element of \\(\mathcal{B}(F(a),F(a))\\), namely the identity \\(1_{F(a)}\\). Our bijection maps this to some morphism from \\(a\\) to \\(G(F(a))\\), which we write as

\[ \eta_a \colon a \to G(F(a)) .\]

You get such a morphism for any \\(a\\). And using the fact that \\(\alpha\\) is _natural_, you can prove these morphisms define a natural transformation

\[ \eta \colon 1_{\mathcal{A}} \to G F \]

This is called the **unit**. (I'm sorry; that word that is used for too many different things in mathematics.)

Amazingly, _the unit is a lot like a cap._ Why? Remember that when we have an object \\(x\\) in a compact closed category, the cap is a morphism

\[ \cap_x \colon I \to x \otimes x^\ast.\]

This resembles the unit, with \\(x\\) playing the role of \\(G\\), and \\(x^\ast\\) playing the role of \\(F\\). The surprise is that this resemblance is significant, not just superficial!

What about the cup? Well, we can take our bijection

\[ \alpha_{a,b} : \mathcal{B}(F(a),b) \to \mathcal{A}(a,G(b)) \]

and let \\(a = G(b)\\), getting

\[ \alpha_{G(b),b} : \mathcal{B}(F(G(b)),b) \to \mathcal{A}(G(b),G(b)) .\]

There's an obvious element of \\( \mathcal{A}(G(b),G(b))\\), namely the identity \\(1_{G(b)}\\). It must come from some morphism from \\(F(G(b))\\) to \\(b\\), which we write as

\[ \epsilon_b \colon F(G(b)) \to b, \]

and you can prove such morphisms define a natural transformation

\[ \epsilon \colon F G \Rightarrow 1_{\mathcal{B}} \]

called the **counit**. This should remind you of how any object \\(x\\) in a compact closed category has a cup:

\[ \cup_x \colon x^\ast \otimes x \to I .\]

So far our evidence for an analogy between the unit and counit and the cap and cup is pretty thin. The real test is the snake equation. If we can prove the unit and counit obey that, something real must be going on!

We can do it. Of course, first we need to _state_ the snake equation for the unit and counit. I don't have room to do this here, so watch these short videos by my friends Eugenia Cheng and Simon Willerton:

* The Catsters, [Adjunctions 1](https://www.youtube.com/watch?v=loOJxIOmShE), [Adjunctions 2](https://www.youtube.com/watch?v=JEJim3t-N9A), [Adjunctions 3](https://www.youtube.com/watch?v=2i_PpYsl8b8), [Adjunctions 4](https://www.youtube.com/watch?v=nP5XQ6OBHHY).

where they call the snake equations the 'triangle equations' - you'll see why. They _start_ by defining an 'adjunction' to be a pair of functors \\( F \colon \mathcal{A} \to \mathcal{B}\\), \\( G \colon \mathcal{B} \to \mathcal{A} \\) equipped with a unit and counit \\(\eta \colon 1_{\mathcal{A}} \to GF \\), \\( \epsilon \colon FG \to 1_{\mathcal{B}}\\) obeying the triangle equations. Then they show this definition is equivalent to the definition of adjoint functors we've been using!

The success of this analogy suggests that maybe we could use string diagrams to work with categories, functors and natural transformations. It's true! To learn how, watch these:

* The Catsters, [String diagrams 1](https://www.youtube.com/watch?v=USYRDDZ9yEc), [String diagrams 2](https://www.youtube.com/watch?v=JeGhNhgOTuk), [String diagrams 3](https://www.youtube.com/watch?v=pmvVE8AGAEA), [String diagrams 4](https://www.youtube.com/watch?v=YNC5faXshAk).

After setting up string diagrams for category theory, Simon describes adjunctions using string diagrams in part 3. You'll see exactly why the unit is like a cap and the counit like a cup - and you'll see the snake equations pop out at the end! In parts 4 and 5 he uses string diagrams to get _monads_ from adjunctions. Monads are very popular in programming languages like Haskell, but this will give a completely different outlook on them.

I should warn you: all this is a _different_ idea than using string diagrams to study enriched categories and enriched profunctors, as we'd been doing in Chapter 4. So don't get them mixed up. But everything fits together in the end - as you've probably seen, category theory keeps generalizing everything in order to unify it and eventually simplify it.

There's much more to say; you can see my own take on it by reading this:

* John Baez, [The tale of _n_-categories](http://math.ucr.edu/home/baez/week73.html#tale)

You'll see how adjunctions and monads and compact closed categories all fit nicely into the framework of _2-categories_. Just as you need categories to work efficiently with set-based mathematics, you need 2-categories to work efficiently with category-based mathematics. These days my students and I have been using 2-categories (and related gadgets like double categories) to study [Markov processes](https://arxiv.org/abs/1710.11343), [Petri nets](https://arxiv.org/abs/1808.05415) and other kinds of networks.

I'm tempted to go on, but this course was meant to give you just a tiny taste of the grand meal of category theory and its many applications, so I will restrain myself and stop here. I've been getting very abstract, but next time I'll give you some suggestions to read more about applications.

**[To read other lectures go here.](http://www.azimuthproject.org/azimuth/show/Applied+Category+Theory#Chapter_4)**