Surjection iff Right Cancellable

Theorem
A mapping $$f$$ is a surjection iff $$f$$ is right cancellable.

Sufficient Condition
Suppose $$f: X \to Y$$ is surjective.

Suppose $$h_1: Y \to Z, h_2: Y \to Z: h_1 \circ f = h_2 \circ f$$.

As $$f$$ is a surjection, $$\operatorname{Im} \left({f}\right) = \operatorname{Rng} \left({f}\right) = Y$$ by definition.

But in order for $$h_1 \circ f$$ to be defined, it is necessary that $$\operatorname{Rng} \left({f}\right) = \operatorname{Dom} \left({h_1}\right)$$.

Similarly, for $$h_2 \circ f$$ to be defined, it is necessary that $$\operatorname{Rng} \left({f}\right) = \operatorname{Dom} \left({h_2}\right)$$.

So it follows that the domains of $$h_1$$ and $$h_2$$ are the same.

Also: again by definition of composition of mappings.
 * $$\operatorname{Rng} \left({h_1}\right) = \operatorname{Rng} \left({h_1 \circ f}\right)$$
 * $$\operatorname{Rng} \left({h_2}\right) = \operatorname{Rng} \left({h_2 \circ f}\right)$$

Now, we have shown that the domains and ranges of $$h_1$$ and $$h_2$$ are the same.

All we need to do now to prove that $$h_1 = h_2$$, and therefore that $$f$$ is right cancellable, is to show that:
 * $$\forall y \in Y: h_1 \left({y}\right) = h_2 \left({y}\right)$$.

So, let $$y \in Y$$.

As $$f$$ is surjective, $$\exists x \in X: y = f \left({x}\right)$$. Thus:

$$ $$ $$ $$ $$

Thus $$h_1 \left({y}\right) = h_2 \left({y}\right)$$ and thus $$f$$ is right cancellable.

Necessary Condition
Suppose $$f$$ is a mapping which is not surjective.

Then $$\exists y_1 \in Y: \neg \exists x \in X: f \left({x}\right) = y_1$$.

Let $$Z = \left\{{a, b}\right\}$$.

Let $$h_1$$ and $$h_2$$ be defined as follows.


 * $$h_1 \left({y}\right) = a: y \in Y$$

h_2 \left({y}\right) = \begin{cases} a & : y \ne y_1 \\ b & : y = y_1 \end{cases} $$

Thus we have $$h_1 \ne h_2$$ such that $$h_1 \circ f = h_2 \circ f$$, and therefore $$f$$ is not right cancellable.

It follows from the Rule of Transposition that if $$f$$ is right cancellable, then $$f$$ must be surjective.