# Math Help - Integral via residues

1. ## Integral via residues

I must calculate $\int _0 ^{\pi} \frac{d \theta}{2+ \cos \theta}$.
Attempt: First I wanted to find the singularities of $f(z)=\frac{1}{2+\cos z}$. I didn't succeeded in it. I know that $\cos z =\frac{e^{iz}+e^{-iz}}{2}$ and using this equality I found out that the singularities of f are when $\frac{4}{e^b} \cos (a) + \frac{\cos (2a)}{e^{2b}}+1=0$ and $\frac{4}{e^b}\sin (a) + \frac{\sin (2a)}{e^{2b}}=0$, simultaneously (when z=a+ib). Which seems way too hard to solve in my opinion. So I'm guessing I'm missing a much simpler way to find the singularities of f.
I've also noticed that $\cos (\theta )$ is the real part of $e^{i\theta}$ but I don't see how it can help.
I'd like some help. Thank you.

2. I have two thoughts.

1. As to finding the poles: Take the equation and go as follows:

$\displaystyle{\frac{e^{iz}+e^{-iz}}{2}=-2}$

$\displaystyle{e^{iz}+e^{-iz}=-4}$

$\displaystyle{(e^{iz})^{2}+4 e^{iz}+1=0}.$

Use the quadratic formula to solve for $e^{iz}$, then take the logarithm and divide by $i$.

2. What contour are you planning on using?

3. Originally Posted by arbolis
I must calculate $\int _0 ^{\pi} \frac{d \theta}{2+ \cos \theta}$.
Attempt: First I wanted to find the singularities of $f(z)=\frac{1}{2+\cos z}$. I didn't succeeded in it. I know that $\cos z =\frac{e^{iz}+e^{-iz}}{2}$ and using this equality I found out that the singularities of f are when $\frac{4}{e^b} \cos (a) + \frac{\cos (2a)}{e^{2b}}+1=0$ and $\frac{4}{e^b}\sin (a) + \frac{\sin (2a)}{e^{2b}}=0$, simultaneously (when z=a+ib). Which seems way too hard to solve in my opinion. So I'm guessing I'm missing a much simpler way to find the singularities of f.
I've also noticed that $\cos (\theta )$ is the real part of $e^{i\theta}$ but I don't see how it can help.
I'd like some help. Thank you.
First, notice that the integral from $\pi$ to $2\pi$ is the same as the integral from 0 to $\pi$, because $\cos\theta = \cos(2\pi-\theta)$. So you are looking at $\frac12\!\!\displaystyle\int _0 ^{2\pi} \frac{d \theta}{2+ \cos \theta}$.

Next, make the substitution $z = e^{i\theta}$. Then $\cos\theta = \frac12(z+z^{-1})$, $dz = izd\theta$, and as $\theta$ goes from 0 to $2\pi$, z goes round the unit circle C. So the integral becomes $\frac12\!\!\displaystyle\oint_C\frac1{2+\frac12(z+ z^{-1})}\,\frac{dz}{iz}$. Can you take it from there?

4. Thanks a lot to both. I'm going to try to solve the problem via both ways.
Originally Posted by Ackbeet
I have two thoughts.

1. As to finding the poles: Take the equation and go as follows:

$\displaystyle{\frac{e^{iz}+e^{-iz}}{2}=-2}$

$\displaystyle{e^{iz}+e^{-iz}=-4}$

$\displaystyle{(e^{iz})^{2}+4 e^{iz}+1=0}.$

Use the quadratic formula to solve for $e^{iz}$, then take the logarithm and divide by $i$.

2. What contour are you planning on using?
Any counter enclosing all the singularities. I must first find the singularities to answer this question I guess. Unless I'm not understanding well the method (which is quite possible).
I reach $e^{iz}=-2-\sqrt 3$ or $\sqrt 3 -2$. Taking the complex logarithm and noting that both numbers are real numbers (hence their argument is worth 0) and dividing by i, I get that $z=-i \log (2+\sqrt 3 )$ or $z=-i \log (2- \sqrt 3)$ which I doubt is right.
Originally Posted by Opalg
First, notice that the integral from $\pi$ to $2\pi$ is the same as the integral from 0 to $\pi$, because $\cos\theta = \cos(2\pi-\theta)$. So you are looking at $\frac12\!\!\displaystyle\int _0 ^{2\pi} \frac{d \theta}{2+ \cos \theta}$.

