Average and autocorrelation of $\sum_{k=-\infty}^{+ \infty} (-1)^{k+1}\delta(t-kT)$ I was trying to calculate the average and the autocorrelation of this periodic signal:
$X(t) = \sum_{k=-\infty}^{+ \infty} (-1)^{k+1}\delta(t-kT)$
I think that $E[X(t)]$ should be $0$ because the signal is basically made by alternating a positive and a negative Dirac $\delta$.
I found that period is $2T$. But if I calculate $E[X(t)]$ in $[-T;+T]$ i find two positive deltas and a negative one so $E[X(t)]=+1$ . In $[0,+2T]$ two negative ones and one positive so $E[X(t)]=-1$. But the average must be equal in every interval with $2T$ length. Where I am wrong?
For the correlation, I would calculate it using:
$E[X(t)]=P_0$ where $P_0$ is a Fourier coefficient.
Then: $E[X(t)X(t-\tau)] = \sum |{P_k^2}| e^{j2\pi nf_ot}$ 
But I can't find a proper way to calculate the $P_k$ Fourier Coefficients
 A: If you replace the delta functions with approximations that are tall narrow spikes that have width greater than $0$ you can see what is going on.  When you integrate from $-T$ to $T$ you get the second half of the positive spike at $-T$, the whole negative spike at $0$, and the first half of the positive spike at $T$.  When you integrate from $0$ to $2T$ you get two half negative spikes and one whole positive spike.  In each of these cases the integral comes out $0$ as expected.  If you integrate over any other period of length $2T$ you get one of each spike and again the integral comes out zero.  A delta function on the boundary of the integration integral should only count half weight.  
For the autocorrelation, squares of delta functions are hard to deal with.  You get infinite power in zero bandwidth at period $T$ and zero power at any other frequency.  There are conditions of square integrability on the function that the delta function violates.  You can see that by using the tall spike approach.  If you use a tall narrow square wave the integral is easy to calculate. Then when you let the width of the spike go to zero and the height go to infinity the correlation blows up.
A: By integrating over a closed interval, you have an overlap on the interval borders for successive intervals; for example, $[0;2T]\cap[2T;4T] = \{2T\} \ne \emptyset$. Normally this doesn't matter, as the value of a function at one point doesn't affect the integral, but when using the delta distribution, you have to be careful about this.
So you have to integrate either over $[-T;+T)$ or over $(-T;+T]$, and similarly either over $[0;2T)$ or over $(0;2T]$. When doing so, you'll find in both cases that there are only two delta peaks in that interval.
On the autocorrelation part, you have the additional problem that the delta distribution is not square integrable. However, you can still calculate the expectation value as distribution, using the formula
$$\int \delta(x-a)\,\delta(x-b)\,\mathrm dx = \delta(a-b)$$
as long as $a$ and $b$ are in the set you integrate over (otherwise the integral just is zero).
Thus we have for $0\le\tau<T$ (using the interval $[0;2T)$ for integration):
$$\begin{aligned}
E[X(t)X(t-\tau)] &= \int_{[0;2T)}
\left(\sum_k (-1)^{k+1} \delta(t-kT)\right)
\left(\sum_l (-1)^{l+1} \delta(t-\tau - lT)\right)\,\mathrm dt\\
&= 2\delta(\tau)-\delta(\tau+T)-\delta(\tau-T)
\end{aligned}$$
where the main part is to determine for which $k,l$ the peaks are inside the interval. For $\tau$ in other ranges similar results should occur.
Now having this distribution form, doing the Fourier transform shouldn't be too hard to do.
