0

I would like to calculate the following integral with residue theorem $$\int_{-\infty}^{\infty}\frac{dx}{(1+e^x)(x^2+\pi^2)},$$ but I seems not to get it right!

I observe that the poles happen at $z=\pm (2k-1)\pi i$, hence I proceed with calculating the residues and summing them. In the end I obtain a $0$ which is annoying since the integral is not zero.

Could you please help me understand how to do this properly, or, given the comments below, help me know if this is at all possible to use the residue theorem here?


Let $f(z)=\frac{1}{(1+e^z)(z^2+\pi^2)}$. Here are the residues that I calculated:

at $z=i \pi$ we have $Res(f(z),z_0=i\pi)=-\frac{\pi i+1}{4\pi^2}$ and at $z=-i \pi$ we have $Res(f(z),z_0=-i\pi)=\frac{\pi i-1}{4\pi^2}$ and for $z_0=\pm (2k-1)i\pi $ with $k>1$ the residues turn out to be $$\frac{1}{(2k-1)^2-1}\frac{1}{\pi^2}.$$


As Ron Gordon mentioned, the integral can, of course, be evaluated without the residue theorem, but I was after a complex based evaluation. I just add it below:

\begin{align} \int_{-\infty}^{\infty}\frac{dx}{(1+e^x)(x^2+\pi^2)}&=\int_{-\infty}^{0}\frac{dx}{(1+e^x)(x^2+\pi^2)}+\int_{0}^{\infty}\frac{dx}{(1+e^x)(x^2+\pi^2)}\\ &=\int_{0}^{\infty}\frac{dx}{(1+e^{-x})(x^2+\pi^2)}+\int_{0}^{\infty}\frac{dx}{(1+e^x)(x^2+\pi^2)}\\ &=\int_{0}^{\infty}\frac{dx}{x^2+\pi^2}=\frac12 \end{align}

