Consider a function $f$ defined as \begin{align} f(x)=x^2-xg(x)+g^2(x), \quad x\in[0,a], \end{align} where $g$ is a strictly convex function such that $0\leq g(x)\leq x/2$, and the boundary point $a>0$ is such that $g(x)=x/2$.
Assuming that $f$ is an increasing function, can we show that it is also convex?
We need to show $f''(x)\geq 0$. We have \begin{align} f'(x)=2x−g(x)−xg'(x)+2g(x)g'(x)>0, \end{align} since $f$ is increasing, and \begin{align} f''(x)=2−2g'(x)+2(g'(x))^2−(x−2g(x))g''(x). \end{align} Now, since $x−2g(x)\geq 0$, I struggle to control for the $g''(x)$ term which can be large.
Another attempt would be to write \begin{align} f(x)=\frac{1}{2}\Big[(x−g(x))^2+x^2+g^2(x)\Big], \end{align} where $x^2$ and $g^2$ are convex, but I run into the same problem with the first term.