# How can I write $e^{ki\theta}/k$ as a nice integral?

I am trying to evaluate the sum $$\sum_{k=1}^{n}\frac{\cos\left(k\theta\right)}{k}$$ using $\sum_{k=1}^{n}e^{ki\theta}/k$ as a first step. I recognize this as being similar to $\log\left(1-e^{i\theta}\right)$ plus some terms for sufficiently large $n;$ however, I am tempted to write $$i\sum_{k=1}^{n}\frac{e^{ki\theta}}{ik}=i\sum_{k=1}^{n}\left(-\int^{+\infty}_{\theta}e^{ki\alpha}\,\mathrm{d}\alpha\right)$$ and then replace the sum and the integral with justification, but I'm not sure the improper integral converges. A careful analysis on the improper integral yields $$-\int^{+\infty}_{\theta}e^{ki\alpha}\,\mathrm{d}\alpha=-\lim_{b\rightarrow+\infty}\int^{b}_{\theta}e^{ki\alpha}\,\mathrm{d}\alpha=\frac{1}{ik}\left[\lim_{b\rightarrow+\infty}\left(e^{ki\theta}-e^{kib}\right)\right]=\frac{1}{ik}\left[e^{ki\theta}-\lim_{b\rightarrow+\infty}\left(e^{kib}\right)\right]$$ and I'm stuck here. I'm not sure how to evaluate $$\lim_{b\rightarrow+\infty}\left(e^{kib}\right)$$ for a couple of reasons. First, I know that if $k\in\mathbb{N}$ and $b\in\mathbb{R},$ then $\left|e^{kib}\right|\leq1.$ It seems that whenever $b$ is close enough to $2t\pi$ ($t$ integer), $\left|e^{kib}\right|$ approches $1.$ In my mind, a graph of $f(x)=\left|e^{kib}\right|$ would sporadically get close to one. For my assumption to behold, I need $\displaystyle\lim_{b\rightarrow+\infty}\left(e^{kib}\right)=0.$ My guts say maybe it is right, but I don't know how to properly justify it. It seems like the limit can be $1,$ another complex number or simply doesn't exist.

So, how can I formally show what $\displaystyle\lim_{b\rightarrow+\infty}\left(e^{kib}\right)$ is? If $\displaystyle\lim_{b\rightarrow+\infty}\left(e^{kib}\right)\neq0,$ is there another integral that nicely fits this situation?

-
$\mathrm e^{\mathrm ikb}$ is a complex number which travels around the unit circle with a speed $k$ and does not have a limit as $b\to\infty$ – Ilya Jan 10 '13 at 17:18

Some hints: we have that $$\sum_k \frac{\cos (k\theta)}{k} = \Re\left(\sum_k \frac{\exp (\mathrm ik\theta)}{k}\right)$$ so that we only have to compute the latter sum. Let $$f(\theta) = \sum_{k=1}^n \frac{\exp (\mathrm ik\theta)}{k},$$ then $$f'(\theta) = \mathrm i\sum_{k=1}^n \exp (\mathrm ik\theta) = \mathrm i \frac{\exp(\mathrm i(k+1)\theta) -1}{\exp(\mathrm i\theta) - 1}.$$ Please tell me if you need some guidelines for the next steps.
I know it, and that's why I was hoping to find $\int_a^be^{ki\alpha}\,\mathrm{d}\alpha$ and find $a$ and $b$ in way that there's no constants hanging around. Which limits of integration should I take? – Ian Mateus Jan 10 '13 at 17:25
So you need to find a function $g(\theta)$ such that $g'(\theta) = \mathrm e^{\mathrm i k\theta}$, right? Then by Newton-Leibniz any integral works which has $\theta$ as the upper limit, e.g. $$g(\theta) = \int_0^\theta \mathrm e^{\mathrm i ks} \mathrm ds$$ – Ilya Jan 10 '13 at 17:29
I was confused with it because it will lead me to $$\int_0^{\theta}e^{kis} \mathrm ds=\frac{e^{ki\theta}}{ik} - \frac{1}{ik},$$ and the latter term diverges in a sum where $n\rightarrow\infty,$ (which I am studying simultaneously) but it's not the case. Thank you. – Ian Mateus Jan 10 '13 at 17:36
@Ilya:so to get $Re(f(\theta))$ do I need to integrate something like $\int_{0}^{\theta} \frac{d \eta}{1-e^{-i \eta}}$ (from the expression for $f'(\theta))$? – Alex Jan 10 '13 at 20:45