I need to prove the following claim:
Suppose $f:A\to B$ is function. Prove: $f$ is surjective iff for all sets $C$ and all functions $h:B\to C$ and $g:B\to C$, $h\circ f = g\circ f$ implies $h = g$.
Step 1:
Assume $f$ is surjective and $h \circ f = g \circ f$. For all $y\in Y$, there exists $x\in X$ such that $f(x)=y$.
Since $h \circ f = g \circ f$, we have $h(f(x))=g(f(x))$. Because of our assumption, For all $y\in Y$, $h(y)=g(y)$. So, $g=h$.
Step 2:
I do not know how to do step 2. Can you check step 1 and help me to do step 2?