I think $f(x) = x^2$. Then $f'(0)$ should be $0$.
But when I try to calculate the derivative of $f(x) = |x|^2$, then I get:
$f'(x) = 2|x| \cdot \frac{x}{|x|}$, which is not defined for $x = 0$. Does $f'(0)$ still exist?
I think $f(x) = x^2$. Then $f'(0)$ should be $0$.
But when I try to calculate the derivative of $f(x) = |x|^2$, then I get:
$f'(x) = 2|x| \cdot \frac{x}{|x|}$, which is not defined for $x = 0$. Does $f'(0)$ still exist?
On
Hint:
Since $|x|=\begin{cases}x,&x\ge 0\\-x,&x<0\end{cases}$ it follows that
$$f(x)=\begin{cases}x^2,&x\ge 0\\(-x)^2,&x<0\end{cases}$$
and then, $f(x)=x^2$, for $x\in \mathbb R$.
On
$$\frac{f\left(h\right)-f\left(0\right)}{h}=\frac{\left|h\right|^2}{h}$$
If $h<0$ then $\left|h\right|=-h$ and $\left|h\right|^2=h^2$.
If $h>0$ then $\left|h\right|^2=h^2$ then
$$\frac{f\left(h\right)-f\left(0\right)}{h}\underset{h \rightarrow 0}{\rightarrow}0$$ for all $h \ne 0$ then $f'(0)=0$.
So $f(x) =g(u(x)) $ where $g(x) =x^2$ and $u(x) =|x|$. The problem is that you use the chain rule on $g(u(x)) $ while $u(x) $ is not differentiable at zero.
One option is to just use the definition of derivative $$f'(0)=\lim_{h\to 0}\frac{|h|^2}{h}$$ and consider $\lim_{h\to 0^+}$ and $\lim_{h\to 0^-}$.