# Epimorphisms and Surjectivity

posted February 24, 2012

Homework spoiler alert / disclaimer: This post might contain a homework problem solution, and of course it might even be wrong! So if you are doing the exercise mentioned below, read on at your own risk.

I'm currently working through some exercises in Paolo Aluffi's text, Algebra: Chapter 0, and I've come to an exercise asking for a proof of the following:

A function $$f$$ is surjective if and only if it is an epimorphism.

For context, here is the accompanying definition of epimorphism:

A function $$f:A \to B$$ is an epimorphism if for all sets $$Z$$ and all functions $$a_1, a_2 : B \to Z$$, $a_1 \circ f = a_2 \circ f \implies a_1 = a_2.$

This proof necessarily has two parts, one for each direction of the "iff". In this post I'm going to try to work out and show the two sides to the proof.

## Part One

Show that if a function is surjective, then it is an epimorphism.

I found this part of the proof to be pretty straightforward, in part because it is so similar to the analogous proof for monomorphisms.

Let $$f: A \to B$$ be a surjective function. Choose $$a_1, a_2: B \to Z$$ such that

$a_1 \circ f = a_2 \circ f \implies a_1 = a_2.$

Since $$f$$ is surjective, it has a right-inverse $$g : B \to A$$ such that $$f \circ g = \textrm{id}_B$$. We can apply $$f$$'s right-inverse on both sides:

$(a_1 \circ f) \circ g = (a_2 \circ f) \circ g.$

By associativity of $$\circ$$ we have

$a_1 \circ (f \circ g) = a_2 \circ (f \circ g).$

By simplification of $$f \circ g$$ we have

$a_1 \circ \textrm{id}_B = a_2 \circ \textrm{id}_B$

so

$a_1 = a_2.$

So $$f$$ is an epimorphism by the definition.

## Part Two

Show that if a function is an epimorphism, then it is surjective.

If $$f: A \to B$$ is an epimorphism, then by the above definition we can choose two functions $$a_1, a_2 : B \to Z$$ as described above such that

$a_1 \circ f = a_2 \circ f \implies a_1 = a_2.$

Now assume that $$f$$ is not surjective. Then there is some $$b \in B$$ such that $$b \notin \textrm{im} f$$. If so, it's possible that $$a_1(b) \neq a_2(b)$$ so the implication that $$a_1 = a_2$$ does not hold. Therefore, for the implication to hold, $$f$$ must be surjective.

Thanks to Jason Dagit for tons of help!