0
$\begingroup$

I need to find the partial derivative of $\sum_{i=1}^n (y_i - {ae^{x_i^2}} -bx_i^3)^2$ with respect to a and b but I'm having a hard time with the process. Could someone provide a step by step of how to solve this? I have the answer which is $-2\sum_{i=1}^n (y_i - {ae^{x_i^2}} -bx_i^3)e^{x_i^2}$ for a.

My thought process is that with the power rule and assuming that $bx^3,e^{x^2}$ and $y$ are constants, the answer should be $2\sum_{i=1}^n e^{x_i^2}$.

EDIT: To clarify, Here are the parts I'm unsure of.

  1. Why is it -2 instead of just 2 after applying the power rule?
  2. Why is $(y_i - {ae^{x_i^2}} -bx_i^3)e^{x_i^2}$ maintained instead of just $e^{x_i^2}$?
$\endgroup$
  • $\begingroup$ The summation is linear so i can apply it term by term. basically permute the derivative and summation. Can you take thqe partials now? $\endgroup$ – Chinny84 Mar 16 '17 at 21:37
  • $\begingroup$ Sorry I edited my post to better explain my question $\endgroup$ – Curious Cat Mar 16 '17 at 21:47
  • $\begingroup$ I'm sorry; I misread your question. When when you say the answer "should be" $2\sum e^{x_i^2}$, what precisely do you mean? The claim $$\frac\partial{\partial a}\sum_{i=1}^n(y_i-ae^{x_i^2}-bx_i^3)^2=2\sum_{i=1}^ne^{x_i^2}$$ seems highly suspect. If we consider the trivial case in which $n=1$ and all other parameters are $0$, then we have $$\frac\partial{\partial a}a^2=2$$ $\endgroup$ – Kajelad Mar 16 '17 at 22:14
0
$\begingroup$

You have to use the chain rule on this \begin{eqnarray*} f(u) &=& u^2 \\ g(a,b,x,y) &=& y_i -ae^{x_i^2} - bx^3_i \end{eqnarray*} so that the above function is a summation over terms looking like $f(g(a,b,x,y))$. Since the derivative is a linear operator you can exchange summation and differentiation to obtain $$\frac{\partial}{\partial a} \sum_i (y_i -ae^{x_i^2} - bx^3_i)^2 = \sum_i \frac{\partial}{\partial a} (y_i -ae^{x_i^2} - bx^3_i)^2$$ The chain rule on the individual pieces states $$\frac{\partial}{\partial a} f(g(a,b,x,y)) = \frac{d f}{d g} \frac{\partial g}{\partial a} =2 (y_i -ae^{x_i^2} - bx^3_i)(-e^{x^2_i})$$ We can then replace the summation to obtain $$\sum_i -2 (y_i -ae^{x_i^2} - bx^3_i)e^{x^2_i} = -2\sum_i(y_i -ae^{x_i^2} - bx^3_i)e^{x^2_i}$$

$\endgroup$
  • $\begingroup$ Thanks for the answer. My friend explained this to me right before you posted but I understand this now. I haven't done derivatives in a very long time. $\endgroup$ – Curious Cat Mar 16 '17 at 22:28
0
$\begingroup$

Okay, so you need to think about the chain rule and what its implications are. Per your post you have: $\sum_{i=1}^n (y_i - {ae^{x_i^2}} -bx_i^3)^2$ which you are trying to partially differentiate with respect to $a$.

You are correct in using the chain rule. Remember when using the chain rule, you multiply the exponent of what is in the parentheses ($2$ in this case) which is where the $2$ comes from. Remember then that you must reduce the power of the parentheses by one. This yields $\sum_{i=1}^n 2*(y_i - {ae^{x_i^2}} -bx_i^3)^1$

The final step is to take the derivative of the inner function with respect to $a$. Since the inner function is $y_i - {ae^{x_i^2}} -bx_i^3$, the partial with respect to $a$ is $-e^{x_i^2}$ This is negative since the term is $- {ae^{x_i^2}}$ in the inner function.

Combining all that you have done so far you end up with:

$\sum_{i=1}^n 2*(y_i - {ae^{x_i^2}} -bx_i^3)^1*(-e^{x_i^2})$

The constants ($2$ and $-1$) can be removed to the front which gives your answer of $-2\sum_{i=1}^n (y_i - {ae^{x_i^2}} -bx_i^3)e^{x_i^2}$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.