# If $f \circ g$ is injective and $g$ is surjective - is $f$ injective? [duplicate]

Let $f: X \rightarrow Y$ and $g: Y \rightarrow X$

If $f \circ g$ is injective and $g$ is surjective - is $f$ injective?

I am trying to learn the way of prooving things. So I'll give it a try and please correct at every wrong step.

I assume that the given statement ist true.

So first I give the condition that $g$ is surjective: $\forall y \in Y : \exists x \in X:g(y)=x$

So two different $y$-values can point to the same $x$-value:

Let $y_1, y_2 \in Y, y_1 \neq y_2 : \exists x \in X : g (y_1)=x$ and $g (y_2)=x$

Next I want to connect the fact that $f \circ g$ is injective with the surjective condition of $g$:

Let $z_1, z_2 \in X \quad$ Because $z_1, z_2 \in X$ it is true that $z_1, z_2 \in g(y)$ thus: $$f \circ g(y_1) = f \circ g (y_2)$$ $$f(z_1) = f(z_2)$$ $$z_1 = z_2$$

So $f$ is injective.

## marked as duplicate by user228113, user91500, TastyRomeo, C. Falcon, user223391 Feb 21 '17 at 17:58

• no, because there is $f:X \rightarrow Y$ and $g \circ f : X \rightarrow Z$. And I would really appreciate someone could just check my version for me to practice – jublikon Feb 20 '17 at 17:38
• Is $y_1\not=y_2$? Why do you assume there are two different y-values with the same image under g? – la flaca Feb 20 '17 at 17:38
• yes, $y_1 \neq y_2$. I'll correct it. I do that because surjective says that two domain values can hit the same codomain value. I tried to used that to show the injectivity in the composition later – jublikon Feb 20 '17 at 17:40
• @jublikon Special case $X=Z$, I guess. – user228113 Feb 20 '17 at 17:40
• @jublikon surjectivity does not imply injectivity, that's right. But it doesn't mean surjectivity implies not injectivity. So you can not assume there exist two different y-values with the same image. – la flaca Feb 20 '17 at 17:44

The condition that $g\colon Y\to X$ is surjective translates as $$\forall x\in X\;\exists y\in Y,\;g(y)=x$$ not the way you translated it.

Here are sketches of two proofs:

By contrapositive:

We show that if $f$ is not injective, but $g$ surjective, the $f\circ g$ is not injective.

Indeed, let $y_1, y_2\in Y$ such that $f(y_1)=f(y_2)$. As $g$ is surjective, $y_1$ and $y_2$ have (distinct) preimages by $g$ $x_1,x_2\in X$ This means that $$f(y_1)=f(g(x_1))=f(y_2)=f(g(x_2)),$$ so $f\circ g$ is not injective.

Direct proof:

If $f\circ g$ is injective, it implies $g$ is injective. As it is also surjective by hypothesis, it is bijective. Let $g^{-1}\colon X\to Y$ be the inverse bijection . Then the composition $$(f\circ g)\circ g^{-1}=f\circ( g\circ g^{-1})=f\circ\operatorname{id}_X=f$$ is injective.