# function over Z

#### takis1881

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

#### undefined

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

$$\displaystyle 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.

#### undefined

MHF Hall of Honor
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

$$\displaystyle 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.

Last edited:
• takis1881 and chiph588@

#### takis1881

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.

#### undefined

MHF Hall of Honor
Please see my edited post above.

#### takis1881

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

#### undefined

MHF Hall of Honor
I found a function like this too, but it's not an odd one, as f should be.
We can show $$\displaystyle f$$ is odd as follows:

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

Case 1: $$\displaystyle n = 0$$

This is trivial.

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

$$\displaystyle f(n)=n+1$$

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

Cases 3-5: Similar.

• takis1881

#### takis1881

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