Why is $f(x,y) =x^2+y^2$ differentiable everywhere but $f(z) =|z|^2$ is not, where $z$ is a complex variable? If $f(z)=|z|^2$ is a function of complex variable then it's only differentiable at $z=0.$
We can write $f(z)$ as $u(x,y)+ i v(x,y)$, where $u(x,y)=x^2+y^2$ and $v(x,y)=0$. 
Why $x^2+y^2$ is differentiable everywhere but $f(z)$ is not.  
 A: If $z_0\neq0$, then the limit$$\lim_{z\to z_0}\frac{\lvert z\rvert^2-\lvert z_0\rvert^2}{z-z_0}\tag1$$doesn't exist. So, $z\mapsto\lvert z\rvert^2$ is not differentiable at $z_0$. However, if $z_0=x_0+y_0i$, we have$$\lim_{(x,y)\to(x_0,y_0)}\frac{x^2+y^2-x_0^{\,2}-y_0^{\,2}-2x_0(x-x_0)-2y_0(y-y_0)}{\bigl\lVert(x,y)-(x_0,y_0)\bigr\rVert}=0,\tag2$$and therefore $(x,y)\mapsto x^2+y^2$ is differentiable at $(x_0,y_0)$.
Note that if the limit $(1)$ existed and it was equal to some $w\in\mathbb C$, then the map $z\mapsto\frac{\lvert z\rvert^2-\lvert z_0\rvert^2}{z-z_0}$ would behave, near $z_0,$ as $z\mapsto w(z-z_0)$. But no such complex number exists. Asserting $(2)$ doesn't imply that, near $(x_0,y_0)=z_0,$ $f$ acts as the multiplication by a fixed complex number (which, geometrically, is the composition of a rotation with a homothety); it only implies that $f(x,y)-f(x_0,y_0)$ can be approximated by a linear map, which is a more general condition.
A: Let $f=u+iv:D \to \mathbb C$, where $D$ is an open subset of $ \mathbb C$, and let $z_0=x_0+iy_0 \in D.$
Then:
$f $ is in $z_0$ complex differentiable $ \iff u$ and $v$ are in $(x_0,y_0)$ real differentiable and (!) the Cauchy- Riemann differential equations hold in $(x_0,y_0)$.
A: A different way of seeing this is to write (using $x = \frac{z + \overline{z}}{2}$ and $y = \frac{z - \overline{z}}{2i}$); 
$$\frac{\partial}{\partial z} = \frac12 \left( 
\frac{\partial}{\partial x} - i \frac{\partial}{\partial y} \right)$$
and
$$\frac{\partial}{\partial \overline{z}} = \frac12 \left( 
\frac{\partial}{\partial x} +i \frac{\partial}{\partial y} \right)$$
On this form, the Cauchy-Riemann equations simply becomes $\frac{\partial}{\partial \overline{z}}f = 0$. In the case of $f(z)=|z|^2$, one might write this as $|z|^2 = z\overline{z}$, and we see that $\frac{\partial}{\partial \overline{z}} z \overline{z} = z \neq 0$.
