On Cauchy-Schwarz inequality (generalized)

I'm citing Risken, "The Fokker-Planck equation", 2nd edition, at page 70-71:

To derive (...) we need the generalized Cauchy-Schwarz inequality $$$$\tag{1} \left(\int_{-\infty}^{+\infty}f(x)g(x)h(x)\mathrm{d}x\right)^2\leq\int_{-\infty}^{+\infty}f^2(x) h(x)\mathrm{d}x\int_{-\infty}^{+\infty}g^2(x) h(x)\mathrm{d}x$$$$ which holds for any arbitrary functions $$f(x)$$ and $$g(x)$$, and for non-negative $$h(x)$$

But... how can this be true? The only thing he says is

$$\tag{2}\int_{-\infty}^{+\infty}\left(f(x) g(y) - f(y) g (x)\right)^2 h(x)h(y) \mathrm{d}x\mathrm{d}y \geq 0$$

What if both the left and the right-hand side of $$(1)$$ are infinite (and they may as well be, since $$f$$ and $$g$$ are arbitrary)? Two infinities cannot be ordered, $$\infty-\infty$$ is neither positive nor negative, it's just an indeterminate form

• if both sides are $+\infty$ (or even only the RHS), the $\le$ between them still holds. Commented May 14, 2023 at 17:29

The usual Cauchy-Schwarz on the real line says that if $$F,G:\Bbb{R}\to\Bbb{C}$$ are any measurable functions then \begin{align} \int_{\Bbb{R}}|F(x)G(x)|\,dx&\leq \sqrt{\int_{\Bbb{R}}|F(x)|^2\,dx} \sqrt{\int_{\Bbb{R}}|G(x)|^2\,dx}. \end{align} Here, we adopt the convention that $$0\cdot\infty=0$$ and for any $$a\in (0,\infty]$$, $$a\cdot\infty=\infty$$, and $$\sqrt{\infty}=\infty^2=\infty$$. Built into this inequality is the fact that if the right hand side is finite, then so is the left hand side. Also, if the left hand side is infinite, then so is the right hand side. So, this is a proper inequality in the extended sense of $$[0,\infty]$$.
• $$\int_{\Bbb{R}}|F(x)|^2\,dx=\infty$$ and $$\int_{\Bbb{R}}|G(x)|^2\,dx=0$$: In this case we have $$G=0$$ a.e, and so we have $$FG=0$$ a.e, so the LHS and RHS are both $$0$$.
• Same as previous bullet point with roles of $$F,G$$ reversed. This case follows trivially from above.
• Finally, the most interesting case is when $$\int_{\Bbb{R}}|F(x)|^2\,dx$$ and $$\int_{\Bbb{R}}|G(x)|^2\,dx$$ are finite (i.e lie in $$[0,\infty)$$). Here, I would suggest avoiding double integrals since that requires the big hammer of Fubini-Tonelli. This case is handled in almost every analysis book, and also several times on this site, so I won’t go into details here.
Finally, to get the ‘generalized’ version quoted, you simply apply this usual Cauchy-Schwarz with $$F=f\sqrt{h}$$ and $$G=g\sqrt{h}$$ and square both sides.