Consider $f : \mathbb{N} → \mathbb{Z}$ defined as $f (n) = \frac{(−1)^n (2n−1)+1}{4}$. Find its inverse.

1.1k Views Asked by At

I cannot find an inverse of this function for $f(n) = x$, where $x$ is an integer, that gives out a natural number. Some guidance would be very helpful... I already know the function is bijective so there has to be an inverse.

Edited to add that I tried letting $n = 2x$ but since $x$ is an integer, there's still the possibility of having an input like $-2$ that gives a negative number, which is clearly not a natural number.

3

There are 3 best solutions below

0
On

The function does this:

$$1\to 0$$ $$2\to 1$$ $$3\to -1$$ $$4\to 2$$ $$5\to -2$$ $$\vdots$$ and so on.

The inverse would be $g\colon\mathbb{Z}\to\mathbb{N}$ defined by $$g(n) = |2n|+\boldsymbol{1}_{\{n\leq 0\}},$$ where $\boldsymbol{1}_{\{n\leq 0\}}$ is the characteristic function on the event $\{n\leq 0\}$, i.e. it is $1$, when $n$ is non-positive, and is otherwise $0$.

You need to check that this is indeed the inverse.

0
On

$$f^{-1}(z)=\begin{cases} 2|z| + 1 &\quad& z\leq 0\\ 2|z| &\quad& z>0 \end{cases}$$

We see that for $n$ odd, $f(n)=\frac{1-n}{2}$, so the inverse is as claimed.

Then, for $n$ even, $f(n)=\frac{n}{2}$, and the inverse is also as claimed.

0
On

\begin{align*} f(n) &= \frac{(−1)^n (2n−1)+1}{4} \\ 4f(n) &= (−1)^n (2n−1)+1 \\ 4f(n)-1 &= (−1)^n (2n−1) \\ (-1)^n(4f(n)-1) &= (2n−1) \\ 1+(-1)^n(4f(n)-1) &= 2n \\ n &= \frac{1}{2}+\frac{(-1)^n}{2}(4f(n)-1) \\ n&= 1-2f(n) &\text{for n odd} \\ n&= 2f(n) &\text{for n even} \\ \end{align*}

Which is the inverse from $\mathbb{Z} \to \mathbb{N}$ For example, if $f(n) = 1$, you get $n=-1$ (odd) or $n=2$ (even). Since the range of the inverse is $\mathbb{N}$, $n$ has to be 2.

This inverse can be compacted into a single expression, as has been done by others.