About the convexity of the composition of two convex functions

I am starting to learn about convex sets/functions and understand what they are geometrically, but have stumbled upon this:

enter image description here

How exactly does one show this? It kind of seems like a "duh" statement abstractly but I'm interested in seeing if someone could explain this more concretely


Solution 1:

All that we need is the definition of convex function. Let $x,y$ be in an interval $I$ where $f$ is convex and let $t\in [0,1]$. Then, $$f(tx+(1-t)y)\leq tf(x)+(1-t)f(y).$$ Moreover, since $g$ is increasing (first inequality) and convex (second inequality), we get $$g(f(tx+(1-t)y)\leq g(tf(x)+(1-t)f(y))\leq tg(f(x))+(1-t)g(f(y))$$ which means that $h(x)=g(f(x))$ is convex in $I$.

P.S. Note that the composition of two convex functions is not always convex! Take for example $g(x)=1/x$ and $f(x)=1/\sqrt{x}$ in $(0,+\infty)$. They are both convex, but $g(f(x))=\sqrt{x}$ is not convex.