Take the linear regression model $y_i=ax_i+b + \varepsilon_i, 1\leq i\leq n$.
Let the errors $\varepsilon_i$ follow a normal distribution with mean $0$ and constant variance $\sigma^2$. Let $\hat{a}$ and $\hat{b}$ be the estimators of unknown $a$ and $b$. Let $\hat{y}_i=\hat{a} x_i +\hat{b}$ be the predicted value (at point $x_i$) and $\hat{\varepsilon}_i=y_i-\hat{y}_i$ be the residual.
We know that $\hat{\varepsilon}_i$ follows a normal distribution with mean $0$ and variance $\sigma^2 \left( 1-\frac{1}{n} - \frac{(x_i-\bar{x})^2}{\sum{(x_k-\bar{x})^2}} \right)$ We also know that $\hat{\varepsilon}_i$ and $\hat{\varepsilon}_{j\neq{i}}$ are correlated and $Cov(\hat{\varepsilon}_i, \hat{\varepsilon}_j)=- \sigma^2 \left( \frac{1}{n} + \frac{(x_i-\bar{x})(x_j-\bar{x})}{\sum{(x_k-\bar{x})^2}} \right) $
Then, in any book about regression, we are informed that $\frac{ \sum{{\hat{\varepsilon}_i}^2}}{\sigma^2}$ follows a chi-squared distribution with $n-2$ df.
I am struggling to find and algebraic demonstration of that, NOT using matrix notation and theory (because I don’t need it, having only $1$ independent variable $X$). Should the $\hat{\varepsilon}_i$ be not correlated, we would say that $\sum{{\hat{\varepsilon}_i}^2}$ follow a chi-squared distribution with $n$ df (as sum of squared independent normal distributions). But it’s not the case.
I known the well-spread argument that we have $2$ parameters estimated, so it reduces by $2$ the number of df ; but this is not a demonstration…
For example, I can derive with no matrix formulation at all (say « manually ») the fact that $\hat{y}_i$ follows a normal distribution, using the (previously demonstrated) facts that $\hat{a}$ and $\hat{b}$ follow precise normal distribution and that they are correlated.
But I am stuck with $\frac{\sum{{\hat{\varepsilon}_i}^2}}{\sigma^2}$. I tried to use the fact that $Var(\sum{{\hat{\varepsilon}_i}^2})=\sum{ Cov(\hat{\varepsilon}_i, \hat{\varepsilon}_j)}$, but it gives too complicated calculations (if I have not mistaken me…)
So, I would appreciate any direction for a « manual » demonstration of that chi-squared distribution with $n-2$ df…