I've a doubt regarding definite Riemann integral.
I know that this is true $\mid \int_a^b f(x) dx\mid \leq \int_a^b \mid f(x) \mid dx$
And there is a theorem that states that if $f$ is integrable, than $\mid f \mid$ is integrable but the opposite implication is not valid.
I must say that I'm not familiar with the proofs of these facts but I find the two facts quite in contrast with each other.
If the inequality holds than, thinking about the area under the graph, if $\mid f\mid$ can be integrated, then why $f$ should not be? I mean the inequality states that the area under the graph of $f$ is someway "less" than the one under the graph of $\mid f\mid$, therefore if I find the area under the graph of $\mid f\mid$ then I should be able to find the one under the graph of $f$, thus if $\mid f\mid$ is integrable, $f$ should be too.
Of course I'm missing something, but what? I can't see it.
Thanks in advice for your help
Consider the function $$ f(x) = \begin{cases}1, \ x \in \mathbb{Q} \\ -1, \ x \ \in \mathbb{R} \setminus \mathbb{Q} \end{cases}$$ Now $|f(x)| = 1$ and clearly the constant function is integrable, but $f$ is not Riemann integrable on any interval.
Your intuition about the areas is only a part of the theory of Riemann integration. It is useful to have a toolbox of "pathological" objects (such as the above integral, another example is the Cantor set for other areas of math) to test "intuitive" theorems.