Morphism epimorphism if and only if surjective In the category of sets, I want to prove that a morphism is an epimorphism if and only if it is surjective.
In both directions, I'm having a hard time approaching this problem.
This is how far I got.
$$\text{Morphism is epimorphism} \implies \text{Morphism is surjective}:$$
Let $\phi: A \to B$ be an epimorphism. 
For any morphisms $\beta,\beta': B \to Y$, we have 
$$ \beta \ \circ \ \phi = \beta' \ \circ \phi \implies \beta = \beta'.
$$
$$\vdots$$
$$\text{Morphism is surjective}\implies \text{Morphism is epimorphism} :$$
Pick an arbitrary $b \in B$.
Since $\phi$ is surjective there exists an $a\in A$ such that $b = \phi(a)$.
Set $y = \beta(\phi(a)) = \beta'(\phi(a))$.
$$\vdots$$ 

Some hints:


*

*For epic $\Rightarrow$ surjective, let $Y=B \cup \{ \star \}$ (where $\star \not \in B$), let $\beta$ be the identity on $B$, and let $\beta'$ be the map which sends everything in the image of $\phi$ to itself, and everything not in the image of $\phi$ to $\star$. See what happens.

*For surjective $\Rightarrow$ epic, just show that if $\beta,\beta' : B \to Y$ and $\beta \circ \phi = \beta' \circ \phi$, then $\beta(b)=\beta'(b)$ for all $b \in B$. Use the fact that $\phi$ is surjective to write a given $b \in B$ in a more useful way.
