# Evaluation of Integrals using Complex Variables

1. Nov 17, 2004

### Ed Quanta

So how would one solve the following integral using complex variables?,

Integral from 0 to pi of [dx/r +5cos(x)]

where 0<r<5

2. Nov 17, 2004

### ReyChiquito

You can think of a complex integral in two ways, either as the primitive of a function or as a line integral. What is not clear to me, is in what way is your integral stated.

You need to be a lot clearer. Whats the path of integration?

3. Nov 18, 2004

### Ed Quanta

Yes, that is basically what my question is. I am not sure where the branch cuts are.

4. Nov 18, 2004

### shmoe

edit-sorry I misread your bounds on r and missed the fact that your integrand has a discontinuity.

If you're looking for the principle value of that integral, it should still be possible. Look at the contour that goes from -pi to pi (no loss since your integrand is even), with small half circles in the upper half plane to avoid the discontinuities, then the upper half circle of radius pi counter clockwise. There are no poles inside this region, so to find the principle value of the integral on the real axis we can evaluate the integral on these half-circles.

You can find the value of the integral over the large half circle by looking at it's integral over the entire circle of radius pi and the fact that the integrand is even. Next, you'll need to find the limit of the integrals over the small half circles as their radius goes to zero. This will be half their residues (well, the negative of this since we are going clockwise).

Last edited: Nov 18, 2004
5. Nov 18, 2004

### shmoe

I don't think what I posted above will work, sorry. I had shoddily convinced myself that it would, but I can't fill in the details.

I'm sure of this new approach though. Integrate this function over the rectangle with corners 0, pi, pi+iT, 0+iT, except with a little half circle above the x-axis at our singularity. There are no poles inside this contour. Let T go to infinity. The integral along pi+iT to 0+iT will go to zero as we do this (the integrand is of the order e^(-T)). The integral along the vertical sides are pure imaginary since cos(z) is pure real if the real part of z is 0 or pi. We don't care what it actually is, only that its real part is 0.

If we let the radius of the little half circle go to zero, we can get the integral we're interested in. As we do this, the integral over the half circle contributes -i*pi times residue at this pole. The residue is real, so this part of the contours contribution is again purely imaginary.

Since the integral along the parts of our contour that lie on the x-axis must be real, we see that they must actually be zero since the other parts of our contour have only imaginary contributions. Therefore the principal value of this real integral must be zero.

6. Nov 18, 2004

### ReyChiquito

I dont understand one thing... is r a variable? is it fixed?

If it is a variable, is the integral 0 for all 0<r<5 ?

can you state the question again???

are you trying to calculate

$$\int_{0}^{\pi}\frac{dx}{r+5\cos x}$$????

another question, why are we calculating the principal value of the integral?
cant we calculate just the integral?

Last edited: Nov 19, 2004
7. Nov 19, 2004

### ReyChiquito

here is what i've done from what i've understanded

let

$$f(z)=\frac{R\left(\frac{1}{2}\left(z+\frac{1}{z}\right),\frac{1}{2i}\left(z-\frac{1}{z}\right)\right)}{iz}$$

and $\gamma=e^{i\theta}$ where $0\leq\theta\leq2\pi$

then

$$\int_{\gamma}f=\int_{0}^{2\pi}f(e^{i\theta})ie^{i\theta}d\theta=\int_{0}^{2\pi}R\left(\frac{e^{i\theta}+e^{-i\theta}}{2},\frac{e^{i\theta}-e^{-i\theta}}{2i}\right)\frac{ie^{i\theta}}{ie^{i\theta}}d\theta=\int_{0}^{2\pi}R(\cos\theta,\sin\theta)d\theta$$

implies that

$$\int_{0}^{2\pi}R(\cos\theta,\sin\theta)d\theta=2\pi i \sum res\{f(z),\Omega\}$$

where $\Omega$ is the unit disk.

EDIT... in fact, you can extend the result to

$$\int_{0}^{\alpha}R(\cos\theta,\sin\theta)d\theta=2\pi i \sum res\{f(z),\Omega_{\alpha}\}$$

where $\Omega_{\alpha}$ is the slice of unit disk. This should make calculation easier

$$f(z)=-\frac{i}{5z^2+rz+5}$$

Its all downhill from here right?

Last edited: Nov 19, 2004
8. Nov 19, 2004

### shmoe

There's a discontinuity on the path of integration, at arccos(-r/5) since 0<r<5, so I expect he means the principle value if we're to make any sense of the question. When you shifted over to complex variables you end up with poles on the path of integration, so you have to be extremely careful.

9. Nov 19, 2004

### Ed Quanta

I'm sorry, what if r>5?

10. Nov 19, 2004

### shmoe

If r>5 we don't have the discontinuity problem and life is easier. Notice:

