We consider 3 cases.
1) Suppose that degQ=1. By looking at the leading coefficient, we have Q(x)=±x+a. If Q(x)=x+a, we have
P(x)=(x−(a+1))(x−(a+2))…(x−(a+9)).
And if Q(x)=−x+a we have
P(x)=(a−1−x)(a−2−x)…(a−9−x).
2) Suppose that degP=1. By looking at the leading coefficient, we have P(x)=±x+a. In this case
Q(x)=±(x−1)(x−2)…(x−9)−a.
3) Suppose degP,degQ>1. Then, the only option is degP=degQ=3.
Since 1,2,…,9 are 9 roots of P(Q(x)), we have P(x) have 3 roots a,b,c. For each root, for example a, the equation Q(x)=a has 3 roots a1,a2,a3 then a1,a2,a3,b1,b2,b3,c1,c2,c3 form a permutation of 1,2,…,9.
By Vieta's formula, we have
a1+a2+a3=b1+b2+b3 and a1a2+a2a3+a3a1=b1b2+b2b3+b3b1
so a12+a22+a32=b12+b22+b32. Since x2≡0 or 1(mod4) so the number of odd numbers in a1,a2,a3 is the same as the number of odd numbers in b1,b2,b3.
This implies that the number of odd numbers in 1,2,…,9 is divisible by 3, which is a contradiction.