Skip to content
The Lumenary
Grades 9–12Category TheoryLesson available

Composition

Composition of functions g ∘ f: why order matters, associativity, the identity laws, how injectivity, surjectivity and bijectivity behave under composition, and functions between sets as the motivating example of a category.

math.cat.composition

Builds on

Required prerequisites, all the way down: 7

You will learn to

  • Compute composites g ∘ f of functions given by formulas, tables and arrow diagrams, and determine when g ∘ f is defined.
  • Show by example that g ∘ f and f ∘ g can differ, and prove that composition is associative with identity functions as two-sided units.
  • Prove that composites of injections, surjections and bijections are injections, surjections and bijections, and that (g ∘ f)⁻¹ = f⁻¹ ∘ g⁻¹.
  • Explain why sets with functions, composition and identity functions satisfy the axioms that later define a category.

Definition

  • For f : A → B and g : B → C, the composite g ∘ f : A → C is defined by (g ∘ f)(a) = g(f(a)).
  • The identity function id_A : A → A is defined by id_A(a) = a.
  • f : A → B has an inverse if there is g : B → A with g ∘ f = id_A and f ∘ g = id_B.

Theorem

  • Associativity: h ∘ (g ∘ f) = (h ∘ g) ∘ f whenever the composites are defined.
  • Identity laws: f ∘ id_A = f = id_B ∘ f for every f : A → B.
  • Composites of injective (surjective, bijective) functions are injective (surjective, bijective).
  • If g ∘ f is injective then f is injective; if g ∘ f is surjective then g is surjective.
  • (g ∘ f)⁻¹ = f⁻¹ ∘ g⁻¹ when f and g are bijections.

Common misconceptions

  • Reading g ∘ f as 'do g first'; in g ∘ f, the function f is applied first.
  • Assuming composition is commutative.
  • Thinking that g ∘ f injective forces g to be injective; it forces only f to be injective.
  • Composing functions whose codomain and domain do not match.

Leads to

Optional discoveries

Learning pathways

Further reading

  • F. William Lawvere and Stephen H. Schanuel, Conceptual Mathematics: A First Introduction to Categories (1997)
  • Eugenia Cheng, The Joy of Abstraction (2022)