In my notes from university I have written down that the residual standard error (from normal linear regression) has the following distribution
$\frac{\hat{\sigma}^2}{\sigma^2}\sim \frac{\chi^{2}_{n-p}}{n-p}$
I do not understand how this derived though.
We know
$\hat{\sigma}^2 = \frac{1}{n-p} \sum_{i=1}^n{e_i^2}$
e being the residuals of the model
and
$e \sim N(0,\sigma^2M)$
$ M = I_n - X(X^tX)^{-1}X^t$
also
$\chi^2_n = \sum_{i=1}^n{N(0,1)^2}$
So I could understand the result if $e \sim N(0,\sigma^2)$ and the degrees of freedom are n. However the formula does not appear to standardise the M part of the variance.
I believe it has something to do with M being a idempotent matrix of rank n-p but I don't understand how that can be used do derive the above mentioned result.
any help would be greatly appreciated.