Category Theory & Homological Algebra

Monads: Endofunctors With Unit and Multiplication

A monad packages the notion of an "algebraic theory" — groups, rings, vector spaces, complete metric spaces, even side-effecting computations — into a single endofunctor T: 𝒞 → 𝒞 equipped with two natural transformations, a unit η: Id ⇒ T and a multiplication μ: T² ⇒ T, satisfying associativity and unit laws. The famous quip is exact: a monad is a monoid in the category of endofunctors, where the tensor product is functor composition.

Precisely: a monad on 𝒞 is a triple (T, η, μ) with μ ∘ Tμ = μ ∘ μT (associativity) and μ ∘ Tη = μ ∘ ηT = id_T (left/right unit). Every adjunction F ⊣ G generates one via T = GF, and conversely — this is the machine that turns free/forgetful pairs into a uniform account of algebraic structure.

  • FieldCategory theory, universal algebra
  • IntroducedGodement (1958, 'standard construction'); named 'monad' by Mac Lane; theory by Eilenberg–Moore, Kleisli, Beck (1960s)
  • StatementA monad is (T, η, μ) with μ·Tμ = μ·μT and μ·Tη = μ·ηT = id
  • Key factEvery adjunction F ⊣ G yields a monad GF; every monad arises from an adjunction (two canonical ones)
  • Proof techniqueCoequalizers / split coequalizers (Beck), naturality diagram chases
  • GeneralizesMonoids, closure operators, algebraic theories, and the concept of 'free' structure

Interactive visualization

Press play, or step through manually. The visualization is yours to drive — try it before reading on.

Open visualization fullscreen ↗

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

The precise definition

Let 𝒞 be a category. A monad is a triple (T, η, μ) where T: 𝒞 → 𝒞 is an endofunctor and η: Id_𝒞 ⇒ T, μ: T∘T ⇒ T are natural transformations, subject to three coherence axioms drawn as commuting diagrams of functors T³ ⇒ T² ⇒ T:

  • Associativity: μ ∘ Tμ = μ ∘ μT as maps T³ ⇒ T. Here Tμ and μT are the two whiskerings, with components (Tμ)_X = T(μ_X) and (μT)_X = μ_{TX}.
  • Left unit: μ ∘ ηT = id_T, i.e. μ_X ∘ η_{TX} = id_{TX}.
  • Right unit: μ ∘ Tη = id_T, i.e. μ_X ∘ T(η_X) = id_{TX}.

Compare a monoid (M, ·, e): the associativity square m∘(m×1) = m∘(1×m) and unit laws m∘(e×1) = m∘(1×e) = id are the exact same shape. The slogan is literal: a monad is a monoid object in the strict monoidal category ([𝒞,𝒞], ∘, Id) of endofunctors under composition. The tensor is composition, so unit = Id and multiplication = μ.

The picture: T is a 'notion of free stuff'

Think of TX as "formal expressions of type X". If T = the list functor, TX is finite words in X; if T = ℤ[–], TX is formal ℤ-linear combinations; if T = the powerset P, PX is subsets. The unit η_X: X → TX embeds an element as the trivial expression (a one-letter word, a singleton, the generator x itself). The multiplication μ_X: T(TX) → TX flattens a formal expression of formal expressions into one expression: concatenate a list of lists, sum a formal sum of formal sums, union a set of sets.

The axioms are exactly what "flattening" must satisfy. Associativity says a triply-nested expression flattens the same way whether you collapse the inner or outer layer first. The unit laws say wrapping-then-flattening is the identity: putting each letter in its own singleton word and concatenating gives you back the word; a singleton set of sets unions to itself. So a monad is a self-consistent bookkeeping system for building, nesting, and collapsing structured terms.

Key mechanism: adjunctions manufacture monads

