What happens when you find the derivative of $f(x) =|x^2-1|$. Let $f(x) =|x^2-1|$.
I'm trying to see if this function has a point of inflection and even though looking at the graph tells me the answer already, I was just curious.
What happens to the modulus part when you differentiate it? Would you just take the piecewise version of the function and differentiate each function?
 A: We can write the absolute value as $\sqrt{(x^2-1)^2}$, which we can differentiate with the chain rule.
Hence,
$$
\begin{align}
\frac{d}{dx}\left[\sqrt{(x^2-1)^2}\right]&=\frac12\left((x^2-1)^2\right)^{-\frac12}\cdot 2(x^2-1)\cdot 2x\\
&=\frac{x^2-1}{\left((x^2-1)^2\right)^\frac12}\cdot 2x\\
&= \frac{x^2-1}{|x^2-1|}\cdot 2x\\
&=\operatorname{sgn}(x^2-1)\cdot 2x
\end{align}
$$
We used the absolute value and sign functions with the following definitions
$$|f(x)|=\sqrt{f^2(x)}$$
$$\operatorname{sgn}(f(x))= \begin{cases} 
      0 & f(x)=0 \\
      \frac{|f(x)|}{f(x)} & f(x)\neq 0
   \end{cases}
$$
(Note the absolute value can be in the numerator or denominator, the sign function works either way)
You can find the derivative of the general case (as stated by Klein bottle) by applying chain rule to the square root definition of the absolute value function. Give it a try tbh
A: $$\dfrac{\text{d}}{\text{d}x} \vert f(x)\vert = f'(x) \text{sgn}(f(x))$$
Where $\text{sgn}(\cdot)$ is the signum function.
$$\text{sgn}(f(x)) = \dfrac{\vert f(x) \vert}{f(x)}$$
