Exhibit left inverse of a function, if it exists

27 Views Asked by At

Exhibit a left inverse of $f:\mathbb{Z}\to\mathbb{Z}$, if it exists,
where $f(x)=\begin{cases}x,\text{ if }x\in2\mathbb{Z}\\2x-1,\text{ otherwise }\end{cases}$.

$\underline{\text{My observations}}$:-
The given function is not onto, since $3$ has no preimage under $f$.
The function is one-one.
I tried to find range of $f$, i.e., $f(\mathbb{Z})$. According to me,
$f(\mathbb{Z})=2\mathbb{Z}\cup(4\mathbb{Z}+1)$.
So, one possible left inverse can be defined as
$$g(x)=\begin{cases} x,\text{ if }x\in2\mathbb{Z}\\ \frac{x+1}{2},\text{ if }x\in4\mathbb{Z}+1\\ 0,\text{ otherwise } \end{cases}$$

However, answer to this question is given as
$$g(x)=\begin{cases} x,\text{ if }x\in2\mathbb{Z}\\ \frac{x+1}{2},\text{ otherwise } \end{cases}$$

Are both answers correct ?