The engine behind every naturally-occurring monad is an adjunction F ⊣ G, F: 𝒞 → 𝒟 left adjoint to G: 𝒟 → 𝒞, with unit η: Id_𝒞 ⇒ GF and counit ε: FG ⇒ Id_𝒟 satisfying the triangle identities Gε ∘ ηG = id_G and εF ∘ Fη = id_F. Set T = GF. Take η to be the adjunction unit, and define μ := GεF: GFGF ⇒ GF (whisker the counit by G on the left, F on the right).

Then (T, η, μ) is a monad. The proof is a diagram chase: associativity μ∘Tμ = μ∘μT reduces, after peeling G on the left and F on the right, to naturality of ε applied to εF; the unit laws are precisely the two triangle identities. Concretely, forgetful G: Grp → Set with free F: Set → Grp gives T = "free group on the underlying set", η x = the generator x, and μ flattens a word-of-words. The counit ε_H: F(UH) → H evaluates a formal word in H to its actual product — that's where the algebra lives.

Worked example: the free-monoid (list) monad

On 𝒞 = Set, let T X = X* = ⊔ₙ Xⁿ, the set of finite words (including the empty word). Functorially, T f applies f letterwise. The unit η_X(x) = (x), the length-one word. The multiplication μ_X: (X*)* → X* takes a word of words (w₁, w₂, …, w_k) and concatenates: μ(w₁,…,w_k) = w₁w₂⋯w_k.

Check the axioms. Right unit: μ_X(T η_X(w)) takes w = (x₁,…,xₙ), maps each letter to its singleton word to get ((x₁),…,(xₙ)), then concatenates back to (x₁,…,xₙ) = w. ✓ Left unit: μ_X(η_{TX}(w)) wraps w into the one-element word (w), then concatenates to w. ✓ Associativity: a word-of-words-of-words flattens identically whether you first concatenate inner blocks or outer blocks — concatenation of strings is associative, and that is the axiom. ✓ The Eilenberg–Moore algebras of this T are exactly monoids: an algebra h: X* → X gives a multiplication by evaluating two-letter words and a unit by the empty word, and Set^T ≅ Mon.

Why the axioms matter, and Beck's theorem

Drop an axiom and the structure collapses: without associativity, μ has no well-defined multi-fold flattening, so TX loses its universal-algebra meaning; without the unit laws, η fails to exhibit generators and the free–forgetful correspondence breaks. A weaker gadget missing μ (only η) is a pointed endofunctor; one missing η is a non-unital / semigroup monad — neither generates a category of algebras with free objects.

The deep converse is Beck's monadicity theorem (Jonathan Beck, 1967). A functor G: 𝒟 → 𝒞 is monadic — i.e. 𝒟 ≃ 𝒞^T over 𝒞 for T = GF — iff G has a left adjoint, reflects isomorphisms, and 𝒟 has and G preserves coequalizers of G-split pairs (parallel pairs whose image under G admits a split coequalizer). The split-coequalizer hypothesis is essential: it is absolute, so preserved by every functor, which is exactly the leverage the proof needs to reconstruct each algebra as a canonical coequalizer F(TA) ⇉ FA → A, i.e. FGFA ⇉ FA → A (the two maps being F(h) = μ_A and the counit ε_{FA}). This is how one proves Grp, Ring, R-Mod, Cᴬˡᵍ, and compact Hausdorff spaces are categories of algebras.

Significance: algebra, computation, and beyond

