Deriving the relation $\sum (y_i - \bar{y})^2 - \sum (y_i - \hat{y}_i)^2 = \sum (\bar{y} - \hat{y}_i)^2$ $y_i$ denotes the observed values of $y$, $\hat{y}_i$ are the projected values from the explanatory variables, and $\bar{y}$ is the mean. This relation is supposed to hold up when one of the explanatory variables is the constant. So far, I have gotten
$$
\sum (y_i - \bar{y})^2 - \sum (y_i - \hat{y}_i)^2 = \sum(-y_i \bar{y} + 2 y_i \hat{y}_i - \hat{y}_i^2)
$$
It seems that if I can somehow show that $\sum y_i \bar{y} = \sum y_i \hat{y}_i$ then the derivation would be complete. Can someone show me how to proceed from here on?
 A: Somewhat ugly answer:
$$
\begin{align*}
\sum_i \left[ \left( y_i - \bar{y}\right)^2 - \left( y_i - \hat{y}_i\right)^2 -  \left(\bar{y} - \hat{y}_i \right)^2 \right] &=
\sum_i \left( y_i^2 - 2\bar{y}y_i + \bar{y}^2 - y_i^2 + 2y_i \hat{y}_i - \hat{y}_i^2 - \bar{y}^2 + 2\bar{y}\hat{y}_i - \hat{y}_i^2\right) \\
&= \sum_i \left(  - 2\bar{y}y_i   + 2y_i \hat{y}_i + 2\bar{y}\hat{y}_i- 2\hat{y}_i^2 \right)\\
&= -2n\bar{y}^2 + 2n\bar{y}^2 + 2\sum_i \hat{y}_i\left(y_i - \hat{y}_i   \right)  \\
&= 2 \sum_i \hat{y}_i\left( y_i - \hat{y_i}\right) 
\end{align*}
$$
Which equals zero because it's basically the orthogonality condition that's used to estimate your $\hat{b}$ vector in ordinary least squares.
Sketch of linear algebra to show this explicitly (it's so much easier and succinct to use matrix notation...)
$$\begin{align*}
\sum_i \hat{y}_i\left( y_i - \hat{y_i}\right) &=(Xb)'(y - Xb)\\
 &= b'X'y-b'X'Xb \\
&= y'X(X'X)^{-1}X'y - y'X(X'X)^{-1}X'X(X'X)^{-1}X'y\\
&= y'X(X'X)^{-1}X'y - y'X(X'X)^{-1}X'y\\
&= 0
\end{align*}
$$
