Skip to content

Level 1A: Categories – The Language of Mathematics

The Defect. Set-theoretic mathematics defines every object by its elements. A group is a set with operations; a topological space is a set with open subsets. This works for elementary mathematics but breaks down for objects whose essential structure is relational rather than elemental – a topological space is not its underlying set (many different topologies on the same set), and a group is not its underlying set (many different group structures). Category theory shifts the primitive from elements to arrows: what matters about an object is not what it contains but how it relates to other objects.

The One-Line Reveal. Read the definition of a category below. Close the page. Try to verify the axioms in Set (objects = sets, morphisms = functions). The axioms hold because function composition is associative and identity functions exist – and that verification is the proof that Set is a category.

Definition. A category C\mathcal{C} consists of:

  • A collection of objects A,B,C,…A, B, C, \dots
  • For each pair of objects A,BA, B, a collection Hom⁡C(A,B)\operatorname{Hom}_{\mathcal{C}}(A, B) of morphisms (arrows) from AA to BB, written f:A→Bf: A \to B
  • For each triple A,B,CA, B, C, a composition function Hom⁡(B,C)×Hom⁡(A,B)→Hom⁡(A,C)\operatorname{Hom}(B, C) \times \operatorname{Hom}(A, B) \to \operatorname{Hom}(A, C), written (g,f)↦g∘f(g, f) \mapsto g \circ f

satisfying:

  1. Associativity: h∘(g∘f)=(h∘g)∘fh \circ (g \circ f) = (h \circ g) \circ f whenever the compositions are defined.
  2. Identity: for every object AA, there exists id⁡A∈Hom⁡(A,A)\operatorname{id}_A \in \operatorname{Hom}(A, A) such that id⁡A∘f=f\operatorname{id}_A \circ f = f and g∘id⁡A=gg \circ \operatorname{id}_A = g for all composable f,gf, g.

Theorem 1.1. Identity morphisms are unique.

