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.

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

Then from Right Inverse Mapping:
 * $$\exists g: T \to S: f \circ g = I_T$$

Suppose $$h \circ f = k \circ f$$ for two mappings $$h$$ and $$k$$.

Then:

$$ $$ $$ $$ $$ $$ $$

Thus $$f$$ is right cancellable.

So surjectivity implies right cancellability.

Necessary Condition
Now suppose $$f: S \to T$$ is a right cancellable mapping.

If $$T$$ contains only one element, then by definition $$T$$ is a singleton and it automatically follows from Mapping to Singleton is Surjection that $$f$$ is a surjection.

So we suppose that $$T$$ contains at least two elements.

Call those two elements $$a$$ and $$b$$, and we note that $$a \ne b$$.

We define the two mappings $$h, k$$ as follows:
 * $$h: T \to T: \forall x \in T: h \left({x}\right) = \begin{cases}

x & : x \in \operatorname{Im} \left({f}\right) \\ a & : x \notin \operatorname{Im} \left({f}\right) \end{cases}$$


 * $$k: T \to T: \forall x \in T: k \left({x}\right) = \begin{cases}

x & : x \in \operatorname{Im} \left({f}\right) \\ b & : x \notin \operatorname{Im} \left({f}\right) \end{cases}$$

It is clear that:
 * $$\forall y \in S: h \left({f \left({y}\right)}\right) = f \left({y}\right) = k \left({f \left({y}\right)}\right)$$

and so $$h \circ f = k \circ f$$.

But by hypothesis, $$f$$ is right cancellable.

Thus $$h = k$$.

Now, suppose $$T \ne \operatorname{Im} \left({f}\right)$$, and so $$\operatorname{Im} \left({f}\right) \subset T$$.

That is, $$\exists x \in T: x \notin \operatorname{Im} \left({f}\right)$$.

It follows that $$a = h \left({x}\right) = k \left({x}\right) = b$$.

But we posited that $$a \ne b$$.

From this contradiction we conclude that $$T = \operatorname{Im} \left({f}\right)$$

So, by Surjection iff Image equals Range, $$f$$ must be a surjection.