Proving an improper integral inequality involving an exponential and a cosine I would like to prove that $$\left(\int_{0}^{\infty} e^{-t}\cos\theta (t)\,\text{d}t \right)^2 \leq \int_{0}^{\infty} e^{-t}\cos^2\theta(t)\,\text{d}t,$$ where $\theta(t):[0,\,\infty)\to\mathbb{R}$ is some continuous function. (This is all that is known about $\theta$.) My first approach was to apply the Cauchy-Schwarz inequality, but that doesn't seem to be of any use. I then thought that there was a general rule stating that $$\left(\int_{0}^{\infty} f(t)\,\text{d}t \right)^2 \leq \int_{0}^{\infty} f(t)^2\,\text{d}t$$ if the integrals exist and $f$ is non-negative, but this turned out to be an incorrect version of Jensen's inequality, which doesn't seem to work for improper integrals because it involves a factor of $b-a$, where $a$ and $b$ are the integral bounds. So now I'm not sure where to turn. The inequality looks obvious and I am assured that it is true, but I don't know how to prove it. Is there a generally accepted approach to such a question?
 A: Notice that there is an $e^{-t}$ in every integral, which suggests we should take it as part of the measure. We can use Jensen's inequality here, because $ \int_0^{\infty} e^{-t} \, dt = 1$: in general, Jensen says that if $g$ is convex,
$$ g\left( \frac{\int_X f \, d\mu}{\int_X d\mu} \right) \leq \frac{\int_X g \circ f \, d\mu}{\int_X d\mu} . $$
Putting $X=[0,\infty)$ and $d\mu(t) = e^{-t} \, dt $,
$$ g\left( \frac{\int_0^{\infty} f(t) e^{-t} \, dt}{\int_0^{\infty} e^{-t} dt} \right) \leq \frac{\int_0^{\infty} g(f(t)) e^{-t} \, dt}{\int_0^{\infty} e^{-t} dt} , $$
or
$$ g\left( \int_0^{\infty} f(t) e^{-t} \, dt \right) \leq\int_0^{\infty} g(f(t)) e^{-t} \, dt , $$
and then putting $f = \cos \circ \theta $ and $g(t) = t^2$ gives the required inequality.
A: Here is an elementary proof using  Cauchy-Schwarz inequality.
For every continuous and bounded function $u$ and every real number $a\ge 1$, we have
\begin{eqnarray}
\left(\int_0^{\infty}e^{-at}u(t)dt\right)^2
&=&\left(\int_0^{\infty}e^{-\frac{at}{2}}\cdot e^{-\frac{at}{2}}u(t)dt \right)^2\cr
&\le& \left[\int_0^{\infty} \left(e^{-\frac{at}{2}}\right)^2dt\right]\cdot\left[\int_0^{\infty}\left(e^{-\frac{at}{2}}u(t)\right)^2dt\right]\cr
&=&\left(\int_0^{\infty}e^{-at}dt\right)\cdot\left(\int_0^{\infty}e^{-at}u^2(t)dt\right)\cr
&=&\left(=\frac{1}{a}e^{-at}\Big|_0^{\infty}\right)\cdot\left(\int_0^{\infty}e^{-at}u^2(t)dt\right)\cr
&=&\frac{1}{a}\int_0^{\infty}e^{-at}u^2(t)dt\cr
&\le&\int_0^{\infty}e^{-at}u^2(t)dt.
\end{eqnarray}
Now, just set $a=1$ and $u=\cos \circ\theta$.
