Let $f(x)=\begin{cases} \dfrac{1}{x} & \;\text{if }\; x < -1 \\ 0 & \;\text{if }\;-1\le x\le 1 \\ \dfrac{1}{x} & \;\text{if }\; x> 1 \\ \end{cases}$
I wanted to show that $\displaystyle\int_{-\infty}^{\infty}f(x)\;dx$ does not converge.
I know that $\displaystyle\int_{1}^{\infty}f(x)dx$ diverges (Riemann integral) by showing that $\displaystyle\lim_{R\to \infty}\int_{1}^{R}f(x)dx=\infty$. And I can compute the limit $\displaystyle\lim_{r\to -\infty}\int_{r}^{-1}f(x)dx=-\infty$ and that $\displaystyle\int_{-1}^{1}f(x)dx=0$ but what about the sum of these integrals $\displaystyle\int_{-\infty}^{\infty}f(x)dx$, knowing that the sum of divergent integrals may converge.
Each integral needs to converge separately. As a definition, $$\int_{-\infty}^\infty f(x)\mathrm dx=\lim_{A\to -\infty}\lim_{B\to \infty} \int_A^B f(x)\mathrm dx$$ Since neither of these limits exist for our $f$, the integral is divergent.