I'm studying linear regression with Draper's Applying regression analysis book There is a formula for coefficient b1 which is clear to me:
$$ b_{1}= \frac{n\sum x_{i}y_{i}-\sum x_{i}\sum y_{i}}{n\sum x_{i}^2 - \sum x_{i}\sum x_{i}} $$ What I can't understand is how to get this one: $$ b_{1}= \frac{\sum \left (X_{i}-\overline{X} \right )\left (Y_{i}-\overline{Y} \right )}{\sum \left ( X_{i}-\overline{X} \right )^2} $$
$\sum \left (X_{i}-\overline{X} \right )\left (Y_{i}-\overline{Y} \right )=\sum X_i Y_i-(\sum X_i) \overline{Y}-\overline{X} (\sum Y_i)+n\overline{X}\overline{Y}$. Thus $\sum \left (X_{i}-\overline{X} \right )\left (Y_{i}-\overline{Y} \right)=\sum X_i Y_i-n\overline{X}\overline{Y}$. Using this also for $X=Y$ the second expression reads as $\displaystyle\frac{\sum X_i Y_i-n\overline{X}\overline{Y}}{\sum X_i^2-n\overline{X}^2}$. Multiplying both, nominator and denominator, with $n$ gives the first expression for $b_1$.