Let $f$ be irreducible over $\mathbb{Q}$ with splitting field $F$. Suppose $\text{Gal}(F/\mathbb{Q})$ is either $D_8$ or $Q_8$. What are the possibilities for $\deg f$?
I'm using Dummit & Foote, and they characterize possibilities for the Galois groups of irreducible polynomials of degree $\le 4$. There are quartics with Galois group $D_8$, such as $x^4\pm 2$, but no polynomial of degree $<4$ has Galois group $Q_8$. I have no experience with finding Galois groups of polynomials of degree $>4$ by hand (this problem was not given in my class, so please refer me to the proper readings if there is any literature that deals with such questions).
For $Q_8$ I have an example of an 8th degree polynomial whose Galois group is $Q_8$, namely, $x^8−24x^6+144x^4−288x^2+144$ (splitting field is $\mathbb{Q}((2+\sqrt 2)(3+\sqrt 3))$, but this is my go-to example and I do not know of any others nor do I know how to prove or disprove that there are others of higher degree with the same Galois group.
For $D_8$ I would bet that there is some degree 8 out there with this as its Galois group, but I can't construct one, nor can I classify which degrees can give a Galois group $D_8$.
How does one proceed with this type of question (please suggest how this problem can be approached for some other well-known groups as well)?
The two key facts you need are the following:
In particular, when $f$ has $n=\deg f$ roots, $\mathrm{Gal}(E/\mathbb Q)$ must be a transitive subgroup of $S_n$.
This follows because $E$ must have a subfield generated by a single root of $f$.
The second fact tells us the that only possible degrees of $f$ are $1,2,4$ and $8$.
The first fact tells us that for $D_8$, the only possible degrees are $4$ and $8$, and for $Q_8$, the only possible degree is $8$.
An example of a degree $8$ polynomial with Galois group $D_8$ is $X^8 + 6X^4+1$.