TITLE: Determining the best possible constant $k$, for an Integral Inequality
QUESTION [8 upvotes]: If $f : [0,\infty) \to [0,\infty)$ is an integrable function, then what is the best possible constant $k$, for which the following ineqality holds:
$$\int_0^{\infty}f(x)dx \leq k\left(\int_0^{\infty}\sqrt{x}f(x)dx\right)^{1/2}\cdot\left(\int_0^{\infty}f^{2}(x)dx\right)^{1/4}$$
For example, $k=2$ is a bound, since, $$\int_0^{\infty}f(x)dx = \int_0^{y}f(x)dx + \int_y^{\infty}f(x)dx < \sqrt{y}\left(\int_0^{\infty}f^2(x)dx\right)^{1/2} + \frac{1}{\sqrt{y}}\int_0^{\infty}\sqrt{x}f(x)dx$$
and setting, $ y = \dfrac{\displaystyle \int_0^{\infty}\sqrt{x}f(x)dx}{\left(\displaystyle\int_0^{\infty} f^2(x)dx\right)^{1/2}}$, establishes the inequality for the case $k=2$, but it is not strict. 
How to improve the bound $k$ and also determine the function where equality holds for the best constant $k$ ?
Thank you.

REPLY [8 votes]: Suppose
$$
\int_0^\infty\sqrt{x}f(x)\,\mathrm{d}x=A\tag{1}
$$
and
$$
\int_0^\infty f^2(x)\,\mathrm{d}x=B\tag{2}
$$
Then, letting $g(x)^2=A^{1/2}B^{-3/4}f(AB^{-1/2}x)$, we get
$$
\int_0^\infty\sqrt{x}g(x)^2\,\mathrm{d}x=\int_0^\infty g(x)^4\,\mathrm{d}x=1\tag{3}
$$
and
$$
\int_0^\infty f(x)\,\mathrm{d}x=A^{1/2}B^{1/4}\int_0^\infty g(x)^2\,\mathrm{d}x\tag{4}
$$
Thus, maximizing $\int_0^\infty g(x)^2\,\mathrm{d}x$ given $(3)$ yields the best constant for the given inequlity.

The variation of $(4)$ is stationary when
$$
\int_0^\infty g(x)\,\delta g(x)\,\mathrm{d}x=0\tag{5}
$$
Equations $(3)$ imply
$$
\int_0^\infty\sqrt{x}g(x)\,\delta g(x)\,\mathrm{d}x=\int_0^\infty g(x)^3\,\delta g(x)\,\mathrm{d}x=0\tag{6}
$$
To insure $(5)$ holds whenever $(6)$ does, we must have that $g(x)^2=0$ or $g(x)^2=a-b\sqrt{x}$.
Thus, consider $g(x)^2=a-b\sqrt{x}$ on $\left[0,\frac{a^2}{b^2}\right]$ and $g(x)^2=0$ for $x\gt\frac{a^2}{b^2}$.
$$
\begin{align}
\int_0^{a^2/b^2}\sqrt{x}g(x)^2\,\mathrm{d}x
&=\int_0^{a^2/b^2}\left(a\sqrt{x}-bx\right)\,\mathrm{d}x\\
&=\frac{a^4}{6b^3}\tag{7}
\end{align}
$$
$$
\begin{align}
\int_0^{a^2/b^2}g(x)^4\,\mathrm{d}x
&=\int_0^{a^2/b^2}\left(a^2-2ab\sqrt{x}+b^2x\right)\,\mathrm{d}x\\
&=\frac{a^4}{6b^2}\tag{8}
\end{align}
$$
$$
\begin{align}
\int_0^{a^2/b^2}g(x)^2\,\mathrm{d}x
&=\int_0^{a^2/b^2}\left(a-b\sqrt{x}\right)\,\mathrm{d}x\\
&=\frac{a^3}{3b^2}\tag{9}
\end{align}
$$

Solving $(7)$ and $(8)$ given $(3)$ yields
$$
(a,b)=\left(6^{1/4},1\right)\tag{10}
$$
Plugging $(10)$ into $(9)$ yields an optimal constant of
$$
\left(\frac83\right)^{1/4}\doteq1.277886208492545\tag{11}
$$
attained by the function
$$
\left(6^{1/4}-\sqrt{x}\right)\left[0\le x\le6^{1/2}\right]\tag{12}
$$
where $\left[\dots\vphantom{6^{1/2}}\right]$ are Iverson brackets.

The Slick Answer 
Suppose $f(x)\ge0$ and
$$
\int_0^\infty\sqrt{x}f(x)\,\mathrm{d}x=\int_0^\infty f(x)^2\,\mathrm{d}x=1\tag{13}
$$
Then letting $u(x)=\left(6^{1/4}-\sqrt{x}\right)\left[0\le x\le6^{1/2}\right]$
$$
\begin{align}
0
&\le\int_0^\infty(f(x)-u(x))^2\,\mathrm{d}x\\
&=\int_0^\infty\left(f(x)^2-2f(x)u(x)+u(x)^2\right)\,\mathrm{d}x\tag{14}
\end{align}
$$
Applying $(13)$ to $(14)$, dividing by $2$, and rearranging, we get
$$
\begin{align}
1
&\ge\int_0^\infty f(x)u(x)\,\mathrm{d}x\\
&\ge\int_0^\infty f(x)\left(6^{1/4}-\sqrt{x}\right)\,\mathrm{d}x\\
&=6^{1/4}\int_0^\infty f(x)\,\mathrm{d}x-1\tag{15}
\end{align}
$$
Therefore,
$$
\int_0^\infty f(x)\,\mathrm{d}x\le\left(\frac83\right)^{1/4}\tag{16}
$$