While deriving Least Squares Estimators, how to find the derivate of a summation operate? I'm calculating the Least Squares Estimators. There was one step here:
$\frac{d}{d\hat\alpha}{\sum(y_i-\hat\alpha-\hat\beta x_i)}^2=0$ -->
$-2{\sum(y_i-\hat\alpha-\hat\beta x_i)}=0$
I know it is related to the chain rule, yet I don't know how it is applied here. Can someone please explain? Huge huge thanks!

We have
\begin{align*}
\frac{d}{d\hat\alpha}\sum_{i=1}^n(y_i-\hat\alpha-\hat\beta x_i)^2
&=\sum_{i=1}^n\frac{d}{d\hat\alpha}(y_i-\hat\alpha-\hat\beta x_i)^2\\
&=\sum_{i=1}^n2(y_i-\hat\alpha-\hat\beta x_i)\cdot\frac{d}{d\hat\alpha}(y_i-\hat\alpha-\hat\beta x_i)\quad\text{(chain rule)}\\
&=\sum_{i=1}^n2(y_i-\hat\alpha-\hat\beta x_i)\cdot(-1).
\end{align*}
