<s>[INST] Finding the derivative of an absolute value This one I just don't know how to derive.
$\ln\|x^4\cos x\|$
I know the derivative of $\ln\ x$, is just $\frac{1}{x}$ . It is the absolute value that throws me off. My question is, does the absolute value stay as is or does it disappear?


*

*$\frac{1}{|x^4\cos x|}$

*$\frac{1}{x^4\cos x}$
Or is there an extra step that I should preform?
 [/INST] HINT:
$$\frac{d|x|}{dx}=\text{sgn}(x)$$
for $x\ne0$.  Now, use the chain rule, but make sure that $x^4 \cos x\ne0$
SPOILER ALERT: SCROLL OVER SHADED AREA TO REVEAL ANSWER

Let $y=x^4\cos x$.  Then, we have $$\frac{d}{dx}\log|x^4\cos x|=\frac{d\log |y|}{d|y|}\text{sgn(y)}\frac{dy}{dx}=\frac{1}{|x^4\cos x|}\text{sgn}(x^4\cos x)(4x^3\cos x-x^4\sin x)=\frac{1}{x^4\cos x}(4x^3\cos x-x^4\sin x)$$Another way to approach the problem is to split it into two parts, (i) $x^4\cos x>0$, and (ii) $x^4\cos x<0$.  On Part (i), we have $$\frac{d}{dx}\log|x^4\cos x|=\frac{d}{dx}\log(x^4\cos x)=\frac{1}{x^4\cos x}(4x^3\cos x-x^4\sin x)$$On Part (ii), we have $$\frac{d}{dx}\log|x^4\cos x|=\frac{d}{dx}\log(-x^4\cos x)=\frac{1}{-x^4\cos x}(-4x^3\cos x+x^4\sin x)=\frac{1}{x^4\cos x}(4x^3\cos x-x^4\sin x)$$as expected!

</s>