I tried using a very specific counterexample here where I select a surjective function for which the compositions are equal but the functions within are not.
This is probably off-base, but it's what I've got so far.
Assume $f \circ g = f \circ h$.
Consider the surjective function $f:\mathbb{R} \rightarrow \mathbb{R}$ given by $f(x) = x*sin(x)$.
Should I prove this is surjective before proceeding?
Suppose for the sake of contradiction that $g \neq h$ given by
$g(x) = 0$ and $h(x) = 2\pi$.
Can I choose these constant functions? Do I need to define domains and codomains?
$(f \circ g)(x) = f(g(x)) = f(0) = 0 * sin(0) = 0$
$(f \circ h)(x) = f(h(x)) = f(2\pi) = 2\pi * sin(2\pi) = 0$
Observe that $f \circ g = f \circ h$ $\land$ $x_1 \neq x_2$.
Thus we have given a counterexample to disprove the statement. Thus surjectivity of $f$ is not a sufficient condition for the statement to be true.
I understand the proof completely now and understand I have it correct, thank you for your responses.
Let $f: \mathbb{R} \rightarrow [-1,1]$, $f(x)=\sin(x)$. Then let $g(x)=x$, $h(x)=x+2 \pi$. $f$ is surjective and $f \circ h= f \circ g$, but we clearly don't have $h=g$