$$\int_{0}^{\pi}\frac{dx}{r+5\cos(x)}=\frac{1}{2}\int_{0}^{2\pi}\frac{dx}{r+5\cos(x)}$$

You'll be evaluating the second integral.

Next do the substitution $$z=e^{ix}$$, noticing that $$\cos(x)=(z+1/z)/2$$. Your integrand will be the f(z) ReyChiquito gave at the end of his last post (though I get 5/2 where he has the 5's). Your path of integration will be the unit circle counterclockwise. Use the residue theorem.

This is essentially what Rey just mentioned, though I'm not sure what he means when he's talking about doing the integral over a slice of the disc-if you aren't integrating over a closed contour you'll have a hard time evaluating the integral by residues. Maybe he'll clarify the $\Omega_{\alpha}$ contour.

Last edited: Nov 19, 2004
11. Nov 20, 2004

### Ed Quanta

How do I obtain the integrand f(z) = -i/(5z^2/2+ rz + 5/2) ?

Last edited: Nov 20, 2004
12. Nov 20, 2004

### shmoe

Did you try the substitution $$z=e^{ix}$$ I mentioned above? What happened?

13. Nov 20, 2004

### Ed Quanta

Oh, I'm sorry man. You are right. Simple arithmetic mistake I was making.

14. Nov 20, 2004

### ReyChiquito

oh yeah, my mistake... you cant extend so blindly the result, so i would use the 0 to 2pi form of the result i posted. One thing though (on top of my head) i think if you change the domain as shmoe is doing it ([0,pi] to 1/2 [-pi,pi] to 1/2 [0,2pi]) the sign of the cosine must change in the last one, as you are translating only by pi, but i might be wrong. And yeah shmoe, i clearly lost the 1/2 of the variable change *blush*

15. Nov 25, 2004

### shmoe

It's not a translation by pi that I was using, just symmetry about x=pi, namely $$\cos(x)=\cos(2\pi-x)$$. So the integral from pi to 2pi will equal the integral from 0 to pi.

16. Nov 26, 2004

### ReyChiquito

yeah, but you are integrating from -pi to pi, so you are translating the domain of integration.

$$\int_{-\pi}^{\pi}\ne\int_{0}^{2\pi}$$

17. Nov 26, 2004

### shmoe

You never even have to talk about an integral from -pi to pi for this question, but for this function these integrals are equal anyways. Actually for any periodic function of period c it's integral over [a,a+c] will equal it's integral over [b,b+c] for any choice of a, b. The integral over any full period will always yield the same result.

For the function at hand,

$$\int_{-\pi}^{\pi}=\int_{-\pi}^{0}+\int_{0}^{\pi}=\int_{\pi}^{2\pi}+\int_{0}^{\pi}=\int_{0}^{2\pi}$$

Where $$\int_{-\pi}^{0}=\int_{\pi}^{2\pi}$$ by the 2pi periodicity of cos (a simple substitution if you prefer).

18. Nov 28, 2004

### ReyChiquito

K, then what im i doing wrong?

taking the change of variable $u=x+\pi$ and $du=dx$

$$\int_{-\pi}^{\pi}\frac{dx}{r+5\cos x}=\int_{0}^{2\pi}\frac{du}{r+5\cos(u-\pi)}=\int_{0}^{2\pi}\frac{du}{r-5\cos u}$$

Im thinking is correct, because $\cos x$ in $[-\pi,\pi]$ doesnt look the same as in $[0,2\pi]$. In fact, the graph is "minus" the first one.

Last edited: Nov 28, 2004
19. Nov 28, 2004

### shmoe

You're not doing anything wrong. But you should realize that:

$$\int_{0}^{2\pi}\frac{dx}{r+5\cos x}=\int_{0}^{2\pi}\frac{dx}{r-5\cos x}$$

To see this use your translation substitution to show:

$$\int_{0}^{\pi}\frac{dx}{r+5\cos x}=\int_{\pi}^{2\pi}\frac{dx}{r-5\cos x}$$

and

$$\int_{\pi}^{2\pi}\frac{dx}{r+5\cos x}=\int_{0}^{\pi}\frac{dx}{r-5\cos x}$$

think of the simpler graph of 1+cos(x) on [-pi,pi] and [0,2pi]. They look different, and if you were to integrate over these two intervals, you could use your translation to show they are equal to one another except for the "negative cos". But look at the areas under these graphs, should be the same no? You're just adding up the area in a different order.

Think about what I said about integrating a periodic function over a full period.

20. Nov 29, 2004

### ReyChiquito

You are right, its just that

$$\int_{0}^{2\pi}\frac{dx}{r+5\cos x}=\int_{0}^{2\pi}\frac{dx}{r-5\cos x}$$

is not as obvious at first glance, and i suck at geometry :)

i even had to prove it analytically, just to convince myself :P