Math-fun
  • 9,507
  • We can't tell you what your mistake is unless you include the calculation that got the wrong answer. – eyeballfrog Jun 17 '19 at 15:24
  • Because of that second factor, the poles at $z=\pm i\pi$ are not really poles after all. – bob.sacamento Jun 17 '19 at 15:25
  • What @eyeballfrog said. Btw, regarding "hence I proceed with calculating the residues and summing them": Why would the integral be the sum of the residues? That often happens, but you need to show it happens... – David C. Ullrich Jun 17 '19 at 15:27
  • @bob.sacamento ??? Certainly there are poles at $\pm i\pi$; that second factor makes them poles of order $2$. – David C. Ullrich Jun 17 '19 at 15:28
  • @eyeballfrog Thank you for the comment, do you mean I should write out how I calculated the residues? – Math-fun Jun 17 '19 at 15:33
  • @DavidC.Ullrich Fair enough. Forgive my misuse of terminology. I should have said that I suspect that the OP is summing on those poles like he does with all the others, and that will give an incorrect result. – bob.sacamento Jun 17 '19 at 15:34
  • @Math-fun You need to show how you found the sum of the residues. You also need to explain why the sum of the residues gives the integral! – David C. Ullrich Jun 17 '19 at 15:34
  • @DavidC.Ullrich I think I don't understand the process properly. Do you mean I should be careful with the contour and make it clear which contour I am using? – Math-fun Jun 17 '19 at 15:35
  • You need to write out the whole thing, including what contour you're using. – David C. Ullrich Jun 17 '19 at 15:43
  • Given the many downvotes: it seems I have annoyed people around, sorry for asking a bad a question ... – Math-fun Jun 17 '19 at 15:49
  • I think I see the problem. You summed over all residues instead of just the ones in the upper half plane, right? – eyeballfrog Jun 17 '19 at 16:01
  • @eyeballfrog This is true, I summed over all the residues. – Math-fun Jun 17 '19 at 16:02
  • @eyeballfrog I wondered about that. Decided not to ask, since I don't see why it matters. Why should the integral equal the sum of the residues in the upper half-plane? – David C. Ullrich Jun 17 '19 at 16:04
  • Two downvotes is not "many". Anyway, if it's a bad question it's because you ask us to find your error, without showing what you did. You still haven't done that, btw... – David C. Ullrich Jun 17 '19 at 16:06
  • @DavidC.Ullrich I am typing the details and plotting the contour line ... I am not that fast :-) You are right, 2 is not many. And I am reading the residues theorem properly. – Math-fun Jun 17 '19 at 16:09
  • The question, as it is now, showing an effort to solve (looking at the computation of the residues), is a fair question: Well, if one has all details there will be no post on the problem. The answer to "where is my error?!" is rather simple, one has to take a suitable contour, in our case a D with the I part on the real line, so only "half of the poles contribute". I'll type shortly the solution, since controlling the denominator is an interesting issue. (Well, we just take a radius of the ) in D between the poles. That's all.) – dan_fulea Jun 17 '19 at 16:13
  • @DavidC.Ullrich when drawning the contour line, which is a half circle in the upper half with radius $R$ joined with its diameter from $-R$ to $R$, then the integral over the half circle will be zero only if $R$ is infinity such that all the poles are included. Does that make sense? – Math-fun Jun 17 '19 at 16:14
  • The effort of understanding the situation, and the issue deserve my 1+ – dan_fulea Jun 17 '19 at 16:14
  • @dan_fulea thank you very much for the comment. I agree with others that I asked a bad question and did not formulate it correctly. – Math-fun Jun 17 '19 at 16:18
  • "the integral over the half circle will be zero only if RR is infinity such that all the poles are included. Does that make sense?" No, it makes no sense to talk about $R=\infty$ if $R$ is the radius of a circle. You need to show that the integral approaches $0$ as $R\to\infty$. (Which btw I don't see how to do.) – David C. Ullrich Jun 17 '19 at 16:21
  • @dan_fulea " (Well, we just take a radius of the ) in D between the poles. That's all.) " Yes of course we take the radius to miss the poles. "That's all"??? How do you show that the integral over the ) tends to $0$? – David C. Ullrich Jun 17 '19 at 16:23
  • @DavidC.Ullrich Thank you very much David. – Math-fun Jun 17 '19 at 16:24
  • @DavidC.Ullrich by the way is this your book? https://www.amazon.com/David-C.-Ullrich/e/B001JSBKVU – Math-fun Jun 17 '19 at 16:27
  • I seem to recall writing that, yes. – David C. Ullrich Jun 17 '19 at 16:28
  • @DavidC.Ullrich As it stands, and after drawing a contour and looking that the residue theorem carefully, I understood the problems you mentioned in your posts. In particular the "choice of radius" seems not be trivial here. – Math-fun Jun 17 '19 at 16:54
  • I normally love the challenge of evaluating an integral using complex analysis. But in this case it is silly. Maybe one could do with a rectangular contour and a change in the integrand, but I cannot think of such an integrand right now. But the evaluation of this integral is trivial! Hint: break it up into negative and positive pieces, and the exponential term goes away, and you are left with a trivial integral. – Ron Gordon Jun 17 '19 at 19:38
  • @RonGordon I could also evaluate this without the complex stuff - which I am learning - and you are right: this is a simple integral :-) – Math-fun Jun 17 '19 at 19:40
  • The application of the residue theorem would go the same way as here. You'll get $$\operatorname{Res}{x = \pi i} f(x) + \sum{k \geq 2} \operatorname{Res}{x = (2 k - 1) \pi i} f(x) = -\frac 1 {4 \pi^2} + \frac 1 {4 \pi i} + \frac 1 {4 \pi^2} \sum{k \geq 2} \left( \frac 1 {k - 1} - \frac 1 k \right) = \frac 1 {4 \pi i}.$$ – Maxim Jun 17 '19 at 20:00
  • @Maxim Thank you for the reference! this is interesting and fun of course. – Math-fun Jun 17 '19 at 20:10

2 Answers2

2

Let us consider the following contour.