Proof. Let id⁡A\operatorname{id}_A and id⁡A′\operatorname{id}'_A both be identity morphisms on AA. Then id⁡A=id⁡A∘id⁡A′\operatorname{id}_A = \operatorname{id}_A \circ \operatorname{id}'_A (since id⁡A′\operatorname{id}'_A is an identity) =id⁡A′= \operatorname{id}'_A (since id⁡A\operatorname{id}_A is an identity). ■\blacksquare

The One-Line Reveal. The proof above is two applications of the identity axiom – once for each identity morphism. The pattern (use one axiom, then the other) recurs in every uniqueness proof in category theory.

CategoryObjectsMorphismsComposition
Set\mathbf{Set}setsfunctionsfunction composition
Grp\mathbf{Grp}groupsgroup homomorphismsfunction composition
Top\mathbf{Top}topological spacescontinuous mapsfunction composition
Vectk\mathbf{Vect}_kvector spaces over kklinear mapsfunction composition
Matk\mathbf{Mat}_knatural numbersn×mn \times m matricesmatrix multiplication

The last example (Matk\mathbf{Mat}_k) shows that objects need not be sets: the object nn is a natural number (a “dimension”), and the morphisms from mm to nn are n×mn \times m matrices. Composition is matrix multiplication, which is associative, and the identity matrix is the identity morphism. Choosing a basis identifies Vectkfd\mathbf{Vect}_k^{\mathrm{fd}} (finite-dimensional vector spaces) with this matrix category: every finite-dimensional space is isomorphic to some knk^n, and once bases are fixed, linear maps are exactly matrices. The matrix category also shows that the axioms never mention elements: the object nn is not a set at all. The table names categories that later levels build, on purpose: category theory is the language the course will speak. Work with Set\mathbf{Set} today; Top\mathbf{Top} and Vectk\mathbf{Vect}_k become fully built examples in their own levels, and the table is a map of where the course is going, not a list of prerequisites.

Quick check.

  1. What two axioms must a category’s composition satisfy?
  2. In Set\mathbf{Set}, what is the identity morphism of a set AA?
  3. Name a category whose objects are not sets.
  4. How many identity morphisms can an object have?
  5. What does the type Hom⁡(B,C)×Hom⁡(A,B)→Hom⁡(A,C)\operatorname{Hom}(B,C) \times \operatorname{Hom}(A,B) \to \operatorname{Hom}(A,C) encode about composability?

Answers: 1. Associativity; an identity morphism for every object. 2. The identity function id⁡A\operatorname{id}_A. 3. Matk\mathbf{Mat}_k: objects are natural numbers, morphisms are matrices. 4. Exactly one (Theorem 1.1). 5. The codomain of the first arrow must be the domain of the second.

2. Monomorphisms, Epimorphisms, and Isomorphisms

Section titled “2. Monomorphisms, Epimorphisms, and Isomorphisms”

Definition. A morphism f:A→Bf: A \to B is a monomorphism (mono) if for all g1,g2:C→Ag_1, g_2: C \to A, f∘g1=f∘g2f \circ g_1 = f \circ g_2 implies g1=g2g_1 = g_2.

Definition. A morphism f:A→Bf: A \to B is an epimorphism (epi) if for all h1,h2:B→Ch_1, h_2: B \to C, h1∘f=h2∘fh_1 \circ f = h_2 \circ f implies h1=h2h_1 = h_2.

Definition. A morphism f:A→Bf: A \to B is an isomorphism if there exists g:B→Ag: B \to A with g∘f=id⁡Ag \circ f = \operatorname{id}_A and f∘g=id⁡Bf \circ g = \operatorname{id}_B. We write f:A≅Bf: A \cong B.

Theorem 2.1. Every isomorphism is both a monomorphism and an epimorphism.

Proof. Let f:A→Bf: A \to B be an isomorphism with inverse g:B→Ag: B \to A. To show ff is mono: suppose f∘g1=f∘g2f \circ g_1 = f \circ g_2 for g1,g2:C→Ag_1, g_2: C \to A. Compose both sides with gg on the left:

g∘f∘g1=g∘f∘g2  ⟹  (g∘f)∘g1=(g∘f)∘g2  ⟹  id⁡A∘g1=id⁡A∘g2  ⟹  g1=g2.g \circ f \circ g_1 = g \circ f \circ g_2 \implies (g \circ f) \circ g_1 = (g \circ f) \circ g_2 \implies \operatorname{id}_A \circ g_1 = \operatorname{id}_A \circ g_2 \implies g_1 = g_2.

To show ff is epi: suppose h1∘f=h2∘fh_1 \circ f = h_2 \circ f for h1,h2:B→Ch_1, h_2: B \to C. Compose both sides with gg on the right: h1∘(f∘g)=h2∘(f∘g)h_1 \circ (f \circ g) = h_2 \circ (f \circ g), and f∘g=id⁡Bf \circ g = \operatorname{id}_B, so h1=h2h_1 = h_2. ■\blacksquare

The One-Line Reveal. The proof’s pivot is composing with the inverse gg – canceling ff using its inverse. The same cancellation works for any isomorphism in any category.

Caution. The converse fails: a morphism that is both mono and epi need not be an isomorphism. (In Set\mathbf{Set} it does hold, because mono and epi are exactly injective and surjective, and injective plus surjective is bijective; the category axioms alone are too weak to force it.) Work in Mon\mathbf{Mon}, the category of monoids (a set with an associative binary operation and an identity element) and functions preserving both. The inclusion N↪Z\mathbb{N} \hookrightarrow \mathbb{Z} of the natural numbers into the integers, both under addition, is mono: it is injective, and if f∘u=f∘vf \circ u = f \circ v for u,v:X→Nu, v: X \to \mathbb{N} then f(u(x))=f(v(x))f(u(x)) = f(v(x)) for every x∈Xx \in X, so u(x)=v(x)u(x) = v(x) by injectivity. It is epi: let f,g:Z→Mf, g: \mathbb{Z} \to M be monoid homomorphisms agreeing on N\mathbb{N}, so in particular f(1)=g(1)f(1) = g(1). A homomorphism out of Z\mathbb{Z} is determined by the image of 11: for k≥0k \geq 0 additivity gives f(k)=kf(1)f(k) = k f(1), and for k<0k < 0 we have f(k)+f(−k)=f(0)=0Mf(k) + f(-k) = f(0) = 0_M, so f(k)f(k) is a two-sided additive inverse of f(−k)=(−k)f(1)f(-k) = (-k)f(1), and two-sided inverses are unique (if y+x=x+y=0y + x = x + y = 0 and z+x=x+z=0z + x = x + z = 0, then y=y+0=y+(x+z)=(y+x)+z=0+z=zy = y + 0 = y + (x + z) = (y + x) + z = 0 + z = z). So ff and gg agree everywhere. But the inclusion is not an isomorphism: a retraction Z→N\mathbb{Z} \to \mathbb{N} would have to send −1-1 to a natural number nn with n+1=0n + 1 = 0, and there is no such natural number.

Quick check.

  1. State monomorphism in one line.
  2. What is the pivot of Theorem 2.1’s proof?
  3. Why is N↪Z\mathbb{N} \hookrightarrow \mathbb{Z} epi in Mon\mathbf{Mon}?
  4. Why does mono plus epi give an isomorphism in Set\mathbf{Set}?
  5. What is a split epimorphism?

Answers: 1. f∘g1=f∘g2f \circ g_1 = f \circ g_2 forces g1=g2g_1 = g_2, for all pairs into the domain. 2. Composing with the inverse gg cancels ff. 3. A homomorphism out of Z\mathbb{Z} is pinned by f(1)f(1), since f(−1)f(-1) is the unique two-sided inverse of f(1)f(1). 4. Mono is injective and epi is surjective there. 5. There is gg with f∘g=id⁡Bf \circ g = \operatorname{id}_B.

Definition. An object TT in C\mathcal{C} is terminal if for every object AA, there exists a unique morphism A→TA \to T. An object II is initial if for every object AA, there exists a unique morphism I→AI \to A.

Theorem 3.1. Terminal objects are unique up to unique isomorphism.

Proof. Let TT and T′T' be terminal. Since T′T' is terminal, there exists f:T→T′f: T \to T'. Since TT is terminal, there exists g:T′→Tg: T' \to T. Now f∘g:T′→T′f \circ g: T' \to T' is a morphism from T′T' to itself. Since T′T' is terminal, there is exactly one morphism T′→T′T' \to T' – namely id⁡T′\operatorname{id}_{T'}. So f∘g=id⁡T′f \circ g = \operatorname{id}_{T'}. Symmetrically, g∘f=id⁡Tg \circ f = \operatorname{id}_T. So f:T≅T′f: T \cong T', and g=f−1g = f^{-1} is the unique such isomorphism (any other g′g' with f∘g′=id⁡T′f \circ g' = \operatorname{id}_{T'} would satisfy g′=gg' = g by the same uniqueness argument). ■\blacksquare

