<s>[INST] If 2 roots of the equation $(p-1)(x^2+x+1)^2-(p+1)(x^4+x^2+1)$ are real and distinct and $f(x)=\frac{1-x}{1+x}$... Question: If 2 roots of the equation $(p-1)(x^2+x+1)^2-(p+1)(x^4+x^2+1)$ are real and distinct and $f(x)=\frac{1-x}{1+x}$, then $f(f(x))+f(f(\frac{1}{x})) = ?$
(a)p
(b)2p 
(c)-p
(d)-2p
Attempt: the give equation can be written as $(x^2+x+1)[(p-1)(x^2+x+1)-(p+1)(x^2-x+1)] = 2(x^2+x+1)(-x^2+px-1)$
$f(f(x))=x$ and $f(f(\frac{1}{x}))=-\frac{1}{x}$
So the required expression $x-\frac{1}{x}$
Now, $2(x^2+x+1)(x^2-px+1)=0$ (taking $-$ outside of second brackett) and $(x^2+x+1)\neq0$, so $(x^2-px+1)=0$. For this equation to have distinct real roots, $p^2-4>0$
But I am getting nowhere near the given options.
 [/INST] $\bf{My\; Solution::}$ Given
$$(p-1)(x^2+x+1)^2-(p+1)(x^4+x^2+1) = 0$$
$$\displaystyle (p-1)(x^2+x+1)^2=(p+1)(x^4+x^2+1)$$
We can write it as $$\displaystyle \frac{p+1}{p-1}=\frac{(x^2+x+1)^2}{(x^4+x^2+1)}=\frac{(x^2+x+1)^2}{(x^2-x+1)(x^2+x+1)}=\frac{x^2+x+1}{x^2-x+1}$$
Now We can Write it as $$\displaystyle \frac{\left(x+\frac{1}{x}+1\right)}{\left(x+\frac{1}{x}-1\right)}=\frac{p+1}{p-1}$$
Now Using Componendo-Dividendo, We get
$$\displaystyle \frac{\left(x+\frac{1}{x}+1\right)+\left(x+\frac{1}{x}-1\right)}{\left(x+\frac{1}{x}+1\right)-\left(x+\frac{1}{x}-1\right)}=\frac{(p+1)+(p-1)}{(p+1)-(p-1)}$$
So we get $$\displaystyle x+\frac{1}{x} = p..................(1)$$
Now Given $$\displaystyle f(x) = \frac{1-x}{1+x}$$. So $\displaystyle f(f(x)) = x$ and $\displaystyle f\left(f\left(\frac{1}{x}\right)\right)=\frac{1}{x}$
So $$\displaystyle f(x)+f\left(f\left(\frac{1}{x}\right)\right)=x+\frac{1}{x}=p$$ From $(1)$ equation.
</s>