Solution (source code)

= Solution

Invariance of $W$ means every power of $\alpha$ restricts to the corresponding power of $\beta$. Therefore $m_\alpha(\beta)$ is the restriction of $m_\alpha(\alpha)$, and it is zero. Divide $m_\alpha=qm_\beta+r$ with $\deg r<\deg m_\beta$. Evaluation at $\beta$ gives $r(\beta)=0$. By minimality of $m_\beta$, $r=0$, proving
$$
\boxed{m_\beta\mid m_\alpha}.
$$
The zero-subspace case has $m_\beta=1$ and satisfies the same conclusion.