I’m working through the textbook A First Course in Complex Analysis and I’m trying to solve problem 4.30:
Compute the real integral $$\int_{0}^{2\pi}\frac{d\varphi}{2+\sin(\varphi)}$$ by writing the sine function in terms of the complex exponential and making the substitution $z=e^{i\varphi}$ to turn the real integral into a complex integral.
I started by rewriting the sine function as $\frac{e^{i\varphi}-e^{-i\varphi}}{2i}$:
$$=\int_{0}^{2\pi} \frac{d\varphi}{2+\tfrac{e^{i\varphi}-e^{-i\varphi}}{2i}}=2i\int_{0}^{2\pi} \frac{d\varphi}{4i+e^{i\varphi}-e^{-i\varphi}}$$
Then I substituted $z=e^{i\varphi}$, as the problem asked, and got $dz=izd\varphi$, so $d\varphi=\tfrac{-idz}{z}$. I also defined my path as $\gamma:[0,2\pi]\rightarrow \mathbb{C}$ as $\gamma(\varphi)=e^{i\varphi}$
$$=2i\int_{\gamma} \frac{1}{4i+z-\tfrac{1}{z}} \frac{-idz}{z}=2\int_{\gamma} \frac{dz}{z^2+4iz-1}$$.
We can see that the inside of the integral is a rational function, so it should be holomorphic everywhere where it’s defined. The poles can then be calculated by the quadratic equation as $\pm \sqrt{3}i-2i$.
However, these poles clearly lie outside of the region enclosed by $\gamma$, the unit circle.
Since the inside of the integral is defined and holomorphic on all points on $\gamma$ and inside $\gamma$, and $\gamma$ is a closed curve, we have:
$$2\int_{\gamma} \frac{dz}{z^2+4iz-1}=2\cdot0=0$$
However, this is very obviously wrong, because the original integral is always positive and hence can’t be zero.
So my questions are:
- Where is my mistake?
- How would you solve this correctly?
Answering my own question because @user10354138 in the comments pointed out the very obvious mistake that the poles are actually at $(-2\pm\sqrt{3})i$. One of those,$(-2+\sqrt{3})i$ lies inside of our curve, so by cauchy’s integral theorem:
$$=2\int_{\gamma} \frac{dz}{(z-(-2-\sqrt{3})i)(z-(-2+\sqrt{3})i)}$$ $$=2\int_{\gamma} \frac{\tfrac{1}{z-(-2-\sqrt{3})i}}{z-(-2+\sqrt{3})i}$$ $$=2 \cdot 2 \pi i \frac{1}{(-2+\sqrt{3})i-(-2-\sqrt{3})i}=\frac{2\pi}{\sqrt{3}}$$