# An approximation related to Euler's constant and the Harmonic number

Let's consider Euler's constant $$\gamma$$, i.e., $$\gamma=\lim_{n\to \infty} \sum_{k=1}^n\frac{1}{k}-\ln(n).$$

Prove the following approximation: $$\sum_{k=1}^{m-1}\frac{1}{k}-\ln(m)+\frac{1}{2m}+\frac{1}{12m^2}\approx \gamma.$$

The above approximation can be found in many places, e.g. John D. Cook's blog and appears back in Concrete Mathematics asymptotics chapter as a non-trivial exercise of Euler's summation formula. While there are more efficient algorithms that estimates Euler's constant, this approximation allows also one way to look at large values of the Harmonic number (as mentioned in John's blog).

• As stated this is not a precise mathematical statement that can be proved. What does $\approx$ mean? – Greg Martin Feb 18 at 18:52
• @GregMartin In this case, I would assume $\approx$ means to show that the difference of the two sides is $o(m^{-2})$ as $m\to\infty$. – Teepeemm Feb 18 at 19:39
• – Simply Beautiful Art Feb 18 at 21:28
• @GregMartin: I believe that $\sim$ was intended and it is to mean "asymptotic to". The description by Teepeemm is what I had assumed. – robjohn Feb 18 at 22:03
• @AliBagheri: please add some context about where you encountered this question, or what you tried, or why you think it is interesting. I think it is interesting (which is why another person and I have answered with detailed answers), however, it would help to prevent future votes to delete and possibly even get the question reopened if you added some context to the question. – robjohn Feb 21 at 20:51

