We spent a lot of time in [Chapter 2](http://www.azimuthproject.org/azimuth/show/Applied+Category+Theory#Chapter_1) studying [Galois connections](https://forum.azimuthproject.org/discussion/1828/lecture-4-chapter-1-galois-connections/p1). Now all that time is going to pay off! We're going to generalize Galois connections between preorders, and get 'adjoint functors' between categories. These are one of most fruitful ideas in category theory.

Remember, given two preorders \$$A\$$ and \$$B\$$, a **Galois connection** is a pair of monotone maps \$$f: A \to B\$$ and \$$g: B \to A\$$ such that

$f(a) \le b \textrm{ if and only if } a \le g(b)$

for all \$$a \in A, b \in B\$$. We call \$$f\$$ the **left adjoint** of \$$g\$$, and \$$g\$$ the **right adjoint** of \$$f\$$.

But now we know that a preorder is a special sort of category: a category where there's at most one morphism from any object \$$x\$$ to any object \$$y\$$. We denote the existence of a morphism by \$$x \le y\$$.

So how do we generalize Galois connections to arbitrary categories? A first guess might be this:

**First Attempt at a Generalization.** Given categories \$$\mathcal{A}\$$ and \$$\mathcal{B}\$$, an **adjunction** is pair of functors \$$F: \mathcal{A} \to \mathcal{B}\$$ and \$$G: \mathcal{B} \to \mathcal{A}\$$ such that there is a one-to-one correspondence between morphisms

$m: F(a) \to b$

and morphisms

$n : a \to G(b)$

for all objects \$$a\$$ in \$$\mathcal{A}\$$ and \$$b\$$ in \$$\mathcal{B}\$$. We call \$$F\$$ the **left adjoint** of \$$G\$$, and \$$G\$$ the **right adjoint** of \$$F\$$.

You can check that this generalization does indeed reduce to the definition of Galois connection when our categories are preorders. However, it's not the _right_ generalization!

The reason is that merely saying _there exists_ a one-to-one correspondence is not enough to do much. We should at the very least _specify_ a one-to-one correspondence, and make it part of the definition.

This is not good enough either, but it's a step in the right direction, so let's write it down.

Remember, the set of morphisms from \$$F(a)\$$ to \$$b\$$ in the category \$$\mathcal{B}\$$ is called \$$\mathcal{B}(F(a),b)\$$. The set of morphisms from \$$a\$$ to \$$G(b)\$$ in the category \$$\mathcal{A}\$$ is called \$$\mathcal{A}(a,G(b))\$$. So, we're going to specify a one-to-one correspondence, also known as a [bijection](https://en.wikipedia.org/wiki/Bijection), between these two sets.

**Second Attempt at a Generalization.** Given categories \$$\mathcal{A}\$$ and \$$\mathcal{B}\$$, an **adjunction** is pair of functors \$$F: \mathcal{A} \to \mathcal{B}\$$ and \$$G: \mathcal{B} \to \mathcal{A}\$$ together with a bijection

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

for every pair of objects \$$a\$$ in \$$\mathcal{A}\$$ and \$$b\$$ in \$$\mathcal{B}\$$. We call \$$F\$$ the **left adjoint** of \$$G\$$, and \$$G\$$ the **right adjoint** of \$$F\$$.

This is getting nice. We could actually do a fair amount with this. But for serious work we'll need \$$\alpha\$$ to be a _natural isomorphism_, which gives a bijection \$$\alpha_{a,b}\$$ when we feed it a pair of objects \$$(a,b) \$$.

And this, in turn, means that we need to interpret \$$\mathcal{B}(F(-),-)\$$ and \$$\mathcal{A}(-,G(-))\$$ as _functors_, which give sets \$$\mathcal{B}(F(a),b) \$$ and \$$\mathcal{A}(a,G(b)) \$$ when we feed them a pair of objects \$$(a,b) \$$. The blanks stand for slots where we can feed in \$$a\$$ and \$$b\$$ - this is standard math notation.

Defining these functors takes a little work. Let me run through it rapidly now in a sketchy way. Next time we'll look at some examples, and eventually we'll need to get serious about the details.

For any pair of categories \$$\mathcal{A}\$$ and \$$\mathcal{B}\$$ there's a category \$$\mathcal{A} \times \mathcal{B}\$$, called the 'product' of \$$\mathcal{A}\$$ and \$$\mathcal{B}\$$. Objects here are pairs \$$(a,b) \$$ where \$$a\$$ is in \$$\mathcal{A}\$$ and \$$b\$$ is in \$$\mathcal{B}\$$; There's more that needs to be said - I haven't filled in all the details - but let's move ahead.

For any category \$$\mathcal{A}\$$ there a category \$$\mathcal{A}^{\text{op}} \$$ called the **opposite** of \$$\mathcal{A}\$$, which has the same objects but has morphisms going the opposite way. In other words, a morphism \$$f: a \to a'\$$ in \$$\mathcal{A}^{\text{op}} \$$ is defined to be morphism \$$f: a' \to a\$$. There's more that needs to be said, but let's keep moving!

Given functors \$$F: \mathcal{A} \to \mathcal{B}\$$ and \$$G: \mathcal{B} \to \mathcal{A}\$$, I claim that there are functors

$\mathcal{B}(F(-),-) : \mathcal{A}^{\text{op}} \times \mathcal{B} \to \mathbf{Set}$

and

$\mathcal{A}(-,G(-)) :\mathcal{A}^{\text{op}} \times \mathcal{B} \to \mathbf{Set}$

that give sets \$$\mathcal{B}(F(a),b) \$$ and \$$\mathcal{A}(a,G(b)) \$$, respectively, when we feed them an object \$$(a,b) \in \mathcal{A}^{\text{op}} \times \mathcal{B} \$$.

So, for an adjunction, what we want is a natural isomorphism between these functors!

Now we are ready - except for the important details I left out - for the correct definition:

**Definition.** Given categories \$$\mathcal{A}\$$ and \$$\mathcal{B}\$$, an **adjunction** is pair of functors \$$F: \mathcal{A} \to \mathcal{B}\$$ and \$$G: \mathcal{B} \to \mathcal{A}\$$ together with a natural isomorphism

$\alpha : \mathcal{B}(F(-),-) \to \mathcal{A}(-,G(-)).$

We call \$$F\$$ the **left adjoint** of \$$G\$$, and \$$G\$$ the **right adjoint** of \$$F\$$.

Note that the final definition is shorter than our two previous guesses! But it packs a bigger punch... and it takes more work to really understand it. We'll start next time.

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