Discrete Fourier transform: understanding the indices -- sum of the square of a real signal

46 Views Asked by At

Definitions. The discrete Fourier transform (DFT) $\mathcal F$ and its inverse $\mathcal F^{-1}$ on a sequence of N real or complex numbers ${\displaystyle \left\{\vec{x}\right\} :=x_{0},x_{1},\ldots,x_{N-1}}$ is defined $$ {\displaystyle \begin{aligned}X_{k} & =\mathcal{F}\vec x=\sum_{n=0}^{N-1}x_{n}u_{k}\left(n\right)\;,\end{aligned} \qquad x_{n}=\mathcal{F}^{-1}\vec X=\sum_{k=0}^{N-1}X_{k}\cdot u_{n}\left(k\right)\;,} $$ where the Fourier coefficients are $\left\{ \vec{X}\right\} :=X_{0},X_{1},\ldots,X_{N-1}$, and the orthonormal basis functions are $u_{k}\left(n\right)=e^{-i2\pi\frac{kn}{N}}/\sqrt{N}$ and $u_{k}\left(n\right)=e^{+i2\pi\frac{kn}{N}}/\sqrt{N}$. Orthonormality guarantees that $\sum_{n}u_{k}\left(n\right)u_{k'}\left(n\right)^{*}=\delta_{kk'}$ and $\sum_{k}u_{n}\left(k\right)u_{n'}\left(k\right)^{*}=\delta_{nn'}$.

Sum of the square of a real signal. Let us calculate $$ \sum_{n}x_{n}^{2} =\sum_{n}\left(\sum_{k=0}^{N-1}X_{k}\cdot u_{n}\left(k\right)\right)\left(\sum_{k'=0}^{N-1}X_{k'}\cdot u_{n}\left(k'\right)\right) =\sum_{k=0}^{N-1}\sum_{k'=0}^{N-1}X_{k}X_{k'}\left(\sum_{n=0}^{N-1}u_{n}\left(k\right)u_{n}\left(k'\right)\right) $$

Now, evaluate the final term in parenthesis, $$\sum_{n=0}^{N-1}u_{n}\left(k\right)u_{n}\left(k'\right)=u_{k}\left(n\right)=\frac{1}{N}\sum_{n=0}^{N-1}e^{+i2\pi\frac{n}{N}\left(k+k'\right)}=\delta_{k,-k'}$$

The question. I now get confused about the meaning of the Dirac delta function here with the negative sign for $k'$. If I blindly evaluate the sum $$ \sum_{n}x_{n}^{2}=\sum_{k=0}^{N-1}\sum_{k'=0}^{N-1}X_{k}X_{k'}\delta_{k,-k'}\;, $$ I will find zero, since $k,k'$ are non-negative, and the delta function is always zero. This is clearly wrong. Obviously, I need to take the modulo of the index here $-k \mod N = N-k$, but I don't understand how I am supposed to see this from the math? Where is the condition that requires us to limit the range? There is nothing in the sums that requires the range of the index or the modulo artithmetic. I thought that the $\exp$ function guaranteed that. Sorry for the confusion, hopefully someone can help clear this up for me.