# Computing the Integral $\int_0^{2\pi} \frac{1 + \sin(\theta)}{3 + \cos(\theta)}d \theta$

Compute the integral $$\int_0^{2\pi} \frac{1 + \sin(\theta)}{3 + \cos(\theta)}d \theta$$

My attempt: Using residue integration and rewriting the expression using complex identities for $$\sin(\theta)$$ and $$\cos(\theta)$$: $$\sin(\theta) = \frac{1}{2i}\left(z - \frac{1}{z}\right), \hspace{4mm} \cos(\theta) = \frac{1}{2}\left(z + \frac{1}{z}\right)$$ and $$d\theta = \frac{dz}{iz}$$:

$$\int_0^{2\pi} \frac{1 + \sin(\theta)}{3 + \cos(\theta)}d \theta$$ $$= \int_C \frac{1 + \frac{1}{2i}(z - \frac{1}{z})}{3 + \frac{1}{2}(z+ \frac{1}{z})} \frac{dz}{iz}$$ $$= \frac{1}{2i} \int_C \frac{1 + \frac{1}{2i}(z - \frac{1}{z})}{(z + 3 - 2\sqrt{2})(z + 3 + 2\sqrt{2}) }dz$$ We see that only the singularity $$z = 2 \sqrt{2} - 3$$ lies inside the unit circle, and evaluating this singularity gives

$$r = \frac{1 + \frac{1}{2i}(z - \frac{1}{z})}{z + 3 + 2\sqrt{2}}_{z = 2\sqrt{2} - 3} = \frac{1}{4\sqrt{2}} - i/2$$ which gives the final answer:

$$2\pi i(\frac{1}{2i})(\frac{1}{4\sqrt{2}} - i/2) = \frac{\pi}{4 \sqrt{2}} - \frac{\pi i}{2}$$ whereas the answer should be $$\pi/\sqrt{2}$$

• I believe there is no use of residue calculus. An elementary approach to this is enough. Commented Nov 8, 2021 at 12:04
• Why going to complex integration? It will work, but a simple weierstrass substitution $x=\tan(\theta/2)$ make things more elementary (although maybe a bit longer, but just easy computations). Also, you can provide what you got and maybe we can check where you had the mistake, because ofc the solution has to be real. Commented Nov 8, 2021 at 12:24
• @Marcos updated with more details now. The reason is because I'm trying to learn residue integration.
– Pame
Commented Nov 8, 2021 at 12:40

The integrand that you have written, $$\frac{1+\frac 1{2 i}(z-\tfrac{1}{z})}{3+\frac 12(z+\tfrac{1}{z})}\frac {\mathrm d z}{i z} = -\frac{(z+i)^2}{z (z+3-2\sqrt 2)(z+3+2\sqrt 2)}\mathrm dz,$$ is correct; however its poles within $$|z|<1$$ are $$z=2\sqrt 2-3$$ and $$z=0$$. You are on the right track with the first one, but you also need to add the residue from $$z=0$$.