Examples of involutions on $\mathbb{R}$ Just recently I read up something about involutions (functions $f: A \rightarrow A$ such that $f(f(x))=x$, for all $x$ in the domain of $f$), and was wondering how many (if there is a small set of general functions) such involutions exist for $A = \mathbb{R}$, or maybe $A = \mathbb{R} - S$, where S is some set of points that would make the involution work if they were left out of $A$. In general I'm interested in real functions that are involutions, continuous or otherwise.
There were some examples I found here, but any more would be certainly very interesting!
 A: The set of continuous involutions on $\mathbb R$ has a fairly easy to describe structure. Let $f$ be a continuous involution on $\mathbb R$. Then:


*

*Any point is either fixed, or of period $2$. The set of fixed points is closed, so the set of periodic points is open.

*If $x$ is of period $2$, there is a fixed point between $x$ and $f(x)$.

*If $x$ is of period $2$, there is exactly one fixed point between $x$ and $f(x)$. Let $a$ be the nearest fixed point to $x$ between $x$ and $f(x)$. Then as $x$ approaches $a$, $f(x)$ must approach $a$, and can never be equal to a fixed point, since by our choice of $a$, $x$ is never itself fixed as it approaches $a$. This is impossible if there's another fixed point between $x$ and $f(x)$.

*If $f$ has at least two fixed points, then suppose there is a non-fixed point in between them. Take the largest open interval of non-fixed points around that point. Its boundaries are fixed. By continuity and (2), near the left edge of that interval, $f(x)$ must be outside of the interval on the left, and near the right edge, $f(x)$ must be outside on the right. As $x$ runs through the interval, $f(x)$ can't touch any fixed points, so this violates the intermediate value theorem.

*If on the other hand, any two fixed points of $f$ have no non-fixed points between them, then the set of fixed points forms a single closed interval. If this interval isn't all of $\mathbb R$, then (3) is impossible to satisfy for any non-fixed $x$.


Thus $f$ either fixes $\mathbb R$ or has exactly one fixed point, dividing the real line into two halves. By (2), the left half must map onto the right half and vice-versa. For simplicity let's say the fixed point is $0$. Then $f$ can/must be equal to any/some strictly decreasing continuous function with $f(0)=0$ on $\mathbb R^+$, and to its inverse on $\mathbb R^-$. For instance we can take $f(x)=-2x$ for positive $x$ and $f(x)=-\frac12x$ for negative $x$.
A: Here are a couple of examples that might have some appeal. 


*

*The link has $f(x)=a+(x-a)^{-1}$, but in fact $f(x)=a+b(x-a)^{-1}$ works for any real $a$ and $b$ (of course one must remove $x=a$ from the domain). 

*Let $g$ be defined on $\lbrace0,1,\dots,9\rbrace$ by $g(9)=9$, $g(d)=8-d$ for $d\ne9$. Then get $f(x)$ by applying $g$ to each of the digits in the decimal expansion of $x$. E.g., $\pi=3.14159265\dots$, so $f(\pi)=5.74739623\dots$. 
These are, of course, special cases of the construction given by user6312, but maybe their concreteness and simplicity justify their separate mention. 
It further appears that the equation $f(f(x))=x$ is known as Babbage's functional equation. There's a nice paper about it by J F Ritt, On certain real solutions of Babbage's functional equation, Annals of Math 17 (1916) 113-122, doi: 10.2307/2007270. 
A: Any function withich is symmetric w.r.t.the 45°-axis has $f(x)=f^{-1}(x)$ and so $f(f(x))=x$. Visually, obvious examples are $f(x):=\pm x$ and $f(x):=\frac{1}{x}$. 
Moreover, if we take such a function and shift it along the 45°-axis, the property doesn't get lost. Hence, take any function for which $f(f(x))=x$ and define $F_{(f,d)}(x):=f(x-d)+d$, then
$F_{(f,d)}(F_{(f,d)}(x))=f((f(x-d)+d)-d)+d=f(f(x-d))+d=(x-d)+d=x$.
This explains why $\frac{1}{x-d}+d$ works. Also visually, it's clear that the property doesn't get lost if you mirror the function along the axis. Define $G_f(x):=-f(-x)$, then
$G_f(G_f(x))=-f(-(-f(-x)))=-f(f(-x))=-(-x)=x.$
This "generating new functions via shift" busines reminded me of the modular group. I determined it's nontrivial involutive elements and they are $\frac{ax+b}{cx-a}$. Shifting them along the axis by $s$ gives a lot of example solutions: $\frac{b-cs(s+x)+a(2s+x)}{c(s+x)-a}$.
A: If you assume continuity, you still have as many involutions as continuous functions from $\mathbb R$ to itself, namely cardinality $c$.  For if $f$ is any strictly decreasing continuous function from $[0, \infty)$ onto $(-\infty, 0]$, you can extend $f$ to $(-\infty, 0)$ by $f(t) = x$ where $f(x) = t$, and you get a continuous involution.
A: If we do not put any conditions on $f$, there will be far too many involutions.
Divide the reals in any way into a disjoint union of $1$-element sets and/or $2$-element sets.
For any such subdivision $\mathbb{U}$, if $\{a\}$ is a singleton set in the subdivision, let $f(a)=a$. If $\{a,b\}$ is a doubleton set in the subdivision, let $f(a)=b$ and $f(b)=a$.  Then $f$ is an involution.  Any subdivision determines an involution, and conversely every involution determines a subdivision.
It follows that there are $2^\mathfrak{c}$ involutions, "just as many," from the point of view of cardinality, as the number of functions from $\mathbb{R}$ to $\mathbb{R}$.
A: There is a discontinuous involution of the real line called Jimm (ج) which moreover satisfies (and is defined by) the functional equations
f(1/x)= 1/f(x), f(-x)=-1/f(x) and f(1-x)=1-f(x).
It is induced by Dyer's after automorphism of PGL(2,Z).
For details see https://ems.press/books/irma/189/3583
