Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Evaluate the integral

$$\int_{0}^{\infty} \frac{{(1+x)}^{-n}}{\log^2 x+\pi^2} \ dx, \space n\ge1$$

share|cite|improve this question
Is $\log^2 x = \log \log x$ or $= (\log x)^2$? – filmor Oct 6 '12 at 19:52
For $n=1$, the first thing I thought of was using a contour and complex techniques. Take the upper half plane minus $\epsilon$ half circles about -1 and 0. What do you think? – Euler....IS_ALIVE Oct 6 '12 at 19:52
up vote 10 down vote accepted

This is the same integral as $\frac 1 {2 \pi i} \int_{\mathcal{C}} \frac {d x}{(1+x)^n \ln(-x)}$, where the contour $\mathcal{C}$ starts from infinity, below the positive axis and returns to infinity above the positive axis, after going around zero. Therefore the answer is given by the residue in $x=-1$ which is the coefficient of $y^{n-1}$ in the series expansion of $\frac 1{\ln(1-y)}$. Not sure if there's a closed form for that, but I guess there should be.

EDIT: Here's the reasoning in more detail. First, if $x>0$ then $\ln (-x \pm 0 i) = \ln x \pm \pi i$. Therefore, $$ \frac 1 {\ln(x)^2 + \pi^2} = \frac 1 {2 \pi i} \left(\frac 1 {\ln(x)-\pi i} - \frac 1 {\ln(x) + \pi i}\right), $$ where in the RHS we have the difference between the value of the function $\frac 1 {\ln(-x)}$ above and below the real axis.

enter image description here

Now consider the contour $\mathcal{C}$ shown above in red. When integrating along the part under the positive real axis and above the real axis we end up with the discontinuity across the branch cut. The part at infinity vanishes if $n \geq 1$. Therefore, $$ \frac 1 {2 \pi i} \int_{\mathcal{C}} \frac {d x}{(1+x)^n \ln(-x)} = \frac 1 {2 \pi i} \int_0^\infty \frac {d x}{(1+x)^n} \left(\frac 1 {\ln(-(x+0 i))}-\frac 1 {\ln(-(x-0 i))}\right)= \int_0^\infty \frac {d x}{(1+x)^n (\ln(x)^2 + \pi^2)}. $$

Now we should compute the contour integral. We only have on pole at $x=-1$ so we need to compute its residue: $$ \operatorname{Res}\left(\frac 1{(1+x)^n \ln(-x)},x=-1\right) = \operatorname{Res}\left(\frac 1{y^n \ln(1-y)},y=0\right), $$ which is the same as the coefficient of $y^{n-1}$ in the expansion of $\frac 1 {\ln(1-y)}$, which is often denoted as $[y^{n-1}] \frac 1 {\ln(1-y)}$.

The expansion of $\frac 1 {\ln(1-y)}$ around $y=0$ is easy to find by computer. I find $$ \frac 1 {\ln(1-y)} = -\frac{1}{y}+\frac{1}{2}+\frac{y}{12}+\frac{y^2}{24}+\frac{19 y^3}{720}+\frac{3 y^4}{160}+\frac{863 y^5}{60480}+\frac{275 y^6}{24192}+\frac{33953 y^7}{3628800}+\frac{8183 y^8}{1036800}+O\left(y^9\right), $$ but I can't find a closed form for the $n-1$-th coefficient.


We want to find the coefficient of $y^k$ in the expansion of $\frac 1 {\ln(1-y)}$. Using Lagrange inversion formula we have that $$ k [y^k] \left(\frac 1 {\ln(1-y)}\right) = -[y] (1-e^y)^{-k} = (-1)^{k+1} [y^{k+1}]\left(\frac y {e^y-1}\right)^k. $$

Now, using the generating function for Stirling polynomials, $$ \left(\frac y {e^y-1}\right)^k = \sum_{p=0}^\infty (-1)^p \frac {S_p(k-1)}{p!} t^p, $$ where $S_p(x)$ are the Stirling polynomials, we have that $$ [y^k] \left(\frac 1 {\ln(1-y)}\right) = \frac {S_{k+1}(k-1)} {k (k+1)!}. $$

When evaluated at integer coefficients $m>n$, the Stirling polynomial $S_n(m)$ can be expressed in terms of Stirling numbers of first kind, but here we are not in that situation...

Edit3: Thanks to a comment below I found out the rational numbers which appear as the result of the integral are called Gregory coefficients (see here for more details and properties).

share|cite|improve this answer
(+1) This is the best solution at the moment – Norbert Oct 7 '12 at 9:55
@Ttl: OEIS sequence A002206 is relevant here. – Peter Bala Oct 8 '12 at 13:23
@Sidious Lord: Formulas for the coefficients in the expansion of $\frac 1 {\ln(1-y)} $ are given in the OEIS sequence A002206. – Peter Bala Oct 8 '12 at 13:31
Why not use Cauchy's Itegral Formula? $$ f^{(n)}(z_0) = \frac{n!}{2\pi i}\int_\mathcal{C} \frac{f(z)}{(z-z_0)^{n+1}}dz. $$ I know it's the same, but I believe it's more easy to use. – Pragabhava Oct 9 '12 at 1:48

