If $a,b$ are roots for $x^2+3x+1=0$.Calculating $(\frac{a}{b+1})^2 +(\frac{b}{a+1})^2$ If $a,b$ are roots for the equation $x^2+3x+1=0$.How to calculate $$\left(\frac{a}{b+1}\right)^2 +\left(\frac{b}{a+1}\right)^2$$

HINT:
As $ab=1, \frac a{b+1}=\frac{a}{\frac1a+1}=\frac{a^2}{a+1}=y$(say)
So, $a^2=y(a+1)$ 
and again $a^2+3a+1=0\implies a^2=-3a-1$
So, $ay+y=-3a-1\implies a=-\frac{y+1}{y+3} $
As $a$ is root of the given eqaution $$\left(-\frac{y+1}{y+3} \right)^2+3\left(-\frac{y+1}{y+3} \right)+1=0$$
Simply to get $y^2+4y-1=0$
Using Vieta's Formula, the required sum will be $(-4)^2-2(-1)=18$
