TITLE: Is the composition of $n$ convex functions itself a convex function?
QUESTION [49 upvotes]: Is a set of convex functions closed under composition? I don't necessarily need a proof, but a reference would be greatly appreciated.

REPLY [45 votes]: There is no need for the first function in the composition to be nondecreasing. And here is a proof for the nondifferentiable case as well. The only assumptions are that the composition is well defined at the points involved in the proof for every $\alpha \in [0, 1]$ and that $f_n, f_{n - 1}, \dots, f_1$ are convex nondecreasing functions of one variable and that $f_0 : \mathbb R^n \to \mathbb R$ is a convex function.
First let $g : \mathbb R^m \to \mathbb R$ a convex function and $f : \mathbb R \to \mathbb R$ a convex nondecreasing function, then, by convexity of $g$:
$$
g( \alpha x + ( 1 - \alpha ) y ) \leq \alpha g( x ) + ( 1 - \alpha )g( y ).
$$
So, using the fact that f is nondecreasing:
$$
f( g( \alpha x + ( 1 - \alpha ) y ) ) \leq f( \alpha g( x )+ ( 1 - \alpha )g( y ) ).
$$
Therefore, again by convexity:
$$
f( g( \alpha x + ( 1 - \alpha ) y ) ) \leq \alpha f( g( x ) ) + ( 1 - \alpha )f( g( y ) ).
$$
This reasoning can be used inductively in order to prove the result that
$$
f_n \circ f_{n - 1}\circ\cdots\circ f_0
$$
is convex under the stated hypothesis. And the composition will be nondecreasing if $f_0$ is nondecreasing.