Criteria for a cubic polynomial in $\Bbb Q[x]$ to split completely over $\Bbb Q_p$

Background: A quadratic polynomial splits over a field $k$ iff its discriminant is a square in $k$. Squares in $\Bbb R$ are just the elements $\ge 0$, and it is also quite easy to recognise squares in a $p$-adic field $\Bbb{Q}_p$. (With a little oddity for $p=2$, which nevertheless can be done and has nice special cases.)

In particular it is easy to find, for each prime $p$, an irreducible quadratic $f_p \in \Bbb{Q}[x]$ which factors completely in both $\Bbb{Q}_p$ and $\Bbb R$. Actually, $f_p = x^2-(1+p^n)$ works for $n\ge 2$ for odd $p$, resp. $n \ge 4$ for $p=2$ (where $n=3$ is only excluded because that's the only case where $1+p^n$ is already a square in $\Bbb Q$).

So let's get cubic, let $$f(x) = ax^3+bx^2+cx+d$$ ($a\neq 0$) be irreducible in $\Bbb{Q}[x]$. Over $\Bbb R$, $f$ factors completely iff its discriminant

$$\Delta(f) = 18abcd - 4b^3d + b^2c^2 - 4ac^3 - 27a^2d^2$$

is a square (i.e. $\ge 0$). But this is treacherous. Over a general field $k\supset \Bbb Q$, $\Delta(f)$ being a square is a necessary criterion for $f$ to factor completely, but not sufficient. What makes it work in $\Bbb R$ is that by the Intermediate Value Theorem, $f$ has at least one root $\alpha \in \Bbb R$ to begin with. Then the other roots are expressions of $\sqrt{\Delta(f)}$ and $\alpha$ -- compare Expressing the roots of a cubic as polynomials in one root and Express one root of depressed cubic equation via another and square root of discriminant). In other words, the splitting field of $f$ over $\Bbb Q$ is $\Bbb Q[\alpha, \sqrt{\Delta(f)}]$, so its splitting field over $\Bbb R$ is $\Bbb R[\alpha, \sqrt{\Delta(f)}] = \Bbb R$.

With this argument, a necessary and sufficient criterion for $f$ to factor completely in $k$ is that $\Delta(f)$ is a square in $k$, and $f$ has at least one root in $k$.

But how to check whether $f$ has at least one root in, say, $\Bbb Q_p$? Well, Hensel's Lemma of course. This seems to work somewhat for "big" $p$, but I run into trouble for $p=2,3$.

Question 1: What are nice necessary and sufficient criteria for $f$ to factor completely in $\Bbb{Q}_p[x]$? (With special attention to $p=2,3$, although of course a general approach that does not even have to handle these cases differently would be optimal.)

Question 2: For each prime $p$, is there a cubic $f_p$, irreducible over the rationals, which splits completely both in $\Bbb{Q}_p[x]$ and in $\mathbb{R}[x]$?

Edit: Lubin and Franz Lemmermeyer have given a nice construction for question 2 in the comments, thank you for that. My stance on it would be to set

$$f_p := \begin{cases} x^3-x+pk & \text{for odd }p\\ x^3-x+8k & \text{for }p=2\\ \end{cases}$$ where $k$ is rational with $v_p(k)\ge 0$. Notice that $x^3-x=x(x-1)(x+1)$ has at least one simple root modulo $p$, so Hensel gives us at least one root in $\Bbb Q_p$. Further $$\Delta(f_p) = \begin{cases} 4(1-\frac{3^3k^2}{2^2}\cdot p^2) & \text{for odd }p\\ 4(1-3^3k^2 \cdot 2^4) & \text{for }p=2\\ \end{cases}$$ is a square in $\Bbb Q_p$, so $f_p$ splits completely in $\Bbb{Q}_p$. To make sure it also splits completely in $\Bbb R$, we have to ensure that $\Delta(f_p) \ge 0$, which we do by choosing $k$ with real absolute value $$|k| \le \begin{cases} \frac{2\sqrt3}{9p} & \text{for odd }p\\ \frac{\sqrt 3}{36} & \text{for }p=2.\\ \end{cases}$$ Now the last thing we want to ensure is that $f_p$ is irreducible over $\Bbb Q$. "Generically", it is. Does anybody see a nice way to enforce this? Funnily, my first attempt for $p=2$, namely $k=\frac{1}{21}$ (since $\frac{1}{21}<\frac{\sqrt 3}{36}<\frac{1}{20}$), already gives the $\Bbb Q$-irreducible $$f_2 = x^3-x+\frac{8}{21}$$ even though its discriminant happens to be the rational square $\frac{4}{49}$.

By the way, I have found this site quite useful for playing around with polynomials over $p$-adics: https://math.la.asu.edu/~jj/localfields/

