Consider the multiple linear regression model $y = Xβ + ε$, where $X$ is the $n × p$ design matrix, $y$ is the $n × 1$ dimensional vector of response and $ε ∼ N(0,σ^2I)$. The vector consisting of the average of $y$ is given by $$\bar y = \frac{\mathbb{I}}{n} y = X_2(X_2' X_2)^{−1}X_2 y, $$ where $\mathbb{I}$ is an $n×n$ matrix of ones and $X_2$ is a vector of ones.
a. Prove $$( y − \hat y )' ( \hat y − \bar y)= 0$$ by showing that $$( y − \hat y )' ( \hat y − \bar y)= y ' ( I − H ) ' ( H − \frac{\mathbb{I}}{n} ) y \tag 1$$ where $H=X(X'X)^{-1}X'$ and then use the fact that $(I −H)X = 0 $ (an $n×p$ matrix of zeros).
I can show (1) but don't don't know how to manipulate to show it equals zero. Here's my attempt:
$y ' ( I − H ) ' ( H − \frac{\mathbb{I}}{n} ) y= (( I − H )y)' ( H − \frac{\mathbb{I}}{n} ) y \quad $
$\qquad \qquad \qquad \quad=((I-H)ε)'( H − \frac{\mathbb{I}}{n} ) y \qquad$ and then I'm stuck.
b. Show $$\operatorname{Cov}( y − \hat y , \hat y − \bar y)= 0$$
Let $S$ be the space spanned by the columns of $X$. Then $H$ is an orthogonal projection onto $S$ and $I - H$ is an orthogonal projection onto $S^\perp$. Since
$$ y - \hat{y} = (I - H)y \in S^\perp $$
and
$$ \hat{y}-\bar{y} = Hy - (1/n)\mathbb{I}y $$
we have that $(y - \hat{y})^T(\hat{y}-\bar{y}) = (1/n)y^T(I-H)\mathbb{I}y$. By the definition of $\mathbb{I}$, $\mathbb{I}y = \alpha\mathbf{1}$, where $\mathbf{1}$ is the vector of all ones and $\alpha\in\mathbb{R}$. Since the first column of the design matrix $X$ equals $\mathbf{1}$ it follows that $\alpha Xe_1 = \alpha\mathbf{1} = \mathbb{I}y$, where $e_1$ is the first canonical basis vector in $\mathbb{R}^n$. Hence, $\mathbb{I}y \in S$, which implies that $(I-H)\mathbb{I}y = 0$ and proves the result.
For part (b) you may use the fact that $H\mathbb{I} = \mathbb{I}$ by the arguments above to show that the covariance is zero.