Q:

Discontinuous functions with the intermediate value property

Show that any function $f$ which is not continuous on $[a,b]$, but satisfies the intermediate value property, assumes some value infinitely often.
Here $f$ has the intermediate value property if:
whenever $(c,d)$ is a subinterval of $[a,b]$, $f$ achieves every value between $f(c)$ and $f(d)$. 
I am close to the answer here. I know there exists an $\epsilon$ such that for all $\delta_n = {1\over n}$ we have an $x_n$ such that $|x_n-x_0|<1/n$ but $|f(x_n)-f(x_0)| \geq \epsilon$, where $f$ is not continuous at $x_0$. 
I'd like to be able to say that we can select these $x_n$ so that $(f(x_n))$ is a sequence of distinct elements, and then somehow proceed. How should I do this, and is this the correct way to go?

A:

Your approach is fine. For each $n$ you've got an $x_n$ in $(x_0-\frac1n,x_0+\frac1n)$ such that either $f(x_n)\ge f(x_0)+\epsilon$ or else $f(x_n)\le f(x_0)-\epsilon$. Now use the IVP [*] to get a $y_n$ in $(x_0-\frac1n,x_0+\frac1n)$ such that $f(y_n)$ is equal to $f(x_0)+\epsilon$ or $f(x_0)-\epsilon$. Conclude that at least one of those two values must be assumed infinitely often.
[*] Suppose, e.g., that $x_n\gt x_0$. The IVP applied to the interval $[x_0,x_n]$ says that, in that interval, $f$ assumes all values between $f(x_0)$ and $f(x_n)$. If $f(x_n)\ge f(x_0)+\epsilon$ then then $f(x_0)+\epsilon$ is one of those values; if $f(x_n)\le f(x_0)-\epsilon$ then . . .

