Solution (source code)

= Solution

Use the stationary <autoregressive process of order one>
$$
X_t-\mu=\phi(X_{t-1}-\mu)+\varepsilon_t,\qquad\varepsilon_t\overset{\mathrm{iid}}\sim N(0,\sigma^2),\quad|\phi|<1.
$$
Multiplication by $X_{t-1}-\mu$ and expectation, using independence of the innovation from the past, gives the <autocovariance> equation $\gamma(1)=\phi\gamma(0)$. With $\bar X=n^{-1}\sum_tX_t$, define the sample autocovariances using the same denominator:
$$
\widehat\gamma(h)=\frac1n\sum_{t=h+1}^n(X_t-\bar X)(X_{t-h}-\bar X),\qquad h=0,1.
$$
Substitution into that equation gives the <Yule–Walker estimator for an autoregressive process of order one>
$$
\boxed{\widehat\phi_{YW}=\frac{\widehat\gamma(1)}{\widehat\gamma(0)}=\widehat\rho(1).}
$$
This is exactly the lag-one <sample autocorrelation function> under the divisor-$n$ convention, provided the sample has positive variance. Using different divisors for different lags would change the estimator.