# Function composition proof - proof that function is injective

Let $f:A\to B$ be a function.

Let $h:B\to B$, $g:A\to A$ be an injective and surjective functions.

Prove: $f$ is injective iff $h\circ f \circ g$ is injective.

What I did is this:

Case 1: Let assume that $h\circ f \circ g$ is injective and prove that $f$ is injective.

Since $g,h$ are injective and surjective, there exist an inverse for each one of them such that:

$$h^{-1}h\circ f \circ gg^{-1}= f$$

So $f$ is injective as well.

Case 2:

Let assume that $f$ is injective and prove that $h\circ f \circ g$ is injective.

Since $f$ is injective then: $f \circ g$ is injective as well (*)

Lets define $Z = f \circ g$ $\leftarrow$ injective

So we have: $h \circ Z$ where both functions are injective, then their composition must be as well. (**)

That's why $h \circ f \circ g$ is injective.

I'm not quite sure about the steps I did in * and **,

Both of them rely that the composition of two injective functions is injective, but is that true? If so, can someone show me why?

Thanks

• If you can assume the composition of two injective functions is injective then the composition of three injection functions is also by induction. No need to introduce Z. But I think you need to prove the composition of two injective functions is injective (unless your text already did it for you). It's very easy and I'm sure you can do it. Commented Nov 25, 2015 at 19:57

Let $f$ and $g$ be two injective functions. Consider the $p=f \circ g$. Then \begin{align*} p(a) & = p(b)\\ f(g(a)) & = f(g(b))\\ g(a) & = g(b) && (\because f \text{ is injective})\\ a & = b && (\because g \text{ is injective}) \end{align*} Thus $p$ is injective.

1) if $f$ is injective then $h \circ f \circ g$ is injective.

If $h \circ f \circ g (a) =h \circ f \circ g (b)$ then

$f \circ g (a) = f \circ g(b)$ as h is injective.

$g(a) = g(b)$ as f is injective.

$a = b$ as g is injective.

Thus $h \circ f \circ g$ is injective.

2) if $h \circ f \circ g$ injective than $f$ is injective. (you did okay but...)

Suppose $a \ne b$.

Then $c = g^{-1}(a) \ne g^{-1}(b) = d$

Then $h(f(g(c)) \ne h(f(g(d))$

The $f(g(c)) = f(a) \ne f(b) = f(g(c))$;

So $f(a) = f(b)$ only if $a = b$.

So f is injective.