[Math] Show that if $g \circ f$ is injective, then so is $f$.

discrete mathematicsfunctionsproof-writing

The Problem:

Let $X, Y, Z$ be sets and $f: X \to Y, g:Y \to Z$ be functions.

(a) Show that if $g \circ f$ is injective, then so is $f$.

(b) If $g \circ f$ is surjective, must $g$ be surjective?

Where I Am:

So, I really have trouble with these, for some reason. I can draw pictures and make sense of the problems, but writing down proofs is very difficult for me.

Basically, for (a), I ended up with some complicated statement involving an implication implying another implication and then tried to derive a contradiction. It just got so convoluted that I couldn't make sense of it anymore, and I know there's a quick, elegant way to show it.

For (b), I know that $g$ need not be surjective. Once again, though, proving it directly from definitions has given me a bit of a headache.

Any help here would be appreciated. Thanks in advance.

The Proofs!

Ok, I did it. Thanks for the help, everyone! Let me know if there's anything wrong with these proofs, or if they could bet any better.

(a) Suppose $f$ is not injective. Then
$$ f(x_1)=f(x_2) \implies x_1 \ne x_2 \text{ }(*).$$
Let $f(x_1)=y_0=f(x_2)$ and let $g(y_0)=z_0$. Then $$ (g \circ f)(x_1) = (g \circ f)(x_2) = g(y_0) = z_0. $$
Since $g \circ f$ is injective,
$$ (g \circ f)(x_1) = (g \circ f_2) \implies x_1 = x_2. $$
However, this contradicts $(*)$. Therefore, $f$ must be injective.

(b) Suppose $g$ is not surjective. Then

$$ \forall y \in Y, \exists z \in Z \text{ such that } g(y) \ne z \text{ }(**).$$

Since, $g \circ f$ is surjective,

$$ \forall z \in Z, \exists x \in X \text{ such that } g(f(x)) = z \text{ } (***). $$

Let $f(x) = y$. Then,

$$ g(f(x)) = g(y) = z. $$

Because of $(***)$, this is true for all $z \in Z$, which contradicts $(**)$. Therefore, $g$ must be surjective.

Best Answer

(a) Let $f(x_1)=f(x_2)$. Then, $g(f(x_1))=g(f(x_2))$, but since $g\circ f$ is injective...

(b) $g(Y)\supseteq (g\circ f)(X)=g(f(X))$. Hence, if $(g\circ f)(X)=Z$...