# Deriving the DFT magnitude of $A\cos(2\pi nk/N)$

Given that $$x(n) = A\cos(2\pi nk/N),$$ the $N$-point DFT of $x(n)$ can be expressed as follows—the derivation can be found in here: $$X(m) = \color{red}{\frac{A}{2}\sum_{n=1}^{N-1}e^{-j2\pi n(m-k)/N}}+\frac{A}{2}\sum_{n=1}^{N-1}e^{-j2\pi n(m+k)/N}.$$ It is said that the left summation above represents a positive-frequency spectral component. Does it mean to say that, when $m$ is negative, the summation goes down to zero?

• Not at all. All it means is that the left summation is associated with a complex exponential with a positive frequency. Similarly, the right summation is associated with a complex exponential with a negative frequency. – Peter K. Apr 25 '16 at 17:17
• @PeterK. In what perspective is the left summation associated with a positive frequency? Can you elaborate on that? – user20709 Apr 25 '16 at 17:21

So here's a plot of the summation. It is true that $X(m)$ is zero for some values of $m$ negative. However, due to the $N$-periodic nature of the summation, any $m$ for which $k\ \mbox{mod}\ N = m$ will be non-zero.

EDIT

I still don't understand how the negative portion of bins goes down to zero as a result of m−k

So, rewrite the summation as:

$$\sum_{n=1}^{N-1}e^{-j2\pi nm/N} \cdot e^{j2\pi nk/N}$$

so that all you are doing is modulating a complex exponential of frequency $m$ with one of frequency $k$ and summing the result.

This is just taking the inner product of two complex exponentials. The inner product just projects one exponential onto another. In this special case (for discrete time) where the frequencies are harmonically related, the only time when this is non-zero is when $m = k \ \mbox{mod}\ N$.

R Code Below #30344

N <- 100
k <- 5
m_vals <- seq(-N,N)

Xm <- rep(0,2*N+1)

for (m in m_vals)
{
Xm[m+N+1] <- sum(exp(-1i*2*pi*seq(0,N)*(m-k)/N))
}

plot(m_vals, Re(Xm), type="l", col="blue", xlab="m", ylab="X(m)")

title("Plot of X(m) vs m for m -100 to 100")

• Thank you for the plot. It clearly answers my question. However, I still don't understand how the negative portion of bins goes down to zero as a result of $m-k$. Sorry to bother you. – user20709 Apr 25 '16 at 17:51