# Solving real integrals by residue theorem

• Jun 25th 2005, 01:36 PM
Ene Dene
Solving real integrals by residue theorem
I have a concrete problem. I've solved a lot of real integrals, but I just can't solve this one:

$\displaystyle \int_0^\infty \frac{1}{(4x^2+\pi^2)*cosh(x)} dx$

I used rectangle path of integration (0, 0) -> (R,0), (R,0)->(R,2Pi*I), (R,2Pi*I)->(0,2Pi*I), R-->infinity. Residue (in 1/2*I*Pi) of this function by this path, or path of rectangle from -oo to +oo (I can do that since it is an even function, thus integral is 1/2 of value by this path), with height of 2Pi*I (or just Pi*I) is 0.
Integral is not a zero, infact the solution is ln2/(2Pi), so it means that probably integral from 2Pi*I to 0 on Im axis is not zero! I can't calculate that integral (and it seems to me that its zero!)... Anyway, If anyone knows how to solve this integral (and belive me, its not easy), please notify me as soon as you can, here, or by email: edeumic@xnet.hr. (You can solve it on a paper, scan it, and than send it if you find that easyer). Oh yeah, don't solve it numerically...

Thank you.
• Jun 30th 2005, 07:13 AM
hpe
Quote:

Originally Posted by Ene Dene
I have a concrete problem. I've solved a lot of real integrals, but I just can't solve this one:
$\displaystyle \int_0^\infty \frac{1}{(4x^2+\pi^2)cosh(x)} dx$

Since $\displaystyle (4x^2 + \pi^2)\cosh(x) = (2x + i\pi)(2x-i\pi)\cos(ix)$, the integrand has poles at $\displaystyle z = \pm (2k-1)\frac{i\pi}{2}$ for k = 1, 2, 3 ... The residues at $\displaystyle z = \pm \frac{i\pi}{2}$ are $\displaystyle \frac{1}{4i\pi^2}$, the residues at $\displaystyle z = \pm (2k-1)\frac{i\pi}{2}$ for k>1 are $\displaystyle (-1)^k\frac{1}{4i\pi^2 (k^2-k)}$.

Now integrate from z=-R + 0i along the real axis to z=+R+0i and then on the half circle $\displaystyle C = \{ z | |z| = R, \Re z > 0\}$ back to z = -R+0i. The result is
$\displaystyle \int_{-R}^R \frac{1}{(4x^2+\pi^2)\cosh(x)} dx + \int_C \frac{1}{(4x^2+\pi^2)\cosh(x)} dx$
and by the Residue Theorem this equals
$\displaystyle \frac{1}{2\pi} + \sum_{k=2}^{M} (-1)^k\frac{1}{2\pi (k^2-k)}$
where M is a suitable number (about $\displaystyle R/\pi$). Send R to infinity, then the integral along C goes to zero, and we obtain
$\displaystyle \int_{-\infty}^\infty \frac{1}{(4x^2+\pi^2)\cosh(x)} dx = \frac{1}{2\pi} \left(1 + \sum_{k=2}^{\infty} (-1)^k\frac{1}{k^2-k}\right)$.

Splitting the infinite sum into terms with even k = 2r and odd k = 2r+1 (allowed since the sum converges absolutely), we obtain
$\displaystyle \sum_{k=2}^{\infty} (-1)^k\frac{1}{k^2-k}$
$\displaystyle = \sum_{r=1}^\infty \frac{1}{(2r)^2 - 2r} - \sum_{r=1}^\infty \frac{1}{(2r+1)^2 - (2r+1)}$
$\displaystyle = \ln2 + (\ln 2 - 1)$
since both sums are essentially alternating harmonic series - you can see this by using the formula $\displaystyle \frac{1}{z^2-z} = \frac{1}{z-1} - \frac{1}{z}$.

