Solution (source code)

= Solution

The parameters are $\mu\in\mathbb R$, $|\phi|<1$ and innovation <variance> $\sigma^2>0$. Stationarity gives $X_1\sim N(\mu,\sigma^2/(1-\phi^2))$, and the <Markov property> gives $X_t\mid X_{t-1}\sim N(\mu+\phi(X_{t-1}-\mu),\sigma^2)$. Multiplying the initial density and the transition densities yields the <stationary Gaussian AR1 likelihood>, with $n=31$:
$$
\boxed{L(\mu,\phi,\sigma^2;x)=(2\pi\sigma^2)^{-n/2}\sqrt{1-\phi^2}\exp\left[-\frac{(1-\phi^2)(x_1-\mu)^2+\sum_{t=2}^n\{(x_t-\mu)-\phi(x_{t-1}-\mu)\}^2}{2\sigma^2}\right].}
$$
The initial-observation factor depends on all three parameters and must be retained for the full stationary <likelihood function>. Omitting it gives a conditional likelihood given $X_1$, a different objective.