Finding the linear prediction coefficients for a sampled sinusoid
In the absence of more details, I assume that


the phase $\Theta$ is a random variable and
$\Theta$ is uniformly distributed on the interval $[0,2\pi]$, so that its probability density function is $\frac{1}{2\pi}$ on that interval.


This is a common choice of model for such problems, and I will show that its guarantees that the stochastic process $x$ is wide-sense stationary (WSS).

\begin{equation}
\begin{split}
\mathsf{E}[x[n]] &amp;=~ \mathsf{E}[2\sin(0.25\pi n + \Theta)]\\
&amp;=~ 2\mathsf{E}[\sin(0.25\pi n + \Theta)]\\
&amp;=~ 2\int_{0}^{2\pi}\sin(0.25\pi n + \theta)\frac{1}{2\pi}d\theta\\
&amp;=~ \frac{1}{\pi}\int_{0}^{2\pi}\sin(0.25\pi n + \theta)d\theta
\end{split}
\end{equation}
The integral is the integral of sine over a $2\pi$-wide interval, so it is equal to 0. Hence $\mathsf{E}[x[n]] = 0$, independent of $n$.

\begin{equation}
\begin{split}
\mathsf{Var}[x[n]] &amp;=~ \mathsf{E}\left[\left(x[n] - \mathsf{E}[x[n]]\right)^2\right]\\
&amp;=~ \mathsf{E}\left[\left(x[n] - 0\right)^2\right]\\
&amp;=~ \mathsf{E}\left[x[n]^2\right]\\
&amp;=~ \mathsf{E}\left[4\sin^2(0.25\pi n + \Theta)\right]\\
&amp;=~ 4\int_{0}^{2\pi}\sin^2(0.25\pi n + \theta)\frac{1}{2\pi}d\theta\\
&amp;=~ \frac{2}{\pi}\int_{0}^{2\pi}\sin^2(0.25\pi n + \theta)d\theta\\
&amp;=~ \frac{2}{\pi}\times\pi ~=~ 2,
\end{split}
\end{equation}
which is independent of $n$. We see that $x$ is a WSS process.

This is important because we rely on expected values of the form
\begin{equation}
\begin{split}
\mathsf{E}[x[n]x[m]] &amp;=~ \mathsf{E}[4\sin(0.25\pi n + \Theta)\sin(0.25\pi m + \Theta)]\\
&amp;=~ \frac{4}{2\pi}\int_{0}^{2\pi}\sin(0.25\pi n + \theta)\sin(0.25\pi m + \theta)d\theta
\end{split}
\end{equation}
I leave it as an exercise to show that the value of this integral depends only on the difference $n-m$ and not on $n$ and $m$ separately.

In particular, we can define $R[i] = \mathsf{E}[x[n]x[n-i]]$ and know that $R[i]$ is really a function of $i$ alone and has no dependence on $n$.

For second-order linear predictive coding (LPC), we estimate $x[n]$ from the previous two values:
\begin{equation}
\widehat{x}[n] = a_1x[n-1] + a_2x[n-2].
\end{equation}
The error is then
\begin{equation}
\begin{split}
e[n] &amp;=~ x[n] - \widehat{x}[n]\\
 &amp;=~ x[n] - a_1x[n-1] - a_2x[n-2].
\end{split}
\end{equation}
The coefficients $a_1$ and $a_2$ must be chosen to minimize mean square error, which is $\mathsf{E}[e[n]^2]$.

To minimize mean square error, the error must be stochastically orthogonal to the random variables that make up the estimate:

\begin{eqnarray}
\mathsf{E}[e[n]x[n-1]] &amp;=&amp; 0,\\
\mathsf{E}[e[n]x[n-2]] &amp;=&amp; 0.
\end{eqnarray}
These will give us linear equations whose solution reveals the proper choice of $a_1$ and $a_2$.

\begin{equation}
\begin{split}
\mathsf{E}[e[n]x[n-1]] &amp;=~ \mathsf{E}\left[\left(x[n] - a_1x[n-1] - a_2x[n-2]\right)x[n-1]\right)]\\
&amp;=~ \mathsf{E}[x[n]x[n-1]] - a_1\mathsf{E}[x[n-1]^2] - a_2\mathsf{E}[x[n-2]x[n-1]]\\
&amp;=~ R[1] - a_1R[0] - a_2R[1]
\end{split}
\end{equation}
Since we want this quantity to be equal to zero, we have the linear equation
\begin{equation}
R[0]a_1 + R[1]a_2 = R[1].
\end{equation}

\begin{equation}
\begin{split}
\mathsf{E}[e[n]x[n-2]] &amp;=~ \mathsf{E}\left[\left(x[n] - a_1x[n-1] - a_2x[n-2]\right)x[n-2]\right)]\\
&amp;=~ \mathsf{E}[x[n]x[n-2]] - a_1\mathsf{E}[x[n-1]x[n-2]] - a_2\mathsf{E}[x[n-2]^2]\\
&amp;=~ R[2] - a_1R[1] - a_2R[0]
\end{split}
\end{equation}
Since we also want this quantity to be zero, we have the linear equation
\begin{equation}
R[1]a_1 + R[0]a_2 = R[2].
\end{equation}

We now have the system of equations
\begin{equation}
\left(\begin{array}{cc}
R[0] &amp; R[1]\\
R[1] &amp; R[0]
\end{array}\right)
\left(\begin{array}{c}a_1\\a_2\end{array}\right)
=
\left(\begin{array}{c}R[1]\\R[2]\end{array}\right),
\end{equation}
whose solution is
\begin{equation}
\left(\begin{array}{c}a_1\\a_2\end{array}\right)
= \frac{1}{R[0]^2 - R[1]^2}
\left(\begin{array}{c}
R[0] &amp; -R[1]\\-R[1] &amp; R[0]
\end{array}\right)
\left(\begin{array}{c}R[1]\\R[2]\end{array}\right)
\end{equation}

I leave it as an exercise to compute the correlations $R[0]$, $R[1]$, and $R[2]$.


An aside: In higher-order LPC we take advantange of the very nice structure of the matrix in the linear equations (it's a Toeplitz matrix). That structure allows one to use the so-called Levinson-Durbin algorithm to solve it numerically. While the matrix is real symmetric and thus is numerically amenable to numerous algorithms, Levinson-Durbin is the one used in practice because of its speed and because it yields other useful quantities as it runs. These reflection coefficients (RCs) that it yields along the way, are proxies for the linear prediction coefficients (LPCs).

I should note here that there are sometimes differences in sign. See, for example, the help page for MATLAB's lpc function. But once the signs are chosen, there is consistency afterward. Check the definition of LPC in your example before starting.

The filter to compute the error is $x[n] - a_1x[n-1] - a_2x[n-2]$, so the impulse response is $\mathbf{h} = (h_0, h_1, h_2) = (1, -a_1, -a_2)$. The corresponding frequency response is
\begin{equation}
H(e^{i\omega}) = 1 - a_1e^{-i\omega} - a_2e^{-2i\omega}.
\end{equation}

In some applications (such as vocoders), the error ($x[n] - \widehat{x}[n]$) is assumed to be a noise process. If the LPCs have been received, then a realization of the noise process is generated, and an approximation of the original signal is created by using the inverse filter, which is an IIR filter with $z$-transform
\begin{equation}
\frac{1}{H(z)} = \frac{1}{1 - a_1z^{-1} - \cdots - a_kz^{-k}}.
\end{equation}