I know there are some proof in the internet, but I attempted to proove the formulas for the intercept and the slope in simple linear regression using Least squares, some algebra, and partial derivatives (although I might want to do it wituout partials if it's easier).
I've posted my attempt below. I don't know what to from here.


The partial derivatives of $$ Q(\alpha,\beta)=\sum_i (y_i-\alpha-\beta x_i)^2 $$ are $$ \frac{\partial Q}{\partial \alpha}(\alpha,\beta)=-2\sum_i(y_i-\alpha-\beta x_i)=-2(n\bar{y}-n\alpha-n\beta\bar{x})\tag{1} $$ and $$ \frac{\partial Q}{\partial \beta}(\alpha,\beta)=-2\sum_ix_i(y_i-\alpha-\beta x_i)=-2(\mathrm{SP}_{xy}-n\alpha\bar{x}-\beta\mathrm{SS}_x)\tag{2} $$ with $\mathrm{SP}_{xy}=\sum x_i y_i$ and $\mathrm{SS}_x=\sum x_i^2$. Putting $(1)$ equal to zero gives us $$ \hat{\alpha}=\bar{y}-\hat{\beta}\bar{x} $$ and plugging this into $(2)$ gives us the equation $$ \begin{align} 0=\mathrm{SP}_{xy}-n(\bar{y}-\hat{\beta}\bar{x})\bar{x}-\hat{\beta}\mathrm{SS}_x&=\mathrm{SP}_{xy}-n\bar{y}\bar{x}+n\hat{\beta}\bar{x}^2-\hat{\beta}\mathrm{SS}_x\\ &=\mathrm{SP}_{xy}-n\bar{y}\bar{x}-\hat{\beta}(\mathrm{SS}_x-n\bar{x}^2) \end{align} $$ and hence $$ \hat{\beta}=\frac{\mathrm{SP}_{xy}-n\bar{y}\bar{x}}{\mathrm{SS}_x-n\bar{x}^2}. $$