I’ve been perusing the internet looking for interesting problems to solve. I found the following problem and have been going at it for the past 30 minutes with no success:

Find a function f:R→R satisfying f(f(x))=−x for all x∈R.

I am also wondering, can we find f so that is continuous?

I was thinking of letting f be a periodic function, and adding half the period to x each time. I had no success with this, and am now thinking that such a function does not exist.

Source: http://www.halfaya.org/Casti/CalculusTheory2/challenge.pdf

**Answer**

An important piece of information is:

**Theorem:** f is not continuous.

**Proof:** Observe that f is invertible, because

f(f(f(f(x))))=f(f(−x))=x

and so f∘f∘f=f−1. Any *continuous* invertible function on R is either strictly increasing or strictly decreasing.

If f is strictly increasing, then:

- 1<2
- f(1)<f(2)
- f(f(1))<f(f(2))
- −1<−2

contradiction! Similarly, if f is strictly decreasing, then:

- 1<2
- f(1)>f(2)
- f(f(1))<f(f(2))
- −1<−2

contradiction! Therefore, we conclude f is not continuous. ◻

For the sake of completeness, the entire solution space for f consists of functions defined as follows:

- Partition the set of all positive real numbers into ordered pairs (a,b)
- Define f by, whenever (a,b) is one of our chosen pairs,
- f(0)=0
- f(a)=b
- f(b)=−a
- f(−a)=−b
- f(−b)=a

To see that every solution is of this form, let f be a solution. Then we must have f(0)=0 because:

- Let f(0)=a. Then f(a)=f(f(0))=0 but −a=f(f(a))=f(0)=a, and so f(0)=0

If a≠0, then let f(a)=b. We have:

- f(b)=f(f(a))=−a
- f(−a)=f(f(b))=−b
- f(−b)=f(f(−a))=a

From here it's easy to see the set {(a,f(a))∣a>0,f(a)>0} partitions the positive real numbers and so is of the form I describe above.

One particular solution is

f(x)={0x=0x+1x>0∧⌈x⌉ is odd1−xx>0∧⌈x⌉ is evenx−1x<0∧⌊x⌋ is odd−1−xx<0∧⌊x⌋ is even

e.g. f(1/2)=3/2, f(3/2)=−1/2, f(−1/2)=−3/2, and f(−3/2)=1/2.

(This works out to be Jyrki Lahtonen's example)

**Attribution***Source : Link , Question Author : Gamma Function , Answer Author : Community*