# Kan extension

Kan extensions are universal constructs in category theory, a branch of mathematics. They are closely related to adjoints, but are also related to limits and ends. They are named after Daniel M. Kan, who constructed certain (Kan) extensions using limits in 1960.

An early use of (what is now known as) a Kan extension from 1956 was in homological algebra to compute derived functors.

In Categories for the Working Mathematician Saunders Mac Lane titled a section "All Concepts Are Kan Extensions", and went on to write that

The notion of Kan extensions subsumes all the other fundamental concepts of category theory.

Kan extensions generalize the notion of extending a function defined on a subset to a function defined on the whole set. The definition, not surprisingly, is at a high level of abstraction. When specialised to posets, it becomes a relatively familiar type of question on constrained optimization.

## Definition[]

A Kan extension proceeds from the data of three categories

${\displaystyle \mathbf {A} ,\mathbf {B} ,\mathbf {C} }$

and two functors

${\displaystyle X:\mathbf {A} \to \mathbf {C} ,F:\mathbf {A} \to \mathbf {B} }$,

and comes in two varieties: the "left" Kan extension and the "right" Kan extension of ${\displaystyle X}$ along ${\displaystyle F}$.

The right Kan extension amounts to finding the dashed arrow and the natural transformation ${\displaystyle \eta }$ in the following diagram:

Formally, the right Kan extension of ${\displaystyle X}$ along ${\displaystyle F}$ consists of a functor ${\displaystyle R:\mathbf {B} \to \mathbf {C} }$ and a natural transformation ${\displaystyle \eta :RF\to X}$ that is couniversal with respect to the specification, in the sense that for any functor ${\displaystyle M:\mathbf {B} \to \mathbf {C} }$ and natural transformation ${\displaystyle \mu :MF\to X}$, a unique natural transformation ${\displaystyle \delta :M\to R}$ is defined and fits into a commutative diagram:

where ${\displaystyle \delta _{F}}$ is the natural transformation with ${\displaystyle \delta _{F}(a)=\delta (Fa):MF(a)\to RF(a)}$ for any object ${\displaystyle a}$ of ${\displaystyle \mathbf {A} .}$

The functor R is often written ${\displaystyle \operatorname {Ran} _{F}X}$.

As with the other universal constructs in category theory, the "left" version of the Kan extension is dual to the "right" one and is obtained by replacing all categories by their opposites.

The effect of this on the description above is merely to reverse the direction of the natural transformations.

(Recall that a natural transformation ${\displaystyle \tau }$ between the functors ${\displaystyle F,G:\mathbf {C} \to \mathbf {D} }$ consists of having an arrow ${\displaystyle \tau (a):F(a)\to G(a)}$ for every object ${\displaystyle a}$ of ${\displaystyle \mathbf {C} }$, satisfying a "naturality" property. When we pass to the opposite categories, the source and target of ${\displaystyle \tau (a)}$ are swapped, causing ${\displaystyle \tau }$ to act in the opposite direction).

This gives rise to the alternate description: the left Kan extension of ${\displaystyle X}$ along ${\displaystyle F}$ consists of a functor ${\displaystyle L:\mathbf {B} \to \mathbf {C} }$ and a natural transformation ${\displaystyle \epsilon :X\to LF}$ that are universal with respect to this specification, in the sense that for any other functor ${\displaystyle M:\mathbf {B} \to \mathbf {C} }$ and natural transformation ${\displaystyle \alpha :X\to MF}$, a unique natural transformation ${\displaystyle \sigma :L\to M}$ exists and fits into a commutative diagram:

where ${\displaystyle \sigma _{F}}$ is the natural transformation with ${\displaystyle \sigma _{F}(a)=\sigma (Fa):LF(a)\to MF(a)}$ for any object ${\displaystyle a}$ of ${\displaystyle \mathbf {A} }$.

The functor L is often written ${\displaystyle \operatorname {Lan} _{F}X}$.

