Solving equation with Complex Numbers and two unknowns. I have the following track:
If $z=a+bi$, with the imaginary number $i$, solve the following equation
    $$z^2+|z|^2-18=0$$
Well, first of all I replaced $z$ with $a+bi$ and then $|a+bi|^2$ with $(a^2+b^2)$.
After, I got $a$ as a function of $b$, but in this case I have two unknowns.
Any suggestion?

Assume that $z$ is a solution, then
$$
z^2 = 18-|z|^2
$$
and hence
$$
|z|^2 = |18 - |z|^2|
$$
Put $t = |z|$. Thus $t^2 = 18-t^2$ or $t^2 = t^2 - 18$, but the second possibility clearly can't occur. Hence $2t^2 = 18$, so $t = \pm 3$, but since $t$ is positive, we must have $t=3$.
Returning to the original equation, it now reads
$$
z^2 - 9 = 0
$$
so $z = \pm 3$.