• For #2, it seems to me that if you take $f(x)=(x-a)(x-b)(x-c)$ for distinct integers $a,b,c$, and look at $g=f(x)+\varepsilon$, where $\varepsilon$ is rational and small both in the $p$-adic sense and the real sense, then $g$ should work, if you were not careless in your choice of $\varepsilon$: after all, a “generic” $\Bbb Q$-polynomial will be irreducible. – Lubin Jan 24 '18 at 4:39
• I see. Certainly I should have thought of Krasner besides Hensel. – Torsten Schoeneberg Jan 24 '18 at 5:26
• The decomposition law in nonnormal cubic extensions with discriminant $D$ tells you that if $(D/p) = -1$, then $p$ either splits completely or is inert. Thus if $f$ has one root modulo $p$, it must split completely in the $p$-adic completion. For #2, take $f = (x-1)(x-2)(x-3) + p^m$ for a large power of $p$ and show that one of these polynomials is irreducible (I see that's what Lubin said, except that $\epsilon$ does not have to be small in the real sense since cubic polynomials always have a real root). – franz lemmermeyer Jan 24 '18 at 13:11
• To tell the truth, I wasn’t thinking of Krasner either. For $a$, $b$, and $c$ mutually incongruent modulo $p$, Hensel does it for you perfectly well. – Lubin Jan 24 '18 at 20:16
• @franzlemmermeyer re second part: If $\epsilon$ is too big in the real sense (concretely, $>\frac{2}{9}\sqrt{3}$ with your values, which $p^m$ certainly is), the polynomial has only one real root ($\Leftrightarrow$ the discriminant becomes negative). It's supposed to factor completely both over $\Bbb R$ and over $\Bbb{Q}_p$. But certainly $\epsilon =(p/q)^m$ for high enough $m$ and $q>p$ with $gcd(q,p)=1$ does the job. – Torsten Schoeneberg Jan 25 '18 at 4:11

$\def\QQ{\mathbb{Q}}$You might know this, but it wasn't explicit: for a polynomial $f$ of degree $d$ over a $p$-adic field, then $\operatorname{Gal}(f) \subseteq A_d$ (the alternating group) if and only if $\Delta(f)$ is a square. In the case $d=3$, then $A_3 = C_3$ (cyclic) and so the only possible groups are $C_3$ (and $f$ is irreducible) or the trivial group (and $f$ splits). The latter cases are therefore distinguished by testing if $f$ has a root in the ground field. Hence your statement that $f$ splits if and only if the discriminant is a square and $f$ has a factor.

Answer 1. The general answer for finding roots of polynomials over $p$-adic fields is "Panayi's root finding algorithm". One place where it is documented is in section 8 of "On the computation of all extensions of a $p$-adic field" by Pauli and Roblot.
Answer 2. Something a little more direct, I suppose, is that you could use the explicit expression for the roots of a cubic polynomial. This will involve testing if various quantities are cubes, so it's quite analogous to the $d=2$ case, and Hensel's lemma will give you a criterion for whether or not a number is a cube.
Answer 3. Recall the discriminant is defined as $$\Delta = \prod_{i \neq j} (\alpha_i - \alpha_j)$$ where $\alpha_i$ are the roots of $f(x)$, and so testing if it has a square root is really testing if $\sqrt{\Delta} = \prod_{i < j} (\alpha_i - \alpha_j) \in \QQ_p$. If we have a square-root, then we know that the Galois group is inside $C_3$. If $\omega\in\QQ_p$ is a primitive cube root of unity (this exists if and only if $3 \mid p-1$), then similarly defining $$\Phi=\prod_{i=1}^3 \alpha_{i \bmod 3}+\omega\alpha_{i+1\bmod3}+\omega^2\alpha_{i+2\bmod3}$$ then you can expand this out and express it in terms of coefficients of $f$ and $\sqrt\Delta$ (just like you can express $\Delta$ in terms of coefficients of $f$). Then Fact: $f$ has a root if and only if $\Phi$ has a cube root. Therefore $f$ splits if and only if $\sqrt{\Delta}$ and $\sqrt[3]{\Phi}$ both exist.
For things like this, the luxury of being able to test for a $n$th root are generally restricted to fields containing primitive $n$th roots of unity. Hence the discriminant is so well-known because every field has square roots of unity!
• Thank you for this. Certainly the nicest case is $p \equiv 1$ mod 3 where one can exploit the third roots of unity. Do you happen to have a formula for $\Phi$ in the coefficients? As for Panayi's algorithm, which is new to me, it seems that it is rather employed to classify extensions of $\Bbb Q_p$, whereas I want something to be factored completely in $\Bbb Q_p$ (vaguely said, it lies "under" the $p$-adics, not "over" them). Or were you thinking of using it indirectly, as in "If $f$ did not split over $\Bbb Q_p$, its splitting field would be ..."? – Torsten Schoeneberg Jan 25 '18 at 9:04
• Expressing $\Phi$ is an exercise to the reader, I don't know the formula. – Doris Jan 25 '18 at 15:46
• Panayi's algorithm is an algorithm taking $f(x) \in \mathbb Q_p[x]$ and returning the roots of $f(x)$ in $\mathbb Q_p$. So a necessary and sufficient condition of having a root is "Panayi's algorithm says so". As flippant as this sounds, this approach has been used to prove parts of local class field theory explicitly. – Doris Jan 25 '18 at 15:48