# Polynomial $f(x)$ over $\mathbb{R}$ has $k$ distinct roots, then $f(x) + a$ too

I am trying to learn Galois theory by myself. When reading a section for applications to polynomials, I got stuck in the following exercise:

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

Is there an example for which the assumption that the roots of $f(x)$ are distinct is essential for the conclusion to hold?

A straightforward example over the reals is $$f(x) = (x-1)^2,$$ which has $1$ root: $x=1$ (We're not counting with multiplicity.) However, by introducing the parameter $a$, no matter how small, $$f(x) + a = (x-1)^2 + a$$ has $0$ roots if $a>0$ and has $2$ distinct roots if $a<0$.
Let $x_1, \dots, x_s$ be the zeroes of the derivative of $f$. Choose $\varepsilon$ to be the minimum of $\{|f(x_i)|, i =1, \dotsc, s\}$. Since all roots are distinct by assumption, we have $\varepsilon > 0$. This is exactly the $\varepsilon$ you are looking for. Showing this is a little bit technical, but an easy exercise (And it is definitely very intuitive: Shifting the graph a little bit upwards and downwards by such a small amount that no local minimum or maximum will exceed the x-axis will not change the number of roots).