Composition & Identity

How arrows compose, identity morphisms, and associativity

Composition & Identity

The three axioms of a category are deceptively simple: (1) morphisms compose, (2) composition is associative, and (3) every object has an identity morphism. These three rules are enough to build an entire universe of mathematics.

Composition is the heartbeat of category theory. When we have f : A → B and g : B → C, we can form the composite g ∘ f : A → C. This seemingly simple idea turns out to be the foundation for functors, natural transformations, and everything else.

Composition Pipeline

Composition is the fundamental operation: given f : A → B and g : B → C, the composite g ∘ f : A → C goes from A directly to C. Watch the particle travel along both arrows to reveal the composite!

fgABC
Press Play to see composition in action

Key insight: Composition is written right-to-left: g ∘ f means "first apply f, then apply g." The composite morphism g ∘ f "short-circuits" through B, going directly from A to C.

Identity Morphisms

Every object in a category has a special identity morphism that acts as a "do nothing" arrow. For any morphism f : A → B, composing with identity changes nothing: f ∘ id_A = f = id_B ∘ f.

fid_Aid_BABf ∘ id_A = f

Key insight: Identity morphisms are the categorical analog of the number 0 for addition or 1 for multiplication — they are the neutral element for composition.

Associativity Checker

Composition must be associative: for arrows f, g, h in sequence, it doesn't matter which pair we compose first. The result is always the same morphism from A to D.

h ∘ (g ∘ f)
fghg ∘ f firstABCD
(h ∘ g) ∘ f
fghh ∘ g firstABCD
h ∘ (g ∘ f) = (h ∘ g) ∘ f — Associativity holds!

Key insight: Associativity means we can write h ∘ g ∘ f without parentheses — the grouping doesn't matter. This is one of the three axioms every category must satisfy.

Commutative Diagram Builder

A diagram commutes when all paths between the same two objects compose to the same morphism. This is the single most important concept in category theory — "diagram chasing" is how proofs work!

fghABC
Paths:
Diagram commutes! g ∘ f = h

Key insight: When category theorists draw a diagram and say it "commutes," they mean every pair of paths with the same start and end compose to the same morphism. Most theorems in category theory are expressed this way.

Key Takeaways

  • Composition — Given f : A → B and g : B → C, the composite g ∘ f : A → C goes directly from A to C.
  • Identity — Every object A has an identity morphism id_A such that f ∘ id_A = f and id_B ∘ f = f.
  • Associativity — h ∘ (g ∘ f) = (h ∘ g) ∘ f — parentheses don't matter.
  • Commutative Diagrams — A diagram commutes when all paths between the same endpoints give the same composite.