# How to find the following DFT?

Let $$x[n] = \cos(\frac{\pi}{8}n)$$ and $$X(k) = \text{DFT}_{16} \{ x[n]\}$$

In order to find $$X(k)$$ I write out the DFT sum:

$$X(k) = \sum_{n=0}^{N-1} x[n] e^{-j2\pi kn/N} = \sum_{n=0}^{15} \cos(\frac{\pi}{8}n) e^{-j2\pi kn/16}$$

I could expand the $$\cos(\cdot)$$ as two complex exponentials inside the sum but that would make the computation rather tedious.

However, if we expand it before jumping into the summation we see that:

$$\cos(\frac{\pi}{8}n) = 0.5e^{j\pi n/8}+0.5e^{-j\pi n/8}$$

Which is just the 16 Pt IDFT of $$0.5 \cdot \delta[k-1] + 0.5\cdot \delta[k+1]$$ (Properties table in $$\textbf{FSP 2014 Vetterli et al Pg 256}$$).

At this stage I am not sure how to proceed with handling this IDFT and getting the $$\text{DFT}_{16}$$ of the original $$x[n]$$ although I do see some similarities between this and the duality property of the CTFT which makes me think that perhaps if I multiply my IDFT with $$N=16$$ I should get my desired DFT but I am not sure.

Sidenote: What if the function was changed to $$\cos(\frac{\pi}{16}n)$$ or $$\cos(\frac{\pi}{4}n)$$. Would we still handle it the same way?

$$\textbf{Edit:}$$ Attempt at a solution for the sidenote, $$x[n] = \cos\frac{\pi}{16}n$$:

Let $$x[n] = \cos\frac{\pi}{16}n = 0.5e^{j\pi n/16}+0.5e^{-j\pi n/16}$$

Split the DFT sum into two parts:

$$\frac 12 \sum_{n=0}^{N-1}e^{j\frac{\pi}{16}n}e^{-j\pi/8 kn} = \frac 12 \sum_{n=0}^{N-1}e^{j\frac{\pi}{8}n(\frac 12 - k)} = \frac 12 \frac{1 - (e^{j\frac{\pi}{8}(\frac 12 - k)})^{16}}{1-e^{j\frac{\pi}{8}(\frac 12 - k)}}$$

$$\frac 12 \sum_{n=0}^{N-1}e^{-j\frac{\pi}{16}n}e^{-j\pi/8 kn} = \frac 12 \sum_{n=0}^{N-1}e^{-j\frac{\pi}{8}n(\frac 12 + k)} = \frac 12 \frac{1 - (e^{-j\frac{\pi}{8}(\frac 12 + k)})^{16}}{1-e^{-j\frac{\pi}{8}(\frac 12 + k)}}$$

Upper one equals $$\frac{1}{1-e^{j\pi /16}\cdot e^{-j\pi/8 k}}$$

And lower one equals $$\frac{1}{1-e^{j\pi /16}\cdot e^{j\pi/8 k}}$$

How can I combine the two to get the final result?

• Yes, your approach is correct. Here is a visual representation of the DFT in question. Just keep in mind that the shift to the left represented by $\delta[k+1]$ is a circular shift. Whatever falls off, comes back up on the other side! Apr 11 at 13:00
• Thank you! By the way, shouldn't the third plot have $n$ as its x-axis label?
– user67157
Apr 11 at 14:10
• Yes you are correct. It should be 'n' instead of 'k' Apr 11 at 14:11
• I see. Also, what about handling functions like $\cos(\frac{\pi}{16}n)$ in this fashion?
– user67157
Apr 11 at 14:13
• @AcerbicNarcissist hm, you're asking this for a reason. What do you think would be different? Apr 11 at 14:27