Let $f,g:[0,1] \to [0, \infty)$ be two continuous functions such that $$f(0) = g(0) = 0,$$ $f$ is convex, $g$ is concave and increasing and $$\displaystyle \int_0^1f(x)dx = \int_0^1g(x)dx.$$ Prove that $$ \displaystyle \int_0^1\left(f(x) \right)^2dx \geq \int_0^1\left(g(x) \right)^2dx.$$
I don't quite know how to approach the problem.
I thought about using Chebyshev's inequality due to the fact that $g$ is increasing, $F(x) = \int_0^xf(t)dt$ is increasing (since $f$ is convex) and $G(x) = \int_0^xg(t)dt$ is increasing (since $g$ is increasing and $g(0) = 0$), but it didn't help me.
I also tried to obtain something by writing the convexity and concavity point-wise and using the fact that $\displaystyle h(x) = \frac{f(x)}{x}$ is increasing and $p(x) = \displaystyle \frac{g(x)}{x}$ is decreasing, but I got nothing.
It will be easy to answer the following question first: Assume that $f(x)$ is convex, $f(0)=0$, $f(x)\geq 0$ and $\int_{0}^{1}f(x)dx=M>0$ is fixed. Which function makes the integral $$ \int_{0}^{1}f(x)^{2}dx $$ as small as possible? We will prove that linear function is the optimizer, i.e. $f(x) = kx = 2Mx$ gives the answer. To prove this, we need a lemma:
Lemma. Let $f:[0, 1]\to [0, \infty)$ be a convex continuous function with $f(0)=0$. Then we have $$ \int_{0}^{1}xf(x)dx\geq \frac{2}{3}\int_{0}^{1}f(x)dx $$
This is actually a contest problem I saw before. We will show this later.
Assume that the lemma holds. Then we have $$ 0\leq \int_{0}^{1}(f(x)-2Mx)^{2}dx = \int_{0}^{1}f(x)^{2} -4M\int_{0}^{1}xf(x)dx + \frac{4}{3}M^{2} \leq \int_{0}^{1}f(x)^{2}dx - \frac{4}{3}M^{2} $$ so $\int_{0}^{1}f(x)^{2}dx \geq \frac{4}{3}M^{2}$, where the equality holds for $f(x)=2Mx$. Similarly, the reversed inequality holds for the concave function $g(x)$ with same condition, so we get $$ \int_{0}^{1}f(x)^{2}dx \geq \frac{4}{3}M^{2} \geq \int_{0}^{1}g(x)^{2}dx. $$
Proof of Lemma. Since $f(x)$ is convex, we have $$\int_{0}^{x}f(t)dt \leq \frac{1}{2}xf(x)$$ for any $x$. (Consider the triangle with vertices $(0, 0), (x, 0), (x, f(x))$.) Then \begin{align*} \frac{1}{2}\int_{0}^{1}xf(x)dx &\geq \int_{0}^{1}\int_{0}^{x}f(t)dtdx \\ &=\int_{0}^{1}\int_{t}^{1}f(t)dxdt \,\,\quad(\text{Fubini's theorem})\\ &=\int_{0}^{1}(1-t)f(t)dt \\ &= \int_{0}^{1}f(x)dx - \int_{0}^{1}xf(x)dx \end{align*} and we get the inequality.