TITLE: Computing the Galois group of a polynomial
QUESTION [38 upvotes]: Does there exist an algorithm which computes the Galois group of a polynomial 
$p(x) \in \mathbb{Z}[x]$? Feel free to interpret this question in any reasonable manner. For example, if the degree of $p(x)$ is $n$, then the algorithm could give a set of permutations $\pi \in Sym(n)$ which generate the Galois group.

REPLY [2 votes]: There is another way that doesn't seem to be mentioned here. This is just something that occurred to me a few days ago; if anyone knows whether this has been done before I would greatly appreciate your comments.
It is well known that, given a field $K_0$ and a polynomial $p \in K_0[x]$, the following process will eventually give us a field $K_n$ which is a splitting field for $p$:

choose a monic irreducible factor of $p$ of degree $> 1$ in $K_0[x]$. Call this factor $q_1$.
Let $K_1 = K[r_1] / (q_1(r_1))$.
choose a monic irreducible factor of $p$ of degree $> 1$ in $K_1[x]$. Call this factor $q_2$.
Let $K_2 = K_1[r_2] / (q_2(r_2))$.
choose a monic irreducible factor of $p$ of degree $> 1$ in $K_2[x]$, etc.

So we have a splitting field $K_n$, explicitly constructed as a quotient of $K_0[r_1, \ldots r_n]$. Let $I$ be the kernel of the obvious map from $K_0[r_1, ... r_n]$ to $K_n$. The algorithm above also gives us a Gröbner basis for $I$: for each of the polynomials $q_i$, with $2 \leq i \leq n$ let $q'_i$ be a lift of $q_i$ to a monic polynomial with coefficients in the polynomial ring $K_0[r_1, ... r_{i - 1}]$. Then it is easy to see that $B:=\{q_1(r_1), q'_2(r_2), ... q'_n(r_n)\}$ is a Gröbner basis for $I$ with the lexicographic monomial ordering with $r_n > r_{n-1} > ... > r_1$.
In general, if we have a ring $R$ with an ideal $J$, an automorphism $f: R \rightarrow R$ will induce an automorphism of $R/J$ iff $J$ is $f$-invariant, i.e. $f(x) \in J$ whenever $x \in J$. In particular, if $\sigma$ is a permutation of $\{ r_1 \ldots r_n \}$, and $f_\sigma$ is the corresponding automorphism of $K_0[r_1, ... r_n]$, we have that $f_\sigma$ induces an automorphism of $K_n$ iff $I$ is $f_\sigma$-invariant, or equivalently, $f_\sigma(b) \in I$ for each $b \in B$. Furthermore, we can test if $f_\sigma(b) \in I$ with multivariate division, which is convenient as $B$ is already a Gröbner basis for $I$.
In summary, we can check if a permutation $\sigma$ of the roots of $p$ is in the Galois group by checking if $f_\sigma(b) \in I$ for each $b \in B$, and this can be done with multivariate division.