How to prove that function that maps elements from Z to N is injection

43 Views Asked by At

I have a function that maps Z to N.

Intuitively I know that it is an injection, but I don't know how to prove it's injection. I know how to prove that some function is injection, but if the function has cases I'm not sure how to approach this. $$ h(a)= \begin{cases}2 a, & a>0 \\\\ -2 a+1, & a \leq 0\end{cases} $$

1

There are 1 best solutions below

3
On BEST ANSWER

One often checks injectivity by considering $a,b$ with $f(a)=f(b)$ and trying to deduce $a=b$. In this case it is easier to show the contrapositive statement: You have to show that for any two $a,b \in \mathbb Z$ with $a\neq b$ the function satisfies $f(a)\neq f(b)$. Since the function is defined through a case distinction you have no other choice than to check this property via a case distinction. What cases can appear?

If $a>0$ and $b>0$ then $a\neq b$ implies $f(a)=2a \neq 2b = f(b)$, essentially because the function $\mathbb N \rightarrow \mathbb N, x \mapsto 2x$ is an injection.

Similarly, if $a\leq0$ and $b\leq 0$ then $a\neq b$ implies $f(a) = -2a+1 \neq -2b+1 = f(b)$, since the functions $\mathbb Z \rightarrow \mathbb Z, x \mapsto -2x$ and $\mathbb N_0 \rightarrow \mathbb N, x \mapsto x+1$ are injections.

We still have to consider what happens if $a>0$ and $b\leq0$ and what happens if $a\leq0$ and $b>0$. By symmetry it suffices to consider the first case. Here $f(a)=2a$ is an even number, while $f(b)=-2b+1$ is odd, so $f(a)\neq f(b)$.