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$$
Because $x^2+3x+1=0$, we have $x^2=-3x-1$ and also $x^2+2x+1=-x$, for $x=a,b$. Hence $$\left(\frac{a}{b+1}\right)^2=\frac{a^2}{(b+1)^2}=\frac{-3a-1}{-b}=\frac{3a+1}{b}$$ By symmetry, the desired expression is $$\frac{3a+1}{b}+\frac{3b+1}{a}=\frac{3a^2+a}{ab}+\frac{3b^2+b}{ab}=\frac{3a^2+a+3b^2+b}{ab}=\frac{3(-3a-1)+a+3(-3b-1)+b}{ab}=\frac{-8(a+b)-6}{ab}$$ Lastly, because $a,b$ are roots of $x^2+3x+1$, we know that $ab=1$ and $a+b=-3$. Plugging this into our final expression gives $$\frac{-8(-3)-6}{1}=18$$
Hint: $(a+1)^2 + a = 0$ and so $\frac{1}{(a+1)^2} = -\frac{1}{a}$
We note that the expression given is a symmetric rational function of the roots of the original polynomial, so can be expressed in terms of the coefficients of the original polynomial. We then use the basic facts we know about the sum and product of the roots, and the fact that both $a$ and $b$ satisfy the polynomial to achieve successive simplification of otherwise unwieldy terms. Here are some hints for a way through.
Note that $a+b=-3$ and $ab=1$ so that $(a+1)(b+1)=ab+(a+b)+1=-3+2=-1$
Use this to put the whole thing over a common denominator and simplify.
Note also that $a^2(a+1)^2=a^2(a^2+2a+1)=a^2(a^2+3a+1-a)=-a^3$
You might also need to use $a^2+b^2=(a+b)^2-2ab$
Since the full answer closest in spirit to this has been deleted, note first $(a^2+b^2) = (-3)^2-2=7$. Then put the desired expression over common denominator $(a+1)^2(b+1)^2=1$ to obtain:$$a^2(a+1)^2+b^2(b+1)^2=-a^3-b^3=3(a^2+b^2)+(a+b)=21-3=18$$ [see comment for middle step]