Existence of a function with certain integral properties Does there exist a non-negative Borel-measurable function $g:\mathbb [1,\infty)\to[0,\infty)$ such that
\begin{align*}
\int_1^{\infty}g(y)^2\,\mathrm dy<&\,\infty,\\
\int_1^{\infty}\frac{g(y)}{\sqrt{y}}\,\mathrm dy=&\,\infty?
\end{align*}
$g(y)=1/\sqrt{y}$ “almost” works, but yet it doesn't. In fact, no function of the form $g(y)=1/y^{m}$ with $m>0$ works, because the first condition would imply that $2m>1$ and the second would require that $m+1/2\leq1$, and these two inequalities are incompatible.
Intuitively, $g$ must decline “much faster” than $1/\sqrt{y}$ so as to make the integral of $g(y)^2$ convergent, yet not so fast as to make the integral of $g(y)/\sqrt{y}$ convergent.
Does anyone have any ideas?

Got it. $$g(y)=\frac{\chi_{[2,\infty)}(y)}{\sqrt{y}\log y}.$$