The One-Line Reveal. The proof uses the definition of terminal twice: once to get ff, once to get gg, then the uniqueness of morphisms from a terminal object forces the compositions to be identities.

Examples of universal properties as terminal/initial objects:

  • The product A×BA \times B comes with projections πA:A×B→A\pi_A: A \times B \to A and πB:A×B→B\pi_B: A \times B \to B, and is characterised by: for every object CC with maps f:C→Af: C \to A and g:C→Bg: C \to B, there exists a unique h:C→A×Bh: C \to A \times B with πA∘h=f\pi_A \circ h = f and πB∘h=g\pi_B \circ h = g. In Set\mathbf{Set}, hh sends xx to the pair (f(x),g(x))(f(x), g(x)), and nothing else could work. The content of the definition is the existence and uniqueness of hh, not what the elements of A×BA \times B are.
  • The kernel of a group homomorphism φ:G→H\varphi: G \to H comes with an inclusion ker⁡φ→G\ker \varphi \to G, and it is universal among that data: any homomorphism k:K→Gk: K \to G with φ∘k\varphi \circ k the trivial map factors uniquely through ker⁡φ\ker \varphi.
  • The disjoint union A⊔BA \sqcup B comes with injections A→A⊔BA \to A \sqcup B and B→A⊔BB \to A \sqcup B, and is characterised dually: it is initial among objects CC equipped with maps from AA and from BB, meaning every such pair of maps extends uniquely to a map A⊔B→CA \sqcup B \to C.

