Why $x^{p^n}-x+1$ is irreducible in ${\mathbb{F}_p}$ only when $n=1$ or $n=p=2$ I have a question, I think it concerns with field theory.

Why the polynomial $$x^{p^n}-x+1$$ is irreducible in ${\mathbb{F}_p}$ only when $n=1$ or $n=p=2$?

Thanks in advance. It bothers me for several days. 
 A: We will use fairly liberally the result that if $q(x)\in\mathbb F_p[x]$ is irreducible, then, for any $k$, $q(x)\mid x^{p^k}-x$ if and only if $\deg q\mid k$.
If $q_n(x)=x^{p^n}-x+1$ is irreducible, then there is a automorphism, $\phi$ of the field $\mathbb F_p[x]/\left<q_n(x)\right>$ which sends $\bar x$ to $\bar x-1$, namely:
$$\phi(\alpha)=\alpha^{p^n}$$
for any element $\alpha$.  (Where $\bar x$ is the image of $x$ from $\mathbb F_p[x]$ in this field.)
Then, $\phi(\bar x)=\bar x^{p^n}=\bar x-1$.  So that automorphism must have order $p$: $\phi^p = 1$, the identity automorphism.
Now, $\phi^k(\alpha)=\alpha^{p^{kn}}$, so, in particular, $\bar x=\phi^p(\bar x)=\bar x^{p^{pn}}$, and therefore we know $0=\bar x^{p^{pn}}-\bar x$, and therefore that the polynomial $x^{p^{pn}}-x$ is divisible by $q_n(x)$.
Using the result above, we therefore see that $p^n=\deg q_n(x)\mid pn$.  But $p^n\mid pn$ can only happen if $n=1$ or $n=2$ and $p=2$.
I think you can show that $q_1(x)\mid x^{p^p}-x$ pretty straight-forwardly, therefore showing that it must factor as elements of degree $p$ and degree $1$.  But clearly it has no factors of degree $1$ since it has no roots in $\mathbb F_p$, so, since $\deg q_n=p$, $q_1(x)$ must be prime.
Then you have the last case, $x^4-x+1$ over $\mathbb F_2$, which you can brute force.
A: I have another solution that might be easier to follow.
Let $\alpha$ be a root of $q(x)=x^{p^n}-x+1$. Note that $\alpha + a$ is also a root of $q(x)$ for all $a \in \mathbb{F}_{p^n}$. Consider cyclic muplicative group $\mathbb{F}_{p^n}^{\times} = \mathbb{F}_{p}(\theta)$ for some generator $\theta$, then $\alpha + \theta$ and $\alpha$ are roots of $q(x)$, so they belong to $\mathbb{F}_{p}(\alpha)$ which shows that $\theta \in \mathbb{F}_{p}(\alpha)$, hence $\mathbb{F}_{p^n} \subset \mathbb{F}_{p}(\alpha)$. We have $\mathbb{F}_{p} \subset  \mathbb{F}_{p^n} \subset \mathbb{F}_{p}(\alpha)$.
If $p(x)$ is irreducible over $\mathbb{F}_p$, then $[\mathbb{F}_{p}(\alpha):\mathbb{F}_{p}] = p^n$, hence $|\mathbb{F}_{p}(\alpha)|=p^{pn}$. Consider the endomorphism $\sigma$: $\mathbb{F}_{p}(\alpha) \to \mathbb{F}_{p}(\alpha)$ which sends $\alpha \to \alpha^{p^n}$ (why it is a endomorphism?). Consider subgroup of automorphism $H = \langle \sigma \rangle$. $H$ fixes $\mathbb{F}_{p^n}$ (Why?), so we have $[\mathbb{F}_{p}(\alpha): \mathbb{F}_{p^n}]=|H|=p$ ($\sigma^p$ is identity map). Then $[\mathbb{F}_{p}(\alpha):\mathbb{F}_{p}] = [\mathbb{F}_{p}(\alpha): \mathbb{F}_{p^n}][\mathbb{F}_{p^n}:\mathbb{F}_{p}]$ which means $p^{n}=pn$ and this only happens when $n=1$ or $n=p=2$.