Thus $\displaystyle \int_{-\infty}^\infty \frac{1}{(4x^2+\pi^2)\cosh(x)} dx = \frac{\ln2}{\pi}$ as asserted. :cool:
• Jun 30th 2005, 09:07 AM
Ene Dene
Bravo...
First, I can't understand how I couldn't find the residue at $\displaystyle z = \pm (2k-1)\frac{i\pi}{2}$ . Now I did that without any problems. Second, I used the wrong path, probably led by numerous examples with $\displaystyle cosh(x)$, and all of them having rectangle paths. I tried to solve it like this... to find function with this properties:

$\displaystyle \frac{1}{(4x^2+\pi^2)cosh(x)}=g(x)-g(x+2\pi i)$, and then I'd look at the rectangle path (-R,0) to (R,0), (R,2Pi*i) to (-R, 2Pi*I), R->infinity... And then I'd had:

$\displaystyle \oint g(z) dz = \int_{-\infty}^\infty g(x)dx-\int_{-\infty}^\infty g(x+2\pi i)dx+\int_C g(z)dz$

Integral over C is 0 as R->infinity, and since $\displaystyle g(x)-g(x+2\pi i)=\frac{1}{(4x^2+\pi^2)cosh(x)}$, it is easy to find the solution.

But... I failed to find the function g(x). For example, it is easy to solve:

$\displaystyle \int_{0}^\infty \frac{x^2}{(x^2+\pi ^2)cosh(x)}dx$

by that method.

Anyway, thank you very much!

If you have the time, and the will, or someone else, I have one more that is bothering me... (and no more, I promise :) ) :

$\displaystyle \int_{0}^\infty \frac{ln(1+x)}{1+x^2} dx$

1+x is the problem...

I have an exam next monday, and I'm solving all the problems from earlier exams, these two are the only two integrals that I was unable to solve, I wouldn't like to get something similar on an exam, and not to know how to solve it. Thank you!

P.S. I'm writing this post for over 50mins now, I really need to learn latex fast! :)
• Jun 30th 2005, 12:13 PM
ticbol
Don't have enough time for I have to go to work in a while, so may I just offer a way, not the complete solution yet, on how to solve

INT.(0->inf.)[ln(1+x)/(1+x^2)]dx ---(i)

---------------
One way is by parts:
INT.[u*dv] = uv -INT.[v*du]

Let u = 1/(1+x^2)
So, du = (-2x) / (1+x^2)^2

And dv = ln(1+x) dx
So, v = 1/(1+x)

Then, the indefinite integral of (i) is:
= [1/(1+x^2)][1/(1+x)] +INT[2x / (1+x)(1+x^2)^2]dx

-------------
Then, integrate the 2nd integral by partial fractions.

Decompose the integrand.
[2x / (1+x)(1+x^2)^2] = (Ax +B)/(1+x^2) +(Cx +D)/[(1+x^2)^2] +E/(1+x)

2x = (Ax +B)(1+x^2)(1+x) +(Cx +D)(1+x) +E(1+x^2)^2

And so on.....
• Jun 30th 2005, 12:59 PM
Ene Dene
Quote:

Originally Posted by ticbol
And dv = ln(1+x) dx
So, v = 1/(1+x)

But this is not OK. $\displaystyle v=-x + ln(1 + x) + x ln(1 + x)$
• Jun 30th 2005, 10:33 PM
ticbol
Yes. I was not even 100 meters away this morning and I knew what I gave you is wrong. I mistakenly said INT.[ln(1+x)]dx = 1/(1+x).

It should be the other way around: INT.[1/(1+x)]dx = ln(1+x)

What made me realized my mistake was why are there so many unknowns in the decomposed integrand. There are 5 of them. Long solution, or use matrix. I don't do matrices, so...
Then I saw the switch. Zeez, so that's why.
But I did not go back to my computer to inform you my mistake. I was running late for work, as it was, so I would just rectify my mistake when I get back home.

-------------------------

First thing first, if you cannot solve it by integration by parts, it does not mean it cannot be solved by integration by parts.

----------------
INT.(0->inf.)[ln(1+x)/(1+x^2)]dx ---(i)

Again, one way is by integration by parts.

Let u = ln(1+x)
So, du = 1/(1+x)

And dv = [1/(1+x^2)] dx
so, v = arctan(x)

