Why replacing $\cos(x)$ by $e^{ix}$ in an integral and taking the real part doesn't always work? When does it work?

168 Views Asked by At

I wanted to solve the following integral using the residue theorem $\begin{align*}\int_{0}^{2\pi} \frac{\cos(3x)}{5-4\cos(3x)} \,dx\end{align*}$ and for that I thought I could replace it by $\begin{align*} \operatorname{Re}\biggl(\int_{0}^{2\pi} \frac{e^{3ix}}{5-4 e^{3ix}}\, dx\biggr) = \operatorname{Re}\biggl(\oint_\gamma \frac{z^{3}}{5-4 z^{3}} \frac{dz}{iz}\biggr)\end{align*}$ using $z=e^{ix}$ and $\gamma$ beeing a closed loop along the unit circle. Following this method, I could find that there are no singularities enclosed by the path so this should give me $\begin{align*}\int_{0}^{2\pi} \frac{\cos(3x)}{5-4\cos(3x)}\, dx=0\end{align*}$ which is wrong. I thought the mistake is in the step $\begin{align*}\int_{0}^{2\pi} \frac{\cos(3x)}{5-4\cos(3x)}\, dx=\operatorname{Re}\biggl(\int_{0}^{2\pi} \frac{e^{3ix}}{5-4 e^{3ix}}\, dx\biggr)\end{align*}$. Indeed I calculated these on Wolfra alpha and didn't get the same result. I don't understand when I can use the trick of substituting an integral with $\cos(x)$ by the real part of an integral with $e^{ix}$ or substituting an integral with $\sin(x)$ by the imaginary part of an integral with $e^{ix}$ multiplied by $i$, since $e^{ix}=\cos(x) + i\sin(x)$. So, I would like to know in general when I am allowed to use it, and when I should be more careful about it.

1

There are 1 best solutions below

7
On BEST ANSWER

Yep the mistake is there the problem is that the $\operatorname{Re}$ function is linear, but it doesn’t distribute over division. $$\operatorname{Re} \left(\frac{a}{b}\right)$$ is not the same as $$ \frac{\operatorname{Re} (a)}{\operatorname{Re}(b)}.$$

Therefore, you cannot change $$\frac{\cos(3x)}{5-4\cos(3x)} $$ to $$\operatorname{Re}\left(\frac{e^{3ix}}{5-4 e^{3ix}}\right).$$

Basically the only time this will work as is, is if you only have cos on the numerator of the fraction.