I'm working on the below problem
Given a WSS random process $X(n) = K \cos(2\pi n + \Theta)$, where $K$ is a constant and $\Theta$ is a random variable with a uniform distribution between $0$ and $2\pi$. $X(n)$ has mean value $0$ (zero) and autocorrelation $\phi_{xx}(l) = \frac{K^2}{2} cos(2\pi l)$.
$X(n)$ is applied to an N-point moving average filter, producing the output $Y(n)$. Calculate the average output power $P_Y$.
$\textbf{Solution}$
It is clear that $P_X = \frac{K^2}{2} cos(2\pi \cdot 0) = \frac{K^2}{2}$ ($= \sigma_X^2$ since $m_X = 0$).
The $N$ point moving average filter can be described by the impulse response: $h(n) = \frac{1}{N} \sum_{k=0}^{N-1} \delta(n - k)$. The output of the filter has also zero mean ($m_Y = 0$) and also $\sigma_Y^2 = \sigma_X^2 \sum_{n=-\infty}^{\infty}|h(n)|^2 = \sigma_X^2 \frac{1}{N} = \frac{1}{N} \frac{K^2}{2} = P_Y$
However, if I move to the freq domain then I have the following: The power spectral density of the output $Y(n)$ is given by $S_Y(\omega) = |H(e^{j\omega})|^2 S_X(\omega)$. The average output power $P_Y$ is the integral of the power spectral density $S_Y(\omega)$: $P_Y = \frac{1}{2\pi} \int_{-\pi}^{\pi} S_Y(\omega) d\omega$.
The power spectral density of $X(n)$ is the Fourier transform of the autocorrelation function $ \phi_{XX}(l)$, we get: $S_X(\omega) = \mathcal{F}\left\{\frac{K^2}{2} \cos(2\pi l) \right \} = \frac{K^2}{2} \cdot \pi \left( \delta(\omega - 2\pi) + \delta(\omega + 2\pi) \right)$. If I am to use this $S_X(\omega)$ in the integral for $P_Y = \frac{1}{2\pi} \int_{-\pi}^{\pi} S_Y(\omega) d\omega$ then $\delta(\omega \pm 2\pi) = 0$ within the integration limits $[-\pi, \pi]$ and the result is $0$ !
Pretty sure that I 'm having a fundamental error somewhere (probably in the definition of the $P_Y$ integral).
Any inputs are welcomed!!