# $f:\mathbb{R}\rightarrow\mathbb{R}$ such that $f(f(x))=-x$ non-continous only on a finite set

I'm looking for a function $$f:\mathbb{R}\rightarrow\mathbb{R}$$ such that $$f(f(x))=-x$$ with the nicest (in terms of continuity and differentiability) properties possible.

The condition $$f^2(x):=f(f(x))=-x$$ implies that $$f$$ is an odd function and, in particular, that $$f(0)=0$$. To see this note that $$f^3(x)=f^2(f(x))=-f(x)$$ and also $$f^3(x)=f(f^2(x))=f(-x)$$.

Using this property one can see that $$f$$ cannot be differentiable in general, because then the chain rule applied to $$f^2$$ leads to $$f'(f(x))\cdot f'(x)=-1$$ and, for $$x=0$$, this would be $$f'(0)^2=-1$$.

However, I was able to build an $$f$$ satisfying the desired condition if I allow it to be non-continuous on a numerable set. Namely, let $$A=(0,1]\cup(2,3]\cup(4,5]\cup\cdots$$ $$B=(1,2]\cup(3,4]\cup(5,6]\cup\cdots$$ and define $$f$$ as follows: $$f(x)= 0 \mbox{, if } x=0$$ $$f(x)= x+1 \mbox{, if } x\in A$$ $$f(x)=-x+1 \mbox{, if } x\in B$$ $$f(x)= x-1 \mbox{, if } x\in -A$$ $$f(x)=-x-1 \mbox{, if } x\in -B$$

This definition is inspired by the fact that, for any non-zero $$a$$, if we let $$f(a)=b$$, then the orbit of $$a$$ under $$f$$ is $$a\mapsto b\mapsto -a\mapsto-b$$, so we need to decompose the positive numbers into two disjoint bijective sets (here $$A$$ and $$B$$) and then let $$f$$ jump from $$A$$ to $$B$$, then to $$-A$$, then to $$-B$$ and finally back to $$A$$.

So, I understand that in order to find an $$f$$ that is non-continuous on a finite set we need to decompose the positive reals into two disjoint bijective sets so that each of them is at most a finite union of connected (in the usual topology) subsets. Is this even possible?

My first intuition is that the answer is no because the number of discontinuity points that we need doesn't match, but I'm not able to formalize this properly.

• connected sets or reals are intervals, and each of the two disjoint sets would have to contain an unbounded interval (a ray). – Mirko Nov 9 at 0:27
• @Mirko You're absolutely right, but I don't see any immediate implications in the problem at hand: an unbounded interval is bijective to a bounded interval. – A. Bellmunt Nov 13 at 11:12

Suppose that this is possible. That is, there exists $$f:\mathbb{R}\to\mathbb{R}$$ with $$f\big(f(x)\big)=-x$$ for all $$x\in\mathbb{R}$$ such that the set $$F\subseteq \mathbb{R}$$ at which $$f$$ is discontinuous is finite.
First, note that $$0\in F$$. Otherwise, $$\mathbb{R}\setminus F$$ contains a connected component $$U$$ with $$0\in U$$. Note that $$U$$ is an open set, and since $$f(0)=0$$, $$f$$ maps $$U$$ to itself. Due to the given functional equation, $$U$$ is symmetric around $$0$$, that is $$U=(-t,t)$$ for some $$t>0$$. Define $$g=h_t\circ f\circ h_t^{-1}:\mathbb{R}\to\mathbb{R}$$, where $$h_t:U\to\mathbb{R}$$ is given by $$h_t(u)=\tan\left(\frac{\pi u}{2t}\right)$$ for all $$u\in U$$. Then, $$g$$ also satisfies $$g\big(g(x)\big)=-x$$, and $$g$$ is continuous and bijective. However, any bijective continuous function on $$\mathbb{R}$$ is either increasing or decreasing, but then $$g\circ g$$ must be increasing. This contradicts the result that $$g\big(g(x)\big)=-x$$ for all $$x\in\mathbb{R}$$.
Now, we can see that $$\big|F\setminus\{0\}\big|$$ is divisible by $$4$$, as each point $$x\in F\setminus\{0\}$$ has an orbit of size $$4$$ under the iterations by $$f$$. So, we write $$F\setminus\{0\}=\bigsqcup_{k=1}^n\{a_k,b_k,-a_k,-b_k\}$$ where $$b_k=f(a_k)$$, $$-a_k=f(b_k)$$, $$-b_k=f(-a_k)$$, and $$a_k=f(-b_k)$$. Therefore, $$\mathbb{R}\setminus F$$ is a union of $$4n+2$$ disjoint open intervals $$\pm I_0,\pm I_1,\pm I_2,\ldots,\pm I_{2n}$$, where $$I_0,I_1,I_2,\ldots,I_{2n}$$ lie entirely in the positive reals, and $$f$$ is continuous on each interval $$\pm I_k$$.
It is clear that, if $$I$$ and $$J$$ are two such intervals and $$f(x)\in J$$ for some $$x\in I$$, then $$f(I)=J$$. Furthermore, for such pairs $$I$$ and $$J$$, we must have $$I \neq \pm J$$. That means the orbit of each interval $$\pm I_k$$ under the iterations by $$f$$ has size $$4$$ as well. However, we have $$4n+2$$ intervals, which is indivisible by $$4$$. This is a contradiction. Therefore, there is no such a function $$f$$.
• Thanks for the proof that $0$ must be a discontinuity point. The argument on the number of connected components is what I had in my head when I wrote "the number of discontinuity points that we need doesn't match" but properly written. :-) – A. Bellmunt Nov 13 at 11:05