Inequality of continuous functions with integral Let M be a positive real number.Let $f:[0,\infty)\to[0,M] $ be a continuous function satisfying
$$ \int\limits_{0}^\infty (1+x)f(x)dx<\infty.$$
Prove the following inequlity.
$$\left(
\int\limits_{0}^\infty f(x)dx 
\right)^2\le 4M\int\limits_{0}^\infty xf(x)dx.$$

Your proposal in the comments is close.  Try this:
$$
\frac{d}{dt} \left( \int_0^t f(x) dx \right)^2 = 2  \left( \int_0^t f(x) dx \right) \frac{d}{dt} \int_0^t f(x) dx = 2 f(t) \int_0^t f(x) dx \\
\le 2 f(t) \int_0^t M dx = 2 M t f(t).
$$
Now integrate from $t=0$ to $t=T$:
$$
\left( \int_0^T f(x) dx \right)^2 \le \int_0^T 2 M tf(t) dt
$$
and then send $T \to \infty$ to get 
$$
\left( \int_0^\infty f(x) dx \right)^2 \le \int_0^\infty 2 M xf(x) dx.
$$
