# how to choose coefficients for a polynomial which gives a pair of complex conjugates at roots?

I recently found WeBWork and was trying to write up some problems and wanted to make a problem such that the factors of the polynomial would have a pair of complex conjugates. I understand that $2$ is a complex number. I want to choose just those polynomials which will give $\mathbb{R}$ & an even number of $\mathbb{C}$ roots or just an even number of $\mathbb{C}$ roots. I do know that the coefficients must be rational numbers, but that is all. I believe there is something deeper for me to learn here.

How do I generate polynomials that do not have only real roots, with rational coefficients?

If you want two of the roots to be $a$ and $\bar a$, complex conjugates, then $(x-a)(x-\bar a)=x^2-(a+\bar a)x+|a|^2=x^2-2\text{Re}( a) x +|a|^2$. So just make sure that the real part of $a$ is rational, and that the modulus of $a$ is the square root of a rational number (this means that $\text{Im}(a)=\sqrt{r}$ for some rational $r$). You can do this for other complex numbers $b,c,d,...$ and assemble a polynomial as large as you like by multiplying all of the resulting quadratics. For good measure, you can also multiply by some $x-q$ terms where $q$ is a rational number if you would like some real roots too.