# What is composition of convex and concave function?

Suppose that $f: \mathbb{R}\to \mathbb{R}$ is convex function and $g: \mathbb{R}\to \mathbb{R}$ is concave function. What can we say about their composition $g\circ f$ and $f\circ g$? Are they convex or concave functions?

• Have you tried with some examples? Commented Oct 17, 2016 at 11:38
• Yes, but I can't conclude with examples. Commented Oct 17, 2016 at 12:43
• You cannot conclude anything without additional information; for instance, if $f$ is also nonincreasing, then the composition is concave. Commented Oct 17, 2016 at 17:33
• See p. 84 of web.stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf Commented Oct 18, 2016 at 16:55
• @LinAlg Many thanks for your useful reference! Commented Oct 18, 2016 at 18:33

Hint. Try $$f(x)=e^x$$ (convex) and $$g(x)=-x^2$$ (concave).
What about $$f(g(x))=e^{-x^2}$$? Is it convex or concave? Check the plot at WA.
P. S. If we assume that $$f,g$$ are $$C^2$$ then $$(f(g(x))'=f'(g(x))\cdot g'(x),\quad (f(g(x))''=f''(g(x))\cdot (g'(x))^2+f'(g(x))\cdot g''(x)$$ So if $$f''\geq 0$$, $$g''\leq 0$$ and $$f'\leq 0$$ then $$(f(g(x))''\geq 0$$.
• Or more generally if $\frac{f''(g(x))*(g'(x))^2}{-g''(x)} \ge f'(g(x))$ then it is convex, right? (But just notice that this condition is much more specific because it depends on $g(x)$ rather than only on the derivatives). $f'$ can be positive, but it just has to be small enough such that the hessian of $h$ is still positive semi definite right? Commented Jan 20, 2019 at 19:21