Surjection iff Right Cancellable

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

Proof

 * 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$$.

It is clear that the domains of $$h_1$$ and $$h_2$$ are the same - this follows from the fact that $$f$$ is surjective. Similarly, the ranges being the same follows from this.

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.


 * Suppose $$f$$ is a mapping which is not a surjection.

Then $$\exists y_1 \in Y: \lnot \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.