Next, make the substitution $z = e^{i\theta}$. Then $\cos\theta = \frac12(z+z^{-1})$, $dz = izd\theta$, and as $\theta$ goes from 0 to $2\pi$, z goes round the unit circle C. So the integral becomes $\frac12\!\!\displaystyle\oint_C\frac1{2+\frac12(z+ z^{-1})}\,\frac{dz}{iz}$. Can you take it from there?
I don't really understand why $dz=iz d\theta$ nor why since $\cos \theta = \cos (2 \pi - \theta)$ then the integral is worth the same as the integral from pi to 2 pi. Maybe the fundamental theorem of calculus, but I'm unsure.
I'm also not sure I can do the rest. I think I should still find the poles of the integrand? If so, I reach some non sense ( $\cos (2\theta )=-1$ and $\sin (2 \theta)=4$ ).

5. See here for my explanation of contour integration. You don't actually have to use the contour enclosing all the singularities. Refer to posts 6 through 8 in the link for my recommendations on choosing contours. You do need to know what singularities are actually there, of course.

...which I doubt is right.
Fortunately, you have a relatively easy way of checking your answer: plug those numbers you got into the cosine function, and see if you get -2. I think you have some sign errors there.

If you plan on pursuing my proposed method of contour integration, you're fairly soon going to be doing something rather similar to Opalg's very fine approach: choosing a contour and parametrizing it. What'll you pick?

6. it's because [LaTeX ERROR: Convert failed] and then you know [LaTeX ERROR: Convert failed] , so you replace that with z in the expression for [LaTeX ERROR: Convert failed] .

7. Ok thanks a lot to both.
Originally Posted by Ackbeet
See here for my explanation of contour integration. You don't actually have to use the contour enclosing all the singularities. Refer to posts 6 through 8 in the link for my recommendations on choosing contours. You do need to know what singularities are actually there, of course.
Unfortunately I can't see the page you are referring. I get a "Page not found" message. I also tried to access it by google and also get the same message. I really need to read it, I really don't understand why I can choose wheter or not to enclose all the singularities. I'm curious if someone else also has this problem to access the page.
Edit: I could accessto an old version of the page with google chrome. I will copy it here.
Originally Posted by Ackbeet
Like I said, the first step is to choose a contour. Here are some guidelines:

1. Pick a contour that includes the range of values over which the original integral runs.

2. Pick a simple, closed contour.

3. Pay attention to where the poles of the integrand are located relative to your closed contour. Sometimes you can simplify things by not including any poles, or by only including poles where it is easy to compute residues, etc.

4. Pick a contour that has a good deal of symmetry. That will usually simplify expressions.

and
If you make no mistakes, there's loads of freedom in choosing contours. Let me outline the general idea of the solution. You pick a contour such as I have described. Let's say that the contour has various "legs of the journey", or is partitioned into the following contours: , where one of them, , corresponds to the original integral, and . You've got an original integrand . Now, let's suppose further that you know what the value of
is. What you do is set

.

The hope is that all the , except the one you're interested in, are very easy to do. You might be able to eliminate them on the basis of an ML estimate, for example. Then, you simply shove everything except the integral in which you're interested over to the other side:

.

Everything on the RHS is either known or easy to compute. Voila! You're done. That's the high-level view of contour integration as it's used to evaluate real-valued integrals. Make sense?
Edit 2: Latex cannot be copied... A few questions regarding your post #8. Can $C_j$ be the whole real axis? In the case of my integral, can it be the part of the real axis starting from 0 and ending at $\pi$? If so, I would certainly pick a contour including this part of path. Probably a semi circle, I'm not sure to include 0, 1 or 2 poles. I also need to know where they are located (I will do it right now). But if I enclose at least 1 pole, I won't know the value of $\oint _C f(z)dz$ since I'd have to calculate the residue of it. I think I'm somehow confused.

