If $\int_{1}^{\infty}f\left(x\right)dx$ converges absolutely then $\int_{1}^{\infty}f^{2}\left(x\right)dx$ converges?

If $f(x)$ has very narrow peaks that grow in size so that the sum of the area of the $n$-th peak converges, the sum of the peaks of $f^2(x)$ can diverge.

For example, if $f(x) = n^a $ for $n \le x \le n+n^{-b} $, then $\int_n^{n+1} f(x) dx =n^{a-b} $ and $\int_n^{n+1} f^2(x) dx =n^{2a-b} $.

To get the first sum to converge, we need $a-b < -1$ and to get the second sum to diverge we need $2a-b > -1$.

If we choose, for some $c > 0$, $a-b=-1-c$ and $2a-b=-1+c$, then $a = 2c$ and $b=1+3c$ will work.

Choosing $c=1/4$, we get $a = 1/2$ and $b = 7/4$.

For this, $n^{a-b} =n^{-5/4} $ and the sum of these converges, and $n^{2a-b} =n^{-3/4} $ and the sum of these diverges.

Round off the corners if you don't like boxes.


Sketch: The answer is yes if $f$ is bounded, as you noticed. But $f$ need not be bounded: One way towards a counterexample is to think of tall thin triangles marching out to $\infty.$ Similar to the triangle example is an infinite seres that's fairly easy to write down:

$$f(x) = \sum_{n=1}^{\infty}n\sin^2(n^3\pi x)\mathbb \chi_{[n,n+n^{-3}]}(x).$$


Idea: $\ f$ is the zero function except tiny neighbourhoods around positive integers.

enter image description here

Above is an idea for such a function. Observe that $f(n)=2^{n-1}$.

Let's call the trapezoids $T_1,T_2,T_3$ and so on.

Make sure that the area below the upper base of each trapezoid $T_n$ is $2^{-n}$. (by manipulating its endpoints)

Also make sure that the sum of the area under the left and right sides of each trapezoid is $2^{-n}$.

So, the area under each trapezoid is $2.2^{-n}$.

So, the integral $\displaystyle \int_0^\infty f(x) \ \mathrm dx = \sum_{n=1}^\infty 2. 2^{-n} = 2$. $\implies f$ is absolutely convergent.

Now, when you square $f$, the height of the upper base of each $T_n$ will be squared.

For example, the height of $T_1$ will be $1$, the height of $T_2$ will be $4$ etc.

Also, the shape of the left and right sides of each trapezoid will be different, but we're not interested in that.

Anyways, the area under the upper base of $T_n$ will be $(2^{n-1})^2 \cdot 2^{-n}= 2^{n-2}$.

$\implies$ areas under upper bases of "squared trapezoids" will be divergent.

Hence $\displaystyle \int_0^\infty f^2(x) \ \mathrm dx$ is divergent.