Compute the real part and the imaginary part of a variable

Good day. I have a question of how to get the algebraic expressions for $a$, real part $b$ (denoted $Re(b)$), and imaginary part $b$ (denoted $Im(b)$). Let's say $a$ is a real number and $b$ is a complex number. I have three equations as below:

$$a ^ 2 = X,\quad(a + b)^2 = Y,\quad(a + bi)^2 = Z,$$

where $X, Y, Z$ are symbols, and $i$ is imaginary part of $1i$. I tried to solve above equations to get $a$ and $Re(b)$, $Im(b)$ in terms of symbols $X, Y, Z$. However, I am stuck at the step:

\begin{align*} a &= \sqrt X\\ Re(b) + Im(b) &= \sqrt Y - \sqrt X\\ i(Re(b) + Im(b)) &= \sqrt Z - \sqrt X \end{align*}

The 2nd and 3rd equations seems conflict with each other. May I ask how to solve above equations. Any help would be appreciated. Thanks.


Let $b=u+vi$. We have $$ \begin{array}{lll} x &= a^2 &= a^2 \\ y &= (a+b)^2 &= (a+u+vi)^2 &= a^2 + 2au + u^2 - v^2 + 2v(u+a)i \\ z &= (a+bi)^2 &= (a-v+ui)^2 &= a^2 - 2av + v^2 - u^2 - 2u(v-a)i \end{array} $$ First we can substitute $a=\sqrt{x}$. $$ \begin{aligned} y = x + 2u\sqrt{x} + u^2 - v^2 + 2v(u+\sqrt{x})i \\ z = x - 2v\sqrt{x} + v^2 - u^2 - 2u(v-\sqrt{x})i \end{aligned} $$ We can then combine the equations for $y$ and $z$: $$ \frac{y+z}{2} = x + 2u\sqrt{x}i $$ This implies $$ u = \frac{2x-y-z}{4\sqrt{x}}i$$ Treating the equation of $y$ as a quadratic in $v$, $$ -v^2 + 2(u+\sqrt{x})iv + x +2u\sqrt{x} + u^2 - y = 0 $$ I then obtained via the quadratic formula $$ v = 2(u+\sqrt{x})i \pm \sqrt{x + 2u\sqrt{x} + u^2 - y - (u+\sqrt{x})^2} $$ Does this agree with your results? Note that, since $u$ and $v$ were assumed to be real, I believe $y$ and $z$ must have nonzero imaginary part...