# 2nd derivative of a functions absolute value

So on wolfram alpha I am told that if $y=y\left ( x \right )$ then $\frac{d^{2}}{dx^{2}} \left | y \right |= \frac{y}{\left | y \right |}y^{''}+2\delta \left ( y \right )y^{'2}$

But when I attempt to prove it myself I get... $$y=y\left ( x \right ) \rightarrow \frac{d^{2}}{dx^{2}} \left | y \right | = \frac{d}{dx} \left ( \frac{d}{dx} \left | y \right | \right ) = \frac{d}{dx} \left( \frac{y}{\left | y \right |} y^{'} \right )$$ $$=\frac{1}{\left | y \right |}\frac{d}{dx} \left( yy^{'} \right ) + yy^{'}\frac{d}{dx} \left( \frac{1}{\left | y \right |} \right ) = \frac{yy^{''} + y^{'2}}{\left | y \right |} - \frac{y^{2}y^{'2}}{\left | y \right |^{3}} = \frac{y}{\left | y \right |}y^{''}$$

Could any of you fine mathematicians help a guy out? I am not sure where the second term comes from.

• Maple says this here $$\left( {\frac {{\rm d}^{2}}{{\rm d}{x}^{2}}}y \left( x \right) \right) \left| 1 \right| + \left( {\frac {\rm d}{{\rm d}x}}y \left( x \right) \right) ^{2}{\it signum} \left( 1,y \left( x \right) \right)$$ – Dr. Sonnhard Graubner Jul 20 '15 at 12:52
You have to be careful about the delta function. Consider the derivative of a unit step... there's an infinite slope at the origin and nothing around it. If you are sloppy, you skip this contribution. Because it happens at $y=0$, your fractions don't exist there, so this special case has to be handled separately.
Write this as $$\frac{d}{dx}|y|=\operatorname{sign}(y)\, y'$$ Then you have $$\frac{d^2}{dx^2}|y|=\operatorname{sign}'(y)\, y'+\operatorname{sign}(y)\, y''$$
Now, the sign function jumps from $-1$ to $1$ at $y=0$, so its derivative is $2\delta(y)$ (times $y'$ for the chain rule), where $\delta$ is the infamous delta (impulse) function - the function with a unit integral that is zero everywhere except for an exceptionally narrow infinite peak at the origin.