# Prove that g is injective then f is injective

Let $g,f:\Bbb Z\to \Bbb Z$ be functions that are defined like this:

$g=\begin{cases} f(x)-1 &\mbox{if } f(x)=2y \\ f(x)+1 & \mbox{if } f(x)=2y+1 \end{cases}$

I want to prove that if $g$ is injective, then also $f$

What I did is this:

I declared $c,d \in Z$ such that $f(c) = f(d)$ Let assume that $f(c),f(d)$ are even, let substitute in g:

$g(c) = f(c) -1$ $g(d) = f(d) -1$

It easy to see that: $f(c) -1 = f(d) -1$,

but because $g$ is injective, $c=d$, hence, if $f(c) = f(d)$ then: $c=d$ and f is surjective (I proved just the even part since the odd part of the function is similar)

I'm not sure about the way I proved this, is this right?

Is there another way of solving this? I'd be glad for some help.

Thanks!

• This is a correct proof of injectivity. You started with 2 general arguments having the same image, and you established in the most general case (image even, image odd separately) that the arguments must be equal. – Justpassingby Dec 5 '15 at 17:28
• @roger the hypothesis is not about $c$ and $d$ but about $f(c)=f(d)$ which is a single number, either even or odd. – Justpassingby Dec 5 '15 at 17:29
• @Justpassingby Yep, thanks. Reading too fast. I deleted my comment. – rogerl Dec 5 '15 at 17:30