What is the value of $$\displaystyle{\lim_{n\to \infty}\frac{1}{n}\sum_{r=0}^{n-1}\cos\frac{r\pi}{2n}}$$
The answer is given as $1$ but I am almost 100% sure it will not be $1$. What will be the correct answer and how to find it.
On
this is nothing but $$\int_0^1dx \cos \frac{\pi x}{2}=\frac{2}{\pi}$$. This method is known as "limit of sum", where $\frac{r}{n} $ is replaced by $x$, $$\frac{1}{n}$$ is replaced by $dx$ and $$\sum_{n_0}^{n_1}$$ by $$\int_a^b$$. The limits are evaluated as: $$a=\lim_{n \to \infty}\frac{n_0}{n}$$ and $$b=\lim_{n \to \infty} \frac{n_1}{n}$$
On
By the Riemann sum we have
$$\lim_{n\to\infty}\frac1n\sum_{r=0}^{n-1}\cos\left(\frac{r\pi}{2n}\right)=\int_0^1\cos\left(\frac{\pi x}{2}\right)dx=\frac2\pi\sin\left(\frac{\pi x}{2}\right)\Bigg|_0^1=\frac2\pi$$
On
Without integrals, using complex numbers.
Let $2\theta=\frac{\pi}{2n}$ and sum the geometric progression:
$$\sum_{r=0}^{n-1}e^{2ir\theta}=\frac{e^{2in\theta}-1}{e^{2i\theta}-1}=\frac{i-1}{e^{2i\theta}-1}=\frac{(i-1)e^{-i\theta}}{e^{i\theta}-e^{-i\theta}}=\frac{(i-1)(cos\theta-i\sin\theta)}{2i\sin\theta}.$$ Taking the real part, $$\sum_{r=0}^{n-1}\cos\frac{\pi r}{2n}=\frac{\cos\theta+\sin\theta}{2\sin\theta}=\frac12\cot\theta+\frac12.$$
In the limit when $\theta\rightarrow 0$, we can replace $\cot\theta$ by $\frac1{\theta}$ and ignore the term $\frac12$: $$\frac1n\sum_{r=0}^{n-1}\cos\frac{\pi r}{2n}\rightarrow\frac{1}{2n\theta}=\frac2{\pi}.$$
Hint : This is equivalent to the integral $\int_{0}^1 \cos {\dfrac{\pi x}{2}}dx $
In general, $$\int_{0}^1f(x)dx=\lim_{n\rightarrow \infty}\sum_{r=0}^{n-1}\dfrac{1}{n}f(\dfrac{r}{n})$$
Also,
$$\int_{a}^bf(x)dx=\lim_{n\rightarrow \infty}\sum_{r=0}^{n-1}\dfrac{b-a}{n}f(a+r\dfrac{b-a}{n})$$