<s>[INST] Solve the equation $ z^2 + \left\vert z \right\vert = 0 $, where $z$ is a complex number. I've tried solving this, but I'm stuck at one point.
Here's what I did:
Let $ z = x + yi $, where $x, y \in \mathbf R$
Then , $ (x + yi)^2 + \sqrt{x^2 + y^2} = 0 $
Or, $x^2 + {(yi)}^2 + 2xyi + \sqrt{x^2 + y^2} = 0 $
Or, $ x^2 - y^2 + 2xyi + \sqrt{x^2 + y^2} = 0 + 0i$
Thus, $ x^2 - y^2 + \sqrt{x^2 + y^2} = 0\qquad\qquad\qquad\qquad\qquad\qquad\ (i)$
and $2xy = 0 \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad(ii)$
If $2xy = 0$, then either $x = 0 $ or $y = 0$
Now, if I take $ x = 0$, and subsitute in $(i)$, I get either $y = 0$ or $y  = 1$.
So far, so good, but if I take $y = 0$, and substitute in $(ii)$:
We have $x^2 + \sqrt{x^2} = 0$
so $x^2 = -\sqrt{x^2} $
or $x^2 = -x$
or $\frac{x^2}{x} = -1 $
or $x = -1$
However, this solution doesn't satistfy the equation $x^2 + \sqrt{x^2}$ or the original equation. 
What am I doing wrong here ?
 [/INST] In $x^2 = -\sqrt{x^2}$, note that $x$ is real, so you have a non-negative on the left, and a non-positive on the right. Therefore they must both be $0$.
Alternative solution:
$$
z^2=-|z|\\
|z|^2=|z|\\
|z|=0\quad \text{or}\quad|z|=1
$$
then for $|z|=1$, solve $z^2+1=0$.
</s>