I have a problem calculating $$\frac{1}{\sqrt{2\pi}}\sum_{r=-N}^{N-1}e^{-i2arq}\int_a^{2a}Ae^{iqu}du$$
Calculating the integral gives me
$$\frac{A}{iq\sqrt{2\pi}}\left(e^{-iqa}-e^{-i2qa}\right)\sum_{r=-N}^{N-1}e^{-i2arq}$$
From this I dont see how to get to the solution (it is given): $$\frac{A}{\sqrt{2\pi}}e^{\frac{-iaq}{2}}\frac{\sin(2qaN)}{q\cos(\frac{qa}{2})}$$
I would be grateful for any help or advice!
Thank you.
Note that what you need to calculate is a partial sum of a geometric series:
$$ \sum_{r=-N}^{N-1} (e^{-i2aq})^r = \frac{e^{i2aqN} - e^{-i2aqN}}{1 - e^{-i2aq}}$$
Then you have
\begin{align} (e^{-iaq}-e^{-i2aq})\frac{e^{i2aqN} - e^{-i2aqN}}{1 - e^{-i2aq}} &= e^{- i\frac32aq}(e^{i\frac12 aq}-e^{-i\frac12 aq})\frac{e^{i2aqN} - e^{-i2aqN}}{e^{-iaq}(e^{iaq} - e^{-iaq})} = \\ &= e^{- i\frac{aq}{2}} 2i \sin(\frac{aq}{2})\frac{2i\sin(2aqN)}{2i\sin(aq)}\end{align} With just a bit more of trigonometry, you get the desired result.