# Deriving the Fourier transform of cosine and sine

In this answer, Jim Clay writes:

... use the fact that $\mathcal F\{\cos(x)\} = \frac{\delta(w - 1) + \delta(w + 1)}{2}$ ...

The expression above is not too different from $\mathcal F\{{\cos(2\pi f_0t)\}=\frac{1}{2}(\delta(f-f_0)+\delta(f+f_0))}$.

I have been trying to obtain the later expression by using the standard definition of the Fourier transform $X(f)=\int_{-\infty}^{+\infty}x(t)e^{-j2\pi ft}dt$ but all I end up with is an expression so different from what's apparently the answer.

Here's my work:

\begin{align} x(t)&=\cos(2\pi f_0t)\\ \Longrightarrow \mathcal F\left\{x(t)\right\}&=\int_{-\infty}^{+\infty}\cos(2\pi f_0t)e^{-j2\pi ft}dt\\ &=\int_{-\infty}^{+\infty}\frac 12 \left(e^{-j2\pi f_0t}+e^{j2\pi f_0t}\right)e^{-j2\pi ft}dt\\ &=\frac{1}{2}\int_{-\infty}^{+\infty}\left(e^{-j2\pi f_0t}e^{-j2\pi ft}+e^{j2\pi f_0t}e^{-j2\pi ft}\right)dt\\ &=\frac{1}{2}\int_{-\infty}^{+\infty}\left(e^{-j2\pi t\left(f_0+f\right)}+e^{-j2\pi t\left(f-f_0\right)}\right)dt\\ &=\frac{1}{2}\left(\int_{-\infty}^{+\infty}\left(e^{-j2\pi t(f_0+f)}\right)dt+\int_{-\infty}^{+\infty}\left(e^{-j2\pi t(f-f_0)}\right)\right) dt \end{align}

This is where I'm stuck.

Your work is OK except for the problem that the Fourier transform of $\cos(2\pi f_0 t)$ does not exist in the usual sense of a function of $f$, and we have to extend the notion to include what are called distributions, or impulses, or Dirac deltas, or (as we engineers are wont to do, much to the disgust of mathematicians) delta functions. Read about the conditions that must be satisfied in order for the Fourier transform $X(f)$ of the signal $x(t)$ to exist (in the usual sense) and you will see that $\cos(2\pi f_0 t)$ does not have a Fourier transform in the usual sense.
Turning to your specific question, once you understand that impulses are defined only in terms of how they behave as integrands in an integral, that is, for $a < x_0 < b$, $$\int_{a}^{b} \delta(x-x_0)g(x)\,\mathrm dx = g(x_0)$$ provided that $g(x)$ is continuous at $x_0$, then it is easier to deduce the Fourier transform of $$\cos(2\pi f_0 t) = \left.\left.\frac{1}{2}\right[e^{j2\pi f_0 t} + e^{-j2\pi f_0 t}\right]$$ by musing on the fact that $$\int_{-\infty}^\infty \delta(f-f_0)e^{j2\pi ft}\,\mathrm df = e^{j2\pi f_0t}$$ and so it must be that $\cos(2\pi f_0 t)$ is the inverse Fourier transform of $\displaystyle \left.\left.\frac{1}{2}\right[\delta(f-f_0) + \delta(f+f_0)\right]$.
Then just use a table of Fourier transform pairs to see that $\delta(t) \leftrightarrow 1$, and variable substitution ($f_1 = f+f_0$ and $f_2 = f-f_0$), to get what you need.