# Computation of an integral (Use of Resdiue theorem).

1. Nov 16, 2007

### MathematicalPhysicist

I need to compute the integral:
$$\int_{0}^{\infty}dx\frac{cos(x)}{cosh(x)}$$
so obviously i need to use the residue theorem here and evaluate the contour integral of the complex function (cos(z)/cosh(z)) the singularity point here is $$z=i\pi/2$$
the intervals i decided to do the are:
(0,0)->(R,0)->(R,pi)->(0,pi)->(0,0)
and then ofcourse we shall let R approach infinity.
so by the residue theorem we get that:
$$\int_c\frac{cos(z)}{cosh(z)}=2i\pi Res(cos(z)/cosh(z),z=i\pi/2)$$
on the other hand, after some algebraic manipulations we get that:
z=x+iy $$cos(z)/cos(z)=(cos(x)cos(y)cosh(x)cosh(y)+sin(y)sin(x)sinh(y)sinh(x))/(cos^2(y)cosh^2(x)+sin^2(y)sinh^2(x))($$
now to calculate the integral we have that:
the above integral with z equals (before letting R approach infinity):
$$\int_{0}^{R}\frac{cos(x)}{cosh(x)}dx+i\int_{0}^{\pi}\frac{(cos(R)cos(y)cosh(y)cosh(R)+sin(y)sinh(y)sin(R)sinh(R))}{cos^2ycosh^2R+sinh^2ysinh^2R}-\int_{R}^{0}\frac{cosh(\pi)cos(x)}{cosh(x)}dx+i\int_{\pi}^{0}cos(y)cosh(y)dy$$
now i think that one of the above summed integrals is when R approaches zero approaches zero as well, to prove this would be quite long cause i think i need there l'ohpital rule, the second imaginary part shouldn't be too much of a hastle, by parts, i just want to see if this approach is the correct one, or is there a simpler appraoch that will make my life easier?

Last edited: Nov 16, 2007
2. Nov 16, 2007

### Despondent

$$\int\limits_0^\infty {\frac{{\cos x}}{{\cosh x}}dx} = \frac{1}{2}\int\limits_{ - \infty }^\infty {\frac{{\cos x}}{{\cosh x}}dx = \frac{1}{2}\int\limits_{ - \infty }^\infty {\frac{{e^{ix} }}{{\cosh x}}} } dx$$

Doing it this way, you can avoid having to bound the cosine term explicitly.

Edit: Your approach in using a rectangular contour is correct. You don't need to evaluate any integrals. The whole point of using such a contour is to enable you to end up with an integral of the same form as the original one you are trying to evaluate. You obtain such an integral by letting R approach infinity so that (in this case) two of the integrals vanish.

Last edited: Nov 16, 2007
3. Nov 16, 2007

### NateTG

Doesn't the contour you chose include the singularity? Specifically, the segment:
$$0 + i \pi \rightarrow 0 + i0$$
seems to include
$$0 + i \frac{\pi}{2}$$

Since the function is even, you can do something like this:
$$\int_{0}^{R} \frac{\cos(x)}{\cosh(x)}dx=\frac{1}{2} \int_{-R}^{R} \frac{\cos(x)}{\cosh(x)} dx$$

I'd be tempted to try a half-circle complex countour - no idea if it works out well.

Last edited: Nov 16, 2007
4. Nov 16, 2007

### Despondent

A rectangular contour, as the thread starter has attempted to use, is the way to go. The method is to calculate the integral in two ways, one directly via the residue theorem and the other by parameterising the contour.

A semi circular contour will probably not work. This is because as the radius increases, more and more singularities will be enclosed which will be inconsistent with the calculation using the residue theorem.

5. Nov 16, 2007

### NateTG

Yeah. Sometimes circular contours lead to nice cancellation - not this time though.

6. Nov 16, 2007

### MathematicalPhysicist

those with the imaginary coeffiecients vanish correct?
but i don't see how does the second imaginary integral get vanish after letting R approach infinity, if it does get vanish it should have no relevance to R cause it doesn't depend on it.

7. Nov 16, 2007

### Despondent

I think you should go with my suggestion to write the integrand in terms of the complex exponential. You don't need any tricks here (eg. multiplying the numerator and the denominator by some function).

The contour C you should use has vertices -R, R, R + (pi)*i, -R + (pi)*i which you have indicated the use of in your original post.

The integral can be calculated using the residue theorem as you've done. The second way is to parameterise the contour. You can do this as follows.

The integral is $$\int\limits_0^\infty {\frac{{\cos x}}{{\cosh x}}} dx = \frac{1}{2}\int\limits_{ - \infty }^\infty {\frac{{e^{ix} }}{{\cosh x}}} dx$$.

So the integral you need to consider is:

$$J = \int\limits_C^{} {\frac{{e^{iz} }}{{\cosh z}}dz}$$

$$= \int\limits_{ - R}^R {\frac{{e^{ix} }}{{\cosh x}}dx + \int\limits_0^\pi {\frac{{e^{i\left( {R + iy} \right)} }}{{\cosh \left( {R + iy} \right)}}} } idy + \int\limits_R^{ - R} {\frac{{e^{i\left( {x + i\pi } \right)} }}{{\cosh \left( {x + i\pi } \right)}}} + \int\limits_\pi ^0 {\frac{{e^{i\left( { - R + iy} \right)} }}{{\cosh \left( { - R + iy} \right)}}idy}$$

The second and fourth integrals can be shown to vanish in the limit as R goes to infinity. Just use
$$\left| {\int\limits_C^{} {f\left( z \right)dz} } \right| \le \mathop {\max }\limits_{z \in C} \left| {f\left( z \right)} \right| \times length\left( C \right)$$.
You can now use some identities to combine the first and the third integral to get some multiple of the integral that you want to evaluate.