I've been reading into how to minimize objective functions and I am curious about the following, I have a model $y=X \beta +\epsilon$ where $E[\epsilon|X]=0$ and $Var[\epsilon|X]=\Sigma$ where $\Sigma$ is not diagonal and is a covariance matrix. $\beta$ can be estimated by least squares to get, $$\hat{\beta}=(X^T \Sigma^{-1}X)^{-1}X^T\Sigma^{-1}y$$.
So this comes from the minimization of $(y-X\beta)^T \Sigma^{-1}(y-X\beta)$. Now if I assume that $\epsilon \sim AR(2)$ then $Var[\epsilon|X]=\Sigma=Cov(AR(2))$ making it a covariance matrix with respect to AR(2). So my question is, is there any way to decompose $\Sigma$ in the objective function such that it can be written in the form of the AR(2) coefficients and its variance so that the objective function can be minimized with respect to variance, and AR(2) coefficients if $y, \beta$, and $X$ are known.
Thank you