# Differentiability of the absolute value of a function

The derivative of ##|f(x)|## with respect to ##x## is ##f'(x)## for ##f(x) > 0## and ##-f'(x)## for ##f(x) < 0##. However, it is undefined wherever the value of the function is zero. I was wondering, though, if the product of this "undefined derivative" and zero is zero.

mfb
Mentor
However, it is undefined wherever the value of the function is zero.
It does not have to be. Consider |f(x)| where f(x)=x^2, for example. It has a derivative everywhere, even at f(x)=0.
I was wondering, though, if the product of this "undefined derivative" and zero is zero.
You cannot calculate a product with "undefined derivative" in it. There might be a way to avoid calculating this product, however, then the result could be well-defined.

It does not have to be. Consider |f(x)| where f(x)=x^2, for example. It has a derivative everywhere, even at f(x)=0.
You cannot calculate a product with "undefined derivative" in it. There might be a way to avoid calculating this product, however, then the result could be well-defined.

I actually asked this question because I couldn't deal with the discontinuity in ##\frac{d|y|}{dx}## while deriving something in classical mechanics.
I wanted to show that ##\frac{d|v_r|}{dt} \hat{v}_r = \frac{dv_r}{dt} \hat{r}## where ##\hat{v}_r## is defined to be ##+\hat{r}## if ##v_r > 0##, and ##-\hat{r}## if ##v_r < 0##. How do I make make both sides equal for ##v_r < 0##?
##\hat{v}_r## is a unit vector that is always pointing in the direction of the radial velocity of a particle (i.e., it could point in the same direction, or in the opposite direction as the radial base vector), and ##v_r## is the scalar component of the radial velocity; it can be positive, negative, or zero.

mfb
Mentor
For negative v, converting the left side to the right one gives a minus sign for both components each, they cancel, done. That won't work at r=0 because the radial vectors are not even defined there.

For negative v, converting the left side to the right one gives a minus sign for both components each, they cancel, done. That won't work at r=0 because the radial vectors are not even defined there.

How do I make it work for ##v_r = 0##? The equation I want to derive [geometrically] is ##a = (\ddot{r} - r \dot{θ}^2) \hat{r} + (r \ddot{θ} + 2 \dot{r} \dot{θ}) \hat{θ}##, which holds for all values of ##v_r##.
I'm trying to get from ##\frac{d|\dot{r}|}{dt} \hat{v}_r## to ##\ddot{r} \hat{r}##.

HallsofIvy
Homework Helper
The derivative of ##|f(x)|## with respect to ##x## is ##f'(x)## for ##f(x) > 0## and ##-f'(x)## for ##f(x) < 0##. However, it is undefined wherever the value of the function is zero. I was wondering, though, if the product of this "undefined derivative" and zero is zero.
You are phrasing this badly! What is the product of "left" and 0? What is the product of "red" and 0?

"Undefined" means exactly that- there is NO derivative at x= 0 so you cannot multiply it by 0 or any other number. Now if you are asking about the limit, a x goes to 0, of 0 times the derivative (for x not 0), then, yes, that limit is 0.

You do not need to differentiate absolute value to get your formula, you just need to write x and y coordinates in terms of ##r## and ##\theta##, then differentiate and write everything in vector form, see Wkipedia.

You do not need to differentiate absolute value to get your formula, you just need to write x and y coordinates in terms of ##r## and ##\theta##, then differentiate and write everything in vector form, see Wkipedia.

I can easily differentiate velocity in vector form to get acceleration in polar coordinates, but I'm trying to obtain the expression for acceleration in polar coordinates geometrically, like in the book Introduction to Mechanics by K&K.

Svein
Anyone?
Just an anecdote: About 40 years ago, I was doing coordinate transform for a small robot. What I did, was to calculate the position and orientation of the "hand" and subtract from the previous position. This gave me a 6-dimensional matrix D which represented the first order derivative of the transform. Taylor's theorem then gave me $\Delta X=D\circ \Delta M$ where X are the Euclidean coordinates and M the motor positions. Inverting D then gave $\Delta M = D^{-1}\Delta X$, telling me how to step the motors in the next interval. But - at some positions det(D) approached 0, which meant that it was not possible to invert D. What we decided was that we would continue to use the old D-1 until the determinant got bigger than a predefined minimum. It worked!

Very simple, define ##g(x)=x^2## and ##f(x)=\sqrt{x}##

Take the derivative of ##f(g(x))##

##\frac{d}{dx} \left [ f(g(x)) \right ] = f'(g(x)) \cdot g'(x) = \frac {1}{2 \sqrt{x^2}} \cdot 2x = \frac{x}{\sqrt{x^2}} = \frac{x}{\left | x \right |} = \mathrm{sgn(x)}##

Last edited:
Svein
Very simple, define g(x)=x2g(x)=x^2 and f(x)=x√f(x)=\sqrt{x}
Clever but -
$\frac{d}{dx}f(g(x))=\frac{df}{dg}\frac{dg}{dx}=\frac{1}{2\sqrt{g}}2x$. The trouble lies with $\frac{1}{2\sqrt{g}}$, which is not defined (or finite) for g=0. In another (famous) proof I have seen a slight variation: Define $g(x)=1-x^{2}$ and $f(x)=\sqrt{1-x}$. Then $\frac{d}{dx}f(g(x))=\frac{df}{dg}\frac{dg}{dx}=\frac{-1}{2\sqrt{g}}\cdot -2x$, just as before, but the singular point is no longer at 0.

Clever but -
$\frac{d}{dx}f(g(x))=\frac{df}{dg}\frac{dg}{dx}=\frac{1}{2\sqrt{g}}2x$. The trouble lies with $\frac{1}{2\sqrt{g}}$, which is not defined (or finite) for g=0. In another (famous) proof I have seen a slight variation: Define $g(x)=1-x^{2}$ and $f(x)=\sqrt{1-x}$. Then $\frac{d}{dx}f(g(x))=\frac{df}{dg}\frac{dg}{dx}=\frac{-1}{2\sqrt{g}}\cdot -2x$, just as before, but the singular point is no longer at 0.

Yes but since you've redefined the function as ##x^{\frac{2}{2}}## and applied the chain rule, you've essentially taken the derivative of a fractional exponent.

You can say that ##\forall \: x^n## the derivative has a singularity at zero where ##n \in (0,1)##.