Irreducible polynomial in $\mathbb Q[x]$ of degree $n$ having exactly $n-2$ real roots.

I need to show that for any $n$ there is an irreducible polynomial in $\mathbb Q[x]$ of degree $n$ having exactly $n-2$ real roots.

I know that from a previous exercise that if $f(x) \in \mathbb{R}[x]$ is any polynomial having exactly $k$ distinct real roots, there exists $\epsilon > 0$ for which $f(x) +a$ has exactly $k$ real roots, for all $a\in \mathbb{R}$ with $|a|<\epsilon$.

Then by starting with any polynomial $f(x) \in \mathbb Q[x]$ with exactly $n-2$ distinct real roots, and using the paragraph above $f(x)+a$ has the same property for infinitely many $a\in \mathbb Q$. Now, how can use the Eisenstein irreducibility criterion for $f(x) \in \mathbb Z[x]$ and $a \in \mathbb Q$ to prove my initial statement?

Thanks

• See this related answer for a more general result. Listing this, because the method closely follows what you seem to be trying. The twist in getting the resulting polynomial to be irreducible is kinda neat IMHO. – Jyrki Lahtonen Mar 18 '15 at 13:56

I'd start with some polynomial $f\in\mathbb Z[X]$, say $$f(X)=(X^2+m)(X-k_1)\cdots(X-k_{n-2})$$ with $m,k_1,\dots,k_{n-2}$ positive even integers, and $k_1<\cdots<k_{n-2}$. Now use your previous post which says that $f(X)+\dfrac a b$ has also exactly $n-2$ real roots for all $a,b\in\mathbb Z$, $b\ne0$ with $\bigg\vert\dfrac ab\bigg\vert<\epsilon$ for some $\epsilon>0$. Then $bf(X)+a$ has the same property. If $$f(X)=X^n+a_{n-1}X^{n-1}+\cdots+a_1X+a_0$$ then $$bf(X)+a=bX^n+(ba_{n-1})X^{n-1}+\cdots+(ba_1)X+(ba_0+a).$$ Now chose $b$ odd, $a=2$, and use Eisenstein's Criterion for $p=2$.