# Understanding how to form a definite integral from limit of an infinite sum

I have to solve the limit $$\lim_{n\rightarrow\infty}\left(\frac1n\sum_{k=1}^n(\text{log}\:k)^2-\left(\frac1n\sum_{k=1}^n(\text{log}\:k)\right)^2\right)$$

I don't know how to proceed in this problem. However, the solution says that this limit is equal to the limit $$\lim_{n\rightarrow\infty}\left(\frac1n\sum_{k=1}^{n-1}\left(\text{log}\:\frac kn\right)^2-\left(\frac1n\sum_{k=1}^{n-1}\left(\text{log}\:\frac kn\right)\right)^2\right)$$

Which is equal to $$\int_0^1 (\text{log}\:x)^2dx-\left(\int_0^1 \text{log}\:x\;dx\right)^2$$

Can someone explain how these two equations were derived from the first expression? I am aware of expressing definite integral as limit of an infinite sum. But I don't see how the above conversions were made. I need the intermediate steps.

Write

$$\log k = \log k - \log n + \log n = \log \frac{k}{n} + \log n,$$

so that

\begin{align}\left(\frac{1}{n}\sum_{k = 1}^n \log k\right)^2 &= \left(\frac{1}{n}\sum_{k = 1}^n \log\frac{k}{n} + \log n\right)^2\\ &= \left(\frac{1}{n}\sum_{k = 1}^n \log \frac{k}{n}\right)^2 + \frac{2\log n}{n}\sum_{k = 1}^n \log \frac{k}{n} + (\log n)^2 \tag{1} \end{align}

and

\begin{align}\frac{1}{n}\sum_{k = 1}^n (\log k)^2 &= \frac{1}{n}\sum_{k = 1}^n \left[\left(\log\frac{k}{n}\right)^2 + 2\log n\log\frac{k}{n} + (\log n)^2\right]\\ &=\frac{1}{n}\sum_{k = 1}^n \left(\log \frac{k}{n}\right)^2 + 2\frac{\log n}{n}\sum_{k = 1}^n \log \frac{k}{n} + (\log n)^2 \tag{2} \end{align}

Subtracting $(1)$ from $(2)$, we obtain

\begin{align} & \frac{1}{n}\sum_{k = 1}^n (\log k)^2 - \left(\frac{1}{n}\sum_{k = 1}^n \log k\right)^2 \\ &= \frac{1}{n}\sum_{k = 1}^n \left(\log \frac{k}{n}\right)^2 - \left(\frac{1}{n}\sum_{k = 1}^n \log \frac{k}{n}\right)^2\\ &= \frac{1}{n}\sum_{k = 1}^{n-1} \left(\log \frac{k}{n}\right)^2 - \left(\frac{1}{n}\sum_{k = 1}^{n-1} \log \frac{k}{n}\right)^2 \end{align}

The last step follows since $\log \frac{k}{n} = 0$ when $k = n$.

Since

$$\frac{1}{n}\sum_{k = 1}^{n-1} \log \frac{k}{n}$$

is a sequence of Riemann sums for $\log x$ over $[0,1]$, and

$$\frac{1}{n}\sum_{k = 1}^{n-1} \left(\log \frac{k}{n}\right)^2$$

is a sequence of Riemann sums for $(\log x)^2$ over $[0,1]$, we have

$$\frac{1}{n}\sum_{k = 1}^{n-1} \log \frac{k}{n} \to \int_0^1 \log x\, dx$$

and

$$\frac{1}{n}\sum_{k = 1}^{n-1} \left(\log \frac{k}{n}\right)^2 \to \int_0^1 (\log x)^2\, dx,$$

whence the third step follows.

• Can you please also include the last step of getting the integral? Mar 5 '15 at 3:46
• @Tejas I have included the details for getting the last step.
– kobe
Mar 5 '15 at 3:52