# DFT of a complex sinusoid

I'm attending this course (Coursera: Audio Signal Processing for Music Applications) in which the professor derives a general equation for Discrete Fourier Transform (DFT) for a complex sinusoid. The following is the screenshot of the slide he used:

While the derivation is totally fine, I'm having trouble understanding the concluding statement

if $k \neq k_0, denominator \neq 0$ & $numerator = 0$ thus $X_1[k]=N$ for $k=k_0$ & $X_1[k]=0$ for $k \neq k_0$

I did try value substitution and all, but all that can't seem to justify the statement. My understanding is that if $k=k_0$, both the numerator and the denominator would be zero and there would be no way the result is $N$ and I have no clue about the first part of the statement either. Or I'm missing something here (or forgotten some basic school math here). What's going on here?

• You can use L'Hospital's rules if you wish. But it's better to consult to the answers below. – Fat32 Jul 20 '17 at 13:50
• De L'Hospital rule is neat, but one should use it with a lot of care, or not use it at all math.stackexchange.com/questions/1710786/… – Laurent Duval Dec 10 '18 at 20:49

• $N$ if $k= k_0$
• $f(r)=\frac{1-r^N}{1-r}$ with $r=e^{-j 2\pi(k-k_0)/N}$ if $k\neq k_0$
Indeed, as you correctly remarked, numerator and denominator would vanish for $r=1$ (or $k= k_0$), so the fraction is not "theoretically" defined. However, it is consistent to the limit, as $f(r)\to N$ as $r\to 1$ since $e^{-j 2\pi(k-k_0)/N}\to 1$ when $k \to k_0$ (allowing real $k$).
Mathematically, the fraction gives one single expression, defined by continuity at $k= k_0$. It is a bit like saying that $\frac{r^2-1}{r-1}$, not defined at $r=1$, is in some way equivalent to $r+1$ (using $r^2-1=(r-1)(r+1)$ and wrongfully simplifying the fraction. This is not correct, but makes sense.