show that $f$ is Riemann integrable on $[0,1]$ Let $f(x)=\sin\left(\frac{1}{x}\right)$ if $0<x\le1$ and $f(x)=0$ if $x=0$. Show that $f$ is Riemann integrable on $[0,1]$ and calculate it's integral on $[0,1]$.
I would like to know if my proof holds, please. And, I would like have a hint on how we can calculate the intergal of this such of functions, please.
My attempt is to pass by Darboux upper and lower sums.
To show that $f$ is Riemann integrable, we have to show the following:$\forall \epsilon>0$ $\exists$ a partition $\sigma$: $\overline{S}_{\sigma}(f)<\underline{S}_{\sigma}(f)+\epsilon$.
Let $0<\epsilon<2$ and consider the following intervals $[0,\epsilon/2]$ and $[\epsilon/2,1]$. First of all, as $f(x)$ is continuous on $[\epsilon/2,1]$($\sin(\frac{1}{x})$ is continuous on $[\epsilon/2,1]$), it is integrable on this interval. We would like to show now that $f$ is intergable on $[0,\epsilon/2]$. Consider the partition $\sigma=\{0,\frac{\epsilon}{2}\}$ on $[0,\epsilon/2]$ We have that
$\overline{S}_{\sigma}(f)-\underline{S}_{\sigma}(f)=\sum_{i=0}^{0}M_i(x_{i+1}-x_i)-\sum_{i=0}^{0}m_i(x_{i+1}-x_i)$ with $M_i=\sup\{f(x):x\in[x_i,x_{i+1}]\}$ and $m_i=\inf\{f(x):x\in[x_i,x_{i+1}]\}$.
We have that $M_i\le1$ and $m_i\le 0$. Thus,
$\sum_{i=0}^{0}M_i(x_{i+1}-x_i)-\sum_{i=0}^{0}m_i(x_{i+1}-x_i)\le1\cdot \frac{\epsilon}{2}< \epsilon$. Therefore, as $f(x)$ is integrable on $[0,\epsilon/2]$ and on $[\epsilon/2,1]$, we conclude that $f$ is integrable on $[0,1]$.
Now, I would like to calculate it's integral value... If someone could help with it, I would appreciate it. Honestly, I have no idea how to integrate this such of discontinuous functions at finitely many points.
Edit:
As $f(x)$ is continuous on $[\epsilon/3,1]$, it is integrable on this interval. Therefore, $\forall \epsilon>0 \ \exists$ partition $\tau$ on the interval $[\epsilon/3,1]$: $\overline{S}_{\tau}(f)-\underline{S}_{\tau}(f)<\epsilon/3$
To show that $f$ is integrable on $[0,1]$, we have to show that: $\forall \epsilon>0 \ \exists$ a partition $\sigma$: $\overline{S}_{\sigma}(f)-\underline{S}_{\sigma}<\epsilon$
Suppose $0<\epsilon<3$ and let $\sigma=\tau \ \cup \{0\}$ be a partition on the interval $[0,1]$. We have that (for the following inequality I use the same definition for $M_i$ and $m_i$ as above in the post):
$\overline{S}_{\sigma}(f)-\underline{S}_{\sigma}=\Big(\sum_{i=0}^{0}\underbrace{M_i}_{\le1}(x_{i+1}-x_i)-\sum_{i=0}^{0}\underbrace{m_i}_{\ge -1}(x_{i+1}-x_i)\Big)+\underbrace{\Big(\sum_{i=1}^{n}M_i(x_{i+1}-x_i)-\sum_{i=1}^{n}m_i(x_{i+1}-x_i)\Big)}_{<\epsilon/3}<\frac{\epsilon}{3}+\frac{\epsilon}{3}+\frac{\epsilon}{3}=\epsilon$.
Therefore, $f$ is integrable on $[0,1]$.
 A: This is about feedback on your proof.
Your goal is to find a partition $\sigma$ such that $\overline{S}_{\sigma} (f) <\underline{S} _{\sigma} (f) +\epsilon $ but instead you are trying to use that $f$ is integrable on $[\epsilon/2,1]$ and prove  that $f$ is integrable on $[0,\epsilon/2]$.
This is not what you want. You want a partition $\sigma$ which works as expected.
You can just say that since the function is integrable on $[\epsilon/2,1]$ there is a partition $\sigma_1$ of $[\epsilon/2,1]$ which works for this interval and then take $\sigma=\sigma_1\cup \{0\}$ and using your argument in question show that this particular partition works for $[0,1]$.
You have the correct idea but you need to present it in proper manner.
A: Integrate by parts
$$\int \sin \left(\frac{1}{x}\right) \, dx=x\sin \left(\frac{1}{x}\right) -\int x \left(-\frac{1}{x^2}\right)\cos \left(\frac{1}{x}\right)\,dx=$$
$$=x \sin \left(\frac{1}{x}\right)-\text{Ci}\left(\frac{1}{x}\right)+C$$
Ci is cosine integral
$$\text{Ci}(x)=-\int_x^{\infty}\frac{\cos x}{x}$$
$$\int_0^1 \sin \left(\frac{1}{x}\right) \, dx=\sin (1)-\text{Ci}(1)-\lim_{a\to 0^+}\left[a \sin \left(\frac{1}{a}\right)-\text{Ci}\left(\frac{1}{a}\right)\right]$$
set $\frac{1}{a}=t$
$$\lim_{t\to\infty}\left[\frac{1}{t} \sin t-\text{Ci}\left(t\right)\right]=0$$
$$\int_0^1 \sin \left(\frac{1}{x}\right) \, dx=\sin (1)-\text{Ci}(1)\approx 0.504$$
