TITLE: Evaluate a limit of series using Riemann integral
QUESTION [5 upvotes]: Let $$ \lim_{n\to\infty} n\cdot \sum_{j=1}^n \frac{\cos\left(\frac{n}{j}\right)f\left(\frac{n}{j}\right)}{j^2} $$
Where $f$ is $C^\infty$ and monotonically decreasing: $\lim_{x\to\infty} f(x) = 0$.
I need to evaluate the limit. Riemann integral should be used. I guess there should be some algebraic moves to reach that, and the integrand (my guess) should be $f(x)\cos(x)$.
Could you help me please connect the dots?

REPLY [4 votes]: Define $g(x)=\frac{\cos\left(\frac{1}{x}\right)f\left(\frac{1}{x}\right)}{x^2}$, and write the above  as:
$$\sum_{j=1}^{n} \frac{1}{n}g\left(\frac{j}{n}\right)$$
Which is a Reimann sum, which has, as a limit:
$$\int_{0}^1 g(x)\,dx$$
That's gonna depend on $g$. In particular, it might be an improper integral, depending on whether you can make $g$ continuous at $0$.
Then $g\left(\frac{1}u\right)=u^2f(u)\cos u$ 
Substituting $x=\frac{1}{u}$ so $dx=\frac{-du}{u^2}$ you get:
$$\int_1^{\infty} f(u)\cos u \,du$$