TITLE: Integral of $L^2(\mathbb R^+)$ function is $o(\sqrt x)$
QUESTION [6 upvotes]: I stumbled upon an exercise which goes as follows :

Let $f \in L^2(\mathbb R^+)$, show that $\int_0^x f(t)\text{d}t = o\left(\sqrt x\right)$.


Cauchy-Schwarz inequality gives the fact that $\int_0^x f = O\left(\sqrt x\right)$
For decreasing functions, the results holds since $xf(x)^2 \leq \int_x^{2x} f^2 = o(1)$.
Simple limit examples such as $f(t) = \dfrac 1 {\sqrt t\ln(t)}$ or $f(t) = \displaystyle\sum_{k} \dfrac{1_{[k,k+1]}}{\sqrt k}$ advocate for the result.

However I cannot produce a proof of that result nor find any counterexample, I don't even know what to believe. Given the source of the problem, a proof, if there is, should be elementary.
Happy Hollidays

REPLY [3 votes]: For any $0 < a < x$, using the Cauchy-Schwartz inequality one has
$$\bigg|\int_0^x f(t) dt\bigg| \leq  \int_0^a |f(t)| dt  + \int_a^x |f(t)| dt $$
$$ \leq \int_0^a |f(t)| dt + \bigg(\int_a^x|f(t)|^2 dt\bigg)^{1/2} (x - a)^{1 \over 2}$$
Given any $\epsilon > 0$ one can choose $a$ so that
$$\bigg(\int_a^{\infty}|f(t)|^2 dt\bigg)^{1/2} < {\epsilon \over 2}$$
Thus for such $a$ one has
$$\bigg|\int_0^x f(t) dt\bigg| \leq  \int_0^a |f(t)| dt + {\epsilon\over 2}x^{1 \over 2}$$
So if $x$ is large enough one has the desired result that
$$\bigg|\int_0^x f(t) dt\bigg| \leq \epsilon x^{1 \over 2}$$