TITLE: Calculating an improper integral as a limit of a sum.
QUESTION [7 upvotes]: This question arose from a solution I saw yesterday: 
Suppose f is continuous on (0,1] and has an infinite discontinuity at 0.
If the improper integral $\int_0^1 f(x) dx$ converges, is it always the case that:
$$\int_0^1 f(x) dx = \displaystyle\lim_{n\to\infty}\sum_{i=1}^{n}f\left(\frac{i}{n}\right)\frac{1}{n}$$ and, if so, how does one justify this equality?

REPLY [3 votes]: According to Polya and Szego "Problems and Theorems in Analysis, Vol. I, Ch. 1, $\S$ 3, Pr. 20"

Let $f$ be monotone on the interval $(0,1)$. It need not be bounded on $x=0$, $x=1$. If the improper integral $$\int_0^1 f$$ exists then $$\lim_{n\to\infty}\frac 1n \sum_{k=1}^{n-1}f\left(\frac kn\right)=\int_0^1f$$

P Assume $f$ is increasing. Then $$ \int_{0}^{1-\frac 1n}f\leq \lim_{n\to\infty}\frac 1n \sum_{k=1}^{n-1}f\left(\frac kn\right)\leq \int_{\frac 1 n}^1f$$
The condition that the function be monotonic is essential only in a neighborhood of the singularities.