$$L(a,b) = {\sum_{i=1}^n (y^i - (ax^i +b)^2)^2})$$ $$\frac{dL}{da} = \sum_{i=1}^n \frac{(y^i-y^-)*(x^i-x^-))}{var(x)}$$

How can I canclulate the $\frac{dL}{da}$?

$$2(y^i - (ax^i +b))^2)* \frac{d(y^i - (ax^i +b)^2)}{da} = $$

  • $\begingroup$ you should show your thought process and work of the problem $\endgroup$
    – Eric Brown
    May 15, 2019 at 0:32
  • 1
    $\begingroup$ May I echo Eric's thoughts above. Also, you probably mean to find $\frac{\partial L}{\partial a}$? Are you familiar with the sum rule? $\endgroup$ May 15, 2019 at 0:37
  • $\begingroup$ You are right. In fact, I am not used to the derivative of sums. Yes I mean the derivative of L based on a $\endgroup$ May 15, 2019 at 0:43

1 Answer 1


$$L(a,b) = {\sum_{i=1}^n (y^i - (ax^i +b)^2)^2}$$

\begin{align} \frac{\partial L}{\partial a} &= \sum_{i=1}^n 2(y^i-(ax^i+b)^2)\frac{\partial (y^i-(ax^i+b)^2)}{\partial a} \\ &= -2\sum_{i=1}^n (y^i-(ax^i+b)^2)\frac{\partial ((ax^i+b)^2)}{\partial a} \\ &=-4\sum_{i=1}^n (y^i-(ax^i+b)^2)(ax^i+b)x^i \\ \end{align}

where in the first line I have used the fact that differentiation is linear and I have repeatedly used chain rule.

  • $\begingroup$ chain rule, $\frac{\partial v^2}{\partial a} = 2v\frac{\partial v}{\partial a}$ $\endgroup$ Jun 11, 2019 at 4:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .