What is the derivative of $f(x):=x^2e^{-|x|}$, and why?

I simply don't understand how to differentiate such a function, let alone why the derivative when $x=0$ is $0$.

  • 1
    $\begingroup$ What have you tried? Do you know what the definition of the derivative is? Did you try applying it to this function? $\endgroup$
    – Snaw
    Feb 8, 2022 at 19:45
  • $\begingroup$ @Snaw yea i know what the derivative is, but I want the derivative for every real number $\endgroup$
    – Serket
    Feb 8, 2022 at 19:47
  • $\begingroup$ $*$ denotes convolution or just multiplication? $\endgroup$
    – Ilovemath
    Feb 8, 2022 at 19:59
  • $\begingroup$ You can make a case decision: For $x\geq 0$ we have $f(x)=x^2\cdot e^{-x}$ The derivative is $2x\cdot e^{-x}-x^2\cdot e^{-x}$. Now let $\lim\limits_{x\to 0}$. $\endgroup$ Feb 8, 2022 at 20:04
  • $\begingroup$ @callculus42 This is true (assuming we also show the same for $x<0$), but it only works since $f(x)$ is continuous in a neighbourhood of $0$ and relies on a theorem which is on one hand easy but on the other hand quite often not proved in an introductory calculus course. I'm guessing OP was meant to differentiate the function using the definition at $x=0$. $\endgroup$
    – Snaw
    Feb 8, 2022 at 20:10

2 Answers 2


On $(0,\infty)$, we have $f(x)=x^2e^{-x}$ so $f$ is differentiable on this open interval and $f'(x)=2xe^{-x}-x^2e^{-x}=x(2-x)e^{-x}$.

Similarly, on $(-\infty,0)$, $f(x)=x^2e^{x}$ so $f$ is differentiable on this open interval and $f'(x)=2xe^{x}+x^2e^{x}=x(2+x)e^{x}$.

It remains to see if $f$ is differentiable at $0$. We have, for every $x\neq 0$


By continuity of $\exp$ and the absolute value, we get that $\lim_{x\to 0}\frac{f(x)-f(0)}{x-0}$ exists and is equal to $0e^0=0$. By definition, $f$ is differentiable at $0$ and $f'(0)=0$.

We can summarize this as $f'(x)=x(2-|x|)e^{-|x|}$ for every real number $x$. (Note that, as @TurlocTheRed explained in their answer, $f'$ is odd since $f$ is even).


Since $f(x)=x^2e^{-|x|}, f(x)$ is an even function.

If $f(x)$ is a differentiable function and $f(x)=f(-x)$, it's an even function and $f'(x)=-f'(-x)$ by the chain rule. So if an even function is differentiable for $x>0$, then its differentiable for $x<0$. Further, that derivative is an odd function. Odd functions reach $0$ at the origin if the functions is defined there.

$f'(x)=2xe^{-|x|}-\frac{|x|}{x}x^2e^{-|x|}, x\ne0.$ Approaches $0$ as $x\to 0$.

So we have some non rigorous evidence $f'(0)\to0$.

At $0$, you can use $\lim_{x \to 0} \frac{f(x)-f(0)}{x}$ as Taladris does elsewhere.

EDITI: Removed erroneous use of the Symmetric Derivative.

  • $\begingroup$ $\lim_{\Delta x \to 0} \frac{f(x+\frac{\Delta x}{2})-f(x-\frac{\Delta x}{2})}{\Delta x}=\lim_{\Delta x\to 0} \frac{0}{\Delta x}$ seems wrong: you cannot just take the limit of the numerator only. $\endgroup$
    – Taladris
    Feb 9, 2022 at 2:29
  • $\begingroup$ @Taladris, for $x=0$, the numerator is $0$ for all values of $\Delta x$ since $f$ is an even function. That's not a limit in the numerator, but the difference between equal function values. $\endgroup$ Feb 9, 2022 at 2:33
  • $\begingroup$ Then with the same reasoning, you would prove that $f(x)=|x|$ is differentiable at $0$, no? $\endgroup$
    – Taladris
    Feb 9, 2022 at 2:41
  • $\begingroup$ I guess it does! I need to patch that up. $\endgroup$ Feb 9, 2022 at 3:42
  • 1
    $\begingroup$ Since $\frac{f(x+h/2)-f(x-h/2)}{h} = \frac{1}{2}\left(\frac{f(x+h/2)-f(x)}{h/2}-\frac{f(x-h/2)-f(x)}{h/2}\right)$, then we have that if $f$ is differentiable at $x$, then $\lim_{h\to 0}\frac{f(x+h/2)-f(x-h/2)}{h}$ exists and is equal to $0$. But the converse is false (consider $f(x)=|x|$) $\endgroup$
    – Taladris
    Feb 9, 2022 at 4:04

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