Then,
The indefinite integration of (i) is
= [ln(1+x)]arctan(x) -INT.[(arctan(x))/(1+x)]dx

I cannot do longhand the second integral, but you may want to use Integrators in the Internet to find the integration of this second integral.

----------
If by you cannot solve (i) by parts you mean by longhand ("longhand" here means without the help of Integrators, etc.), then, maybe, no one can really solve (i) by parts.
• Jul 1st 2005, 12:59 AM
Ene Dene
No problem, mistakes happen. But it would be really nice if I'd stay just with rational integral, easy to solve. :)

Quote:

Originally Posted by ticbol
First thing first, if you cannot solve it by integration by parts, it does not mean it cannot be solved by integration by parts.

I don't think that this integral can be solved by partial integration, I've tried before, after running out of options. The key is to use residue theorem. Integrals of type: $\displaystyle (ln(x))^k*f(x)$ where f(x) is a rational function in general are easy, lot of work, but you know where to go all the way, but problem is in this x+1, that is whats bothering me. I've tried supstitution 1+x=t, but then boarders of integration change, and I have an integral from 1 to infinity, and then I can't use the method mentiond before.

Quote:

Originally Posted by ticbol
And dv = [1/(1+x^2)] dx
so, v = arctan(x)

Then,
The indefinite integration of (i) is
= [ln(1+x)]arctan(x) -INT.[(arctan(x))/(1+x)]dx

I cannot do longhand the second integral, but you may want to use Integrators in the Internet to find the integration of this second integral.

----------
If by you cannot solve (i) by parts you mean by longhand ("longhand" here means without the help of Integrators, etc.), then, maybe, no one can really solve (i) by parts.

Integral $\displaystyle \int \frac {arctan(x)}{1+x}dx$ is not any easier to solve than the first one. If the solution is the only thing that I'm interested in, than there would be no problem, with Mathematica, I can calculate the numerical solution, but I need to know the algoritam how to solve this, becoase on an exam I can't use internet or something similar :). Thanks for trying to help.
• Jul 1st 2005, 04:05 PM
hpe
Quote:

Originally Posted by Ene Dene
For example, it is easy to solve:
$\displaystyle \int_{0}^\infty \frac{x^2}{(x^2+\pi ^2)cosh(x)}dx$
by that method.

If you can go that integral with your method, you can also do the integral of
$\displaystyle \frac{1}{(x^2 +\pi^2)\cosh(x)}$, since
$\displaystyle \frac{\pi^2}{(x^2 +\pi^2)\cosh(x)} + \frac{x^2}{(x^2 +\pi^2)\cosh(x)} = \frac{1}{\cosh(x)}$
and
$\displaystyle \int \frac{1}{\cosh(x)}dx = \int \frac{2e^x}{e^{2x}+1}dx = 2 \arctan(e^x)+C$. I'd be curious to see your method.
• Jul 2nd 2005, 12:01 AM
Ene Dene
Quote:

Originally Posted by hpe
If you can go that integral with your method, you can also do the integral of
$\displaystyle \frac{1}{(x^2 +\pi^2)\cosh(x)}$, since
$\displaystyle \frac{\pi^2}{(x^2 +\pi^2)\cosh(x)} + \frac{x^2}{(x^2 +\pi^2)\cosh(x)} = \frac{1}{\cosh(x)}$
and
$\displaystyle \int \frac{1}{\cosh(x)}dx = \int \frac{2e^x}{e^{2x}+1}dx = 2 \arctan(e^x)+C$. I'd be curious to see your method.

Ok, lets solve $\displaystyle \int_{0}^\infty \frac{1}{(x^2 +\pi^2)\cosh(x)}dx$ by "my" method. We take rectangle from -R to R, R->infinity, with height $\displaystyle 2\pi i$. The idea is to find a function that has the following properties:

$\displaystyle f(x)=g(x)-g(x+2\pi i)$

Now, we find the integral of g(x) over closed path (rectangle path):