Monads unify universal algebra: any Lawvere theory or finitary algebraic theory yields a finitary monad on Set, and finitary monads on Set correspond exactly to such theories — so "category of models" always means "Eilenberg–Moore category of a monad". Compact Hausdorff spaces are algebras for the ultrafilter monad β (Manes' theorem); this is a striking non-syntactic example. In topology and homological algebra, monads (as triples) drive the bar construction, monadic (co)homology, and descent theory via comonads.

In programming-language semantics, Moggi (1991) observed that Kleisli categories model computational effects — state, exceptions, nondeterminism (the powerset monad!), continuations, I/O — giving Haskell its do-notation, where Kleisli composition (f >=> g) is exactly μ ∘ T g ∘ f. The same μ that concatenates lists sequences effects. Monads also underlie codensity constructions, the theory of operads, and Barr–Beck descent — a single 3-axiom package echoing from abstract algebra to compilers.

Monads from adjunctions: the two canonical factorizations and their algebras. Here F ⊣ G with T = GF.
NotionObjectsUniversal propertyRelation to T
Kleisli category 𝒞_TSame as 𝒞; maps X → TYInitial adjunction realizing TFree T-algebras only
Eilenberg–Moore 𝒞^TT-algebras (A, h: TA → A) with unit+assoc lawsTerminal adjunction realizing TAll T-algebras
Powerset monad P on SetSets; algebras are complete sup-latticesη = {·}, μ = unionP-algebras ≅ complete join-semilattices
Free-monoid monad (list) on SetAlgebras are monoidsη = singleton word, μ = concatenation of lists of listsSet^T ≅ Mon
Free abelian group ℤ[–] on SetAlgebras are abelian groupsη = basis inclusion, μ = formal-sum flatteningSet^T ≅ Ab

Frequently asked questions

Why is 'a monad is a monoid in the category of endofunctors' literally true, not just an analogy?

The endofunctor category [𝒞,𝒞] is strict monoidal under composition ∘ with unit Id. A monoid object there is an object T with maps η: Id → T and μ: T∘T → T satisfying the monoid associativity and unit diagrams. Those diagrams, written out componentwise, are exactly the monad axioms μ·Tμ = μ·μT and μ·Tη = μ·ηT = id. So the statement is a definitional identity, first made precise by Bénabou/Mac Lane.

What is the difference between the Kleisli and Eilenberg–Moore categories?

Both realize the same monad T as coming from an adjunction, but they are the initial and terminal such realizations. Kleisli 𝒞_T has the same objects as 𝒞 with morphisms X → TY; it is equivalent to the full subcategory of free T-algebras. Eilenberg–Moore 𝒞^T consists of all T-algebras (A, h: TA → A). Kleisli embeds fully-faithfully into 𝒞^T as the free algebras (TX, μ_X).

Does every monad come from an adjunction?

Yes — in at least two canonical ways. The Kleisli adjunction and the Eilenberg–Moore adjunction both have composite GF equal to T with the given η and μ. In fact these are the initial and terminal objects of the category of adjunctions inducing T, a result of Kleisli and of Eilenberg–Moore. So 'monad' and 'adjunction, up to which resolution you pick' are two views of one phenomenon.

What exactly is a T-algebra and why do the algebra axioms mirror the monad axioms?

A T-algebra is a pair (A, h: TA → A) with h·η_A = id_A (unit) and h·μ_A = h·Th (associativity/compatibility with flattening). The axioms say the 'structure map' h evaluates formal expressions coherently: evaluating a trivial expression returns the element, and evaluating a nested expression agrees whether you flatten first or evaluate inner blocks first. This is why Set^T for the list monad is exactly Mon.

What is the role of the G-split coequalizer hypothesis in Beck's monadicity theorem?

It is the crux. Each T-algebra (A,h) is the coequalizer of the parallel pair F(h), ε_{FA}: F(TA) ⇉ FA → A (with T = GF, so F(TA) = FGFA; equivalently F(h) = μ_A), and G maps this to a split coequalizer with splitting supplied by η, which is absolute — preserved by all functors. Requiring 𝒟 to have and G to preserve coequalizers of exactly the G-split pairs lets you reconstruct 𝒟 as 𝒞^T. Weakening to all reflexive pairs gives the 'crude' monadicity variant.

Is the powerset functor really a monad, and what are its algebras?

Yes. On Set, P with η_X(x) = {x} and μ_X(𝒮) = ⋃𝒮 (union of a set of subsets) satisfies the axioms: union is associative and singleton-then-union is identity. Its Eilenberg–Moore algebras are complete join-semilattices (equivalently complete lattices), with the structure map A ⊆ PX ↦ sup A. The Kleisli category is the category of sets and relations, since a map X → PY is a relation.