Factorization of cubic $x^3 + x^2 - 2x -1\pmod p$ Show that $x^3 + x^2 - 2x -1$ factorizes mod $p$ as a product of distinct linear factors if $p \equiv \pm 1 \pmod 7$, is a cube for $p=7$ and irreducible otherwise.
I was told there are both a solution with splitting fields and an elementary solution but I can't think of any of them.
Any help appreciated!
 A: Well, I suppose my argument is the one with splitting fields; here it is, in all its prolixity:
As @quarague has pointed out, you can see that your polynomial is $\equiv(X-2)^3\pmod7$, so that case is disposed of.
Otherwise, consider a (primitive) seventh root of unity $\zeta\in\Bbb C$, root of the irreducible polynomial $X^6+X^5+X^4+X^3+X^2+X+1$. Then it’s a nice computation to show that the minimal polynomial of $\xi=\zeta+\zeta^{-1}$ is your polynomial $X^3+X^2-2X-1$. (I’ve done this computation many times, and I recognized the polynomial.)
Now let’s consider four cases, depending on the order of $p$ in the multiplicative group of $\Bbb F_7$: since this group is cyclic of cardinality six, these are the cases:
If $p\equiv1\pmod7$, as, for instance $p=29$, then the seventh roots of unity are already in $\Bbb F_p$, so that $\xi=\zeta+1/\zeta$ is in $\Bbb F_p$, and its polynomial must split.
If $p$ is  of order two, i.e. $p\equiv-1\pmod7$, as with $p=13$, then $7|(p^2-1)$ so $\zeta$ is quadratic over $\Bbb F_p$. Now write $p=7m-1$, and write $\xi=\zeta+\zeta^{-1}=\zeta+\zeta^{7m-1}=\zeta+\zeta^p$. That is, $\xi$ is the trace of $\zeta$ from $\Bbb F_{p^2}$ down to $\Bbb F_p$. Again, $\xi\in\Bbb F_p$, and your polynomial splits.
If $p$ is of order three, i.e. $p\equiv2,4\pmod7$, as with $p=23$ and $p=11$, then $7|(p^3-1)$ and $\zeta$ is cubic over $\Bbb F_p$. But since $\zeta$ is a root of $X^2-\xi X+1$, we see that $\bigl[\Bbb F_p(\zeta):\Bbb F_p(\xi)\bigr]$ is either $1$ or $2$, and the latter is impossible because $[\Bbb F_p(\zeta):\Bbb F_p]=3$.
Thus $\xi$ is cubic over $\Bbb F_p$ and your polynomial is irreducible modulo $p$.
The last case, that $p$ was of order six, i.e. $p\equiv3,5\pmod7$, is similar, with three fields now, $\Bbb F_p\subset\Bbb F_p(\xi)\subset\Bbb F_p(\zeta)$ and $\bigl[\Bbb F_p(\zeta):\Bbb F_p(\xi)\bigr]=2$ and again $\xi$ cubic over $\Bbb F_p$, with your polynomial being irreducible.
A: To test whether $f$ has multiple roots, we perform the Euclidean algorithm for $\gcd(f,f')$. This gives
$$
7 = (2 x^2 + x - 3)(x^3 + x^2 - 2x -1)' +  (-6 x - 1)(x^3 + x^2 - 2x -1)
$$
Therefore, $x^3 + x^2 - 2x -1$ has a multiple root iff $p=7$.
Indeed, $x^3 + x^2 - 2x -1=(x+5)^3$. This also follows from the Euclidean algorithm. The first step tells us a double root, which in this case turns out to be a triple root:
$$
x^3 + x^2 - 2x -1=5(x+5)(x^3 + x^2 - 2x -1)' \bmod 7
$$

Here is a proof that if $x^3 + x^2 - 2x -1$ has a root, then it splits.
If $a$ is a root of $x^3 + x^2 - 2x -1$, then the other roots are $b= a^2 - 2$ and $c = -a^2 - a + 1$. This can also be expressed as follows: if $u$ is a root, then so is $g(u)=u^2-2$.
Indeed, the discriminant of $x^3 + x^2 - 2x -1$ is $\Delta=49$.
On the other hand, $\Delta=d^2$, where
$$d=(a-b)(a-c)(b-c)=(a-(b+c)a+bc)(b-c)=(3a^2+2a-2)(b-c)$$
since $b+c=-1-a$ and $bc=1/a=a^2+a-2$.
Therefore, $b-c=\dfrac{14 a^2 + 7 a - 21}{49}d$. Using $b+c=-1-a$ and $d=\pm 7$ gives the result.
A: You can a bit of algebraic number theory to prove the claim in arguably a faster way.
As mentioned in the other answers the roots of this polynomials are $\zeta_7 + \zeta_7^{-1}$, $\zeta_7^2 + \zeta_7^{-2}$, $\zeta_7^3 + \zeta_7^{-3}$. This means that the splitting field of the polynomial is $\mathbb{Q}(\zeta_7 + \zeta_7^{-1})$. It is an easy exercise in algebraic number theory to prove that the ring of integers of this algebraic number field is  $R =\mathbb{Z}[\zeta_7 + \zeta_7^{-1}]$. Hence by Dedekind's Theorem we can transform the problem from how $x^3 + x^2 - 2x - 1$ factors mod $p$ to how $pR$ splits in $R$.
To do this first of all compute the Galois group of the polynomial. It's not hard to conclude it is isomorphic to $\mathbb{Z}/3\mathbb{Z}$. This follows, because the discriminant of the polynomial is $49$. You can use some of the methods mentioned in here. Moreover this means that $7$ is the only prime that ramifies in $R$, since it is the only prime factor of the discriminant. Moreover, as the ramification index has to divide the order of the Galois group we have that it is $3$. Thus we have that $x^3 + x^2 - 2x - 1$ is a cube mod $7$.
From now one assume that $p \not = 7$. Then $pR$ doesn't ramify in $R$. Thus we have that the inertia group of $p$, $I_p$ is the trivial group. On the other side the decomposition group, $D_p$ can be either the whole group, which means that $x^3 + x^2 - 2x - 1$ remains irreducible module $p$, or it is the trivial group, meaning that the polynomial factors into three linear factors. It's well-known that $D_p/I_p$ is cyclic and generated by the Frobenius element. In this example it is the automorphism $\phi(\alpha) = \alpha^p$ for all $\alpha \in R$.
So it remains to find when this automorphism is identity and when not. It is obviously identity on $\mathbb{Z}$, so it will be identity if and only iff $(\zeta_7 + \zeta_7^{-1})^p = \zeta_7 + \zeta_7^{-1}$. Finally it is not hard to notice this is the case if and only if $p \equiv \pm 1 \pmod 7$. 
