compute temporal average of $\sin(\omega_0t+\Phi)\sin(\omega_0t+\omega_0\tau+\Phi)$ assuming that $\Phi$ is uniformly distributed over $(0,2\pi)$ compute:
$$E[\sin(\omega_0t+\Phi)\sin(\omega_0t+\omega_0\tau+\Phi)]$$
I have solved the problem as continues:
$$\begin{align}
E[\sin(\omega_0t+\Phi)\sin(\omega_0t+\omega_0\tau+\Phi)]&=\frac{1}{2\pi}\int_0^{2\pi}\sin(\omega_0t+\Phi)\sin(\omega_0t+\omega_0\tau+\Phi)\,dt\\
&=\frac{1}{4\pi}\int_0^{2\pi}(\cos(\omega_0\tau)-\cos(2\omega_0t+2\Phi+\omega_0\tau))\,dt\\
&=\frac{1}{4\pi}[t\,cos(\omega_0\tau)-\frac{1}{2\omega_0}\sin(2\omega_0t+2\Phi+\omega_0\tau)]_0^{2\pi}\\
&=\frac{1}{4\pi}[(2\pi)\cos(\omega_0\tau)-\frac{1}{2\omega_0}(\sin(4\pi\omega_0+2\Phi+\omega_0\tau)-\sin(2\Phi+\omega_0\tau))]\\
&=\frac{1}{2}\cos(\omega_0\tau)-\frac{1}{8\pi\omega_0}(\sin(4\pi\omega_0+2\Phi+\omega_0\tau)-\sin(2\Phi+\omega_0\tau))
\end{align}$$  
but the book that I am studying has written $\frac{1}{2}\cos(\omega_0\tau)$ as the answer could you tell me what am I doing wrong?  
P.S.
$\sin(\omega_0t+\Phi)\sin(\omega_0t+\omega_0\tau+\Phi)$ is a stochastic. if I integrate with respect to $\Phi$ I'll get ensemble average but if I integrate with respect to time I'll get temporal average. here I'm trying to compute the temporal average but I'm totally not sure about the interval of integration
 A: In order to compute temporal average, I should use the formula:
$$\mu_X=\lim_{T\to\infty}\hat\mu_X=\lim_{T\to\infty}\frac{1}{2T}\int_{-T}^T X(t)dt$$ so we have:
$$\begin{align}
\hat\mu_X&=\frac{1}{2T}\int_{-T}^T \sin(\omega_0t+\Phi)\sin(\omega_0t+\omega_0\tau+\Phi)\,dt\\
&=\frac{1}{4T}\int_{-T}^T (\cos(\omega_0\tau)-\cos(2\omega_0t+2\Phi+\omega_0\tau))\,dt\\
&=\frac{1}{4T}[t\cos(\omega_0\tau)-\frac{1}{2\omega_0}\sin(2\omega_0t+2\Phi+\omega_0\tau)]_{-T}^T\\
&=\frac{1}{4T}[2T\cos(\omega_0\tau)-\frac{1}{2\omega_0}(\sin(2\omega_0T+2\Phi+\omega_0\tau)-\sin(-2\omega_0T+2\Phi+\omega_0\tau))]\\
&=\frac{1}{4T}[2T\cos(\omega_0\tau)-\frac{1}{\omega_0}(\sin(2\omega_0T)\cos(2\Phi+\omega_0\tau))]\\
&=\frac{\cos(\omega_0\tau)}{2}-\frac{\sin(2\omega_0T)}{4T\omega_0}\cos(2\Phi+\omega_0\tau)
\end{align}$$then
$$\mu_X=\lim_{T\to\infty}\hat\mu_X=\frac{\cos(\omega_0\tau)}{2}$$
A: I think the problem is that you've integrated the function on the wrong domain. You have to integrate it on a full period which is $\frac{\pi}{\omega_0}$. Since the function you're about to integrate is periodic, you won't need to integrate on an infinite domain.
This way you will get the answer $\frac{1}{2}\cos(\omega_0\tau)$.
A: While there is nothing wrong with sepideh answer, just for the sake of completeness, I would like to show how to calculate the ensemble average, that is the expectation 
$$E[\sin(\omega_0t+\Phi)\sin(\omega_0t+\omega_0\tau+\Phi)]$$
your originally asked for. The random variable under expectation can be written as $f(\Phi)$, where
$$f(x)=\sin(\omega_0t+x)\sin(\omega_0t+\omega_0\tau+x).$$
Since $\Phi$ is uniformly distributed on the interval $(0,2\pi)$, it has constant density $1/2\pi$ concentrated on this interval, and our expectation is 
$$   E[f(\Phi)] = 
     \int_0^{2 \pi} f(x) \frac{1}{2 \pi} \, dx =\\
     \frac{1}{2 \pi} \int_0^{2 \pi} \sin (\omega_0 t + x) \sin (\omega_0 t +
     \omega_0 \tau + x) \, dx =\\
     \frac{1}{4 \pi}  \int_0^{2 \pi} (\cos (\omega_0 \tau) - \cos (2 \omega_0
     t + \omega_0 \tau + 2 x)) \, dx = \frac{1}{2}\cos(\omega_0\tau).
$$
This means your random process is ergodic after all.
