Show that every $f(x) \in K[x]$ can be represented as $g(x^{p^e})$ A (probably simple) question I encountered but I don't know how to approach:

Let $K$ be a field of prime characteristic $p>0$.
  Show every $f(x) \in K[x]$ can be represented as $g(x^{p^e})$ for some $e \ge 0$ and $g \in K[x]$ with $g'(x) \neq 0$.

I saw a related post but it has different starting point.
 A: Note: I thought I could use a slightly different method to answer this but alas this ended up looking very similar to the answer already given by @quid. But I spell out some more of the details, so I decided to post this anyway in case it's useful.
For our $f(x) \in K[x]$, let $f(x)=a_0 + a_1 x+ a_2 x^2 + \ldots +a_nx^n$. Let $D(f)=f'$ be the formal derivative of $f(x)$ in $K[x]$. Now if $f'(x)\neq 0$ then $f(x)=f(x^{p^0})$ works. If, however, $f'(x)=0$, we have $0\equiv a_1+2a_2x+\ldots+na_nx^{n-1}$. But now because of the definition of formal derivatives, the $ia_i$ are now elements of $K$ (unlike exponents, which are just integers used to count the number of times you multiply $x$ by itself in "$x^n$"). As this polynomial is the zero polynomial, we must have that $ia_i=0$ for all $i$. So either $i=0$ or $a_i=0$ in $K$. But $i=0 $ in $K$ if and only if $ p | i$ in the integers, since we're in characteristic $p$. So the only times when we can have $a_i$ non-zero, is when $p|i$. Hence $f(x)=a_0+a_px^p+a_{2p}x^{2p}+\ldots +a_{rp}x^{rp}$ for some $r \in \mathbb Z$. 
Now letting $g(x)=a_0+a_px+a_{2p}x^{2}+\ldots +a_{rp}x^{r}$ works, provided $g'(x)\neq 0$, as $f(x)=g(x^{p^1})$. Otherwise, call $g$ "$g_1$" instead and repeat this process with $g_1$ instead of $f$ to get a $g_2$ and so on. Then finally one of these $g_m$ will have $g_m'(x)\neq 0$ as $\deg(f)= p\deg(g_1) = \ldots = p^i \deg(g_i),$ so this process must terminate before (or at) $g_i$ where $p^i$ is the largest power of $p$ dividing $deg(f)$. Then $f(x)=g_1(x^p)=g_2(x^{p^2})=\ldots =g_m(x^{p^m}) $ and $g_m' \neq 0$.
A: Note that you need $f$ non-constant, otherwise this is just not true.

Now, first note, if $f'(x)\neq 0$ then set $e=0$ and $f=g$ and you are done. 
Second, if $f'(x)= 0$, then writing $f(x)= \sum_{i=0}^n a_i x^i $, you have $f'(x)=\sum_{i=1}^ ia_i x^{i-1}$. So that $ia_i = 0$ for all $i=0, \dots, n$ and thus $a_i=0$ for all $i$ with $p \nmid 0$. 
Note that for this to happen, for a non-constant $f$, the degree of $f$ is at least $p$.
Thus $$f(x)= \sum_{i=0}^n a_i x^i = \sum_{i=0}^{\lfloor n/p \rfloor} a_{pj} x^{pj}.$$ 
Set $g_1(x) = \sum_{i=0}^{\lfloor n/p \rfloor} a_{pj} x^{j}$. 
Note that $g_1$ is non-constant and the degree of $g$ is at most $(\deg f)/p$. 
If $g_1(x)' \neq 0$ you are done with $g= g_1$ and $e=1$. If $g_1(x)'=0$ repeat the process with $g_1$ instead of $f$. This stops at some point as the degree decreases.
If you want to me more formal, you can prove it by induction on the degree of $f$.
