How to find all polynomials P(x) such that $P(x^2-2)=P(x)^2 -2$? I am trying the fallowing exercise :
Solve $P(X^2 -2)=P(X)^2 -2$ with P a monic polynomial (non-constant)
My attempt :
Let P satisfying $P(X^2-2) = (P(X))^2-2$
Then $Q(X)=P(X^2-2) = (P(X))^2-2$ 
Therefore,  $$Q(X^2-2) = (P(X^2-2))^2-2 = (P(X)^2-2)^2-2 = Q^2-2$$
As X is a solution, by defining the sequence:
$(P_n)_{n \geq 1}$ with $P_1 = X$ and for all $n \geq 1, P_{n+1} = P_n^2-2$
We obtain a sequence of polynomials which are solutions. 
But I don't know how to prove it's the only one. If someone have an idea to prove it or an another method to solve the problem ? 
Thank you in advance for your time.
 A: Lemma : If $P(x)^2$ is a polynomial in $x^2$, then so is either P(x) or P(x)/x.
By the lemma, there is a polynomial Q such that $P(x)=Q(x^2-2)$ or $P(x)=xQ(x^2-2)$.
Then $Q((x^2-2)^2-2)=Q(x^2-2)^2−2$ or $(x^2-2)Q((x^2-2)^2-2)=x^2Q(x^2-2)^2-2$
Substituting $x^2-2=y$ yields $Q(y^2-2)=Q(y)^2-2$ and $yQ(y^2-2)=(y+2)Q(y)^2+1$ 
Suppose that $yQ(y^2-2)=(y+2)Q(y)^2-2$. Setting $y=-2$ we obtain that $Q(2)=1$
Note that, if $a\neq 0$ and $Q(a)=1$ then also $aQ(a^2+1)=(a+2)-2$ and hence $Q(a^2+1)=1$.
We thus obtain an infinite sequence of points at which Q takes value 1.
Namely the sequence given by $a_{n+1}=a_{n^2}-2$. 
Therefore $Q≡1$. It follows that if $Q≢1$, then $P(x)=Q(x^2-2)$. 
Now we can easily list all solutions: these are the polynomials of the form $T(T(⋯(T(x))⋯))$, where $T(x)=x^2-2$.
NB: Lemma/proof,
Let $P(x)=a_nx^n+a_{n−1}x_{n−1}+⋯+a_0$, $a_n≠0$. 
The coefficient at $x^{2n−1}$ (of $P(x)^2$) is $2a_na_{n−1}$, from which we get $a_{n−1}=0$. Now the coefficient at $x_{2n−3}$ equals $2a_na_{n−3}$; hence $a_{n−3}=0$, and so on. Continuing in this manner we conclude that $a_{n−2k−1}=0$ for $k=0,1,2,…,$ i.e. $P(x)=a_nx^n+a_{n−2}x^{n−2}+a_{n−4}x_{n−4}+⋯$.
A: I'd like to see an elementary solution for this special case. But here is what caught my attention.
Let $f(x)=x^2-2$. Then $P\circ f = f \circ P$ and so $P\circ f^n = f^n \circ P$, where $f^n$ is the $n$-th iterate of $f$ (not $f$ raised to the power $n$). This means that orbits of $f$ that are bounded are mapped by $P$ to bounded orbits and so $P$ leaves the filled Julia set of $f$ invariant. Reciprocally, $f$ leaves the Julia set of $P$ invariant. The Julia set essentially determines the polynomial and so this means that $P$ is an iterate of $f$. This goes back to Ritt and Julia. For the general case, see these papers and the references they make:


*

*W. M. Boyce, On polynomials which commute with a given polynomial, Proc. Amer. Math. Soc. 33 (1972), 229-234 pdf

*N. Steinmetz and W. Schmidt,
The polynomials associated with a Julia set,
Bull. London Math. Soc. (1995) 27 (3): 239-241 pdf

*K. Zimmermann, Commuting polynomials and self-similarity, New York Journal of Mathematics
Volume 13 (2007) 97-106 pdf
A: Let $P_n(x) = \sum_{i=0}^{n}a_ix^i$ for $n>1$. Put it into OP's equation and solve by comparing coefficient for first few $n$, we get:
$$P_1(x)=x$$
$$P_2(x)=x^2 - 2$$
$$P_3(x)=x^3 - 3 x$$
$$P_4(x)=x^4 - 4 x^2 + 2$$
$$P_5(x)=x^5 - 5 x^3 + 5 x$$
For convenience, set $P_{0}(x)=2$.
By observation, we have $P_{n+1}(x)=xP_{n}(x) - P_{n-1}(x)$.
Solving $P_{n+1}(x)=xP_{n}(x) - P_{n-1}(x)$, we get
$$P_n(x)=\left(\frac{x+\sqrt{x^2-4}}{2}\right)^n + \left(\frac{x-\sqrt{x^2-4}}{2}\right)^n$$
Easy to show that $P_n(x)$ satisfies OP's equation.
Now I will show that only $P_n(x)$ satisfies OP's equation:
We have
$$P_n(x)^2 -2 = \sum_{i=0}^{n}\sum_{j=0}^{n}a_ia_jx^{i+j} - 2 \tag{1}$$
and
$$P_n(x^2 - 2) = \sum_{i=1}^{n}a_i\sum_{r=0}^{i}\binom{i}{r}2^{i-r}x^{2r} + a_0 \tag{2}$$
Compare coefficients starting from $x^{2n}$. We always get $a_n=1$. Let $n\le k\le2n-1$. In eq $(1)$, the only term in coefficient of $x^k$ with least index of $a$ is $2a_{k-n}a_n$. In eq $(2)$, coefficient of $x^k$ is $0$ if $k$ is odd, and the possible least index of $a$ in coeffcient is $k/2 > k-n$ if k is even. So if we solve the first $n+1$ equations in order, all of them except the first one($a_n^2=a_n$) are in the form $A + 2a_{k-n}a_n = B$, where A and B are known, which have and only have one solution for $a_{k-n}$. So the coefficients equations can have at most one solution.
