Limit of definite integral of $f(x)\cos(mx)$ Source: Old comp./preliminary exam.
Let $f(x)$ be a Riemann integrable function on $[0,1]$. Prove that $$\lim_{m\to\infty}\int_{0}^{1}f(x)\cos(mx) \, \,dx=0$$
Thought
$(1)$ Because we don't know if $f(x)$ is differentiable, we can only use integration by part by setting $du=f(x)\, \,dx$ and $v=\cos(mx)$, the result is not quite helpful.
$(2)$ We don't know whether $f(x)\cos(mx)$ converges as $m\rightarrow \infty$ so those convergence theorems cannot be applied.
Side note: This exam assume no knowledge in measure theory and Lebesgue integral. 
 A: Since $f$ is Riemann integrable, it is bounded and continuous almost everywhere on $[a,b]$. Also it is Lebesgue integrable. By Lusin's theorem, there is a continuous function $g$ on $[a,b]$ that
$$
m(\{x:f(x)\ne g(x), \:x\in[a,b]\})<\epsilon
$$
Note $g$ is also bounded on $[a,b]$. Then
\begin{align}
\left|\int_{a}^{b}f(x)\cos(mx) \, dx\right|&=\left|\int_{a}^{b}(f(x)-g(x))\cos(mx) \, dx+\int_{a}^{b}g(x)\cos(mx) \, dx\right|
\\
&=\left|\int_{\{x:f\ne g, \:x\in[a,b]\}}(f(x)-g(x))\cos(mx) \, dx+\int_{a}^{b}g(x)\cos(mx) \, dx\right|
\\
&\leqslant \epsilon M+\left|\int_{a}^{b}g(x)\cos(mx) \, dx\right|
\\
\end{align}
So $\int_{a}^{b}f(x)\cos(mx) \, dx\to0$ if $\int_{a}^{b}g(x)\cos(mx) \, dx\to0$. Thus we only prove it for continuous function.
First on any interval $[c,d]$, there is
\begin{align}
\left|\int_c^d\cos(mx)dx\right|&=\left|\dfrac1{m}\int_{mc}^{md}\cos(y)dy\right|
\\
&=\left|\dfrac1{m}\int_{mc}^{2n\pi}\cos(y)dy+\sum\limits_{k=n}^{l}\dfrac1{m}\int_{2k\pi}^{2(k+1)\pi}\cos(y)dy+\dfrac1{m}\int_{2(l+1)\pi}^{md}\cos(y)dy\right|
\\
&\leqslant\dfrac{2n\pi-mc+md-2(l+1)\pi}{m}
\\
&\leqslant\dfrac{4\pi}{m}\tag{1}
\end{align}
where $n=\left[\dfrac{mc}{2\pi}\right]+1,l=\left[\dfrac{md}{2\pi}\right]-1$.
Let $f$ be a continuous function on $[a, b]$. Since $f(x)$ is uniform continuous on $[a,b]$, for any $\epsilon>0,\space\exists \delta>0, \space \forall y_1,y_2\in [a,b], |y_1-y_2|<\delta$, there is $|f(y_1)-f(y_2)|<\epsilon \space$. 
Let $\mathcal{P} = \{x_{0}, x_{1}, x_{2},\ldots, x_{n}\}$ of $[a, b]$ be a partition that $\max\{|x_{k - 1}-x_{k}|\}<\delta,\: k\in[1,n]$. There is
\begin{align}
\left|\int_a^bf(x)\cos(mx)dx-\sum\limits_{i=0}^{n}\int_{x_i}^{x_{i+1}}f(x_i)\cos(mx)dx\right|&=\left|\sum\limits_{i=0}^{n}\int_{x_i}^{x_{i+1}}(f(x)-f(x_i))\cos(mx)dx\right|
\\
&\leqslant\epsilon\int_a^b|\cos(mx)|dx
\\
&\leqslant(b-a)\epsilon\tag{2}
\end{align}
And by $(1)$
\begin{align}
\left|\sum\limits_{i=0}^{n}\int_{x_i}^{x_{i+1}}f(x_i)\cos(mx)dx\right|&=\left|\sum\limits_{i=0}^{n}f(x_i)\int_{x_i}^{x_{i+1}}\cos(mx)dx\right|
\\
&\leqslant\dfrac{4\pi}{m}nM\tag{3}
\end{align}
where $|f(x_i)|\leqslant M$.
From $(2),(3)$, we have
\begin{align}
\left|\int_a^bf(x)\cos(mx)dx\right|&\leqslant\left|\sum\limits_{i=0}^{n}\int_{x_i}^{x_{i+1}}f(x_i)\cos(mx)dx\right|+(b-a)\epsilon
\\
&\leqslant\dfrac{4\pi nM}{m}+(b-a)\epsilon
\end{align}
And
$$
\varlimsup\limits_{m\to\infty}\left|\int_a^bf(x)\cos(mx)dx\right|\leqslant (b-a)\epsilon
$$
Since $\epsilon$ is arbitrary small, we have
$$
\lim\limits_{m\to\infty}\int_a^bf(x)\cos(mx)dx=0 
$$
A: The set $\{e^{\pi imx}\}_{m\in \mathbb{Z}}$ is a basis of $L^2(0,1)$. So $f(x)=\sum_{j\in \mathbb{Z}}a_je^{\pi ijx}$ when $f\in L^2(0,1)$. So $\int_{0}^1f(x)e^{\pi ijx}dx=(f,e^{\pi ijx})=a_j$. For the other hand, $\lim_ja_j=0$ because $f$ is Riemann integrable so bounded and so $f\in L^2(0,1)$. In particular, taking the real part of $a_j$ we have $\lim_j \int_{0}^1f(x)\cos(jx)dx=0.$ 
A: Here is a simplified solution. 
As explained in other post, we only prove it for continuous function.
Since
$$
\int_{a+(k-1)\frac{2\pi}m}^{a+k\frac{2\pi}m}\cos(mx)\,dx=0\tag{1}
$$
\begin{align}
\left|\int_a^bf(x)\cos(mx)\,dx\right|
&\leqslant\left|\sum_{k=1}^n\int_{a+(k-1)\frac{2\pi}m}^{a+k\frac{2\pi}m}f(x)\cos(mx)\,dx\right|+\left|\int_{a+n\frac{2\pi}m}^bf(x)\cos(mx)\,dx\right|\\
&=\left|\sum_{k=1}^n\int_{a+(k-1)\frac{2\pi}m}^{a+k\frac{2\pi}m}\left(f(x)-f\left(a+k\tfrac{2\pi}m\right)\right)\cos(mx)\,dx\right|\tag{by (1)}\\
&+\left|\int_{a+n\frac{2\pi}m}^bf(x)\cos(mx)\,dx\right|\tag{2}
\end{align}
where $n=\left\lfloor(b-a)\frac{m}{2\pi}\right\rfloor$, and $\left|b-a-n\frac{2\pi}m\right|\le\frac{2\pi}m$.
Since $f$ is uniform continuous, given $\epsilon>0$, there exists a $\delta>0$ that for any $x,y\in[a,b]$, $\:|x-y|<\delta$, there is $|f(x)-f(y)|<\epsilon$. Now let $m$ large enough so that $\frac{2\pi}m<\delta<\epsilon$. From $(2)$, there is
$$
\left|\int_a^bf(x)\cos(mx)\,dx\right|\leqslant(b-a)\epsilon+\frac{2\pi}m M<\epsilon(b-a+M)
$$
where $M=\sup_{x\in[a,b]}|f(x)|$.
A: Here is a proof that uses no Lebesgue machinery.
Fix $\epsilon > 0$.
Since $f$ is Riemann integrable on $[0,1]$, there exists a partition $P$ defined by the points $0=x_0 < x_1 < \ldots < x_N = 1$ such that
$$0 \leq \int_0^1 f(x) dx - \sum_{n=1}^{N}a_n(x_n - x_{n-1}) < \epsilon$$
where $a_n = \inf_{x \in [x_{n-1}, x_n]} f(x)$. In other words, $f$ can be approximated from below by a step function, such that the approximation error is less than $\epsilon$.
The inequality can be rewritten as
$$0 \leq \sum_{n=1}^{N}\int_{x_{n-1}}^{x_n} (f(x) - a_n) dx < \epsilon$$
Therefore,
$$\begin{aligned}
\left|\sum_{n=1}^{N}\int_{x_{n-1}}^{x_n} (f(x) - a_n) \cos(mx) dx\right|
& \leq \sum_{n=1}^{N}\int_{x_{n-1}}^{x_n} |f(x) - a_n| dx \\
&= \sum_{n=1}^{N}\int_{x_{n-1}}^{x_n} (f(x) - a_n) dx \\
&< \epsilon
\end{aligned}$$
Now, we compute
$$\left|\int_{x_{n-1}}^{x_n}a_n \cos(mx) dx\right| = \frac{|a_n|}{m}\left|\sin(mx_n) - \sin(mx_{n-1})\right| \leq \frac{2|a_n|}{m}$$
Now choose $m$ large enough that $\displaystyle \frac{2|a_n|}{m} < \frac{\epsilon}{N}$ for all $1 \leq n \leq N$. We then can conclude that
$$\begin{aligned}
\left|\int_{0}^{1}f(x)\cos(mx)dx\right| &= 
\left|\sum_{n=1}^{N}\int_{x_{n-1}}^{x_n} f(x)\cos(mx) dx\right| \\
&\leq \left|\sum_{n=1}^{N}\int_{x_{n-1}}^{x_n} (f(x) - a_n)\cos(mx) dx\right|
+ \left|\sum_{n=1}^{N}\int_{x_{n-1}}^{x_n} a_n \cos(mx) dx\right| \\
&\leq \epsilon + N\left(\frac{\epsilon}{N}\right) \\
&= 2\epsilon
\end{aligned}$$
