Galois group of a reducible polynomial over $\mathbb {Q}$

Solution 1:

Your argument shows that $\text{Gal}(f)$ is contained in $\text{Gal}(g)\times \text{Gal}(h)$, since it sends roots of $g$ to roots of $g$ and roots of $h$ to roots of $h$. The simplest example that shows that you cannot expect equality in general is $f=g^2$. Clearly, in this case $\text{Gal}(f)=\text{Gal}(g)$. More generally, equality holds if and only if the splitting fields of $g$ and $h$ are disjoint over $\mathbb{Q}$. Note that this is stronger than $g$ and $h$ being coprime.

Exercise: find two distinct irreducible polynomials $g$ and $h$ whose splitting fields are not disjoint over $\mathbb{Q}$.