# Analysis Convergence/Divergence

Prove there exists a function $f$ such that $$\int_1^{\infty}f(x)\,dx\text{ converges, but }\int_1^{\infty}|f(x)|\,dx\text{ diverges.}$$

Similarly, prove that there exists a function $g$ such that $$\int_0^1 g(x)\,dx\text{ converges, but }\int_0^1|g(x)|\,dx\text{ diverges.}$$

All I am able to understand in the first part, is to take an example. I am thinking of something like $(1/2)^n$? I am not sure how to account for the absolute values, and when they say prove, can I just find an example only? I am having trouble of thinking of such a function.

-
"Prove" in this context means "find an example and prove that it works." What do you know about the conditional convergence of alternating series? – Qiaochu Yuan Apr 24 '11 at 0:45

Hint: for the first part, think of the series $\log 2=1-\frac{1}{2}+\frac{1}{3}-\ldots$. It converges (and we know to what) but taking the absolute value of each term yields the harmonic series $1+\frac{1}{2}+\frac{1}{3}+\ldots$ which diverges. Can you turn that into an integral? Yes, one way to prove something exists is to exhibit it. For the second part, informally $0=\frac{1}{\infty}$, so maybe you can transform your $f$ in some way to get $g$.
Added: Try $f(x)=\frac{(-1)^{\lfloor x+1 \rfloor}}{\lfloor x \rfloor}$ (I missed some formatting in the comment). If you integrate this from $1$ to $\infty$, each segment of the form $[n,n+1)$ gives one term in the expansion of $\log 2$. Then taking the absolute value gives the harmonic series.
@user8917: no, can you find a function that integrates to make the series for log(2)? The negative terms come because the function is less than zero. Then when you take the absolute value of $f$, the negative terms become positive and the integral diverges like the harmonic series. – Ross Millikan Apr 24 '11 at 1:34