# Find the partial derivative of $E(a,b)=\sum_{i=1}^n(y_i-(a+bx_i))^2$

I would like to know how to find the partial derivatives of the following function please.

$$E(a,b)=\sum_{i=1}^n(y_i-(a+bx_i))^2\tag1$$

I believe that I should get two results

$$\frac{\partial{E}}{\partial{a}} \text{and }\frac{\partial{E}}{\partial{b}}\tag2$$

and that when finding a partial derivative I can treat all other variables as constants. But, I am unsure as to how to treat both the summation and the fact that it is all squared.

If there are rules you use in your derivation, could you state the names please? Many thanks.

• Yes, you treat the other variables as constants. The rules you need are linearity of the derivative and the chain rule. – J.R. Apr 11 '14 at 11:52

The derivative of $\frac{\partial (y_i-a-bx_i)^2}{\partial a}=2(y_i-a-bx_i)(-1)$
and $\frac{\partial (y_i-a-bx_i)^2}{\partial b}=2(y_i-a-bx_i)(-x_i)$