Showing the Uniqueness of a Function

The following question is distantly related to the Fundamental Homomorphism Theorem:

$\fbox{Let}$

$f:A \rightarrow B$

$g_1:B \rightarrow C$

$g_2:B \rightarrow C$

and finally assume $g_1 \circ f = g_2 \circ f$

$\fbox{WTS}$

$g_1 = g_2$

$\fbox{Proof}$

Let $b \in B$ and consider that there must exist an $a \in A$ s.t. $g_1(b) = (g_1 \circ f)(a)$ so that

$$g_1(b) = (g_1 \circ f) (a) = (g_2 \circ f) (a) = g_2(b)$$

But I'm unclear on the very last assertion that $(g_2 \circ f) (a) = g_2(b)$. Couldn't it be that $(g_2 \circ f) (a) = g_2(b_1)$ s.t. $b_1 \ne b$? Does this mean the "proof" is wrong?

-
The proof is wrong because the statement is wrong. You need to add the condition that $f$ is onto. Otherwise, $g_1$ and $g_2$ might secretly disagree at places $f$ can't reach. Actually, your proof makes implicitly use of surjectivity ("there must exist an $a\in A$"). – Hagen von Eitzen Nov 7 '12 at 17:55

The alleged proof goes wrong in the first sentence. Since $f$ isn't assumed to be surjective, there need not be an $a$ of the sort that you say must exist. Not only the proof but the result itself is wrong, unless $f$ is surjective. That is, for any function $f:A\to B$ that isn't surjective, there exist two functions $g_1,g_2: B\to C$, for an appropriate $C$, such that $g_1\circ f=g_2\circ f$ but $g_1\neq g_2$. (Furthermore, $C$ can always be taken to be just $\{0,1\}$.)

This sort of "cancellation" of $f$ from the right side of compositions is used in category theory as the definition of "epimorphism", which serves as a general analog of surjectivity.

-

This is true, if $f$ is surjective. Then, for any $b$, you can use an $a$ such that $f(a)=b$.

One can weaken the assumption: $f$ is such that its image is dense (if $f,g_1,g_2$ are continuous), or generates the whole $B$ (if $f,g_1,g_2$ are homomorphisms).

Btw, what is your 'WTS' means?

-