We have $$\sum\limits_{k = 1}^m {\frac{1}{k}} - \log m = \sum\limits_{k = 1}^m {\frac{1}{k}} - \log \prod\limits_{k = 2}^m {\frac{k}{{k - 1}}} \\ = \sum\limits_{k = 1}^m {\frac{1}{k}} - \sum\limits_{k = 2}^m {\log \frac{k}{{k - 1}}} = 1 + \sum\limits_{k = 2}^m {\left[ {\frac{1}{k} - \log \frac{k}{{k - 1}}} \right]} \\ = 1 + \sum\limits_{k = 2}^\infty {\left[ {\frac{1}{k} - \log \frac{k}{{k - 1}}} \right]} - \sum\limits_{k = m + 1}^\infty {\left[ {\frac{1}{k} - \log \frac{k}{{k - 1}}} \right]} \\ = 1 + \sum\limits_{k = 2}^\infty {\left[ {\frac{1}{k} + \log \left( {1 - \frac{1}{k}} \right)} \right]} - \sum\limits_{k = m + 1}^\infty {\left[ {\frac{1}{k} + \log \left( {1 - \frac{1}{k}} \right)} \right]} .$$ By Taylor's theorem $$\frac{1}{k} + \log \left( {1 - \frac{1}{k}} \right) = - \frac{1}{{2k^2 }} + \mathcal{O}\!\left( {\frac{1}{{k^3 }}} \right),$$ whence the infinite series is convergent and we can write $$\sum\limits_{k = 1}^m {\frac{1}{k}} - \log m = \gamma - \sum\limits_{k = m + 1}^\infty {\left[ {\frac{1}{k} + \log \left( {1 - \frac{1}{k}} \right)} \right]} ,$$ with some constant $$\gamma$$. By Taylor's formula, $$\frac{1}{k} + \log \left( {1 - \frac{1}{k}} \right) = - \sum\limits_{j = 2}^\infty {\frac{1}{{jk^j }}} ,$$ hence $$\sum\limits_{k = 1}^m {\frac{1}{k}} - \log m - \gamma = \sum\limits_{k = m + 1}^\infty {\sum\limits_{j = 2}^\infty {\frac{1}{{jk^j }}} } = \sum\limits_{j = 2}^\infty {\frac{1}{j}\sum\limits_{k = m + 1}^\infty {\frac{1}{{k^j }}} } = \sum\limits_{j = 2}^\infty {\frac{1}{{j!}}\sum\limits_{k = m + 1}^\infty {\frac{{(j - 1)!}}{{k^j }}} } .$$ By the Euler integral $$\frac{{(j - 1)!}}{{k^j }} = \int_0^{ + \infty } {e^{ - kt} t^{j - 1} dt} ,$$ whence, using the geometric series and the Taylor series of the exponential function, $$\sum\limits_{k = 1}^m {\frac{1}{k}} - \log m - \gamma = \sum\limits_{j = 2}^\infty {\frac{1}{{j!}}\sum\limits_{k = m + 1}^\infty {\int_0^{ + \infty } {e^{ - kt} t^{j - 1} dt} } } = \sum\limits_{j = 2}^\infty {\frac{1}{{j!}}\int_0^{ + \infty } {\frac{{e^{ - (m + 1)t} }}{{1 - e^{ - t} }}t^{j - 1} dt} } \\ = \int_0^{ + \infty } {\frac{{e^{ - (m + 1)t} }}{{1 - e^{ - t} }}\frac{1}{t}\sum\limits_{j = 2}^\infty {\frac{{t^j }}{{j!}}} dt} = \int_0^{ + \infty } {\frac{{e^{ - mt} }}{{e^t - 1}}\frac{{e^t - t - 1}}{t}dt} = \int_0^{ + \infty } {e^{ - mt} \left( {1 - \frac{t}{{e^t - 1}}} \right)\frac{1}{t}dt} .$$ Now for $$0, $$\left( {1 - \frac{t}{{e^t - 1}}} \right)\frac{1}{t} = \frac{1}{2} - \sum\limits_{n = 1}^\infty {\frac{{B_{2n} }}{{(2n)!}}t^{2n - 1} } ,$$ with $$B_n$$ being the Bernoulli numbers. Noting that our function tends to zero at infinity and employing Taylor's theorem, we have that $$\left| {\left( {1 - \frac{t}{{e^t - 1}}} \right)\frac{1}{t} - \left( {\frac{1}{2} - \sum\limits_{n = 1}^{N - 1} {\frac{{B_{2n} }}{{(2n)!}}t^{2n - 1} } } \right)} \right| \le C_N t^{2N - 1}$$ for $$t>0$$ and each positive $$N$$ with a suitable positive constant $$C_N$$. Therefore, using the Euler integral, $$\sum\limits_{k = 1}^m {\frac{1}{k}} - \log m - \gamma = \int_0^{ + \infty } {e^{ - mt} \left( {\frac{1}{2} - \sum\limits_{n = 1}^{N - 1} {\frac{{B_{2n} }}{{(2n)!}}t^{2n - 1} } } \right)dt} + \mathcal{O}(1)\int_0^{ + \infty } {e^{ - mt} t^{2N - 1} dt} \\ = \frac{1}{2}\int_0^{ + \infty } {e^{ - mt} dt} - \sum\limits_{n = 1}^{N - 1} {\frac{{B_{2n} }}{{(2n)!}}\int_0^{ + \infty } {e^{ - mt} t^{2n - 1} dt} } + \mathcal{O}(1)\int_0^{ + \infty } {e^{ - mt} t^{2N - 1} dt} \\ = \frac{1}{{2m}} - \sum\limits_{n = 1}^{N - 1} {\frac{{B_{2n} }}{{2n}}\frac{1}{{m^{2n} }}} + \mathcal{O}\! \left( {\frac{1}{{m^{2N} }}} \right).$$ Re-arranging and subtracting $$1/m$$ from both sides gives $$\sum\limits_{k = 1}^{m - 1} {\frac{1}{k}} = \log m + \gamma - \frac{1}{{2m}} - \sum\limits_{n = 1}^{N - 1} {\frac{{B_{2n} }}{{2n}}\frac{1}{{m^{2n} }}} + \mathcal{O}\!\left( {\frac{1}{{m^{2N} }}} \right).$$ Taking $$N=2$$ yields your approximation.

• This is impressive work ! – Claude Leibovici Feb 18 at 9:19

