<s>[INST] Solve for four values of x where x lies in complex plane. I came across this problem and have to find four roots of this equation. Direct multiplication was of no help and factorizing it is a mess.
I tried to factor it using $a^2+b^2=(a+ib)(a-ib) $ 
but was of no help.
$$x^2 + (\frac{ax}{x+a})^2= 3a^2$$
Can anyone through in some ideas?
 [/INST] Okay I tried to solve this question using two techniques, one is by factorizing and then substitution as below:
$$x^2 +(\frac{ax}{x+a})^2 = 3a^2$$
We can write $ a^2 + b^2$ as $$a^2 + b^2= (a-b)^2 +2ab$$ so $x^2 +(\frac{ax}{x+a})^2$ can be written as $$(x -\frac{ax}{x+a})^2 + 2 * x * \frac{ax}{x+a}$$ $$\implies (\frac{x+ax-ax}{x+a})^2 + 2a*\frac{x}{x+a} = 3a^2 $$ $$\implies (\frac{x}{x+a})^2 + 2a*\frac{x}{x+a} = 3a^2$$
Now substitute $$\frac{x}{x+a} = y$$ $$\implies y^2 + 2a*y= 3a^2 $$$$\implies y^2 + 2a*y-3a^2=0 $$ This becomes $$(y+3a)(y-a)=0 $$
$\implies y=a $ or $y=-3a$
When $y=a$
$$\frac{x^2}{x+a}=a$$ $$\implies x^2-ax-a^2 =0$$ $$\implies x = \frac{a\pm a\sqrt(5)}{2}$$
When $y=-3a$
$$\frac{x^2}{x+a}=-3a$$ $$\implies x^2+3ax+3a^2 =0$$ $$\implies x = \frac{-3a\pm ai\sqrt(3)}{2}$$
</s>