Given $|f(x)|=1$,how to construct an $f(x)$, such that $\int ^{+\infty }_{0}f\left( x\right) dx$ converges

Here’s the problem:

Given $|f(x)| = 1$, construct an $f(x)$, such that $$\int ^{+\infty }_{0}f\left( x\right) dx$$ converges.

I think this problem may be done by dividing the 1s and -1s smartly, but I haven’t got any workable ideas on it.

Solutions Collecting From Web of "Given $|f(x)|=1$,how to construct an $f(x)$, such that $\int ^{+\infty }_{0}f\left( x\right) dx$ converges"

Rather than giving you an integral that converges, I’ll give you an example of a divergent integral that comes from a divergent series.

(Just adopt the method I am showing you to a convergent series)

$1-2+3-4+5-….$ is a divergent series.

I am going to construct an integral that is “equal to” this series.

$f(x) = \begin{cases} 1, &[0,1]\\ -1, &[1,3]\\ 1, &[3,6]\\ -1, &[6,10]\\ \dots \end{cases}$

Can you see that

$\int_0^\infty f(x) dx = 1 – 2 + 3 – 4 +\dots$?

Do you see how you can adopt this for any (convergent or divergent) series?

A classic example is something like $\int_0^\infty e^{ix^2}\;dx$. Letting $x=\sqrt{y}$ gives a sort of alternating-decreasing situation whose convergence becomes more obvious.