Solution (source code)

= Solution

An element $\alpha$ is <separable algebraic element>[separable] over $K$ when its <minimal polynomial> has <distinct elements>[distinct] roots in a <splitting field>. A <polynomial> has a <multiple root>[repeated root] exactly when it has a <common root> with its <formal derivative in positive characteristic>[formal derivative]. Hence
$\gcd(f,f')=1$ implies that $f$ has no repeated root and $\alpha$ is separable.

Let $f$ be the <minimal polynomial> of $\beta$. Repeatedly factor through the <Frobenius endomorphism>[Frobenius] until
$$
f(X)=g(X^{p^h}),
$$
where $g'\ne0$. Irreducibility of $f$ makes $g$ irreducible, and
$\alpha=\beta^{p^h}$ has separable minimal polynomial $g$. Put
$$
M=K(\alpha)=K(\beta^{p^h}).
$$
Then $M/K$ is separable and
$$
[L:M]=p^h.
$$
Every $\gamma\in L=K(\beta)$ is a polynomial in $\beta$ of degree below $[L:K]$. The freshman's-dream identity gives
$$
\gamma^{p^h}\in K(\beta^{p^h})=M,
$$
so $L/M$ is <purely inseparable field extension>[purely inseparable].

Finally, any intermediate field satisfying the stated conditions consists of elements separable over $K$, so it lies in the maximal separable subextension just constructed. Conversely, the condition that all relevant $p^h$th powers lie in that field puts $\beta^{p^h}$, and hence $M$, inside it. The two inclusions prove uniqueness.