The Riemann sum of a divergent integral.

calculuslimitsriemann sum

I know that
$$
\int_0^1 \dfrac{dx}{x}=+\infty.
$$

But when I develop its Riemann sum (with tags of the right), I get
$$
\int_0^1 \dfrac{dx}{x}=\lim_{n\to+\infty}\dfrac{1}{n} \sum_{k=1}^n \dfrac{1}{k}=0,
$$

because de harmonic number grows as $\ln(n)$.

I am confused because of this ''apparently'' contradiction. I suppose it is because I should not develop the Riemann sum of a improper integral but I wonder ¿Why? Any advice or help would be appreciated.

Best Answer

You seem to be making a right Riemann sum. (Good choice, there are problems with the left Riemann sum.) You wish to replace $x$ ranging over $(0,1]$ with some expression in $k$ which expression gives a subset of $(0,1]$ as $k$ ranges over its index. You have used $k$ with $n = 1, 2, \dots, n$, but this does not produce values in $(0,1]$. (The first one, $k = 1$, is in that interval, but none of the rest are.) Since you seem to be aiming for even spacing with spacing $1/n$ (which appears in front of your sum) the difference between successive sample $x_k$s is $1/n$. This suggests you should replace $x$ with $k/n$, which does range over a subset of $(0,1]$ as $k$ ranges from $1$ to $n$ and does have $1/n$ spacing between samples.

So you should be looking at \begin{align*} \lim_{n \rightarrow \infty} \frac{1}{n} \sum_{k=1}^n \frac{1}{k/n} &= \lim_{n \rightarrow \infty} \frac{1}{n} \sum_{k=1}^n \frac{n}{k} \\ &= \lim_{n \rightarrow \infty} \sum_{k=1}^n \frac{1}{k} \text{.} \end{align*} And, as you observe, this harmonic sum diverges, as expected.

Related Question