interchanging limits in something like a Riemann sum I got this problem thats been bothering me. How can I interchange those limits D:  
$\lim_{n \to \infty} \sum_{k=1}^{\infty}\frac{n}{n^{2}+k^{2}}=\lim_{n \to \infty}[ \lim_{m \to \infty} \frac{1}{n}\sum_{k=1}^{m}\frac{1}{1+(\frac{k}{n})^{2}}]$. Now I know that theres something wrong cause I need to interchange the limits but even if I could I'd get something with not so much sense cause, what do I do with that $m$, I was thinking in creating a sequence but I couldnt see it. 
So, any help would be really appreciated! :D 
 A: Formally, switching limits we get
$$\begin{align}\lim_{m \to \infty} \lim_{n \to \infty}\sum_{k=1}^{mn}\frac{n}{n^2+k^2} &= \lim_{m \to \infty}\lim_{n \to \infty}\frac{1}{n}\sum_{k=1}^{mn}\frac{1}{1+(k/n)^2}\\ &= \lim_{m \to \infty}\int_0^m \frac{dx}{1 + x^2} \\ &= \lim_{m \to \infty} \arctan(m)\\ &= \frac{\pi}{2}\end{align}$$
This is not easy to justify.  The usual theorems fail since the summand is not monotone and the series is not uniformly convergent. (Otherwise the limit would be $0$).
A rigorous proof would use
$$\sum_{k=1}^\infty\frac{n}{n^2+k^2} = \frac i2\sum_{k=1}^\infty\left(\frac1{in-k}+\frac1{in+k}\right)
=-\frac{1}{2n}+\frac{\pi i}{2}\cot(\pi in)\\
=-\frac1{2n}+\frac\pi2\coth(\pi n)$$
which implies
$$\lim_{n \to \infty}\sum_{k=1}^\infty\frac{n}{n^2+k^2}= \frac{\pi}{2}$$
since $\coth(x) \to 1$ as $x \to \infty$.
A: Suppose $f:[0,\infty)\to [0,\infty)$ is decreasing, and $\int_0^\infty f(x)\,dx$ is finite. For $n=1,2,\dots,$ set
$$S_n = \sum_{k=1}^{\infty}f\left(\frac{k}{n}\right)\cdot\frac{1}{n}.$$
Then
$$\lim_{n\to \infty} S_n = \int_0^\infty f(x)\,dx.$$
This follows from the observation that
$$\int_{0}^\infty f(x)\,dx - \frac{f(0)}{n}\le \int_{1/n}^\infty f(x)\,dx \le S_n \le \int_{0}^\infty f(x)\,dx,$$
which you can see from looking at the areas of rectangles in the usual way.
In our problem, $f(x) = \dfrac{1}{1+x^2},$ and the desired limit is $\pi/2.$