Fix $R>0$ a radius which is a ("big") multiple of $2\pi$, $R=R(n)=2\pi n$. Consider the closed contour $C=C(R)$ build from the two pieces

  • the segment (interval) $I=I(R)$ from $-R$ to $R$,
  • the halfcircle $H=H(R)$ from $R$ to $-R$ parametrized by $t\to Re^{it}$, $t\in[0,\pi]$.

A picture would be:

complex analysis contour integral controlling <span class=$1+e^x$ in the denominator">

and the unit is $\pi$. Then we have for the given meromorphic function $f(z)= (e^z+1)^{-1}(z^2+\pi^2)^{-1}$ $$ \begin{aligned} \int_{\Bbb R}f(x)\; dx & = \lim_{n\to\infty} \int_{-R(n)}^{+R(n)} f(z)\; dz = \lim_{n\to\infty} \int_{I(R(n))} f(z)\; dz \ , \\ 0&= \lim_{n\to\infty} \int_{C(R(n))} f(z)\; dz \\ \int_{I(R)} f(z)\; dz + \int_{H(R)} f(z)\; dz &= 2\pi i\sum_{a\text{ pole inside }C(R)} \operatorname{Residue}_{z=a}f(z) \ . \end{aligned} $$

The zero limit, when integrating on $C(R(n))$, $n\to\infty$ can be motivated as follows. The contour integral is a closed set, not passing through the poles. There is a minimal distance $\pi$ to the poles, which helps us to bound from below $|1+e^z|$, so from above $1/|1+e^z|$. Then the term $1/(x^2+\pi^2)$ is in $O(R^{-2})$, the contour length $(\pi R)$ in $O(R)$, so we land in $O(1)\cdot O(R^{-2})\cdot O(R^1)=O(R^{-1})$.

It remains to consider the sums of the residues of the poles in the upper half plane. We get: $$ \begin{aligned} \operatorname{Residue}_{z=i\pi}f(z) &= \operatorname{Residue}_{h=0\\z=i\pi+h} \frac 1{1+e^{i\pi}e^h}\cdot \frac 1{h+i\pi+i\pi}\cdot \frac 1{h+i\pi-i\pi} \\ &= \operatorname{($h^0$-Coefficient)}_{h=0} \frac 1{1-e^h}\cdot \frac 1{h+2\pi i} \\ &= \operatorname{($h^0$-Coefficient)}_{h=0} \frac 1{-h-\frac 12h^2+O(h^3)}\cdot \frac 1{2\pi i}\cdot \frac 1{1-(-h/(2\pi i))} \\ &= \operatorname{($h^0$-Coefficient)}_{h=0} -\frac 1h \left(1-\frac 12h+O(h^2)\right) \frac 1{2\pi i}\cdot \left(1-\frac h{2\pi i}+O(h^2)\right) \\ &= \operatorname{($h^0$-Coefficient)}_{h=0} -\frac 1{2\pi i}\cdot \frac 1h \left(1-\frac 12h-\frac h{2\pi i}+O(h^2)\right) \\ &= \frac 1{2\pi i}\cdot \left(\frac 12+\frac 1{2\pi i}\right) \end{aligned} $$ I really wanted to do this with bare hands, and use computer only for the check:

sage: var('z');
sage: f(z) = 1 / (1+exp(z)) / (z^2+pi^2)
sage: f(z).residue( z==i*pi )
-1/4*I/pi - 1/4/pi^2
sage: bool( f(z).residue( z==i*pi ) == 1/(2*pi*i) * (1/2 + 1/(2*pi*i)) )
True

It turns out, that all other residues (at poles in the upper half plane) are real. This time we let the computer give us some values:

sage: f.residue( z==3*pi*i )
z |--> 1/8/pi^2
sage: f.residue( z==5*pi*i )
z |--> 1/24/pi^2
sage: f.residue( z==7*pi*i )
z |--> 1/48/pi^2
sage: f.residue( z==9*pi*i )
z |--> 1/80/pi^2
sage: f.residue( z==11*pi*i )
z |--> 1/120/pi^2

and so on as in the OP, the denominators in the rational numbers appearing above (and touching $1/\pi^{2}$) are squares of odd integers, taken minus one.