$\displaystyle \oint g(z) dz = \int_{-\infty}^\infty g(x)dx-\int_{-\infty}^\infty g(x+2\pi i)dx = \int_{-\infty}^\infty f(x)dx$

Here I asumed that integral over C is zero ("latex error, image to big", if I put it :) ). Here is how I do it in this particular case:

$\displaystyle \frac {1}{(x^2+\pi^2)cosh(x)} = \frac {-i}{2\pi(x-i\pi)cosh(x)}+ \frac {i}{2\pi(x+i\pi)cosh(x)}$

From this you can see that $\displaystyle g(x)=\frac {-i}{2\pi(x-i\pi)cosh(x)}$ and $\displaystyle g(x+2\pi i)=\frac {-i}{2\pi(x+i\pi)cosh(x)}$.
Now I find the:

$\displaystyle \oint \frac {-i}{2\pi(x-i\pi)cosh(x)} dz$

It has poles in $\displaystyle i\pi, \frac {i\pi}{2}, \frac {3\pi}{2}$. By residue theroem $\displaystyle \oint g(z)dz=-1+\frac {4}{\pi}$.
Than:
$\displaystyle -1+\frac {4}{\pi}=\int_{-\infty}^\infty \frac {-i}{2\pi(x-i\pi)cosh(x)}dx+$
$\displaystyle \int_{\infty}^\infty \frac {-i}{2\pi((x+2\pi i)-i\pi)cosh(x+2\pi i)}dx+\int_C g(z)dz$

Second integral on the right side has boundaries from +infinity to -infinity (when it change the boundries you have g(x)-g(x+2piI)), but I really don't know how to put minus infront of infinity on uper boundry :).
Integral over C is zero, as R goes to infinity.
So:

$\displaystyle \frac {1}{2}(-1+\frac {4}{\pi})=\int_{0}^\infty \frac{1}{(x^2 +\pi^2)\cosh(x)}dx$

The problem with $\displaystyle \frac {1}{(4x^2+\pi^2)cosh(x)}$ is that 4 infront of $\displaystyle x^2$, I just can't find the g(x). This method is nice for some functions of $\displaystyle e^x$ but, it is often very hard to find g(x).
• Jul 3rd 2005, 08:26 AM
hpe
Quote:

Originally Posted by Ene Dene
If you have the time, and the will, or someone else, I have one more that is bothering me... (and no more, I promise :) ) :
$\displaystyle \int_{0}^\infty \frac{\ln(1+x)}{1+x^2} dx$

I have an answer, but not a complete solution :(
Write
$\displaystyle \int_{0}^\infty \frac{\ln(1+x)}{1+x^2} dx = \int_0^1 \ldots + \int_1^\infty \ldots$
and substitute u = 1/x in the second integral. The result is (after some standard manipulation)
$\displaystyle \int_{0}^\infty \frac{\ln(1+x)}{1+x^2} dx = 2 \int_{0}^1 \frac{\ln(1+x)}{1+x^2} dx -\int_{0}^1 \frac{\ln(x)}{1+x^2} dx$
Now the second integral is the negative of the Catalan constant K = 0.91596... (see (21) on the Mathworld page), while
$\displaystyle \int_{0}^1 \frac{\ln(1+x)}{1+x^2} dx = \frac{\pi}{8} \ln 2$. To check this, use e.g. the Wolfram Integrator to find an antiderivative in terms of logarithms and dilogarithms and then evaluate this, using formulae for the dilogarithm.

So your integral is $\displaystyle \frac{\pi}{4} \ln 2 + K$, hardly something that results easily from an application of the residue theorem. Perhaps you don't have to worry about this particular integral for your exam :)
• Jul 3rd 2005, 08:43 AM
Ene Dene
I used the similar methods and came to same solution, but I was not happy with the way I derived it, I mean, I can't use this in exam, but:
Quote:

Originally Posted by hpe
Here what was the problem... the integral was writen wrong, it sholud have been $\displaystyle ln(x^2+1)$ insted of $\displaystyle ln(x+1)$, than it is posible, and not too hard, to solve it with aplication of residue theorem.