How does the intercept parameter in a linear regression change when the data points are uniformly shifted? I was trying to follow the proof that shows that $a = \overline{y}$ in the least squares regression line $$\hat{y_i}=a + b(x_i - \overline{x})$$
but I don't understand why $\sum_{i=1}^{n} (x_i - \overline{x}) = 0$. The following is the proof:

In order to derive the formulas for the intercept a and slope b, we need to minimize:
  $$Q = \sum_{i=1}^{n}(y_i - (a + b(x_i - \overline{x})))^2$$
  Starting with the derivative of $Q$ with respect to $a$, we get:
  $$\frac{\partial Q}{\partial a} = 2 \sum_{i=1}^{n} (y_i - (a + b(x_i - \overline{x}))) (-1) \stackrel{SET}{=} 0
$$
Now, we solve for $a$:
  \begin{align*}
-\sum_{i=1}^{n} (y_i - (a + b(x_i - \overline{x}))) &= 0\\
-\sum_{i=1}^{n} y_i + \sum_{i=1}^{n} a + b \sum_{i=1}^{n} (x_i - \overline{x}) &=\\
-\sum_{i=1}^{n} y_i + n a + 0 &= \\
a &= \frac{\sum_{i=1}^{n} y_i}{n} = \overline{y}
\end{align*}

 A: $$\sum_{i=1}^{n} (x_i - \overline{x})=\sum_{i=1}^{n} x_i - \sum_{i=1}^{n}\overline{x}$$
$$=\sum_{i=1}^{n} x_i-n\overline{x}$$
$$=\sum_{i=1}^{n} x_i-n\frac{\sum_{i=1}^{n} x_i}{n}=0$$
A: Problem statement:
Given a sequence of measurements $\left\{ x_{k}, y_{k} \right\}_{k=1}^{m}$, a least squares fit using the trial function $y(x)= a + bx $ produces the parameters $(a,b)$. Now consider shifting the $x$ measurements by the mean value $\bar{x}$. How does the intercept parameter change?
Start with measurements $\left\{ u_{k}, v_{k} \right\}_{k=1}^{m}$, where $u_{k}=x_{k}+\bar{x}$, and $v_{k}=y_{k}$. Find the parameters $\left( \alpha, \beta \right)$ which minimize the merit function
$$
 r^{2}(\alpha, \beta) =
\sum_{k=1}^{m} \left( v_{k} - \alpha - \beta u_{k}\right)^{2}.
$$
The minimization requirement on $\alpha$ is
$$
\frac{\partial} {\partial \alpha} r^{2} = -2\sum_{k=1}^{m} \left( v_{k} - \alpha - \beta u_{k}\right) = 0
$$
yields
$$
  m \alpha =  \sum_{k=1}^{m} \left( v_{k} + \beta u_{k}\right)
$$
Divide through by $m>0$, and revert back to the original coordinates:
$$
\begin{align}
  \alpha 
&= \sum_{k=1}^{m} \left( \frac{y_{k}}{m} + \frac{\beta \left( x_{k} - \bar{x}\right)}{m}\right) \\
&= \bar{y} + \beta \bar{x} - \frac{\beta}{m} m\bar{x} \\
&= \bar{y}
\end{align}
$$
Another approach is to start with the intercept parameter
$$
a = \frac
{\sum x^{2} \sum y - \sum x \sum xy}
{m \sum x^{2} - \left( \sum x \right)^{2}}
$$
and evaluate what happens when $x_{k}\to x_{k} - \bar{x}$. The transformation rules are
$$
\begin{align}
  a &\mapsto \alpha \\
%
  \sum y &\mapsto \sum y \\
%
  \sum x &\mapsto \color{red}{0} \\
%
\end{align}
$$
Therefore
$$
 \alpha = \frac
{\sum x^{2} \sum y - \color{red}{\sum x} \sum xy}
{m \sum x^{2} - \left( \color{red}{\sum x} \right)^{2}}
= \frac
{\sum y \sum x^{2} }
{m \sum x^{2}} =
%
\bar{y}
$$
The picture below shows how a translation affects the fit parameters in linear regression: the slope does not change, the intercept moves to $\bar{y}$.

