I'm working on the following problem:
Compute the Fourier transform of the function $f(x) = \begin{cases} -1 & \text{if}\,-2<x<-1 \\ 2 & \text{if}\,\,0<x<2 \\ 0 & \text{otherwise} \end{cases}$.
First, I checked to make sure $f \in L^{2}(-\infty, \infty)$:
$\displaystyle \begin{align}\int_{-\infty}^{\infty} (f(x))^{2}dx = \int_{-2}^{-1}(-1)^2 dx + \int_{0}^{2} (2)^{2} dx = \left[x \right]_{-2}^{-1} + \left[4x \right]_{0}^{2} \\= -1 - (-2) + (4(2) - 4(0)) = -1 + 2 + 8 = 9 < \infty \end{align}$
And it is, so then, using the definition of the Fourier transform: $\displaystyle F(\alpha) = \frac{1}{2 \pi}\int_{-\infty}^{\infty} f(x)e^{-i\alpha x} dx,$
I got $\displaystyle \begin{align} F(\alpha) = \frac{1}{2\pi} \int_{-2}^{-1}(-1) \cdot e^{-i\alpha x} dx + \frac{1}{2\pi}\int_{0}^{2}(2) \cdot e^{-i\alpha x}dx \end{align}$.
Then, letting $u = -i \alpha x$, $\displaystyle \frac{-du}{i \alpha} = dx$, this became
$\displaystyle \begin{align} -\frac{1}{2\pi}\frac{-1}{i \alpha}\left[\int e^{u}du\right]_{x=-2}^{x=-1} + \frac{2}{2\pi}\frac{-1}{i \alpha} \left[\int e^{u} du \right]_{x=0}^{x=2} = \frac{1}{2\pi \alpha i}\left[ e^{u} \right]_{x=-2}^{x=-1} - \frac{1}{\pi \alpha i} \left[e^{u} \right]_{x=0}^{x=2} \\ = \frac{1}{2\pi \alpha i}\left[ e^{-i\alpha x} \right]_{-2}^{-1} - \frac{1}{\pi \alpha i} \left[e^{-i \alpha x} \right]_{0}^{2} \\ = \frac{1}{2\pi \alpha i}\left[ e^{-i\alpha (-2)} - e^{-i \alpha (-1)} \right] - \frac{1}{\pi \alpha i} \left[e^{-i \alpha (2)} - e^{-i \alpha (0)} \right] \\ = \frac{1}{2\pi \alpha i}\left[ e^{2 \alpha i} - e^{\alpha i} \right] - \frac{1}{\pi \alpha i} \left[e^{-2 \alpha i} - 1 \right] \end{align}$.
But, the final answer given in the textbook is $\displaystyle F(\alpha) = \frac{2 e^{-i\alpha}\sin \alpha}{\pi \alpha} - \frac{\left(e^{\displaystyle \left(\frac{3i\alpha}{2}\right)}\right)\cdot \left(\sin \left( \displaystyle \frac{\alpha}{2}\right)\right)}{\pi \alpha}$.
How do I get my answer to look like the textbook's so that I know whether I'm doing it right?? I've been trying to do so for 3 hours now, but all I'm succeeding in doing is getting bogged down in the details of trig identities, and not even getting anywhere with those. How can you learn if you can't figure out whether you're doing something right? And how can you figure out whether you're doing something right when the solutions in the textbook are in such a difficult to obtain form?
That is, of course, assuming I am doing this right...
If I'm not computing the Fourier transforms correctly, please let me know and instruct me on the proper way of doing it.
If I am computing the Fourier transforms correctly, would you please demonstrate to me, in great detail, how I would go about putting my answers in the same form as they are in the back of the book? This is not homework, and you won't be preventing me from learning by showing me all the details worked out. If anything, due to the lack of examples of this type of problem I've seen so far, you'll be helping me learn. Then, I can apply these principles to other exercises in the textbook I want to work on as practice.
Thank you.
Using the hint given by Daniel Fischer that $\displaystyle \sin(z) = \frac{e^{iz}-e^{-iz}}{2i}$, and picking up where I left off in my question, I have that:
$\displaystyle \begin{align}= \frac{1}{2\pi \alpha i}\left[ e^{2 \alpha i} - e^{\alpha i} \right] - \frac{1}{\pi \alpha i} \left[e^{-2 \alpha i} - 1 \right] = = \frac{1}{2\pi \alpha i}\left[ e^{2 \alpha i} - e^{\alpha i} \right] - \frac{1}{\pi \alpha i} \left[e^{-2 \alpha i} - e^{-0\alpha i} \right] \\ = \frac{1}{2\pi \alpha i}e^{2 \alpha i} - \frac{1}{2 \pi \alpha i}e^{\alpha i} - \frac{1}{\pi \alpha i} e^{-2 \alpha i} + \frac{1}{\pi \alpha i}e^{-0 \alpha i} \\ = \frac{1}{2\pi \alpha i}e^{2 \alpha i} - \frac{1}{2 \pi \alpha i}e^{\alpha i} + \frac{2}{2\pi \alpha i}e^{-0 \alpha i} - \frac{2}{2\pi \alpha i} e^{-2 \alpha i} \\= \frac{1}{2\pi \alpha i}e^{2 \alpha i} - \frac{1}{2 \pi \alpha i}e^{\alpha i} + \frac{2}{2\pi \alpha i}\left[e^{-0 \alpha i} - e^{-2 \alpha i}\right] \\ = \frac{1}{2\pi \alpha i}e^{2 \alpha i} - \frac{1}{2 \pi \alpha i}e^{\alpha i} + \frac{2}{2\pi \alpha i}\left[e^{-\alpha i + \alpha i} - e^{-2 \alpha i}\right]\\ = \frac{1}{2\pi \alpha i}e^{2 \alpha i} - \frac{1}{2 \pi \alpha i}e^{\alpha i} + \frac{2}{\pi \alpha }e^{-\alpha i}\frac{\left[e^{ \alpha i} - e^{-\alpha i}\right]}{2i} \\ = \frac{1}{2\pi \alpha i}e^{2 \alpha i} - \frac{1}{2 \pi \alpha i}e^{\alpha i} + \frac{2}{\pi \alpha }e^{-\alpha i}\sin(\alpha) \\= \frac{1}{2\pi \alpha i}e^{(3\alpha/2) i}\left(e^{(\alpha/2) i} - e^{-(\alpha/2) i}\right) + \frac{2}{\pi \alpha }e^{-\alpha i}\sin(\alpha) \\= \frac{1}{2\pi \alpha i}e^{(3\alpha/2) i}\left(- e^{-(\alpha/2) i} + e^{(\alpha/2) i} \right) + \frac{2}{\pi \alpha }e^{-\alpha i}\sin(\alpha)\\ = \frac{-1}{\pi \alpha }e^{(3\alpha/2) i}\left(\frac{ e^{-(\alpha/2) i} - e^{(\alpha/2) i}}{2i} \right) + \frac{2}{\pi \alpha }e^{-\alpha i}\sin(\alpha) \\ = \frac{-1}{\pi \alpha }e^{(3\alpha/2) i}\sin(\alpha/2) + \frac{2}{\pi \alpha }e^{-\alpha i}\sin(\alpha) \\ = \frac{2e^{-\alpha i}\sin(\alpha) }{\pi \alpha }- \frac{e^{(3\alpha/2) i}\sin(\alpha/2) }{\pi \alpha }.\end{align}$