Applying Riemann-Stieltjes Integrals: \begin{align} \sum_{k=1}^n\frac1k &=\int_{1^-}^{n^+}\frac1x\,\mathrm{d}\lfloor x\rfloor\tag1\\ &=\int_1^n\frac1x\,\mathrm{d}x-\int_{1^-}^{n^+}\frac1x\,\mathrm{d}\!\left(\{x\}-\tfrac12\right)\tag2\\ &=\log(n)+\frac1{2n}+\frac12-\int_{1^-}^{n^+}\frac{\{x\}-\tfrac12}{x^2}\,\mathrm{d}x\tag3\\ &=\log(n)+\frac1{2n}+\frac12-\int_{1^-}^{n^+}\frac1{x^2}\,\mathrm{d}\left(\tfrac12\{x\}^2-\tfrac12\{x\}+\tfrac1{12}\right)\tag4\\ &=\log(n)+\frac1{2n}+\frac12-\frac1{12n^2}+\frac1{12}-2\int_1^n\frac{\tfrac12\{x\}^2-\tfrac12\{x\}+\tfrac1{12}}{x^3}\,\mathrm{d}x\tag5\\ &=\log(n)+\frac1{2n}-\frac1{12n^2}+\frac7{12}-2\sum_{k=1}^{n-1}\int_0^1\frac{\tfrac12x^2-\tfrac12x+\tfrac1{12}}{(k+x)^3}\,\mathrm{d}x\tag6\\ &=\log(n)+\frac1{2n}-\frac1{12n^2}+\gamma+2\sum_{k=n}^\infty\int_0^1\frac{\tfrac12x^2-\tfrac12x+\tfrac1{12}}{(k+x)^3}\,\mathrm{d}x\tag7\\ &=\log(n)+\frac1{2n}-\frac1{12n^2}+\gamma+6\sum_{k=n}^\infty\int_0^1\frac{\tfrac16x^3-\tfrac14x^2+\tfrac1{12}x}{(k+x)^4}\,\mathrm{d}x\tag8\\ &=\log(n)+\frac1{2n}-\frac1{12n^2}+\gamma\\ &+6\sum_{k=n}^\infty\int_0^1\left(\tfrac16x^3-\tfrac14x^2+\tfrac1{12}x\right)\left(\frac1{(k+x)^4}-\frac1{k^4}\right)\mathrm{d}x\tag9\\ &=\log(n)+\frac1{2n}-\frac1{12n^2}+\gamma+O\!\left(\frac1{n^4}\right)\tag{10} \end{align} Explanation:
$$\phantom{1}(1)$$: write sum as a Riemann-Stieltjes integral
$$\phantom{1}(2)$$: $$\lfloor x\rfloor=x-\{x\}$$ and $$\{x\}-\frac12$$ has mean $$0$$
$$\phantom{1}(3)$$: integrate by parts
$$\phantom{1}(4)$$: prepare to integrate by parts and $$\tfrac12x^2-\tfrac12x+\tfrac1{12}$$ has mean $$0$$
$$\phantom{1}(5)$$: integrate by parts
$$\phantom{1}(6)$$: break integral into unit intervals
$$\phantom{1}(7)$$: letting $$n\to\infty$$, we get $$\gamma=\frac7{12}-2\sum\limits_{k=1}^\infty\int_0^1\frac{\tfrac12x^2-\tfrac12x+\tfrac1{12}}{(k+x)^3}\,\mathrm{d}x$$
$$\phantom{1}(8)$$: integrate by parts
$$\phantom{1}(9)$$: $$\tfrac16x^3-\tfrac14x^2+\tfrac1{12}x$$ has mean $$0$$
$$(10)$$: $$\left|\,\color{#C00}{6}\color{#090}{\sum\limits_{k=n}^\infty}\color{#C00}{\int_0^1\left(\tfrac16x^3-\tfrac14x^2+\tfrac1{12}x\right)}\color{#090}{\left(\frac1{(k+x)^4}-\frac1{k^4}\right)}\color{#C00}{\mathrm{d}x}\,\right|$$
$$\phantom{\text{(10):}}$$ $$\le\color{#C00}{\frac1{32}}\color{#090}{\sum\limits_{k=n}^\infty\left(\frac1{k^4}-\frac1{(k+1)^4}\right)}$$
$$\phantom{\text{(10):}}$$ $$=\frac1{32n^4}$$

Therefore, \begin{align} \gamma &=\sum_{k=1}^n\frac1k-\log(n)-\frac1{2n}+\frac1{12n^2}+O\!\left(\frac1{n^4}\right)\\ &=\sum_{k=1}^{n-1}\frac1k-\log(n)+\frac1{2n}+\frac1{12n^2}+O\!\left(\frac1{n^4}\right)\tag{11} \end{align} where the big-O term is smaller than $$\frac1{32n^4}$$.

• +1 Please vote to reopen and to leave open Thanks in advance john. – Aryadeva Feb 21 at 17:55
• Unless the downvoter comments as to why this answer is not useful, I will assume this is simply a spiteful downvote. – robjohn Mar 11 at 17:57