Define $f:[0,1]\to \mathbb R$ by $f(x)=\begin{cases}(-1)^nn &\text{ if }\frac{1}{n+1}<x\le \frac{1}{n}\\0 &\text{ otherwise }\end{cases}$
Show that $f$ is NOT Lebesgue integrable in $[0,1]$.
I want to show that $\displaystyle \int_0^1|f(x)|\,dx=\infty$ , but I am unable to find it.
Notice that $f$ can also be written as $$ f = 0\chi_{\{0\}} + \sum_{k=1}^\infty (-1)^k k \chi_{(1/(k+1),1/k]} $$ For each $n \in \mathbb{N}$, define $$ \phi_n = 0\chi_{[0,1/(n+1)]} + \sum_{k=1}^n k \chi_{(1/(k+1),1/k]} $$ to be a simple function. (The $0$ term is there to ensure that each point is covered by a characteristic function.) It is easy to see that $$\int \phi_n\,dx = \sum_{k=1}^n \frac{k}{k(k+1)} = H_{n+1} - 1$$ where $H_n$ is the $n$th Harmonic number and is known to diverge. Since $\phi_n \leq |f|$ for all $n$, $\int |f|\,dx = \infty$.