Given a galois group find the polynomial

What I have in mind in order to make it more concrete are the groups of order 8. We know that there are 5 groups of order 8 in total, 3 abelian and 2 non-abelian and we know their full structure as well. We also know that they can be thought of as the Galois group of some extension over $\mathbb{Q}$ (for example every p-group has that property, but here the situation is much more trivial I think to need such a theorem).

My intuition tells me that there is not a single type of polynomials for which those groups can be realised as Galois groups of those polynomials. For example take $D_4$, the dihedral group of the square. Now $D_4$ can be thought of a Galois group of $f(x)=x^4-2$ over $\mathbb{Q}$ or of a polynomial of degree 8 $f=x^8−3x^5−x^4+3x^3+1$, so even the degree of the polynomial is not fixed.

So my question is certainly not to find all the polynomials for which their Galois group is $D_4$, but find at least one.

To put it simply, my question is this. Given a finite group H which you know it is Galois group over $\mathbb{Q}$, if you know the group's structure/representation etc, is there any way to find a polynomial whose Galois group is H? If yes, what part of the group's structure do you need?

For the groups of order 8 for example, $D_4$ is $f(x)=x^4-2$, for $\mathbb{Z}_8$ my guess would be the cyclotomic $\phi_8=x^4+1$ and what's left is $\mathbb{Z_2}\times \mathbb{Z_4}$, $\mathbb{Z_2}\times\mathbb{Z_2}\times\mathbb{Z_2}$, which are abelian and the quaternion $Q_4$ which is non-abelian. I 'd like to think that if I work on it I 'd probably be able to find polynomials for the abelian groups but i have no idea what i would do for the non-abelian.

• Deciding whether a group is a Galois group over $\mathbb Q$ is a hard problem, called the inverse Galois problem. – lhf Mar 27 '18 at 12:11
• @lhf Yeah I am aware of that and i know I am bordering to this open problem, but I think that if you know everything about the group's structure then you re still in a safe zone. At least in the trivial cases of groups of order 8 i suppose everything 's been solved. For $S_n$ and $A_n$ theese cases have also been trivially answered so I 'd like to think that in the cases that you know everything about the group, there would be some solution. – fhn Mar 27 '18 at 12:15

For groups of smaller order like $8$ it seems to be much easier just to classify the Galois groups of cubics and quartics, as Keith Conrad is doing in his note here. So for quartics, the only group of order $8$ which arises is $D_4$, realized by $x^4+4x^2-2$, see Example $3.10$. Similarly, we easily find a polynomial with Galois group $Q_8$, see for example here: