<s>[INST] Let $f(x)=x^3-3x+1$.Find the number of distinct real roots of $f(f(f(x)))=3$ Let $f(x)=x^3-3x+1$.Find the number of distinct real roots of $f(f(f(x)))=3$
I have noticed that $f(x)=3$ has solutions $-1,-1,2$ But here how to find more roots ? in fact how to even say that they are roots of $f(f(f(x)))=3$?
If anyone has materials to share about these type of problems involving iterations, please do so.
 [/INST] The exact solutions are the roots of the polynomial
? print(h)
x^27 - 27*x^25 + 9*x^24 + 324*x^23 - 216*x^22 - 2241*x^21 + 2268*x^20 + 9639*x^1
9 - 13584*x^18 - 25515*x^17 + 50598*x^16 + 35703*x^15 - 119232*x^14 - 1917*x^13
+ 170721*x^12 - 80352*x^11 - 127980*x^10 + 122958*x^9 + 22599*x^8 - 66339*x^7 +
20412*x^6 + 4374*x^5 - 2187*x^4 
?

Its factorization is 
? factor(h)
%33 =
[                                                          x 4]

[                                                    x^2 - 3 4]

[                                              x^3 - 3*x + 3 2]

[x^9 - 9*x^7 + 3*x^6 + 27*x^5 - 18*x^4 - 27*x^3 + 27*x^2 - 3 1]

?

The polynomial has $11$ real roots, $6$ negative and $4$ positive ones.
You can determine the roots of the $4$ polynomials numerically.
</s>