Prove piecewise monotone function is Riemann integrable

I want to show the following proposition

Let $[a,b]$ be a compact interval and $f: [a,b] \to \mathbb R$ be a bounded, piecewise monotone function. Then $f$ is Riemann integrable.

Our definition of piecewise monotonicity is

Let $[a,b]$ be a compact interval and $f: [a,b] \to \mathbb R$ a function. $f$ is piecewise monotone iff there exists a partition $\xi = \{a=x_0 \lt \ldots \lt x_n = b\}$ of $[a,b]$, such that $f_k := f|_{(x_{k-1},x_k)}$ is monotone for all $k \in \{1,\ldots,n\}$.

I am allowed to use the fact that a monotone function on a compact interval is Riemann integrable, as well as the additivity property, and, that changing one point of a Riemann integrable function doesn't change it's integrability.

My attempt:

Since $f_k$ is monotone, it's Riemann integrable. We use the additivity of the Riemann integral to combine $f_1$ and $f_{2}$, then we can combine those with $f_3$ and so on. Therefore

$$f(x) = \begin{cases} f_1(x) & \text{if } x \in [x_0,x_1) \\ f_2(x) & \text{if } x \in [x_1,x_2) \\ \ldots \\ f_n(x) & \text{if } x \in [x_{n-1},x_n] \end{cases}$$

is Riemann integrable.

I don't feel comfortable with this argument, it seems too simple. And also I think the additivity property requires that the edges of the adjacent intervals match up (i.e. $f_k(x_k) = f_{k+1}(x_k)$) which might not necessarily be true. Can somebody help me out?

• I was about to say that "bounded" is not needed (or: is automatic), but it seems that $f$ may be increasing and decreasing alternatingly. – Hagen von Eitzen Dec 31 '17 at 16:39
• @HagenvonEitzen We are given the following example function which is apparently Riemann integrable: imgur.com/a/4lGBi (I should add it's defined on $[0,1] \to [0,1]$) – philmcole Dec 31 '17 at 16:41
• If a function is Riemann integrable on finitely many disjoint subintervals of $[a,b]$ whose union is $[a,b]$, then it is Riemann integrable on $[a,b]$. Hence it suffice to prove that a monotonic $f:[a,b] \to \mathbb{R}$ is Riemann integrable. – AlohaSine Dec 31 '17 at 21:46
• For the function $g$ of the image, one needs infinitely many subintervals on which $g$ is monotone (decreasing). That doesn't qualify as piecewise monotone by the definition you mention, which requires that $[a,b]$ be partitioned into only finitely many parts. (I don't know if this is a problem for what you want to show.) – coffeemath Dec 31 '17 at 21:46

Integration does not depend on the value of the function at isolated points, so you can define $f_k$ however you please at the partition points and still have that $f_k$ is integrable on $[x_{k-1},x_k]$ even though monotonicity fails at the endpoints.
Just extend the definition of $f_k$ at end points of the subinterval $[x_{k-1},x_{k}]$ so that $f_k$ is monotone on the compact subinterval $[x_{k-1},x_{k}]$. Then $f_k$ is integrable on this subinterval. And since $f$ differs from $f_{k}$ possibly at the end points of this subinterval, it follows that $f$ is also integrable on this subinterval. By additivity it is integrable on whole of $[a, b]$.
and since a continuous function is bounded on any compact interval $$[x_{k-1}, x_k]$$ by the Extreme Value Theorem, it is also Riemann integerable there. Just apply this to every sub-interval in the partition.