What is the derivative of $|f(x)|^n$

6.4k Views Asked by At

Well, it's time for a trivial question but I really need a clarification about!

Let's say I have to evaluate

$$\frac{\text{d}}{\text{d}x}\ |f(x)|^n$$

Shall I have to reason by treating the function as

$$|f(x)|^n = \left(\sqrt{f(x)^2}\right)^n$$

and then it would be quite easy, or shall I try to apply, somehow, the same rule for the derivative of $|x|$ like?

$$D\ |f(x)|^n = n\ f(x)^{n-1}\frac{|f(x)|}{f(x)}f'(x) = n\ f(x)^{n-2}|f(x)|f'(x)$$

Thank you for the clarification!

2

There are 2 best solutions below

2
On BEST ANSWER

The biggest issue is that the function $y \mapsto |y| = \sqrt{y^2}$ is of course not differentiable when $y = 0$. Given this, we can only take the derivative of $|f(x)|^n$ on all points where $f(x) \ne 0$.

But as long as we are at $x$ where $f(x) \ne 0$, either of your two proposed methods will work. We have on the one hand \begin{align*} \frac{d}{dx} |f(x)|^n &= \frac{d}{dx} [f(x)^2]^{n/2} \\ &= \frac{n}{2} [f(x)^2]^{\left(\tfrac{n}{2} - 1\right)} \left[2f(x)f'(x)\right]. \\ &= n \cdot f(x) \cdot f'(x) \cdot |f(x)|^{n-2} \end{align*} and on the other hand \begin{align*} \frac{d}{dx} |f(x)|^n &= n |f(x)|^{n-1} \left[\frac{d}{dx} |f(x)|\right] \\ &= n |f(x)|^{n-1} \frac{f(x)}{|f(x)|} f'(x) \\ &= n \cdot f(x) \cdot f'(x) \cdot |f(x)|^{n-2}. \end{align*} where we used $\frac{d}{dy} |y| = \frac{y}{|y|}$.

You can now see that these two expressions are the same.

Note 1: In your calculations, I saw a couple of small typos or errors.

Note 2: We have to be careful dealing with the expression $[f(x)^2]^{n/2}$. Note this is not the same as $f(x)^n$. For a potentially negative $a$, we do not have that $(a^b)^c = a^{bc}$.

1
On

$\DeclareMathOperator{\abs}{abs}$If $n$ is an even integer, you may as well write $$ |f(x)|^{n} = f(x)^{n} $$ and differentiate using the chain rule.

Otherwise, if $x \neq 0$, the function $\abs(x) = |x|$ is differentiable at $x$, and $$ \abs'(x) = \frac{x}{|x|}. $$ This (plus the chain rule) guarantees that if $f$ is differentiable at $x$ and $f(x) \neq 0$, then your formula is correct: $$ \frac{d}{dx} |f(x)|^{n} = n\, f(x)^{n-2} |f(x)|\, f'(x). $$ If $f(x) = 0$ (or if $f$ is not differentiable at $x$), you need to examine the specific form of $f$ to determine whether or not $\abs^{n}(f)(x) = |f(x)|^{n}$ is differentiable at $x$.