# Integrate $\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} \cos(x) \cdot e^{-jx} dx$

I'm failing at calculating this (pretty simple) integral:

$$\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} e^{-jx} \cdot \cos(x) dx$$

As $$\int e^{ax} \cdot \cos(bx) dx = \frac{e^{ax}}{a^2+b^2}\cdot[a\cdot \cos(x) + b\cdot \sin(bx)]$$ and $a=-j;b=1$ the antiderivative should be the following: $$\frac{1}{2\pi}\cdot\int_{-\pi/2}^{\pi/2} e^{-jx} \cdot \cos(x) dx = \frac{1}{2\pi}\cdot \Bigg[\frac{e^{-jx}}{(-j)^2+1}\cdot[(-j)\cdot \cos(x) + \sin(x)]\Bigg]^{\pi/2}_{-\pi/2}$$ But because $(-j)^2 = -j\cdot-j=j^2=-1$ this leads to an undefined expression.
I know that this has to be wrong because using a calculator I get $\frac{1}{4}$. But I can't find my mistake.

• Use the formula mentioned in math.stackexchange.com/questions/439851/… and then mathworld.wolfram.com/WernerFormulas.html – lab bhattacharjee Sep 11 '18 at 15:01
• The formula antiderivative works for $a,b\in \mathbb R$. When encounter complex numbers, you should be careful. A safe way is to write $\mathrm {e}^{\mathrm i x} = \cos(x) + \mathrm i \sin(x)$. – xbh Sep 11 '18 at 15:02
• $\cos{x} = \frac{e^{jx}+e^{-jx}}{2}$ – saulspatz Sep 11 '18 at 15:04
• @xbh I already integrated functions with complex variables and never had problems. More precisely this is a follow up question of this one: math.stackexchange.com/questions/2912547/… I successfully integrated the function with $n$ but I fail for $n=1$. How do I know if it's a good idea to use my default tables for antiderivatives and when not? – TimSch Sep 11 '18 at 15:45

$$I=\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} e^{-jx} \cdot cos(x) dx$$
Substitute $x=-t$ $$I=\frac{1}{2\pi} \cdot \int_{\pi/2}^{-\pi/2} -e^{jt} \cdot cos(-t) dt$$ $$I=\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} e^{jt} \cdot cos(t) dt$$
$$2I=\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} (e^{-jx}+e^{jx}) \cdot cos(x) dx$$ $$I=\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} \frac{e^{jx}+e^{-jx}}{2} \cdot cos(x) dx$$
Use $$\cos{x} = \frac{e^{jx}+e^{-jx}}{2}$$
• Am I right with the feeling that the $-j$ is causing the problems here? If it was $e^{+jx}$ everything would be alright? – TimSch Sep 11 '18 at 15:37