Solve the quadratic equation with complex number $b$

Solve the quadratic equation: $$x^2 +xi+2=0$$
I was thinking to set $x^2=-2-xi$ but what $i$ have to do when $x+yi$ in this case $x=-2$ and $y=x$...


Exactly the same as in the real case...taking into account that we are working in $\;\Bbb C\;$ , of course:

$$x^2+ix+2=0\implies \Delta=i^2-4\cdot2=-9=(3i)^2$$

so the solutions are

$$x_{1,2}=\frac{-i\pm\sqrt\Delta}2=\frac{-i\pm3i}2=\begin{cases}\cfrac{-4i}2=-2i\\{}\\\cfrac{2i}2=i\end{cases}$$

Another way: complete the square:

$$0=x^2=ix+2=\left(x+\frac i2\right)^2+\frac94\implies\left(x+\frac i2\right)^2=-\frac94=\left(\frac32i\right)^2\implies$$

$$\implies x+\frac i2=\pm\frac32i\implies x=\pm\frac32i-\frac i2=\begin{cases}-2i\\{}\\i\end{cases}$$

Third way: as you began to do, with $\;x=a+bi\;$ :

$$a^2-b^2+2abi=x^2=-xi-2=b-ai-2=(b-2)-ai$$

Now compare real and imaginary parts in both sides:

$$\begin{cases}I\;\;\;a^2-b^2=b-2\\{}\\II\;\;\;2ab=-a\end{cases}$$

Now we have two cases: if $\;a\neq0\;$, then from $II$ we get $\;b=-\cfrac12\;$, and then in $\;I\;$ we get:

$$a^2-\frac14=-\frac52\implies a^2=-\frac94$$

and tyhis can't be as both $\;I,\,II\;$ are real equations, thus it must be that $\;a=0\;$ and then:

$$-b^2\stackrel{II}=-b-2\implies =b^2-b-2=(b-2)(b+1)\implies b=-2,1$$

and again we get the same solutions, as it should be.


Hint:

By inspection (thinking of Vieta's formulas) we factor$$(ix)^2-(ix)-2=(ix+1)(ix-2).$$