I don't understand the following derivation:
$$ e_i = y_i - ax_i - b$$
$$ e_i = (y_i - \bar{y}) - a(x_i - \bar{x}) - (b - \bar{y} + a \bar{x}) $$
I don't really understand what they do and why they do it.
To clarify:
$e_i = y_i - \hat{y}_i$, where $ \hat{y}_i$ is the regression function I believe it's called.