# Inverse Fourier transform: where am I going wrong?

I am studying a course in signal processing, currently we are examining Fourier transforms. I got stuck on an exercise with an inverse Fourier transform.

I am supposed to find the inverse Fourier transform to the signal $$x(\omega)=\cos^2(\omega)$$

I make use of : $$x(n)=\frac{1}{2\pi}\int_{-\pi}^{\pi}\cos^2(\omega)e^{j\omega n} d\omega$$

Eulers formula gives: $$\cos^2(\omega)= (\frac{1}{2}e^{j\omega}-\frac{1}{2}e^{-j\omega})^2=\frac{1}{4}(e^{2j\omega}+2+e^{-2j\omega})$$

So

\begin{align}x(n)&=\frac{1}{2\pi}\int_{-\pi}^{\pi}\frac{1}{4}(e^{2j\omega}+2+e^{-2j\omega})e^{j\omega n} d\omega\\ &=\frac{1}{8\pi}\int_{-\pi}^{\pi}e^{j\omega (n+2)}+2e^{j\omega n}+e^{j\omega (n-2)} d\omega\\ &=\frac{1}{8\pi}[\frac{e^{j\omega (n+2)}}{n+2}+\frac{e^{j\omega n}}{n}+\frac{e^{j\omega (n-2)}}{n-2}]_{-\pi}^\pi\\ &=\frac{1}{8\pi}(\frac{e^{(n+2)}}{n+2}+\frac{e^{n}}{n}+\frac{e^{(n-2)}}{n-2})[e^{j\omega}]_{-\pi}^\pi\\ &=\frac{1}{8\pi}(\frac{e^{(n+2)}}{n+2}+\frac{e^{n}}{n}+\frac{e^{(n-2)}}{n-2})(e^{j\pi}-e^{-j\pi}) \\ &=\frac{1}{8\pi}(\frac{e^{(n+2)}}{n+2}+\frac{e^{n}}{n}+\frac{e^{(n-2)}}{n-2})\cdot0\\ &=0 \end{align}

This is not correct, and i don't quite know where i made a mistake. Any help or insights is appreciated. Please and thank you.

First, make sure to state the type of Fourier transform clearly:

It appears to me that you are dealing with the discrete-time Fourier transform member of the Fourier family. This is important because mathematical form of the operations will either differ slightly, or worse significantly between the discrete-time and the continuous-time versions.

Then you can use Fourier transform properties and pairs to approach your solution.

First, apply a trigonometric trick to your DTFT:

$$X(\omega) = \cos^2(\omega) = \frac{1 + \cos(2\omega)}{2} \tag{1}$$

And also apply Euler's decomposition on it.

$$X(\omega) = \frac{1}{2} + \frac{ e^{j 2\omega}}{4} + \frac{ e^{-j 2\omega}}{4} \tag{2}$$

Then, remember the following DTFT pairs:

$$\delta[n] \longleftrightarrow 1 \tag{3}$$

and $$\delta[n-d] \longleftrightarrow e^{-j d \omega} \tag{4}$$

Finally, apply Eqs. 3 & 4 into Eq.2 to arrive the relation:

$$\frac{ \delta[n]}{2} + \frac{\delta[n+2]}{4} + \frac{ \delta[n-2]}{4} \longleftrightarrow \frac{1}{2} + \frac{ e^{j 2 \omega} }{4} + \frac{e^{-j 2 \omega}}{4} \tag{5}$$

If you are still interested in getting the result by direct application of inverse Fourier transform integral, then consider the following with $$X(\omega) = 1$$:

\begin{align} x[n] &= \frac{1}{2\pi} \int_{-\pi}^{\pi} 1 e^{j \omega n} d\omega \\ \\ x[n] &= \frac{1}{2\pi} \frac{ e^{j \omega n}}{ jn} |_{-\pi}^{+\pi}\\ \\ x[n] &= \frac{\sin(\pi n)}{\pi n} = \text{sinc}(n) \\ \\ x[n] &= \begin{cases}{ 1 ~~~,~~~n = 0 \\ 0~~~,~~~n \neq 0} \tag{6} \end{cases}\\ \end{align}

Eq.6 is what is called as unit-impulse (or unit-sample) in discrete-time domain; $$x[n] = \text{sinc}(n) = \delta[n]$$.

You can derive the coresponding result for $$\delta[n-d]$$...

• yes, yes! discrete time hence the n, duh. This is the right/best answer (deleted mine). Jun 23 '21 at 2:51
• I deleted a comment with a question. I understand now i and think i can motivate an answer thank you! Jun 24 '21 at 16:59
• @Aedrha nice to hear that... ;-) Jun 24 '21 at 18:55

You went wrong in the evaluation of the integrals of type

$$I_m=\int_{-\pi}^{\pi}e^{jm\omega}d\omega,\qquad m\in\mathbb{Z}\tag{1}$$

This integral is indeed zero for all non-zero integers $$m$$. However, you forgot the case $$m=0$$, for which the integral evaluates to $$I_0=2\pi$$. Note that in the case $$m=0$$, you can't divide by $$m$$, as you did.

So in your case, the integral vanishes for all values of $$n$$ except for $$n=0$$ and $$n=\pm 2$$.

A much simpler way of solving that problem is to realize that

$$\cos^2(\omega)=\frac12+\frac12\cos(2\omega)=\frac12+\frac14e^{2j\omega}+\frac14 e^{-2j\omega}\tag{2}$$

from which the result can be written down immediately if you know the basic (discrete-time) Fourier transform pair

$$\delta[n-m]\Longleftrightarrow e^{-jm\omega},\qquad m\in\mathbb{Z}\tag{3}$$

This latter approach was also explained in Fat32's answer.

• Also a very good answer, as always! Jun 23 '21 at 14:08
• @DanBoschen: Thanks Dan! Jun 23 '21 at 14:26
• Thank you Matt! Jun 24 '21 at 17:00

The problem as stated at the present time is a complicated one, as so hypotheses are missing. I would like to underline some caveats: if not checked, they can lead to absurd or wrong results easily.

First, is your equation $$x(\omega)=\cos^2 \omega$$ valid for all $$\omega$$? If so, the function is neither square integrable nor absolutely integrable. The (inverse) Fourier transform is thus not well defined as a function (but maybe as a distribution).

Second the equation is valid only on an interval, say $$[-\pi,\pi]$$, then it is of finite support, and you can follow the steps you took... as long as you don't play with unknown quantities. For instance, the $$\frac{1}{n-2}$$, $$\frac{1}{n}$$, $$\frac{1}{n+2}$$ are not defined for some values of $$n$$ ({-2,0,2}), for which the "zero" factor $$[e^{j\omega}]_{-\pi}^{+\pi}$$ may collapse with the zero denominator. Hence, the equation is not directly valid for those indices. One should compute them separately, or use limiting arguments.

One final advice: try to compute any result in a least two different ways. For instance using the formulae, and with more advanced properties. Here, you might have learned that the (inverse) Fourier transform of a product is a convolution. So if you know which "function" has a cosine for a Fourier transform, then you can double check your result with the convolution of the above solutions.

• This is about discrete time, so the inverse (discrete-time) Fourier transform is actually well-defined. Jun 23 '21 at 10:12