Given a function, prove that it's injective

106 Views Asked by At

Given a function $f: \mathbf{N}_0 \to \mathbf{N}_0$, defined $$ f(x) = \begin{cases} x+3 & \text{if } x \in \mathbf{N}_{\text{even}} \\ x-1 & \text{if } x \in \mathbf{N}_{\text{odd}} \end{cases} $$

I have to prove that the function is injective.

My attempt:

Suppose that $f(a) = f(b), \forall a,b \in N_{even}$

$a+3=b+3 \implies a = b$

Suppose that $f(a) = f(b), \forall a,b \in N_{odd}$

$a-1=b-1 \implies a = b$

Since $a,b$ are arbitrary, $f$ is injective.

2

There are 2 best solutions below

2
On BEST ANSWER

Sorry, but your attempt is incomplete.

What you have to prove is that, if $f(a)=f(b)$, then $a=b$.

There are four cases:

  1. $a$ and $b$ even
  2. $a$ even and $b$ odd
  3. $a$ odd and $b$ even
  4. $a$ and $b$ odd

In case 1, we have $a+3=b+3$, hence $a=b$.

In case 4, we have $a-1=b-1$, hence $a=b$.

You’re missing the other two cases, which actually are the same, so I’ll only deal with 2. In this case, $a-1=b+3$, therefore $$ a=b+4 $$ which is a contradiction.

The fact that cases 2 and 3 can’t happen doesn’t allow you to skip them without justification.

5
On

Proving that $f$ is injective means to prove that$$(\forall a,b\in\mathbb{N}_0):f(a)=f(b)\implies a=b.$$So, take $a,b\in\mathbb{N}_0$ and assume that $f(a)=f(b)$. Note that $f$ maps odd numbers into even numbers and vice-versa. So, since $f(a)=f(b)$, $a$ and $b$ are both odd or both even. If $a$ and $b$ are even, then$$f(a)=f(b)\iff a+3=b+3\iff a=b.$$If $a$ and $b$ are odd, then$$f(a)=f(b)\iff a-1=b-1\iff a=b.$$