4
$\begingroup$

At first glance $(\max(0, x))^2$ looks smooth.

If I'm not mistaken:

if $x \le 0$ the derivative equals $2 \times\max(0, x) \times0 = 0$

if $x \ge 0$ the derivative equals $2 \times \max(0, x) \times 1$ and it equal zero if $x = 0$

Looks like derivative of $(\max(0, x))^2$ is continuous.

But when I tried to check with Wolfram Alpha it shows me that derivative of $(\max(0, x))^2$ is indeterminate at $x = 0$. Link

So can anyone tell me where I made a mistake?

$\endgroup$
4
  • 3
    $\begingroup$ I'm pretty sure the mistake is Wolfram Alpha's. Note that it doesn't even try to find the derivative for negative numbers, despite that clearly existing. $\endgroup$
    – user361424
    Commented Aug 26, 2016 at 8:16
  • $\begingroup$ The second derivative is a step function, which is discontinuous at $0$. $\endgroup$
    – Arthur
    Commented Aug 26, 2016 at 8:21
  • $\begingroup$ @Arthur you are definitely right. But i just consider first derivative $\endgroup$
    – Daiver
    Commented Aug 26, 2016 at 8:23
  • 1
    $\begingroup$ @Arthur i fixed caption of my post. Sorry $\endgroup$
    – Daiver
    Commented Aug 26, 2016 at 8:24

3 Answers 3

2
$\begingroup$

Your function is obviously differentiable on $\mathbb R^*$.

You have if you call your function $f$:

$$\forall x<0, \quad f'(x)=0$$

and

$$\forall x>0, \quad f'(x)=2x.$$

So

$$\lim_{\substack{ x\to 0 \\ x<0}} f'(x)=0=\lim_{\substack{ x\to 0 \\ x>0}} f'(x).$$

And because $f$ is continuous on $\mathbb R$, it gives you that $f$ is differentiable on $0$.

(Wolfram Alpha is wrong)

$\endgroup$
2
  • 1
    $\begingroup$ This line of argument is wrong. Define $f(0) = 1$, $f(x) = 0$ for $x \in \mathbb{R}\setminus \{0\}$. Then $f$ satisfies the last equality you gave, but is not continuous. $\endgroup$
    – user159517
    Commented Aug 26, 2016 at 8:31
  • $\begingroup$ Yes of course, i'll edit. $\endgroup$
    – E. Joseph
    Commented Aug 26, 2016 at 8:31
1
$\begingroup$

Let $f(x) = {\left[\max(0, x)\right]}^2$. The derivative is indeed $f'(x) = \max(0, 2x)$ and the directional limits at $0$ agree.

However, smooth usually means $\mathcal C^\infty$, but $f$ is not $\mathcal C^\infty$, because $f''$ is not continuous. We have that $$f''(x) = 2H(x),$$ where $H(x)$ is the Heaviside step function.

EDIT: The question originally asked if the function is smooth, and was later changed.

$\endgroup$
1
  • $\begingroup$ My mistake. I thought about only first derivatives. I'm sorry for inaccurate caption. $\endgroup$
    – Daiver
    Commented Aug 26, 2016 at 8:31
0
$\begingroup$

Another way to write the function is: $$\begin{align} f(x) & = \operatorname{max}(0, x)^2\\ & = x^2 H(x),\end{align}$$ with $H$ the Heaviside step function. Taking the derivative of this second form gives: $$ f'(x) = 2x H(x) + x^2 \delta(x). $$ If you naively insert $x=0$ into this expression you'll get $f' = 0 + 0 \times \infty$, a classic indeterminate form. This is cleared up by recognizing that in an integral, the only place a delta function has unambiguous meaning, the delta function evaluates what it multiplies at the point where its argument is $0$, divided by the derivative of the argument. In this case, that would give $f'(0) = 0$.

$\endgroup$
1
  • 1
    $\begingroup$ $x^2 H(x)$ is correct, but $\max(0, x^2)$ represents another function (just $x^2$ actually). $\endgroup$
    – rubik
    Commented Aug 26, 2016 at 9:19

You must log in to answer this question.

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