# How can I show that $\frac{\sum\limits_i(Y_i-\hat{Y}_i)}{\sigma^2(n-2)}\sim \frac{\chi^2_{(n-2)}}{n-2}$ for simple linear regression.

I am working on simple linear regression with the normal error assumption $$Y_i=\beta_0+\beta_1 X_i+\epsilon_i$$, $$\epsilon_i \sim N(0,\sigma^2)$$ where the estimated mean response is $$\hat{Y}_i=b_0+b_1 X_i$$ with $$b_0= \bar{Y}-b_1\bar{X}$$ and $$b_1=\frac{\sum\limits_i(X_i-\bar{X})(Y_i-\bar{Y})}{\sum\limits_i(X_i-\bar{X})^2}$$.

In the derivation of the distribution of the quantity $$\frac{(b_1-\beta_1)}{s[b_1]}$$, where $$s[b1]$$ is the standard error in $$b_1$$, I have encountered the claim that $$\frac{SSE}{\sigma^2(n-2)}\sim \frac{\chi^2_{(n-2)}}{n-2}$$ where SSE is the sum of the square residual error $$SSE=\sum\limits_i(Y_i-\hat{Y}_i)^2$$.

This seems to me to imply that $$\frac{Y_i-\hat{Y}_i}{\sigma}\sim N(0,1)$$. However, I have not been able to prove the above facts.

Can anybody help me understand why the above quantity is $$\chi^2_{(n-2)}$$ distributed? THANKS!

Note that $$b_0 \sim N( \beta_0, \sigma^2_{b_0} )$$ and $$b_1 \sim N( \beta_1, \sigma^2_{b_1} )$$, hence $$\hat{Y}_i = b_0 + b_1X_i|Y_i \sim N(Y_i, \sigma^2)$$. However, note that $$\{ \hat{Y}_i\}_{i=1}^n$$ are not independent as from the normal equations you have $$\sum_{i=1}^n\hat{Y}_i= \sum_{i=1}^n X_i\hat{Y}_i = 0$$, hence the degrees of freedom of the $$\chi^2$$ distribution is not $$n$$, but $$n-2$$.