I'm having trouble understanding something from the linear regression chapter of Elements of Statistical Learning.
We have a fixed $N\times p$ matrix $\mathbf{X}$ ($N$ inputs with $p$ predictors) that gives us the observations $\mathbf{y}$ which are "uncorrelated and have constant variance $\sigma^2$." Our predictions $\mathbf{\hat{y}}$ are given using the standard least squares solution, $\mathbf{\hat{y}}=\mathbf{X}\hat{\beta}=\mathbf{X}(\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{y}$. Apparently, an unbiased estimator of the variance $\sigma^2$ is given by:
$$ \hat{\sigma}^2 = \frac{1}{N-p-1}\sum_{i=1}^N(y_i - \hat{y_i})^2 $$ Or the residual sum of squares divided by the degrees of freedom. This leads to: $$ (N-p-1)\hat{\sigma}^2 \sim \sigma^2\chi^2_{N-p-1} $$
I'm familiar with Bessel's Correction, but I still couldn't reconcile these two. Proof that the first one is an unbiased estimator or that the similarity in the second one is true would be greatly appreciated!