Show that if $f$ is integrable on $[a,b]$, then $|f|$ is also integrable. The problem suggests doing it by showing that $U(P,|f|) - L(P,|f|) \le U(P,f)-L(P,f)$ for some partition $P$.  I can get the other steps after that, but I've tried proving this inequality on my own and multiple tutors at my university couldn't figure it out using the material in my book.  Every time I've attempted it on my own, I've gotten the arrow in the opposite direction.  Doesn't $\displaystyle\sup_{i \in [x_{i-1},x_i]} |f(x)| \ge \displaystyle\sup_{i \in [x_{i-1},x_i]} f(x)$ hold?
Note that my class is using a pretty simplified Analysis (question 5.5.2a) book that doesn't cover metric spaces or Lebesgue integrals.  Everything is Riemann and we show a function is Riemann integrable if and only if its upper and lower Darboux integrals are equal.
 A: I can propose the following very own proof. :-) Since $f$ is (properly) Riemann integrable on $[a,b]$, $f$ is bounded on $[a,b]$. By Lebesgue theorem, a bounded function $f$ on a segment is Riemann integrable iff the set $D(f)$ of the discontinuity points of $f$ has the Lebesgue measure $0$. Since the function $|\cdot|$ is continuous, $D(|f|)\subset D(f)$. Thus $0\le\mu(D(|f|))\le \mu(D(f))\le 0$ and again by Lebesgue thereom, the function $|f|$ is Riemann integrable on $[a,b]$.
A: Recall Darboux's Criterion: $f: [a,b] \rightarrow \mathbb{R}$ is Riemann(-Darboux) integrable iff for all $\epsilon > 0$, there is a partition $\mathcal{P} = \{a = x_0 < x_1 < \ldots < x_n = b\}$ of $[a,b]$ such that
$$\omega(f,\mathcal{P}) = \sum_{i=0}^{n-1} \left(\sup(f,[x_i,x_{i+1}])-\inf(f,[x_i,x_{i+1}]) \right) (x_{i+1} - x_{i}) < \epsilon.$$
The quantity
$\omega(f,[x_i,x_{i+1}]) = \left(\sup(f,[x_i,x_{i+1}])-\inf(f,[x_i,x_{i+1}] \right)$
is sometimes called the oscillation of $f$ on the (sub)interval $[x_i,x_{i+1}]$, since it measures the difference between the largest and smallest values.  I claim that for any function $f: I \rightarrow \mathbb{R}$, taking the absolute value does not increase the oscillation: $\omega(|f|,I) \leq \omega(f,I)$.  This is a simple argument that I leave to you: note that this argument also underlies the proof that if $f$ is continuous, so is $|f|$.  The result follows from this by applying Darboux's Criterion twice.
Some comments:

*

*As Alex Ravsky says in his answer, we can actually "reduce" the problem to $f$ continuous at $a$ $\implies$ $|f|$ continuous at $a$ using the (Riemann-)Lebesgue criterion that $f: [a,b] \rightarrow \mathbb{R}$ is Riemann integrable iff it is bounded and its set of discontinuities has measure zero.  This is overkill.


*The result is a special case of another useful result which is usually presented in undergraduate analysis courses: if $f: [a,b] \rightarrow [c,d]$ is Riemann integrable and $\varphi: [c,d] \rightarrow \mathbb{R}$ is continuous, then $\varphi \circ f$ is Riemann integrable.  Applying this with $\varphi(x)= |x|$ we get the result.  For a proof, see Theorem 8.17 of these notes.  This result can be applied, for instance, to show that the product of two Riemann integrable functions is Riemann integrable.


*The proof of the theorem referred to above is not so easy.  However, it becomes much easier if $\varphi$ is not just continuous but Lipschitz, i.e., if there is a constant $C$ such that $|\varphi(x)-\varphi(y)| \leq C|x-y|$ for all $x,y \in [c,d]$.  This simpler case is proved separately as Theorem 8.20 in the above notes, and the proof comes down to observing that for Lipschitz $\varphi$, $\omega(\varphi \circ f, I) \leq C \omega(f,I)$.  Note that the absolute value function is Lipschitz with $C = 1$, and this is exactly what we observed above.
A: It is enough to show that if $I$ is any subinterval of $[a,b]$, then
$$\sup_I\vert f\vert-\inf_I\vert f\vert\leq \sup_I f-\inf_I f\, . $$
If this is done then, given any partition $P$, apply this inequality to each interval $I$ of the partition, multiply by $\vert I\vert$ and and then sum everything to get $U(P,\vert f\vert)-L(P,\vert f\vert)\leq U(P,f)-L(P,f)$.
So let us fix the interval $I$. One may distinguish 3 cases.

*

*If $\inf_I f\geq 0$, then $f\geq 0$ on $I$ so $\inf_I \vert f\vert=\inf_I f$ and $\sup_I\vert f\vert =\sup_I f$ and hence $\sup_I\vert f\vert-\inf_I\vert f\vert= \sup_I f-\inf_I f$.


*If $\sup_I f\leq 0$, then $f\leq 0$ on $I$, so $\inf_I \vert f\vert=-\sup_I f$ and $\sup_I\vert f\vert =-\inf_I f$ and hence $\sup_I\vert f\vert-\inf_I\vert f\vert= \sup_I f-\inf_I f$ again.


*If $\inf_I f<0<\sup_I f$, then we have either $\sup_I\vert f\vert=\sup_I f$, in which case $\sup_I\vert f\vert-\inf_I\vert f\vert\leq \sup_I\vert f\vert=\sup_I f<\sup_I f-\inf_I f$; or $\sup_I \vert f\vert=-\inf_I f$, in which case $\sup_I\vert f\vert-\inf_I\vert f\vert\leq -\inf_I f< \sup_I f-\inf_I f$.
