What is the derivative of $|x|^2$?

133 Views Asked by At

I've thought that since

$$ f(x) = |x|^2 = \begin{cases} (-x)^2, & \mbox{if } x \leq 0 \\ x^2, & \mbox{if } x > 0 \end{cases} = \begin{cases} x^2, & \mbox{if } x \leq 0 \\ x^2, & \mbox{if } x > 0 \end{cases},$$

the derivative of $f(x)$ would be $2x$. However, it seems that it is, actually, only differentiable at $x = 0$. But why?

2

There are 2 best solutions below

0
On BEST ANSWER

Sorry, folks. I was talking about $x$ as a complex variable. So, if $x = a + i\ b$ and $f(x) = u(a,b) + i\ v(a,b) =|x|^2 = a^2 + b^2 $, then $\frac{\partial u}{\partial a} = 2a$, $\frac{\partial v}{\partial b} = 0$, $\frac{\partial u}{\partial b} = 2b$ and $\frac{\partial v}{\partial a} = 0$. Therefore, the Cauchy-Riemann condition is only satisfied when $a = b = 0$, so the function is only analytic at $z=0$.

P.S.: I've made this confusion because I had calculated the derivative of |x|^2 using Mathematica (without saying if it was either real or complex) and the answer was not defined for $x\ne 0$. So, I've thought that this was also the answer for real variables too.

1
On

You're right. $|x|^2 = x^2$, so $|x|^2$ is differentiable wherever $x^2$ is, and their derivatives are the same.