Prove $\int _0^\infty f^2 dx \leq \cdots $ for $f$ convex Prove $$\int _0^\infty f^2(x) dx \leq \frac{2}{3}\cdot  \max_{x \in \mathbb R^+} f(x) \cdot  \int _0^\infty f(x) dx$$ for $f(x) \geq 0$ and convex. 
I know via Holder's we can get without the constant $\frac{2}{3}$ but that should also be true for $f$ not convex. I tried some approaches using convexity but didn't get the desired result. 
A hint or reference would also help. Also, it would be interesting to know when equality holds. 
 A: The r.h.s. is finite if and only if the convex function $f$ is monotone decreasing in $[0,+\infty)$ with $\lim_{x\to +\infty} f(x) = 0$.
Let us consider such a function.
In order to simplify the proof, assume also that $f\in C^1([0,\infty))$ (this assumption can easily be removed).
Let us define the auxiliary function $\varphi\colon [0,+\infty)\to \mathbb{R}$,
$$
\varphi(x) := \frac{2}{3} f(x) \int_x^{+\infty} f(t)\, dt - 
\int_x^{+\infty} f(t)^2\, dt,
\qquad x\geq 0.
$$
We are going to prove that $\varphi(x) \geq 0$ for every $x\geq 0$, hence the required inequality follows from $\varphi(0) \geq 0$.
We have that
$$
\varphi'(x) = \frac{2}{3}f'(x) \int_x^{+\infty} f(t)\, dt
-\frac{2}{3} f(x)^2 + f(x)^2
=
\frac{2}{3}f'(x) \int_x^{+\infty} f(t)\, dt
+\frac{1}{3} f(x)^2.
$$
Since $f$ is convex, if $f'(x) \neq 0$ (hence $f'(x) < 0$) it holds
$$
(*) \qquad \int_x^{+\infty} f(t)\, dt
\geq
\int_x^{x - f(x)/f'(x)} \left(f(x) + (t-x)f'(x)\right)\, dt
= - \frac{f(x)^2}{2 f'(x)}\,,
$$
so that $\varphi'(x) \leq 0$.
On the other hand, if $f'(x) = 0$, then necessarily $f(x) = 0$ so that $\varphi'(x) = 0$.
In conclusion, $\varphi'(x) \leq 0$ for every $x\geq 0$ and $\lim_{x\to +\infty} \varphi(x) = 0$, hence $\varphi(x)\geq 0$ for every $x\geq 0$.
The $C^1$ regularity requirement can be removed observing that $\varphi$ is Lipschitz continuous and the inequality $\varphi'(x) \leq 0$ holds at every point of differentiability.
The equality holds true if and only if $\varphi(0) = 0$, i.e., if and only if $\varphi'(x) = 0$ for every $x\geq 0$.
From the discussion leading to (*), it follows that this can happen if and only if there exists $K\geq 0$ such that $f(x) = 0$ for every $x\geq K$ and $f$ is affine on the interval $[0,K]$.