Every universal property says: this object is the unique (up to unique isomorphism) solution to a certain mapping problem. The problem is always of one shape: be the target of exactly one arrow from every object in a certain configuration.

Quick check.

  1. Define terminal and initial objects.
  2. What does unique up to unique isomorphism give for two terminal objects?
  3. State the product’s universal property.
  4. State the kernel’s universal property.
  5. How does the disjoint union dualise the product?

Answers: 1. Terminal: every object has exactly one arrow to it; initial: exactly one from it. 2. An isomorphism T≅T′T \cong T', and it is the only one compatible with the universal arrows. 3. Projections πA,πB\pi_A, \pi_B; every pair f:C→Af: C \to A, g:C→Bg: C \to B factors uniquely through h:C→A×Bh: C \to A \times B. 4. Every k:K→Gk: K \to G with φ∘k\varphi \circ k trivial factors uniquely through ker⁡φ→G\ker \varphi \to G. 5. Every pair of maps from AA and from BB extends uniquely to a map A⊔B→CA \sqcup B \to C.

Definition. A functor F:C→DF: \mathcal{C} \to \mathcal{D} between categories consists of:

  • A map on objects: A↦F(A)A \mapsto F(A)
  • A map on morphisms: f:A→B↦F(f):F(A)→F(B)f: A \to B \mapsto F(f): F(A) \to F(B)

satisfying:

  1. F(id⁡A)=id⁡F(A)F(\operatorname{id}_A) = \operatorname{id}_{F(A)}
  2. F(g∘f)=F(g)∘F(f)F(g \circ f) = F(g) \circ F(f) (composition preserved)

Theorem 4.1. Functors preserve isomorphisms: if f:A≅Bf: A \cong B then F(f):F(A)≅F(B)F(f): F(A) \cong F(B).

Proof. Let g:B→Ag: B \to A be the inverse of ff. Then F(g)∘F(f)=F(g∘f)=F(id⁡A)=id⁡F(A)F(g) \circ F(f) = F(g \circ f) = F(\operatorname{id}_A) = \operatorname{id}_{F(A)}, and symmetrically F(f)∘F(g)=id⁡F(B)F(f) \circ F(g) = \operatorname{id}_{F(B)}. So F(f)F(f) is an isomorphism with inverse F(g)F(g). ■\blacksquare

The One-Line Reveal. The proof is “apply the functor to both sides of g∘f=id⁡g \circ f = \operatorname{id}” – the functorial axioms do the rest.

Examples:

  • The forgetful functor U:Grp→SetU: \mathbf{Grp} \to \mathbf{Set} sends each group to its underlying set and each homomorphism to its underlying function. It “forgets” the group structure.
  • The free functor F:Set→GrpF: \mathbf{Set} \to \mathbf{Grp} sends each set SS to the free group on SS. This is left adjoint to UU (see below).
  • The fundamental group π1:Top∗→Grp\pi_1: \mathbf{Top}_* \to \mathbf{Grp} sends each pointed space to its fundamental group. This is a functor: continuous maps induce group homomorphisms, and composition of maps induces composition of homomorphisms.

Quick check.

  1. What two laws define a functor?
  2. What do functors do to isomorphisms?
  3. What does the forgetful functor Grp→Set\mathbf{Grp} \to \mathbf{Set} forget?
  4. In what sense is the fundamental group a functor?
  5. Give one functor from this page and one thing it preserves or forgets.

Answers: 1. F(id⁡A)=id⁡F(A)F(\operatorname{id}_A) = \operatorname{id}_{F(A)} and F(g∘f)=F(g)∘F(f)F(g \circ f) = F(g) \circ F(f). 2. Carry them to isomorphisms (Theorem 4.1). 3. The group structure; it keeps the underlying set and functions. 4. Continuous pointed maps induce group homomorphisms, compatibly with composition. 5. For instance: UU forgets; π1\pi_1 preserves loop composition.

5. Natural Transformations and Adjunctions

