In this link it says that $Y$ variables has zero covariance (because covariance matrix has only diagonal terms) which implies they are independent.
Actually in linear regression $Y$ takes its expectation values from linear function of $X$ variables whereas takes its variance from error terms. Also $Y$ is normally distributed because of the fact that errors are normally distributed.
So, if $Y$ variables has zero covariance then errors must be zero covariance which means they are independent. Then in parallel with last answer sum of $(Y_i-\hat{Y}_i)^2$ divided by $\sigma^2$ which means sum of error squared divided by $\sigma^2$ must be chi-square with $n$ degrees of freedom. Why do we have $n-p-1$ dgf afterwards?
Could you help me overcome that contradiction?