Calculate the Fourier transform of the function:
\begin{equation} f(x) = \begin{cases}\cos(x) & \text{ if } \frac{-\pi}{2}\leq x \leq \frac{\pi}{2}\\ 0 &\text{ otherwise.}\end{cases}\end{equation}
What I did was to use the identity: \begin{equation} \cos(x) = \frac{e^{ix} + e^{-ix}}{2}\end{equation}
I now have this integral (note, by convention I let the constant before the integral be $1$): \begin{equation} \int^{\pi/2}_{-\pi/2} \frac{1}{2}\left( e^{-i(\omega-1)x}+ e^{-i(\omega+1)x} \right) \, dx\end{equation}
I have tried solving this many times but I get something totally wrong. The right answer is as follows:
\begin{equation} f(x) = \begin{cases} \frac{2\cos(\pi\omega/2)}{1-\omega^2}), & \text{ if } \omega \neq \pm1\\ \frac{\pi}{2} & \text{ if }\omega = \pm1\end{cases}\end{equation}
Now, I have two questions:
- How do you get that result, that is, evaluate the integral?
- Why do we have two answers and why at $\pm1$ (very contra-intuitive number)?
Thank you!