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?
The assumption that the roots are distinct is essential. Roots of higher multiplicity are unstable, which is another way of saying that if you perturb them slightly, then the number of roots changes.
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$.