Given that $f(x)=\sin x^2$ for $x \in \mathbb{R}$. Then how to find the following limit $$\displaystyle\lim_{n \to \infty} \left(\sum_{k=1}^{ n}f\left(\frac{k}{n} \right) - n\int_0^1 f(x)dx \right) $$
The expression is looking familiar,so I tried by multipling the denominator and the numerator with $\frac{1}{n}$ and have $$\displaystyle\lim_{n \to \infty} \frac{\frac{1}{n}\sum_{k=1}^{ n}f\left(\frac{k}{n} \right) - \int_0^1 f(x)dx }{\frac{1}{n}} $$
Now we know that $$\displaystyle\lim_{n \to \infty} \frac{1}{n}\sum_{k=1}^{ n}f\left(\frac{k}{n} \right) =\int_0^1 f(x)dx $$ Hence it's a $\frac{0}{0}$ form .But how to proceed further from here? Also I would like to ask if there is any generalized method to solve this types of problems means if $S_n$ is the limit sum of an integral and $ S_n \rightarrow S$ as $n \rightarrow \infty$ then how to find $\displaystyle \lim_{n \to \infty}\frac{S_n-S}{\frac{1}{n}}$?