Function with $f \circ f \circ f=f$ What are the functions with $f \circ f \circ f=f$ defined from a set $E$ to itself?
I can prove that such a function is onto iff it is one to one. So suppose also that $f$ is bijective.
If $E=\mathbb{R}$ we have as solutions $f(x)=x$ and $f(x)=-x$ or functions defined piecewise with those functions.
Can we describe all solutions for $E=\mathbb{R}$? For $E=\mathbb{R}^n$ for $n>0$ integer?
 A: Let's partition $\mathbb{R}$ into parts of size one or two, e.g. 
$$\mathbb{R}=\{1,-1\}\cup \{3,\pi\}\cup \{7\}\cup \cdots$$
On the parts of size two, $f$ will send one element to the other.  On the parts of size one, $f$ will fix that element.  
$f(x)=x$ corresponds to the partition where each part is of size $1$.  $f(x)=-x$ corresponds to the partition where each nonzero element is in a part with its negative, and $0$ is in a part of size $1$.
Since $f=f^{-1}$, it is easy to see that any bijective $f$ induces such a partition.
A: There are many. For instance, just try any permutation of two integers, that "flips" them.
For $\mathbb{R}^2$ you have rotations, etc.
Off the top of my head I'm not sure the constraints you need for this to be interesting (continuous for one).
A: Without any further restrictions there is a huge array of solutions, particularly for infinite sets $E$. For instance, if you write $E$ is a disjoint union of doubletons $E=\bigcup D_i$, with $D_i=\{a_,b_i\}$, then defining $f:E\to E$ by $f(a_i)=b_i$ and $f(b_i)=a_i$, clearly solves $f\circ f \circ f=f$. This shows how random such functions can be as the decomposition of E into doubletons can be quite horrible. 
In $R^n$, any reflection about a line solves the equation. Similarly, any rotation by $\pi$ radians about a point solves the equation. The identity function of course also solves the equation. The inversion $z\mapsto 1/z$ is also a solution. 
All of these examples are actually ones where $f=f^-1$. Any such function will, of course, also solves your equation. So, if you include the condition that $f$ is bijective, then $f^{-1}$ exists, and then applying it to the equation yields $f\circ f = id$, in other words $f$ is an involution. In short, under the assumption of bijectivity, solutions to $f\circ f\circ f=f$ are the same as solutions to $f\circ f = id$. 
Other solutions are obtained by writing $E$ as a disjoint union of doubletons and/or singletons, with $f$ defined similarly. 
