# Transforming this serie to a definite integral.

Basically i need to simplify the following summation: $$\sum_{n=0}^\infty \frac{cos(nx)}{n^2}$$ As far as i know this summation is equal to $$\frac{x^2}{2}-\frac{\pi x}{4}+\frac{\pi ^2}{6}$$ when $[0\le x \le 2\pi]$. Now for the project I'm trying to calculate this for the value of $x$ is never included in such interval. So, given that $cos(x) = cos(x +2\pi k)$ i can actually solve this equation by changing the variable to $y=x-2\pi k$ and simplifying with this. But the resulting equation is an equation with 2 variables, $x$ and $k$, that ain't the result i was looking for (i know as well that $k$ is technically not a variable since you can actually find her, but to do so you need to use modulo which has no math equation and therefore is not the thing i was looking for).

So the alternative i have is to convert such summation in a definite integral, i guess. I've spent few hours looking for an actual method to do so without any result (since I'm a computer engineer, not a mathematician, and I've never had to study deeply calculus). I was wondering if you guys can actually point me to the right direction on this. To actually give you more infos about that my summation is in the form $$2\sum_{n=0}^\infty \frac{cos(nxm)}{n^2 m^2}$$ where $m$ is a generic multiplication factor. Ultimately I apologize for my English but understand it's not my first language.

• Is $k$ guaranteed to be an integer? – Eric Towers Mar 23 '18 at 15:52
• Well i guess if $k$ is not an integer you can't write $$cos(x) = cos(x+2\pi k)$$ – Lyn Cassidy Mar 23 '18 at 16:05
• Is it possible to use$$\frac 1a=\int\limits_0^{\infty}dt\, e^{-at}$$for $\Re(a)>0$? – Crescendo Mar 23 '18 at 18:08
• @FelixMarin you're right I've made a mistake in writing that: the summation starts at $n=1$ – Lyn Cassidy Mar 23 '18 at 19:03

$\newcommand{\bbx}{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}{\displaystyle{#1}} \newcommand{\expo}{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}{\mathcal{#1}} \newcommand{\mrm}{\mathrm{#1}} \newcommand{\pars}{\left(\,{#1}\,\right)} \newcommand{\partiald}[]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}{\left\vert\,{#1}\,\right\vert}$ \begin{align} \sum_{n = \color{red}{1}}^{\infty}{\cos\pars{nx} \over n^{2}} & = \Re\sum_{n = \color{red}{1}}^{\infty}{\pars{\expo{\ic x}}^{n} \over n^{2}} = \Re\mrm{Li}_{2}\pars{\expo{\ic x}} \\[5mm] & = {1 \over 2}\pars{\mrm{Li}_{2}\pars{\expo{2\pi\ic\braces{x/\bracks{2\pi}}}} + \mrm{Li}_{2}\pars{\expo{-2\pi\ic\braces{x/\bracks{2\pi}}}}} \\[5mm] & = {1 \over 2}\bracks{-\,{\pars{2\pi\ic}^{2} \over 2!} \,\mrm{B}_{2}\pars{x \over 2\pi}}\,,\qquad\qquad \left\{\begin{array}{rcl} \ds{{x \over 2\pi} \in \left[0,1\right)} & \mbox{if} & \ds{\Im\pars{x} \geq 0} \\[2mm] \ds{{x \over 2\pi} \in \left(0,1\right]} & \mbox{if} & \ds{\Im\pars{x} < 0} \end{array}\right. \end{align}

See this link. $\ds{\mrm{B}_{n}}$ is a Bernoulli Polynomial. Note that $\ds{\mrm{B}_{2}\pars{z} = z^{2} - z + {1 \over 6}}$.

Then, \begin{align} \sum_{n = \color{red}{1}}^{\infty}{\cos\pars{nx} \over n^{2}} & = \pi^{2}\bracks{\pars{x \over 2\pi}^{2} - {x \over 2\pi} + {1 \over 6}} = \bbx{{1 \over 4}\,x^{2} - {\pi \over 2}\,x + {\pi^{2} \over 6}} \end{align}

• This is now super-interesting. Since i know nothing about Polylogarythms and Bernoulli Polynomials, can you give me some advice on books that a computer engeneer could understand on the argument? much appreciated. – Lyn Cassidy Mar 23 '18 at 20:39
• @LynCassidy I suggests you start with the $\texttt{Wikipedia}$ links I provided in the answer. – Felix Marin Mar 24 '18 at 17:30
• Just a quick question: how can you justify the polylogarythm conversion to the point $$\Re{Li_2 (e^{ix})}$$ if $e^{ix} = cos(x)+i\cdot sin(x)$ which means $|e^{ix}| = 1$ for any given x. That might be a problem because 1 is outside the upper boundary of the polylogarythm. – Lyn Cassidy Mar 27 '18 at 13:09
• Felix Marin could you explain better what you've done here? I can't understand the third to fourth passage. Where you convert the Real part of the dilog to a sum of two different dilogs. Are you using real part function? – Lyn Cassidy Apr 2 '18 at 19:19
• @LynCassidy Yes. Because $\displaystyle\Re\left(z\right) = {1 \over 2}\,\left(z + \bar{z}\right)$. The relation between the $\mathrm{Li}_{s}$ and $\texttt{Bernoulli Polynomial}$ is given in the cited link ( Jonqui$\mathrm{\grave{e}}$re's Inversion Formula ). Thanks. – Felix Marin Apr 2 '18 at 20:00

Addressing the content of your first paragraph...

Let $x = \hat{x}+2\pi k$ for $k$ an integer. In your sum, $n$ is also an integer. Then \begin{align*} \cos(nx) &= \cos(n(\hat{x}+2\pi k)) \\ &= \cos(n\hat{x}+2\pi k n) \\ &= \cos(n\hat{x}) \text{,} \end{align*} because $kn$, the product of two integers, is also an integer. Consequently, the value of $k$ has no effect on the sum of your series.

• That's true, the problem is not the effect k has on my summation but the effect it has on the resulting identity, for I get, as written above, an equation with 2 variables: $$\frac{(x-2\pi k)^2}{2} - \frac{\pi(x-2\pi k)}{4} + \frac{\pi ^2}{6}$$ – Lyn Cassidy Mar 23 '18 at 16:06
• Replace $x$ with $\hat{x}$ at the outset, then there are no $k$s at any subsequent point. – Eric Towers Mar 23 '18 at 16:14
• I tried, it doesn't work. I mean from a general prospective what you say might be true, but unfortunately the final result is not the correct one. I really appreciated the answers tho, thanks. – Lyn Cassidy Mar 23 '18 at 16:31
• @LynCassidy : Could you demonstrate that the final result is incorrect in your Question? At this point, I cannot guess why your work convinces you the final result is not the correct one. – Eric Towers Mar 23 '18 at 16:34
• Unfortunately i can't give you the smaller details, but if i didn't misunderstand your previous comment the outcome should be simply $$\frac{\hat x^2}{2}-\frac{\pi \hat x}{4} + \frac{\pi ^2}{6}$$. I got a difference of two of these summations in my equation. Simplifying without $k$ reduces my equation to simply $x$, which is wrong. On this you'll have to trust me. In case i actually misunderstood your comment please give me an explicit example. – Lyn Cassidy Mar 23 '18 at 16:47