Show that $f$ is Riemann integrable on $[0,1]$ when $f(x)= \operatorname{sgn}(\sin(\frac{\pi}{x}))$ for all $x \in (0,1]$ and $f(0)=1$ Help, I am having trouble showing that $f$ is riemann Riemann integrable on $[0,1]$ when
$$f(x)= \begin{cases} \operatorname{sgn}\left(\sin\left((\frac{\pi}{x}\right)\right) & \text{if } x \in (0,1]  \\ 1 & \text{if } x = 0.\end{cases}$$
 A: Firstly, for the sake of simplifying the argument, I'm going to assume that the $\operatorname{sgn}$ function is undefined at $0$. Normally, it's defined to be $0$ at $0$, but this will spoil the simplicity of the argument. There is away around it, but it makes things much more complicated, and I doubt your professor took this into account when they gave you this exercise.
So, let's take the partition
$$P_n = \left\{\left[0, \frac{1}{n}\right], \left[\frac{1}{n}, \frac{1}{n-1}\right], \left[\frac{1}{n-1}, \frac{1}{n-2}\right] \ldots, \left[\frac{1}{3}, \frac{1}{2}\right], \left[\frac{1}{2}, 1\right]\right\}.$$
First thing to note is that $f(x)$ is constant on each interval, except the first interval. For $x \in \left[\frac{1}{2}, 1\right]$, we have $\pi/x \in [\pi, 2\pi]$, hence $\sin(\pi/x) \le 0$, and thus $f(x) = -1$. For $x \in \left[\frac{1}{3}, \frac{1}{2}\right]$, we have $\pi/x \in [2\pi, 3\pi]$, so $\sin(x) \ge 0$, and $f(x) = 1$. Each successive interval, until $\left[0, \frac{1}{n}\right]$, alternates $-1$ and $+1$ in this way.
On the interval $\left[0, \frac{1}{n}\right]$, on the other hand, $f$ achieves both $1$ and $-1$, and alternates between them.
Now, we calculuate $U(f, P_n)$ by computing the maximum value of $f$ on each of the intervals, multiply the result by the length of the interval, and sum these signed areas. We compute $L(f, P_n)$ similarly, taking the minimal value of $f$ on each interval instead.
But, note that $f$ is constant on each interval, except the first! That is, the upper sum and lower sum will agree on every interval, except the first interval. This means that, if we subtract $L(f, P_n)$ from $U(f, P_n)$, then all but one term will cancel: the term corresponding to the first interval $\left[0, \frac{1}{n}\right]$. So,
\begin{align*}
U(f, P_n) - L(f, P_n) &= \left(\max_{x \in \left[0, \frac{1}{n}\right]} f(x)\right) \times \frac{1}{n} - \left(\min_{x \in \left[0, \frac{1}{n}\right]} f(x)\right) \times \frac{1}{n} \\
&= 1 \times \frac{1}{n} - (-1) \times \frac{1}{n} = \frac{2}{n}.
\end{align*}
Because $\frac{2}{n} \to 0$ as $n \to \infty$, there should be some $n$ such that $\frac{2}{n} < \varepsilon$. This tells us that $P_n$ is the partition you want.
