6

I asked Mathematica to evaluate $$\sum_{i=1}^{\infty} \cos(i a)\cos(i b)$$ where $a$ and $b$ are unspecified real numbers, and it told me the answer was simply $-\frac{1}{2}$. This is clearly wrong, as I expect the series to fail to converge for almost any choice of $a,b$ -- but is there some formal sense in which Mathematica's answer makes sense?

user7530
  • 49,280

1 Answers1

15

Let's get reckless:

$$\begin{align} \sum_{k=1}^\infty \cos (kx) &= \frac{1}{2}\left(\sum_{k=1}^\infty e^{ikx} + \sum_{k=1}^\infty e^{-ikx}\right)\\ &= \frac{1}{2} \left(\frac{e^{ix}}{1-e^{ix}} + \frac{e^{-ix}}{1-e^{-ix}} \right)\\ &= \frac{1}{2}\left(\frac{e^{ix}}{1-e^{ix}} + \frac{1}{e^{ix}-1}\right)\\ &= -\frac{1}{2}. \end{align}$$

Then use

$$\cos (ka) \cos (kb) = \frac{1}{2}\left(\cos \left(k(a+b)\right) + \cos \left(k(a-b)\right)\right)$$

to transform

$$\sum_{k=1}^\infty \cos (ka)\cos (kb)$$

into sums of the above form.

Suffice it to say, the series does actually converge in the sense of distributions.

Daniel Fischer
  • 206,697
  • Yeah, sometimes you have to give Mathematica a nudge in the right direction. – Robert Soupe Jun 27 '14 at 18:38
  • +1. Fine answer. Any time I use Dirac Delta, Heaviside or something like those 'functions' appears a user who says it is wrong, no converge, etc... I appreciate very much your answer. – Felix Marin Jun 28 '14 at 06:43