Show that $$\lim_{n\to \infty} \int_{a}^{b}f(x)\cos(nx)dx=0$$ where $f$ is continuous on $[a,b].$
My Attempt:
Since $f$ is uniformly continuous we have for $\epsilon>0$ a $\delta>0$ such that $|t-s|<\delta$ implies $|f(t)-f(s)|<\epsilon.$ Then if we take a partition $a=x_0<x_1<x_2<....<x_k=b$ with mesh less that $\delta$ then we have that $$\left|\int_{a}^{b}f(x)\cos(nx)dx\right|=\left|\sum_{m=0}^{k}\int_{x_k}^{x_{k+1}}f(x)\cos(nx)dx\right|$$ $$=\left|\sum_{m=0}^{k}f(x_{k+1})\int_{x_{k}}^{x_{k+1}}\cos(nx)dx+\int_{x_{k}}^{x_{k+1}}(f(x)-f(x_{k+1}))\cos(nx)dx\right|$$ $$\leq \left|\sum_{m=0}^{k}f(x_{k+1})\int_{x_{k}}^{x_{k+1}}\cos(nx)dx\right|+\left|\int_{x_{k}}^{x_{k+1}}(f(x)-f(x_{k+1}))\cos(nx)dx \right|$$ $$\leq kM\underbrace{\color{red}{(??)}}_{\text{how to estimate the integral with cos(nx)?}}+\epsilon(b-a)$$ Here $M=\max_{{x\in[a,b]}}|f(x)|.$ I can say that $$\left|\int_{x_{k}}^{x_{k+1}}\cos(nx)dx\right|\leq \int_{x_{k}}^{x_{k+1}}\left|\cos(nx)\right| dx =(x_{k+1}-x_{k})$$ and so summing over all the integrals I can get $b-a$ as a bound but it does not involve an $n$ and so I cannot make a conclusion. How should I proceed?
Hint: You were getting close. You have (note you left out the second summation, I put it in),
$$\tag 1 \left|\sum_{j=0}^{k-1}f(x_{j+1})\int_{x_{j}}^{x_{j+1}}\cos(nx)\,dx\right|+\sum_{j=0}^{k-1}\left|\int_{x_{j}}^{x_{j+1}}(f(x)-f(x_{j+1}))\cos(nx)\,dx \right|.$$
Your estimate on the second sum is good. Your estimate on the first sum is not so good. All you need to show is $\int_c^d\cos nx\, dx\to 0,$ for any $c<d,$ which is elementary. That will show the first sum $\to 0.$ Thus the $\limsup$ of $(1)$ is $\le \epsilon(b-a)$ ...