$$f(n)=(-1)^n\lfloor \frac{n}{2}\rfloor$$ this function is a map from $\mathbb{N}$ to $\mathbb{Z}$ ,and it is one to one and onto function .
This function usually use to show $card(\mathbb{N})$ is the same as $card
(\mathbb{Z})$ .
$$n=1 \to f=0\\n=2 \to f=1\\n=3 \to f=-1\\n=4 \to f=+2\\n=5\to f=-2\\\vdots$$ It is easy to prove its bijection. Now my question is : What is the expression of $f^{-1} $
In the other hand
$f(n)$ has clear expression ,does $f^{-1}$ has too ?
2026-04-13 19:46:03.1776109563
Inverse of a function form $\mathbb{N} \mapsto \mathbb{Z}$
67 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
3
First of all, I want to say that I had exactly the same question when I firstly saw the proof for $\mathrm{card}(\mathbb{N})=\mathrm{card}(\mathbb{Z})$, as I was not pleased by any means by the fact that everyone uses two part functions. Although it is absolutely valid and more clear for most people, I find a single obscure formula more pleasant just because it inherently feels like a continuous function.
So, if you really want to express your functions just by one expression, I would argue that $(-1)^n\lfloor \frac{n}{2}\rfloor$ depends on the floor function (and the floor function depends on the minimum function which is a two part function)
So, if we follow that approach, you can take $f\colon \mathbb N\to \mathbb Z$ as follows
$$f(n)=\frac{(-1)^n(2n-1)+1}{4}.$$ You can actually check that it works!, and moreover, it is exactly the same as $(-1)^n\lfloor \frac{n}{2}\rfloor$. Namely, $$n=1 \mapsto f(1)=\frac{-1*(2-1)+1}{4}=\frac{-1+1}{4}=0\\n=2 \mapsto f(2)=\frac{(4-1)+1}{4}=\frac{4}{4}=1\\n=3 \mapsto f(3)=\frac{-1*(6-1)+1}{4}=\frac{-4}{4}=-1\\n=4 \mapsto f(4)=\frac{(8-1)+1}{4}=\frac{8}{4}=+2\\n=5\mapsto f(5)=\frac{-1*(10-1)+1}{4}=\frac{-8}{4}=-2\\\vdots$$
I must say that I found that expression some years ago when I began my studies just because I wanted an obscure function to do the job. Moreover, when the teacher showed that $\mathrm{card}(\mathbb{N})=\mathrm{card}(\mathbb{Z})$ by means of a two part function, I asked him for a single expression and he just said that it was impossible while looking at me with serious disgust. Then, I realized that I really wanted to found it. It was a pain, I just thought about it for several hours, and then I just realized that I found one that actually worked. Curiously, I never cared on who $f^{-1}\colon \mathbb Z\to \mathbb N$ was. There must be a transparent way to deduce $f$, but I don't want to think about it right now, it would be great if someone can shed some light about this.
Now, for $g=f^{-1}\colon \mathbb Z\to \mathbb N$ you can consider
$$g(k)=\frac{1}{2}\left( (-1)^{\max(1, 2k)}(4k-1)+1 \right)$$
You can actually check that it sends $(0, +1, -1, +2, -2,\ldots)$ to $(1, 2, 3, 4, 5,\ldots)$.
I'm not totally satisfied with this formula, as I said before, I think it is better if there are no functions such as $\max, \min$ or absolute value involved. It can be fixed by showing a function $\phi\colon \mathbb Z\to \{-1,1 \}$ defined just by one expression such that $\phi(k)=\begin{cases} -1& \text{if $k\leq 0$,} \\ 1& \text{if $k>0$}. \end{cases}$
And then $g$ becomes $$g(k)=\frac{1}{2}\big( \phi(k)(4k-1)+1 \big).$$ If would be great if someone can find such $\phi$, I'm just very tired right now.
I hope that someone might find this answer nice, maybe some of you might show in your next courses that $\mathrm{card}(\mathbb{N})=\mathrm{card}(\mathbb{Z})$ in this obscure way!
Sorry for my english, I'm still practicing it a lot, and this is a good way to do that!