I noticed that if the absolute value definition $\lvert{x}\rvert=\sqrt{x^2}$ is used, we can get derivatives of functions with absolute value, without having to redefine them as piece-wise.
For example, to get the derivative of $f(x)=x\lvert{x}\rvert$ we write $f(x)=x(x^2)^\frac{1}{2}$ and thus
$ \begin{align} f'(x) &= \sqrt{x^2}+x\frac{1}{2}(x^2)^{-\frac{1}{2}}(2x) \\ &=\sqrt{x^2}+\frac{x^2}{\sqrt{x^2}} \\ &=\frac{2x^2}{\sqrt{x^2}} \\ &=\frac{2x^2}{\lvert{x}\rvert} \\ &=2\lvert{x}\rvert \\ \end{align} $
which is correct. You just have to avoid using the law of exponents to simplify $\lvert{x}\rvert = (x^2)^\frac{1}{2}=x^{2(\frac{1}{2})}=x$.
My question is, why does using $\lvert{x}\rvert=\sqrt{x^2}$ to get derivatives work, and why does the law of exponents seem to show that $\lvert{x}\rvert=x$ ?