1. ## function over Z

Is there any function f:Z->Z, with f(f(n))=-n for every integer n?

2. Originally Posted by takis1881
Is there any function f:Z->Z, with f(f(n))=-n for every integer n?

$f(n)=\begin{cases}2n\quad \ n\ \text{is odd} \\ -\frac{n}{2}\quad n\ \text{is even}\end{cases}$

Ah, posted too soon. Obviously the above does not work when n is divisible by 4. The answer might be no.. I'll keep thinking about it.

3. Well I'm not faring too well with this problem, but perhaps this will be of use: Assuming such function exists (which could be the start of a proof by contradiction, or the start of a way to find such an f), f(f(f(n))) can be thought of as either

Code:
f(  f(f(n))  ) = f(-n)   or   f(f(  f(n)  )) = -f(n)
So f(-n) = -f(n), meaning f(n) is an odd function.

Edits: Ah ok so I think the answer is yes, and there is a simple function we can define.

Here is how I got there.

Suppose f(n) = m.

Then from above we know f(-n) = -f(n) = -m.

We also know f(m) = -n.

And consequently f(-m) = n.

So we partition the integers into groups of four, basically, (not counting 0) and the simplest is {0}, {-2,-1,1,2}, {-4,-3,3,4}, ...

So we can write

$f(n) = \begin{cases}0\quad\quad\quad\ \ n = 0 \\ n+1\quad\ \ n\ \text{odd and positive} \\ n-1\quad\ \ n\ \text{odd and negative} \\ -n+1\quad n\ \text{even and positive}\\-n-1 \quad n\ \text{even and negative}\end{cases}$

which can probably be written in a much more concise manner, anyway that should do the trick.

4. Yes, i found that f is an odd function and f(0)=0. But for the time being, i can't either prove that f does not exist, or find f, if it does exist. Another thing that may help is that if f(a)=b,
then f seems to send a -> b -> -a -> -b -> a.

5. Please see my edited post above.

6. I found a function like this too, but it's not an odd one, as f should be.

7. Originally Posted by takis1881
I found a function like this too, but it's not an odd one, as f should be.
We can show $f$ is odd as follows:

We need to show that $f(n)=-f(-n)$. Consider 5 cases.

Case 1: $n = 0$

This is trivial.

Case 2: $n\ \text{odd and positive}$

$f(n)=n+1$

$-f(-n)=-((-n)-1)=n+1$

Cases 3-5: Similar.

8. Yes, you're right!! I mistakenly considered f(-n)=-n+1. Thank you very much for your help!! Greetings from Greece.