Semigroup of differentiable functions on real line Let $D(\mathbb R) $ be the set of all differentiable functions $f: \mathbb R \to \mathbb R$. Then obviously $D(\mathbb R)$ forms a semigroup under usual function composition. Can we characterize (up to semigroup isomorphism) all finite subsemigroups of $D(\mathbb R)$ which do not contain any constant function ? 
 A: Yes, we can! ;-)
In fact there are only two finite subsemigroups of $D(\mathbb{R})$ which do not contain constant functions.

Every finite subsemigroup of $D(\mathbb{R})$ necessarily contains an idempotent $f$, i.e. a function $f$ such that $f \circ f = f$. Let us examine the properties of $f$.
Let $A$ be the range of $f$. By continuity of $f$, $A$ is an interval. Since $f(f(x)) = f(x)$ for every $x \in \mathbb{R}$, we have $f(x) = x$ for $x \in A$.
If $f$ is non-constant, then $A$ has non-empty interior. We claim that in this case $A = \mathbb{R}$.
Suppose, contrary to this claim, that $A$ is bounded from above, and denote the right endpoint of $A$ by $b$. Then $f(b) = \lim_{x \to b^-} f(x) = \lim_{x \to b^-} x = b$, and so $b \in A$. Thus, $f$ attains a local maximum at $b$. Since $f$ is differentiable at $b$, we have $f'(b) = 0$. On the other hand, $f'_-(b) = \lim_{x \to b^-} f'(x) = 1$, a contradiction. We conclude that $A$ is not bounded from above. Similarly, $A$ is unbounded from below.
Thus, either $f$ is constant or $f$ is the identity function. It follows that any finite subsemigroup of $D(\mathbb{R})$ contains either a constant function or the identity function.

Suppose that $X$ is a finite subsemigroup of $D(\mathbb{R})$ with no constant function and $g \in X$. Then the subsemigroup of $X$ generated by $g$ contains an idempotent, and hence — the identity function. In other words, $g^{\circ n}$ is the identity function for some $n$.
Todd Trimble already pointed out in his answer that necessarily $n = 1$ or $n = 2$, and if $n = 2$, then $g$ is decreasing. Here is a shorter variant of his argument that does not require differentiability:


*

*$g$ is invertible and continuous, and hence strictly monotone; $g \circ g$ is thus strictly increasing;

*if $g(g(x)) > x$ for some $x$, then $g^{\circ 2n}(x) > x$, a contradiction; similarly, if $g(g(x)) < x$ for some $x$, then $g^{\circ 2n}(x) < x$; therefore, $g(g(x)) = x$ for all $x$;

*if $g$ is increasing, then in a similar way $g(x) = x$ for all $x$.
Finally, if $g, h \in X$ and none of them is the identity function, then both are decreasing, and so $g \circ h$ is an increasing function in $X$. Therefore, $g \circ h$ is the identity function, and consequently $g = h^-1 = h$.

We have thus proved that that any discrete subsemigroup of $D(\mathbb{R})$ with no constant function contains the identity function and at most one strictly decreasing function $g$ such that $g = g^{-1}$.
A: This is of course nowhere near a full answer, but in response to Mark Sapir's question, I think the only invertible elements in the monoid of finite order are of order $1$ or $2$ (involutions). 
A diffeomorphism, by which I mean an invertible element in the monoid of (not necessarily continuously) differentiable functions on $\mathbb{R}$, clearly cannot have zero derivative anywhere, by the chain rule. Nor can the derivative ever change sign, since a derivative function satisfies the intermediate value property: if it is positive at one point and negative at another, then it is $0$ somewhere in between (even in the non-continuously differentiable case). So, by the mean value theorem, a diffeomorphism is either strictly monotone increasing or strictly monotone decreasing. 
In the increasing case, the only element $f$ of finite order is the identity. For if $x < f(x)$ for any $x$, then by strict monotonicity of $f$ we have $x < f(x) < f f(x) < f f f (x) < \ldots$, and a similar argument applies if $f(x) < x$. 
In the case where $f$ is decreasing, suppose $f$ has order $n$. Then 
$f^2 = f \circ f$ is increasing and has order $n/2$ if $n$ is even, and order $n$ if $n$ is odd. By the preceding paragraph, it follows that $n/2 = 1$ or $n = 1$ respectively (and of course the latter case doesn't happen since the identity function is not monotone decreasing). 
