Using the Riemann-Lebesgue lemma (for regulated functions), I'd like to calculate"
$$\lim_{n \rightarrow \infty} \int^b_af(x)\cos^2(nx)dx.$$
Here's how I try to calculate it:
Using IBP: $\cos^2(nx) \Rightarrow du=-2n\sin(nx)\cos(nx)$ and $f(x)dx=dv \Rightarrow f(x)=v.$
So,
$-2n\cos(nx)\sin(nx)f(x)\bigg|^b_a - 2n\int^b_af(x)2n\cos(nx)dx.$
But now I'm stuck. I'm not sure where to go from here, since it diverges, but it should not I guess. What am I doing wrong? Any help is appreciated!
Update after comment:
$$\int^b_a\cos^2(nx)f(x)dx= \int^b_a\frac{1}{2}(1+\cos(2nx))f(x)dx= \frac{1}{2}\int^b_af(x)dx+\frac{1}{2}\int^b_af(x)\cos(2nx) \to \frac{1}{2}\int^b_af(x)dx \text{ as $n \to \infty$}.$$
Note $$ \int_a^bf(x)\cos^2(nx)dx=\frac{1}{2}\int_a^bf(x)dx+\frac12\int_a^bf(x)\cos(2nx)dx. $$ First assume that $f(x)\in C^1[a,b]$. Then \begin{eqnarray} &&\bigg|\int_a^bf(x)\cos(2nx)dx\bigg|=\frac1{2n}\bigg|\int_a^bf(x)d\sin(2nx)dx\bigg|\\ &&=\frac{1}{2n}\bigg|f(x)\sin(2nx)\bigg|_a^b-\int_a^bf'(x)\sin(2nx)dx\bigg|\\ &&\le \frac1{2n}\bigg(|f(a)|+|f(b)|+\int_a^b|f'(x)|dx\bigg)\to 0 \end{eqnarray} as $n\to\infty$. This is becase $f(x)$ and $f'(x)$ are bounded in $[a,b]$ since $f(x)\in C^1[a,b]$. If $f(x)\not\in C^1[a,b]$, for fixed $\epsilon>0$, choose $g(x)\in C^1[a,b]$ such that $$ \int_a^b|f(x)-g(x)|dx<\epsilon/2. $$ Choose $N>0$ such that, for $n\ge N$, $$ \bigg|\int_a^bg(x)\cos(2nx)dx\bigg|<\epsilon/2. $$ Then for $n\ge N$, \begin{eqnarray} &&\bigg|\int_a^bf(x)\cos(2nx)dx\bigg|\\ &&=\bigg|\int_a^b(f(x)-g(x))\cos(2nx)dx+\int_a^bg(x)\cos(2nx)dx\bigg|\\ &&\le\int_a^b|f(x)-g(x)|dx+\bigg|\int_a^bg(x)\cos(2nx)dx\bigg|\\ &&\le\epsilon/2+\epsilon/2=\epsilon. \end{eqnarray} Namely $$ \lim_{n\to\infty}\int_a^bf(x)\cos(2nx)dx=0. $$ So $$ \lim_{n\to\infty}\int_a^bf(x)\cos^2(nx)dx=\frac{1}{2}\int_a^bf(x)dx+\lim_{n\to\infty}\frac12\int_a^bf(x)\cos(2nx)dx=\frac{1}{2}\int_a^bf(x)dx. $$