To find a+bi, assume the answer has the form x+yi and square both sides:
(x+yi)2=x2−y2+2xyi=a+bi
Matching real and imaginary parts gives x2−y2=a and 2xy=b. Combined with the modulus relation x2+y2=a2+b2, you can solve for x2 and y2 directly, then pick the signs of x and y so that 2xy matches the sign of b.
Example: 3+4i. Here a=3,b=4, modulus =5. Then x2=25+3=4 and y2=25−3=1, so x=2,y=1 (same sign, since b>0). Check: (2+i)2=4+4i−1=3+4i. ✓