Derivative of $x^2e^{-x(y+c)}$ What's the derivative of this function on x
$x^2e^{-x(y+c)}$
And why? I'm not sure about the result I have on the book
y and c are both constants
 A: Let $z= x^{2}e^{-x (y+c)}$. If $y$ is a function of $x$, then your derivative becomes $$\frac{\rm dz}{\rm dx} = x^{2} e^{-x(y+c)} \times \frac{\rm d}{\rm dx} \bigl( -xy\bigr)  + e^{-x(y+c)}\cdot 2x $$
Now $$ \frac{\rm d}{\rm dx}(xy) = x \frac{\rm dy}{ \rm dx } + y$$
Now if $y$ is not a function of $x$, then consider it as a constant and use the chain rule to differentiate.
A: In derivation, like in many other fields in life, one often has to go slowly to ensure the correct answer was achieved.
In this case, we follow closely the product rule: $\frac{\operatorname d}{\operatorname dx}(f\cdot g) = \frac{\operatorname df}{\operatorname dx}\cdot g + f\cdot\frac{\operatorname dg}{\operatorname dx}$
We also use the following identities:


*

*$\frac{\operatorname dx^k}{\operatorname dx} = kx^{k-1}$

*$\frac{\operatorname de^{f(x)}}{\operatorname dx} = \frac{\operatorname df}{\operatorname dx}\cdot e^{f(x)}$


Therefore we have:
$$\begin{align}
\frac{\operatorname d}{\operatorname dx}(x^2e^{-x(y+c)}) &= \frac{\operatorname d}{\operatorname dx}(x^2)\cdot e^{-x(y+c)} + x^2\cdot\frac{\operatorname d}{\operatorname dx}(e^{-x(y+c)}) \\
&=2xe^{-x(y+c)} + x^2(-y-c)e^{-x(y+c)} \\
&=e^{-x(y+c)}(2x-(y+c)x^2) \\
&=xe^{-x(y+c)}(2-(y+c)x)
\end{align}$$
