\item Since the autocorrelation does \textit{not} depend only on $k$ (i.e. the lag), the process is not wide-sense stationary process. Therefore, the power spectral density function can not be defined.
\item Let's introduce a random phase term $\theta\in\mathcal{U}[-\pi,\pi]$ in the signal, obtaining $x[n]= A\cos(\omega_0 n+\theta)+ w[n]$; the random phase term causes the expectation of the cosine to be zero independently of the frequency (since the average value of a sinusoid is zero):
where we have used the trigonometric identity $\cos(\alpha+\beta)=(1/2)(\cos(\alpha-\beta)+\cos(\alpha+\beta))$. Since the autocorrelation $r_x[n,n-k]$ now only depends on the lag $k$, the process is wide-sense stationary and the power spectral density function is:
where the cross-products disappear because the two processes are independent and zero-mean. To find the autocorrelation of $s[n]$ we exploit its recursivity:
\begin{eqnarray*}
r_s[k] &=&\expt{s[n]s^{*}[n-k]}\\
&=&\expt{(a s[n-1] + w_1[n])s[n-k]}\\
&=& a\,r_s[k-1].
\end{eqnarray*}
We also have, for $k=0$,
\begin{eqnarray*}
r_s[0] &=&\expt{(a s[n-1] + w_1[n])^2}\\
&=& a^2\expt{s^2[n-1]} + 1 \\
&=& a^2\,r_s[0] + 1
\end{eqnarray*}
so that
\[
r_s[0]=\frac{1}{1-a^2}.
\]
Then, by induction
\begin{align*}
r_s[1] &= ar_s[0] = \frac{a}{1-a^2}\\
r_s[2] &= ar_s[1] = \frac{a^2}{1-a^2}\\
&\ldots\\
r_s[k] &= \frac{a^k}{1-a^2}\\
\end{align*}
and, similarly, for negative values of the index we have
\begin{solution}{Filtering a sequence of independent random variables in Python}
Below is the code that computes realizations of the output and estimates the PSD. For a comparison with the theoretical value, we need to compute the exact PSD of the output process. Call $s[n]$ the signal coming out of the filter $H(z)$; then:
\item The modulation theorem tells us that $R(e^{j\omega})$ is the convolution of $C(e^{j\omega})$ with $\tilde\delta(\omega-\omega_0)$, i.e.\ $R(e^{j\omega})= C(e^{j(\omega-\omega_0)})$. Since $C(e^{j\omega})=
X(e^{j\omega})+jY(e^{j\omega})$ and both $X(e^{j\omega}), Y(e^{j\omega})$ live on the $[-\omega_c, \omega_c]$ interval, $R(e^{j\omega})$ lives on the $[\omega_0-\omega_c, \omega_0+\omega_c]$ interval. Since $\omega_c < \omega_0 < \pi-\omega_c$, this interval is entirely contained in the $[0, \pi]$ interval, thus $r[n]$ is analytic.
so let us consider the positive-frequency part of $S(e^{j\omega})$. We can see from~(\ref{sn}) that this is the sum of $X(e^{j(\omega-\omega_0)})/2$ and $jY(e^{j(\omega-\omega_0)})/2$, both of which are shifted versions of $X(e^{j\omega})$ and
$Y(e^{j\omega})$ which live between $\omega_0-\omega_c$ and $\omega_0+\omega_c$, i.e.\ in the positive-frequency part of the