4. Let $k$ be a positive integer, find all polynomials $P(x)=a_{n}+a_{n-1} x+\cdots+a_{0} x^{n}$, where $a_{i}$ are real numbers, that satisfy the equation $P(P(x))=(P(x))^{k}$.


4. If $P(x)$ is the zero polynomial, then it satisfies the condition. Hereafter, assume $P(x)$ is not the zero polynomial, and let $n$ be the degree of $P(x)$. By comparing the degrees of the polynomials on both sides of the given identity, we get $n^{2}=k n$.
(1) If $n=0$, then $P(x)=C$ (a constant). When $k=1$, $C$ can be any non-zero real number; when $k$ is a positive even number, $C=1$; when $k$ is an odd number greater than 1, $C= \pm 1$.
(2) If $n>0$, then $n=k$. Let $\quad P(x)=a_{0} x^{k}+a_{1} x^{k-1}+\cdots+a_{k} \quad\left(a_{0} \neq 0\right)$,
then we have $a_{0}\left(a_{0} x^{k}+\cdots+a_{k}\right)^{k}+a_{1}\left(a_{0} x^{k}+\cdots+a_{k}\right)^{k-1}+\cdots+a_{k} \equiv\left(a_{0} x^{k}+\cdots+a_{k}\right)^{k}$,
by comparing the coefficients of the highest terms on both sides, we get $a_{0}^{f+1}=a_{\delta}^{\delta}$, so $a_{0}=1$, then the above equation becomes
$$
a_{1}\left(x^{k}+\cdots+a_{k}\right)^{k-1}+\cdots+a_{k} \equiv 0 .
$$

Thus, $a_{1}=a_{2}=\cdots=a_{k} \equiv 0$, hence $P(x)=x^{k}$.