# Sum over cosines = dirac delta - how to get the coefficients?

Given this formula:

$$\sum\limits_{n=0}^\infty a_n \cos(n \pi x / d) = \delta(x-x_0)$$

Where $0 \leq x \leq d$. How can one calculate the coeffciients $a_n$?

I googled and searched all kinds of books, but could not find a representation of the Dirac delta to solve this problem.

-
The LHS is invariant by the transformation $x\to x+2d$ but not the RHS. How so? – Did Apr 27 '13 at 12:58
@Did This is from a physical problem. There's the restriction $0 \leq x \leq d$. – Foo Bar Apr 27 '13 at 13:27
The invariance, or lack of invariance, by some translations is very much a physical concept. – Did Apr 27 '13 at 14:51

If you want a Fourier series then you need a repetition of the $\delta$ distribution at the right.

The 'Dirac comb' is defined by : $$\Delta_T(t):=\sum_{k=-\infty}^\infty \delta(t-kT)$$ with $$\Delta_T(t)=\frac 1T\sum_{n=-\infty}^\infty e^{i2\pi nt/T}=\frac 1T+\frac 2T\sum_{n=1}^\infty \cos\left(\frac{2\pi nt}T\right)$$

Replace $\frac T2$ by $d\$ and $\ t$ by $x-x_0$ to get an interesting result

-
I edited my question, I forget the boundaries, sorry. – Foo Bar Apr 27 '13 at 13:29
@FooBar: Note too that a $\sin(\pi n x/d)$ term will appear for general choices of $x_0$ (after the $t=x-x_0$ substitution I proposed)... – Raymond Manzoni Apr 27 '13 at 13:45
@RaymondManzoni: The sine terms can be avoided. I've given the details in my answer below. – user26872 Jun 3 '13 at 2:05
@oen: Hmmm... without the $\sin$ terms (your solution corresponds to mine without $\sin\frac{n\pi x}{d} \sin \frac{n\pi x_0}{d}$) you'll get an even function and clearly the $\delta$ distributions are not symmetric around the origin for general $x_0$ so that you should be in trouble. – Raymond Manzoni Jun 3 '13 at 12:33
@RaymondManzoni: It is a symmetrized version of your solution (there are some critical factors of $2$). I've added some details below. – user26872 Jun 3 '13 at 17:32

Here's another approach.

Consider the boundary value problem $$f''+\lambda^2f = 0$$ where $f'(0) = f'(d)=0$. The orthonormal solutions $$f_n(x) = \begin{cases} \sqrt{\frac{1}{d}}, & n = 0 \\ \sqrt{\frac{2}{d}} \cos \frac{n\pi x}{d}, & n\ne 0 \end{cases}$$ form a basis for square integrable function on $[0,d]$. As such, they satisfy a completeness relation $$\sum_n f_n(x)f_n(x_0) = \delta(x-x_0).$$ Therefore, $$\frac{1}{d} + \frac{2}{d}\sum_{n=1}^\infty \cos \frac{n\pi x}{d} \cos \frac{n\pi x_0}{d} = \delta(x-x_0).$$ This solution is a symmetrized version of @RaymondManzoni's---it is $\Delta_{2d}(x-x_0) + \Delta_{2d}(x+x_0)$. It has period $2d$ so the Dirac comb's don't interfere with one another on $[0,d]$. On the interval of interest it is $\delta(x-x_0)$ and it does not contain terms of the form $\sin\frac{n\pi x}{d}$.

Below we plot the sums for $\Delta_{2d}(x-x_0)$ and $\Delta_{2d}(x-x_0) + \Delta_{2d}(x+x_0)$. We cut off the sums at $n=15$, let $d=1$, and $x_0=1/3$.

-