TITLE: Find all polynomials $f, g \in \mathbb{Z}[X]$ such that $f(g(X))=1 + X + ... + X^{p-1}$
QUESTION [5 upvotes]: Find all polynomials $f, g \in \mathbb{Z}[X]$ such that $f(g(X))=1 + X
 + ... + X^{p-1}$ where $p \gt 2$ is a prime.


One solution is $g = X, f =1 + X + ... + X^{p-1}$.
If $\deg(f)=m, \deg(g)=n$ then $f=\pm X^m + ... , g=\pm X^n + ... $ with $mn = p-1$
I have no idea how to get further.
UPDATE
$g = -X, f =1 - X + X^2 -X^3 + ... + X^{p-1}$ also $f = -X, g =- 1 - X - ... - X^{p-1}$  and $f = X, g =1 + X + ... + X^{p-1}$ are also solutions.

REPLY [2 votes]: Suppose $f(X) = \sum\limits_{k = 0}^m a_k X^k$ and $g(X) = \sum\limits_{j = 0}^n b_j X^j$. It is easy to see that $|a_m| = |b_n| = 1$.
First, consider the situation where $n = 1$. If $g(X) = X + b_0$, then$$
f(X + b_0) = 1 + X + \cdots + X^{p - 1} \Rightarrow f(X) = 1 + (X - b_0) + \cdots + (X - b_0)^m.
$$
If $g(X) = -X + b_0$, then$$
f(-X + b_0) = 1 + X + \cdots + X^{p - 1} \Rightarrow f(X) = 1 + (-X + b_0) + \cdots + (-X + b_0)^m.
$$
Next, suppose $n > 1$. Now focus on the coefficient of the $X^{p - 2} = X^{mn - 1}$ term. Expand $f(g(X))$ to get$$
\sum_{k = 0}^m a_k (g(X))^k = 1 + X + \cdots + X^{p - 1}.
$$
For $0 \leqslant k \leqslant m - 1$, $\deg(a_k (g(X))^k) = kn \leqslant (m - 1)n < mn - 1$, so the coefficient of $X^{mn - 1}$ in $f(g(X))$ is all contributed by $a_m(g(X))^m$. Note that $\deg g = n$, thus the coefficient of $X^{mn - 1}$ in $a_m(g(X))^m$ is $a_m \cdot \binom{m}{1} b_n^{m - 1} b_{n - 1} = m a_m b_{n - 1} b_n^{m - 1}$. Since the coefficient of $X^{mn - 1} = X^{p - 2}$ in $1 + X + \cdots + X^{p - 1}$ is $1$, then$$
m a_m b_{n - 1} b_n^{m - 1} = 1 \Longrightarrow m = 1.
$$
Now, if $f(X) = X + a_0$, then$$
g(X) + a_0 = 1 + X + \cdots + X^{p - 1} \Longrightarrow g(X) = 1 + X + \cdots + X^{p - 1} - a_0.
$$
If $f(X) = -X + a_0$, then$$
-g(X) + a_0 = 1 + X + \cdots + X^{p - 1} \Longrightarrow g(X) = -1 - X - \cdots - X^{p - 1} + a_0.
$$