Let $f:[a,b] \to \mathbb{R}$ be a bounded function. Define $A_{f,x} : (0, \infty) \to \mathbb{R}$ by $$A_{f,x} (r) = \text{diam}\left( f((x-r,x+r) \cap [a,b])\right).$$ Show that for all $\epsilon >0$ the set $\{x\in [a,b] : \lim_{r\to 0^+} A_{f,x} (r)\geq \epsilon \}$ is a closed set.
I showed that $f$ is continuous at $x$ if and only if $\lim_{r\to 0^+} A_{f,x} (r) = 0$. I'm thinking about showing the set is closed by showing the image of the set is closed (since $f$ is continuous, the pre-image must be closed). Is this the right approach? If so/not, how should I proceed/conclude? (In this case, would the set of discontinuities of $f$ be a union of countably many closed sets?)
Let $$ S_\varepsilon=\{x\in [a,b] : \lim_{r\to 0^+} A_{f,x} (r)\geq \varepsilon \} $$ and let $x_0\not\in S_\varepsilon$. This means that $$ \lim_{r\to 0^+} \text{diam}\big(\, f\big[(x_0-r,x_0+r) \cap [a,b]\big]\big)< \varepsilon $$ and hence, there exists an $r_0>0$, such that $$ \text{diam}\big(\, f\big[(x_0-r_0,x_0+r_0) \cap [a,b]\big]\big)< \varepsilon $$ Claim. If $x\in (x_0-r_0,x_0+r_0)$, then $\lim_{r\to 0^+}A_{f,x}<\varepsilon$.
Indeed, if $x_1\in (x_0-r_0,x_0+r_0)$, then for $r_1=|r_0-x_1|$, we have that $$ (x_1-r_1,x_1+r_1)\subset (x_0-r_0,x_0+r_0) $$ and hence $$ \text{diam}\big(\, f\big[(x_1-r_1,x_1+r_1) \cap [a,b]\big]\big)< \varepsilon $$ which in turn implies that $$ \lim_{r\to 0^+} \text{diam}\big(\, f\big[(x_1-r,x_1+r) \cap [a,b]\big]\big)< \varepsilon. $$
Therefore, if $x_0\not\in S_\varepsilon$, then a whole open interval containing $x_0$ is disjoint with $S_\varepsilon$. This means that the complement of $S_\varepsilon$ is open and hence $S_\varepsilon$ is closed.