8. $C_{j}$, in the context of post # 8 there, has to be the interval you started out with, or something so close to it that finding it will directly allow you to write down the value of the original integral. It can be the whole real axis, or it can be just from $0$ to $\pi$.

Including zero poles is the easiest way to go, if you can. Here's what I would do: expand your original interval to $-\pi$ to $\pi$. Since the integrand is even, you can simply divide by two. That is,

$\displaystyle{\int_{0}^{\pi}\frac{d\theta}{2+\cos( \theta)}=\frac{1}{2}\int_{-\pi}^{\pi}\frac{d\theta}{2+\cos(\theta)}.}$

Then, as you've intimated, I would use a semi-circle from $\pi$ to $-\pi$. There are no poles inside this contour.

Where would you go from here?

9. Ok thanks Ackbeet. I'm actually stuck on finding the singularities. I keep finding the same non sense result. I really don't know where I'm wrong: $2+\frac{e^{iz}+e^{-iz}} {2} =0 \Rightarrow 4e^{iz}+e^{2iz}+1=0$. Solving for $e^{iz}$ gives $-2-\sqrt 3$ or $-2 + \sqrt 3$.
Taking the logarithm, I get that $iz= \log |-2-\sqrt 3 |$ or $\log |-2 + \sqrt 3 | \Rightarrow z= -i \log |-2- \sqrt 3|$ or $z=-i \log |-2 + \sqrt 3 |$. I'm guessing I made an error when taking the logarithm of the complex exponential function? If so, I don't see it. I'll answer your question when I find the singularities.

10. It looks like you are correct if you are using the principal value of the logarithm. Plugging those values of z into the cosine function gives precisely -2.

11. I think you'll find that both of those singularities are outside the contour I've described.

12. Originally Posted by Vlasev
It looks like you are correct if you are using the principal value of the logarithm. Plugging those values of z into the cosine function gives precisely -2.
I get 2 with both results, instead of -2. See &#40;1&#47;2&#41;&#40;&#124;-2&#43; sqrt 3&#124; &#43;1&#47;&#124;sqrt 3 -2&#124;&#41; - Wolfram|Alpha.

13. I forgot the absolute values when I plugged them in. You are right. They do give 2.

14. Originally Posted by Vlasev
I forgot the absolute values when I plugged them in. You are right. They do give 2.
Ok so I made an error, but I don't see where. I suppose it's when I take the logarithm?
To Ackbeet: Indeed, I trust you that both singularities are outside the contour you've described. The problem is that if I can't realize it myself, I wouldn't know it when I'm alone. But as of now, I'll just move on and assume that the singularities are outside the contour. Let me think how I'd continue.
Edit: The contour is the semi circle going from -pi to pi. Since no pole nor singularity is enclosed, the contour integral is worth 0 according to Cauchy's integral theorem. Hmm seems way too easy...

15. Originally Posted by arbolis
The problem is that if I can't realize it myself, I wouldn't know it when I'm alone. But as of now, I'll just move on and assume that the singularities are outside the contour. Let me think how I'd continue.
GOOD! That's the spirit!

I found your problem, though. Take the principal value logarithm on both sides of

[LaTeX ERROR: Convert failed]

On the left hand side we get just $iz$. However, since the right hand side is NEGATIVE, we must do this:

[LaTeX ERROR: Convert failed] , since the number is on the negative axis and has argument of [LaTeX ERROR: Convert failed]

Similarly for the other root, since it's negative. In the end, it's your answers with [LaTeX ERROR: Convert failed] added:

$-i\ln(2+\sqrt{3})+\pi$
$-i\ln(2-\sqrt{3})+\pi$

Plugging the 1st one in the equation gives:

$2+\frac{e^{iz}+e^{-iz}} {2} = 2+(1/2)(exp(i(-i\ln(2+\sqrt{3})+\pi))+exp(-i(-i\ln(2+\sqrt{3})+\pi)))$
$= 2+(1/2)((2+\sqrt{3})(-1)+(2+\sqrt{3})^-1(-1)) = 2-2 = 0$

Page 1 of 2 12 Last