Function $f$ with $|f|$ is Lebesgue integrable but $f$ isn't locally Lebesgue integrable

Solution 1:

You've got the right setup.

Hint:

$$\int_{X}f(x)dx = \int_{A}f(x)dx + \int_{X\setminus A}f(x)dx = \int_A 1 dx - \int_{X\setminus A} 1 dx.$$

Solution 2:

In point of fact a function $f:\Bbb R\to\Bbb R$ such that $\lvert f\rvert$ is integrable will be integrable (locally and/or otherwise) if and only if it is measurable.

Your $f$ is not measurable because $A=f^{-1}[1/2,\infty)$, and therefore it isn't integrable.