# Evaluate sum of complex exponentials using Kronecker delta

Commonly in e.g. condensed matter physics one encounters sums of the form

$\sum_{n=0}^{N-1} \sum_{k} A_k \mathrm{exp}[i\frac{2\pi}{N} kn ]$

where $k$ is summed over all integers in the range $[(-N-1)/2,(N-1)/2]$. The exponential here evaluates to the Kronecker delta:

$\sum_{n=0}^{N-1} \mathrm{exp}[{i 2\pi}{N} kn] = \delta_{n,0}$

so the full sum evaluates to

$N \sum_{k} A_{0} = N^2 A_{0}$.

Unfortunately it is not clear to me how to achieve this computation in Mathematica. For example

kterm = A[k]*(1/Sqrt[N]) Exp[I * 2 Pi * k * n]
ksum = FullSimplify[Sum[kterm, {k, -(N - 1)/2, (N - 1)/2}]]
Sum[ksum, {n, 0, N}] // FullSimplify


yields only the unsimplified expression

$\sum_{n=0}^{N} \sum_k A[k] e^{2ikn\pi}$.

Is it possible to make Mathematica do this?

• TIP: don't use upper-case variables. N, in particular, has an already built-in meaning (cf. N). As a rule of thumb, always use lower-case user-defined variables/functions. Aug 23 '18 at 20:17
• Your Mathematica code is not an exact match for the equations you have written. I think you are missing a /N. Your final summation limits have also changed. Aug 23 '18 at 21:43

FullSimplify[Sum[Exp[I*2 Pi*k*n/nN], {n, 0, nN}]]

FullSimplify[Sum[Exp[I*2 Pi*k*n/nN], {n, 0, nN}], k \[Element] Integers]