Our integral is real, so we can forget all these values, getting thus: $$ \int_{\Bbb R} \frac{dx}{(1+e^x)(x^2+\pi^2)} = 2\pi i \left[ \frac 1{2\pi i} \left( \color{blue}{\frac 12}+\frac 1{2\pi i}\right) + \text{real number(s)}\right] \ , $$ and only the blue term survives to give us the "real answer".


Note: I was spending a lot of time trying to check / validate somehow this value numerically. This is the best i could get in pari/gp:

? \p 1000
   realprecision = 1001 significant digits (1000 digits displayed)
? intnum( x=-200, +100, 1 / (1+exp(x)) / (x^2+Pi^2) )
%19 = 0.49500041117264675924354715963413516...

(And we can tacitly control the piece from $[-\infty, -200)$ using $1/(x^2+\pi^2)$.)

dan_fulea
  • 32,856
  • 1
    Silly me, yes of course if you stay away from the zeroes of $|1+e^z|$ it's bounded above zero. If you wanted to prove that you might note that since the exponential has period $2\pi i$ we need only consider the strip $0<y<2\pi$, and $|1+e^z|\to1$ at the left end, $\infty$ at the right end; now compactness gives a lower bound on the remaining set $|x|\le K$, $0\le y\le 2\pi$, $|x+iy-i\pi|\ge\pi$. – David C. Ullrich Jun 17 '19 at 18:29
  • Rather than just discarding the imaginary part, the sum $\sum_{n=1}^\infty 1/[4\pi^2 n(n+1)] = 1/(4\pi^2)$ can be done analytically and indeed cancels the imaginary part from the first pole. – eyeballfrog Jun 17 '19 at 18:34
  • Thank you very much! I just saw the answer and read it carefully. I understand the "residue theorem" better than I did few hours ago. – Math-fun Jun 17 '19 at 19:27
  • ... I also added the evaluation of the integral without the residue theorem, just to make sure that the value is $\frac12$ :-) which is in line with your numerical calculations. – Math-fun Jun 17 '19 at 20:09
  • @David C. Ulrich yes, it is a fair question to see in detail that the lower bound does not depend on $n$ (thus eventually destroying the convergence to zero on the half circle). I like the argument above. I cannot make my (intended) argument work, so the above is a valuable comment, even part of the solution. (This point was of course the only qualitatively hard point in the proof, i was too superficial.) (I was too concentrated on calcululs. My intention was the intermediate value theorem, does not work without adventures, the derivative invents an $R$, covers a part, the other ...) – dan_fulea Jun 17 '19 at 22:35
  • @Math-fun: thanks for the quick proof using calculus and the functional equation, stated in this last version the question should get a lot of +1's! Maybe some people read, think and reevaluate... – dan_fulea Jun 17 '19 at 22:39
1

It's impossible to say whether this has anything to do with your error, since you don't show how you did the calculation, but:

Often one does this sort of thing by considering a contour consisting of $[-A,A]$ plus a semicircle in the upper half-plane from $A$ to $-A$, then showing the integral over the semicircle tends to $0$. Here it's not at all clear why that integral over the semicircle tends to $0$. In fact if you're not careful in choosing $A$ the integral over the semicircle does not even exist, since there are poles on the semicircle!

Offhand I don't see how to do this by the Residue Theorem; I suspect that in your calculation you're just assuming that things work out as usual, but they don't.

  • Many thanks for the hint and explanations. I will try to see if I can attend those issues properly. My take here is that this can't be done "the usual way" and that the residue is potentially not working here. – Math-fun Jun 17 '19 at 15:48
  • your answer of course deserves a +1 :-) thank you! – Math-fun Jun 17 '19 at 15:53
  • @Math-fun "I will try to see if I can attend those issues properly." Aha. We can now say what your error is, or at least one error: Not attending to those issues. – David C. Ullrich Jun 17 '19 at 15:56
  • This is true, I am not familiar with contour integrals. This is the first time I "try" to calculate an integral using the residue theorem. I should learn it. Thank you for making this clear to me :-) In fact I have always avoided this approach ... – Math-fun Jun 17 '19 at 16:00