In the method of least square I have the following
$\hat{B_1}=\frac{\sum (Y_i-\bar{Y})X_i} {\sum (X_i-\bar{X})X_i} \\ ~~~~= \frac{\sum (Y_i-\bar{Y})(X_i-\bar{X})} {\sum (X_i-\bar{X})^2} \\ ~~~~= \frac{S_{XY}}{S_{XX}}$
So my question is about the derivation of the second equality. Could you please explain how you arrived at that step? Thank you.