This is the case $n=1$: $$ \begin{align} \int\limits_{0}^{+\infty}\frac{(1+x)^{-1}}{\log^2 x+\pi^2}dx =\{x=e^{\pi t}\} &=\frac{1}{\pi}\int\limits_{-\infty}^{+\infty}\frac{e^{\pi t}}{(1+e^{\pi t})(1+t^2)}dt\\ &=\frac{1}{\pi}\left(\int\limits_{-\infty}^{0}\frac{e^{\pi t}}{(1+e^{\pi t})(1+t^2)}dt+\int\limits_{0}^{+\infty}\frac{e^{\pi t}}{(1+e^{\pi t})(1+t^2)}dt\right)\\ &=\frac{1}{\pi}\left(\int\limits_{0}^{+\infty}\frac{e^{-\pi t}}{(1+e^{-\pi t})(1+t^2)}dt+\int\limits_{0}^{+\infty}\frac{e^{\pi t}}{(1+e^{\pi t})(1+t^2)}dt\right)\\ &=\frac{1}{\pi}\left(\int\limits_{0}^{+\infty}\frac{1}{(1+e^{\pi t})(1+t^2)}dt+\int\limits_{0}^{+\infty}\frac{e^{\pi t}}{(1+e^{\pi t})(1+t^2)}dt\right)\\ &=\frac{1}{\pi}\int\limits_{0}^\infty\left(\frac{1}{1+e^{\pi t}}+\frac{e^{\pi t}}{1+e^{\pi t}}\right)\frac{1}{t^2+1}dt\\ &=\frac{1}{\pi}\int\limits_{0}^\infty\frac{1}{t^2+1}dt=\frac{1}{2} \end{align} $$

share|cite|improve this answer
Very nice technique – Euler....IS_ALIVE Oct 6 '12 at 20:02
@Norbert: simply nice! Thanks! (+1) – user 1618033 Oct 6 '12 at 20:03

Borrowing from the Norberts answers the integral can be written as:

$$ \frac{1}{\pi}\int\limits_{-\infty}^{+\infty}\frac{e^{\pi t}}{(1+e^{\pi t})^n(1+t^2)}dt = \frac{1}{\pi}\left(\int\limits_{-\infty}^{+\infty}\frac{1}{(1+e^{\pi t})^{n-1}(1+t^2)}dt - \int\limits_{-\infty}^{+\infty}\frac{1}{(1+e^{\pi t})^n(1+t^2)}dt \right)$$

Now it's enough to calculate: $$ g(n)=\frac{1}{\pi}\int\limits_{-\infty}^{+\infty}\frac{1}{(1+e^{\pi t})^n(1+t^2)}dt $$

We can use integration by residues to write this as:

$$ f(t) = \frac{(1+e^{\pi t})^{-n}}{(1+t^2)}\\ g(n) = \frac{1}{\pi}\int\limits_{-\infty}^{+\infty}f(t)dt = 2i\sum_{k=0}^\infty\mathrm{Res}(f,i(2k+1)) $$

Then the original integral is: $g(n-1)-g(n)$.

I didn't manage to write this in closed form, but Mathematica is able to solve this for some values of $n$.

The values of the original integral for $n = 1,\ldots,9$:

$$ \frac{1}{2},\frac{1}{12},\frac{1}{24},\frac{19}{720},\frac{3}{160},\frac{863}{60480},\frac{275}{24192},\frac{33953}{3628800},\frac{8183}{\ 1036800} $$


OEIS sequence A002208 gives formula for $g(n)$.

$$g(n) = -[x^n]\frac{x}{(1-x)\ln(1-x)} = \frac{(-1)^n}{(n-1)!}\sum_{k=1}^n(-1)^{k+1}B_k\frac{s(n,k)}{k}$$

Where $B_n$ is Bernoulli number and $s(n,k)$ is Stirling number of the first kind.

The original integral is: $$g(n-1)-g(n) = \frac{(-1)^{n}}{(n-1)!}\left(\frac{B_n}{n}+\sum_{k=1}^{n-1}(-1)^kB_k\frac{s(n-1,k-1)}{k}\right)$$

share|cite|improve this answer
Makes me think of the coefficients in Stirling's theorem. – marty cohen Oct 6 '12 at 22:46
My Mathematica page is unable to symboliczlly compute this inegtral for $n=1,\ldots,9$. This is strange... – Norbert Oct 7 '12 at 8:53
Mathematica command, for g(n): f[t_, n_] := (1 + Exp[Pi t])^(-n)/(1 + t^2);Table[2 I (Residue[f[z, n], {z, I}] + Sum[Residue[f[z, n], {z, (I Pi + 2 I Pi k)/Pi}, Assumptions -> Element[k, Integers]], {k, 1, Infinity}]) // Simplify, {n, 1, 3}]. Much faster way for the original integral: Table[SeriesCoefficient[y/Log[1 - y], {y, 0, n}], {n, 1, 10}] – 0912 Oct 7 '12 at 9:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.