Deriving the DFT magnitude of $A\cos(2\pi nk/N)$
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 &lt;- 100
k &lt;- 5
m_vals &lt;- seq(-N,N)

Xm &lt;- rep(0,2*N+1)

for (m in m_vals)
{
  Xm[m+N+1] &lt;- 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")