Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a function $f\colon \mathbb{R} \to\mathbb{R} $ such that $ f(f(x)) = -x$ ?

share|cite|improve this question
Answer to a generalization of this question here. – Did Jan 28 '12 at 16:12
An answer on MO demonstrating that there is no such continuous $f$. – Zev Chonoles Jan 28 '12 at 16:13
up vote 14 down vote accepted

There is.

Let $\{A,B\}$ be a partition of the positive reals such that $|A|=|B|=|\mathbb{R}|$, and let $\varphi:A\to B$ be a bijection. Define $f:\mathbb{R}\to\mathbb{R}$ as follows:

$$f(x)=\begin{cases} 0,&\text{if }x=0\\ \varphi(x),&\text{if }x\in A\\ -\varphi^{-1}(x),&\text{if }x\in B\\ -\varphi(-x),&\text{if }-x\in A\\ \varphi^{-1}(-x),&\text{if }-x\in B\;. \end{cases}$$


$$\begin{align*} f(f(x))&=\begin{cases} 0,&\text{if }x=0\\ f(\varphi(x)),&\text{if }x\in A\\ f(-\varphi^{-1}(x)),&\text{if }x\in B\\ f(-\varphi(-x)),&\text{if }-x\in A\\ f(\varphi^{-1}(-x)),&\text{if }-x\in B\;. \end{cases}\\\\ &=\begin{cases} 0,&\text{if }x=0\\ -\varphi^{-1}(\varphi(x)),&\text{if }x\in A\\ -\varphi(\varphi^{-1}(x)),&\text{if }x\in B\\ \varphi^{-1}(\varphi(-x)),&\text{if }-x\in A\\ \varphi(\varphi^{-1}(-x)),&\text{if }-x\in B \end{cases}\\\\ &=-x\;. \end{align*}$$

The idea is simply that $f$ permutes the sets $A,B,-A$, and $-B$ in the order

$$A\stackrel{f}\longrightarrow B\stackrel{f}\longrightarrow -A\stackrel{f}\longrightarrow -B\stackrel{f}\longrightarrow A$$

while leaving $0$ fixed. (Here $-A= \{-a:a\in A\}$, and similarly for $-B$.)

Added: It is possible, though a bit messy, to define $A,B$ and $\varphi$ explicitly. We may, for example, set $A=(0,1]$ and $B=(1,\to)$ and define $\varphi$ as follows. First, for $n\in\omega$ let $\varphi(2^{-n})=2^{n+1}$, so that $\varphi(1)=2,\varphi(1/2)=4,\varphi(1/4)=8$, and so on. Then let $\varphi$ map the interval $(2^{-(n+1)},2^{-n})$ to the interval $(2^n,2^{n+1})$ in the obvious way, taking $x$ to $1/x$.

share|cite|improve this answer
Your addendum looks very much like what is done in the post I mentioned. – Did Jan 28 '12 at 17:11
@Didier: I’ve not yet had a chance to look at that one. I was just trying to find a simple, explicit bijection between a half-closed and an open interval. – Brian M. Scott Jan 28 '12 at 17:30
More accurately, the idea on the page I referred you to (and here) is to exchange infinitely many disjoint intervals in a bijective way. – Did Jan 28 '12 at 18:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.