If $a+i b=\frac{(x+i)^{2}}{2 x^{2}+1}$, prove that $a^{2}+b^{2}=\frac{\left(x^{2}+1\right)^{2}}{(2 x+1)^{2}}$
$a+i b=\frac{(x+i)^{2}}{2 x^{2}+1}$
$=\frac{x^{2}+i^{2}+2 x i}{2 x^{2}+1}$
$=\frac{x^{2}-1+i 2 x}{2 x^{2}+1}$
$=\frac{x^{2}-1}{2 x^{2}+1}+i\left(\frac{2 x}{2 x^{2}+1}\right)$
On comparing real and imaginary parts, we obtain
$a=\frac{x^{2}-1}{2 x^{2}+1}$ and $b=\frac{2 x}{2 x^{2}+1}$
$\therefore a^{2}+b^{2}=\left(\frac{x^{2}-1}{2 x^{2}+1}\right)^{2}+\left(\frac{2 x}{2 x^{2}+1}\right)^{2}$
$=\frac{x^{4}+1-2 x^{2}+4 x^{2}}{(2 x+1)^{2}}$
$=\frac{x^{4}+1+2 x^{2}}{\left(2 x^{2}+1\right)^{2}}$
$=\frac{\left(x^{2}+1\right)^{2}}{\left(2 x^{2}+1\right)^{2}}$
$\therefore a^{2}+b^{2}=\frac{\left(x^{2}+1\right)^{2}}{\left(2 x^{2}+1\right)^{2}}$
Hence, proved.