Section titled “5. Natural Transformations and Adjunctions”

Definition. Given functors F,G:C→DF, G: \mathcal{C} \to \mathcal{D}, a natural transformation η:F⇒G\eta: F \Rightarrow G assigns to each object AA a morphism ηA:F(A)→G(A)\eta_A: F(A) \to G(A) such that for every morphism f:A→Bf: A \to B, the square

F(A)→ηAG(A)F(f)↓↓G(f)F(B)→ηBG(B)\begin{CD} F(A) @>{\eta_A}>> G(A) \\ @V{F(f)}VV @VV{G(f)}V \\ F(B) @>>{\eta_B}> G(B) \end{CD}

commutes: G(f)∘ηA=ηB∘F(f)G(f) \circ \eta_A = \eta_B \circ F(f).

Definition. An adjunction between functors F:C→DF: \mathcal{C} \to \mathcal{D} and G:D→CG: \mathcal{D} \to \mathcal{C} is, for every pair of objects AA of C\mathcal{C} and BB of D\mathcal{D}, a bijection

ΦA,B:Hom⁡D(F(A),B)≅Hom⁡C(A,G(B))\Phi_{A,B}: \operatorname{Hom}_{\mathcal{D}}(F(A), B) \cong \operatorname{Hom}_{\mathcal{C}}(A, G(B))

natural in both variables: for every a:A′→Aa: A' \to A in C\mathcal{C} and every b:B→B′b: B \to B' in D\mathcal{D},

ΦA′,B(h∘F(a))=ΦA,B(h)∘a,ΦA,B′(b∘h)=G(b)∘ΦA,B(h).\Phi_{A',B}(h \circ F(a)) = \Phi_{A,B}(h) \circ a, \qquad \Phi_{A,B'}(b \circ h) = G(b) \circ \Phi_{A,B}(h).

We write F⊣GF \dashv G (FF is left adjoint, GG is right adjoint).

Example: Free ⊣ Forgetful. The free group functor F:Set→GrpF: \mathbf{Set} \to \mathbf{Grp} is left adjoint to the forgetful functor U:Grp→SetU: \mathbf{Grp} \to \mathbf{Set}:

Hom⁡Grp(F(S),G)≅Hom⁡Set(S,U(G)).\operatorname{Hom}_{\mathbf{Grp}}(F(S), G) \cong \operatorname{Hom}_{\mathbf{Set}}(S, U(G)).

This says: a group homomorphism from the free group on SS to GG is exactly a function from SS to GG – the images of the generators freely determine the homomorphism. This bijection is natural in both SS and GG.

Why adjunctions matter. An adjunction captures the concept of “the most efficient solution to a universal problem.” The free group is the most efficient way to turn a set into a group – no extra relations, no wasted structure. Adjunctions formalise this efficiency, and they appear throughout mathematics: the tensor-hom adjunction in algebra, the product-hom adjunction in topology, the base-change adjunction in geometry.

Quick check.

  1. State the naturality square of η:F⇒G\eta: F \Rightarrow G.
  2. What does an adjunction assign to each pair A,BA, B?
  3. Which two naturality equations did the adjunction definition demand?
  4. What do the free and forgetful functors form?
  5. In words: what does Hom⁡Grp(F(S),G)≅Hom⁡Set(S,U(G))\operatorname{Hom}_{\mathbf{Grp}}(F(S), G) \cong \operatorname{Hom}_{\mathbf{Set}}(S, U(G)) say?

