# Homework Help: Contour Integration with Trig Functions

1. Oct 18, 2009

### walking_edges

1. The problem statement, all variables and given/known data

My question has two parts.

The first part is the solution of the following integral:

$$\int^{\infty}_{-\infty}\frac{cos\:x\:dx}{1+x^{2}}$$

They give the answer as being $$\frac{\pi}{e}$$

This is actually an example problem in the book, but I don't understand how they reached the answer. I understand how to use Cauchy's Residue Theorem and how it is used here, but there is a step in the book where they go

"Let $$cos\:x=e^{ix}$$ and then take only the real part of the solution"

that I do not understand. They don't explain why I'm allowed to do this, and so I don't really know how I'm allowed to generalize this result. I don't think I would know what I would be allowed to do if the problem was $$\int^{\infty}_{-\infty}\frac{sin\:x\:dx}{1+x^{2}}$$ My best guess would be that I could let $$sin\:x=e^{ix}$$ and only take the imaginary part of the answer, but I'm not sure.

Here's the second part of my question:
I also have little idea of what to do when I come across more involved integrals like

$$\int^{\infty}_{0}\frac{cos\:x+x\:sin\:x\:dx}{1+x^{2}}$$

I have tried to change that Integral to

$$\int^{\infty}_{-\infty}\frac{1}{2}\frac{e^{ix}(1+x)\:dx}{1+x^{2}}$$

and drawing my infinite arc of the closed curve in the top half of the complex plane where it encloses the singularity $$z=i$$, but I get the answer

$$=(2\pi i)\frac{(e^{-1})(1+i)}{2i}=\frac{\pi}{2}(e^{-1})(1+i)$$

Which I know is not the right answer. After looking at it for a while, I realized I am not allowed to to double the limits of integration like that because the function is not even. Then I became lost on how I could draw my contour so as to enclose a singularity.

If I could have help on why I am allowed to use the identity they used in the book, and how I could possibly draw my contour for the second integral, that would be appreciated.

Thank You

2. Oct 18, 2009

### CompuChip

For the first one, let's call the integrand f(x) = cos(x) / (1 + x2). So what you want to calculate is
$$\int_{-\infty}^\infty f(x) dx$$.
Now suppose that we replace the function f(x) by a complex function h(x) = f(x) + i g(x) [where g(x) is some arbitrary real function]. Then, by basic properties of integration and complex numbers,
$$\int h(x) dx = \int (f(x) + i g(x)) dx = \int f(x) dx + i \int g(x) dx$$
(I'm leaving out the integration boundaries here, because it saves me typing).
So in particular (since the integral of a real function is real),
$$\int f(x) dx = \operatorname{Re}\left( \int h(x) dx \right)$$

Now the trick is of course to choose g(x) in such a way that h(x) is a convenient function to integrate. For example, if f(x) = cos(x), then setting g(x) = sin(x) will give you h(x) = cos(x) + i sin(x) = exp(ix) which is easy to do.

Also, I don't see why you expected
$$\int^{\infty}_{0}\frac{cos\:x+x\:sin\:x\:dx}{1+x^{ 2}}$$
to be equal to
$$\int^{\infty}_{-\infty}\frac{1}{2}\frac{e^{ix}(1+x)\:dx}{1+x^{2}}.$$
Clearly,
$$e^{ix}(1 + x) = (cos x + i sin(x))(1 + x) = cos(x) + x cos(x) + i sin(x) + i x sin(x)$$
is something different from
$$cos(x) + x sin(x) + i \cdot \text{something}$$

3. Oct 18, 2009

### walking_edges

Alright, I think I get it now. Cos (x) was merely the real part of a larger complex function. And so the integral of

$$\int^{\infty}_{-\infty}\frac{sin\:x\:dx}{1+x^{2}}$$

would just be zero, Since the answer to the larger complex function only has a real part to it, and sin(x) is completely in the imaginary part.

Similarly,

$$\int^{\infty}_{0}\frac{cos\:x+x\:sin\:x\:dx}{1+x^{ 2}}$$

is just the real part of a larger complex function. I can say that the h(x) of this second function is

$$\int h(x) dx =\int^{\infty}_{0}\frac{(cos\:x-ix)(i\:sin\:x+1)\:dx}{1+x^{2}}$$

Now that I have my complex function, I can change the notation a bit, and now I just have to draw an appropriate closed curve around a singularity and use Cauchy's Residue Theorem. My curve should be a semicircle that has its arc in either the top or bottom half of the complex plane, and the integral along the path of the arc that I draw should go to zero as its radius extends to infinity. Only the integral along the real axis should contribute to the answer. The function is even for the real part at least, so I can also rewrite my integral a little and make the limits of integration extend over the entire real axis.

So my closed curve becomes
$$\oint h(z) dz=\int^{\infty}_{-\infty}\frac{1}{2}\frac{(cos\:z-iz)(i\:sin\:z+1)\:dz}{1+z^{2}}+\int_{Arc}\frac{(cos\:z-iz)(i\:sin\:z+1)\:dz}{1+z^{2}}$$

I'm having trouble seeing how the arc goes to zero though. Transforming all the z into Re^it and dz into iRe^it dt and then taking the limit as R goes to infinity does not go to zero. All the R's in the sins and consines are bounded, but the values not in them, when multiplied by iRe^it given by dz = iRe^it dt match the order of (1+ Re^it)^2 in the denominator and don't let the limit go to zero.

Last edited: Oct 18, 2009
4. Oct 19, 2009

### CompuChip

No, I think you missed the point. Similarly, you can view sin(x) as the imaginary part of a larger complex function, so the integral you wrote is the imaginary part of the integral of this function. You can try to "prove" it in the same way as I did in my post (only this time multiply f(x) by i and add an appropriate real function to get a conveniently integrable function h(x)).

For the second integration, it may be more convenient to split it up in cos(x) / (1 + x^2) and x sin(x) / (1 + x^2), as you have already done the first part by then.