The use of the word "the" (as in "the left Kan extension") is justified by the fact that, as with all universal constructions, if the object defined exists, then it is unique up to unique isomorphism. In this case, that means that (for left Kan extensions) if ${\displaystyle L,M}$ are two left Kan extensions of ${\displaystyle X}$ along ${\displaystyle F}$, and ${\displaystyle \epsilon ,\alpha }$ are the corresponding transformations, then there exists a unique isomorphism of functors ${\displaystyle \sigma :L\to M}$ such that the second diagram above commutes. Likewise for right Kan extensions.

## Properties[]

### Kan extensions as (co)limits[]

Suppose ${\displaystyle X:\mathbf {A} \to \mathbf {C} }$ and ${\displaystyle F:\mathbf {A} \to \mathbf {B} }$ are two functors. If A is small and C is cocomplete, then there exists a left Kan extension ${\displaystyle \operatorname {Lan} _{F}X}$ of ${\displaystyle X}$ along ${\displaystyle F}$, defined at each object b of B by

${\displaystyle (\operatorname {Lan} _{F}X)(b)=\varinjlim _{f:Fa\to b}X(a)}$

where the colimit is taken over the comma category ${\displaystyle (F\downarrow \operatorname {const} _{b})}$, where ${\displaystyle \operatorname {const} _{b}\colon \ast \to B,\ast \mapsto b}$ is the constant functor. Dually, if A is small and C is complete, then right Kan extensions along ${\displaystyle F}$ exist, and can be computed as the limit

${\displaystyle (\operatorname {Ran} _{F}X)(b)=\varprojlim _{Fa\leftarrow b}X(a)}$

over the comma category ${\displaystyle (\operatorname {const} _{b}\downarrow F)}$.

### Kan extensions as (co)ends[]

Suppose ${\displaystyle K:\mathbf {M} \to \mathbf {C} }$ and ${\displaystyle T:\mathbf {M} \to \mathbf {A} }$ are two functors such that for all objects m and m′ of M and all objects c of C, the copowers ${\displaystyle \mathbf {C} (Km',c)\cdot Tm}$ exist in A. Then the functor T has a left Kan extension L along K, which is such that, for every object c of C,

${\displaystyle Lc=(\operatorname {Lan} _{K}T)c=\int ^{m}\mathbf {C} (Km,c)\cdot Tm}$

when the above coend exists for every object c of C.

Dually, right Kan extensions can be computed by the end formula

${\displaystyle (\operatorname {Ran} _{K}T)c=\int _{m}Tm^{\mathbf {C} (c,Km)}.}$

### Limits as Kan extensions[]

The limit of a functor ${\displaystyle F:C\to D}$ can be expressed as a Kan extension by

${\displaystyle \lim F=\operatorname {Ran} _{E}F}$

where ${\displaystyle E}$ is the unique functor from ${\displaystyle C}$ to 𝟙 (the category with one object and one arrow, a terminal object in ${\displaystyle Cat}$). The colimit of ${\displaystyle F}$ can be expressed similarly by

${\displaystyle \operatorname {colim} F=\operatorname {Lan} _{E}F.}$

### Adjoints as Kan extensions[]

A functor ${\displaystyle F:C\to D}$ possesses a left adjoint if and only if the right Kan extension of ${\displaystyle \operatorname {Id} :C\to C}$ along ${\displaystyle F}$ exists and is preserved by ${\displaystyle F}$. In this case, a left adjoint is given by ${\displaystyle \operatorname {Ran} _{F}\operatorname {Id} }$ and this Kan extension is even preserved by any functor ${\displaystyle C\to E}$ whatsoever, i.e. is an absolute Kan extension.

Dually, a right adjoint exists if and only if the left Kan extension of the identity along ${\displaystyle F}$ exists and is preserved by ${\displaystyle F}$.

## Applications[]

The codensity monad of a functor ${\displaystyle G:D\to C}$ is a right Kan extension of G along itself.

## References[]

• Cartan, Henri; Eilenberg, Samuel (1956). Homological algebra. Princeton Mathematical Series. 19. Princeton, New Jersey: Princeton University Press. Zbl 0075.24305.
• Mac Lane, Saunders (1998). Categories for the Working Mathematician. Graduate Texts in Mathematics. 5 (2nd ed.). New York, NY: Springer-Verlag. ISBN 0-387-98403-8. Zbl 0906.18001.