Answers: 1. G(f)∘ηA=ηB∘F(f)G(f) \circ \eta_A = \eta_B \circ F(f). 2. A bijection Hom⁡D(F(A),B)≅Hom⁡C(A,G(B))\operatorname{Hom}_{\mathcal{D}}(F(A), B) \cong \operatorname{Hom}_{\mathcal{C}}(A, G(B)). 3. ΦA′,B(h∘F(a))=ΦA,B(h)∘a\Phi_{A',B}(h \circ F(a)) = \Phi_{A,B}(h) \circ a and ΦA,B′(b∘h)=G(b)∘ΦA,B(h)\Phi_{A,B'}(b \circ h) = G(b) \circ \Phi_{A,B}(h). 4. An adjunction F⊣UF \dashv U. 5. A homomorphism from the free group on SS is exactly a function from SS into GG.

  1. Verify that Matk\mathbf{Mat}_k satisfies the category axioms. (§1 – composition is matrix multiplication, so associativity of composition is associativity of matrix multiplication, proved entrywise: ((AB)C)ij=∑l(AB)ilClj=∑l,mAimBmlClj=(A(BC))ij((AB)C)_{ij} = \sum_l (AB)_{il}C_{lj} = \sum_{l,m} A_{im}B_{ml}C_{lj} = (A(BC))_{ij}.)
  2. Prove that the empty set ∅\emptyset is an initial object in Set\mathbf{Set}. (§3 – for every set AA, there exists a unique function ∅→A\emptyset \to A because there are no elements to map.)
  3. Prove that if f:A→Bf: A \to B is both mono and split epi (there exists g:B→Ag: B \to A with f∘g=id⁡Bf \circ g = \operatorname{id}_B), then ff is an isomorphism. (§2 – f∘(g∘f)=(f∘g)∘f=f=f∘id⁡Af \circ (g \circ f) = (f \circ g) \circ f = f = f \circ \operatorname{id}_A; cancelling the mono ff on the left gives g∘f=id⁡Ag \circ f = \operatorname{id}_A.)
  4. Show that the forgetful functor U:Grp→SetU: \mathbf{Grp} \to \mathbf{Set} is faithful but not full. (§4 – faithful: distinct homomorphisms are distinct functions; not full: not every function between underlying sets is a homomorphism.)
  5. Let F,F′:C→DF, F': \mathcal{C} \to \mathcal{D} both be left adjoint to the same G:D→CG: \mathcal{D} \to \mathcal{C}. Show that the adjunction bijections Hom⁡D(F(A),B)≅Hom⁡C(A,G(B))≅Hom⁡D(F′(A),B)\operatorname{Hom}_{\mathcal{D}}(F(A), B) \cong \operatorname{Hom}_{\mathcal{C}}(A, G(B)) \cong \operatorname{Hom}_{\mathcal{D}}(F'(A), B) can be composed to give a natural bijection Hom⁡D(F(A),B)≅Hom⁡D(F′(A),B)\operatorname{Hom}_{\mathcal{D}}(F(A), B) \cong \operatorname{Hom}_{\mathcal{D}}(F'(A), B) for all A,BA, B. (§5 – the composition of two bijections is a bijection; naturality follows from the naturality of each adjunction.)

Problems. The quick checks above tested recall. These chain several results and require full written arguments; hints are included where the jump is large.

  1. Prove that initial objects are unique up to unique isomorphism. (Dualise Theorem 3.1: reverse every arrow in the proof.)
  2. Prove that the composition of isomorphisms is an isomorphism and that (f∘g)−1=g−1∘f−1(f \circ g)^{-1} = g^{-1} \circ f^{-1}. (Compose the claimed inverse with f∘gf \circ g and regroup by associativity; both composites collapse to the relevant identity.)
  3. Prove that in Matk\mathbf{Mat}_k the isomorphisms are exactly the invertible square matrices. (An isomorphism in the category needs two-sided matrix inverses: BC=IBC = I and CB=ICB = I for the same nn.)

The entire page follows from one shift: stop asking what objects contain and start asking how they relate. Every definition (mono, epi, terminal, functor, adjunction) is stated in terms of arrows and commutative diagrams – never in terms of elements. This is why category theory applies to objects that have no elements (the category Matk\mathbf{Mat}_k), and why it unifies seemingly unrelated areas (the same universal property describes products in Set\mathbf{Set}, kernels in Grp\mathbf{Grp}, and disjoint unions in Set\mathbf{Set}).

  • Linear Algebra Done Wrong – the next page: coordinate-free linear algebra with determinants as alternating forms.
  • Conceptual Mathematics – Lawvere & Schanuel’s book, which develops this material at a gentler pace.
  • Algebra: Chapter 0 – Aluffi’s book, which treats all of algebra through the categorical lens you have just learned.