Sorry for a bit unprecise title, the length is limited. Here is the full problem statement:
Let $f(x)$ be a function continuous at $x_0$. Let: $$ S(\delta) = \sup_{(x_0 - \delta, x_0 + \delta)} f \\ s(\delta) = \inf_{(x_0 - \delta, x_0 + \delta)} f $$ Prove that: $$ \lim_{\delta \to 0}(S(\delta) - s(\delta)) = 0 $$
Let's define an arbitrary sequence $\{\delta_n\}_{n\in\Bbb N}$ such that: $$ \lim_{n\to\infty}\delta_n = 0 $$ If follows that: $$ S(\delta_n) = \sup_{(x_0 - \delta_n, x_0 + \delta_n)} f \\ s(\delta_n) = \inf_{(x_0 - \delta_n, x_0 + \delta_n)} f $$ Observe that: $$ s(\delta_1) \le s(\delta_2) \le \cdots \le s(\delta_n) \\ S(\delta_1) \ge S(\delta_2) \ge \cdots \ge S(\delta_n) $$
We know that $f(x)$ is continuous at $x_0$. It means that for any sequence $\{x_n\}_{n\in\Bbb N}$ such that: $$ \lim_{n\to\infty} x_n = x_0 $$ we have that: $$ \lim_{n\to\infty}f(x_n) = f(x_0) $$
Or combining the above: $$ s(\delta_1) \le s(\delta_2) \le \cdots \le s(\delta_n) \le f(x_n) \le S(\delta_n) \le \cdots \le S(\delta_2) \le S(\delta_1) \tag 1 $$
Let $n\to\infty$ then: $$ \lim_{n\to\infty} s(\delta_n) = \liminf_{n\to\infty} f(x_n) \le \lim_{n\to\infty}f(x_n) \le \limsup_{n\to\infty} f(x_n) = \lim_{n\to\infty}S(\delta_n) $$
Since $s(\delta_n)$ is monotonically increasing and bounded above, also $S(\delta_n)$ is monotonically decreasing and bounded below we might conclude that: $$ \liminf_{n\to\infty} f(x_n) = \limsup_{n\to\infty} f(x_n) = \lim_{n\to\infty}f(x_n) = f(x_0) $$ Which implies: $$ \lim_{n\to\infty}(S(\delta_n) - s(\delta_n)) = \lim_{\delta\to 0}(S(\delta) - s(\delta)) = 0 $$
I have doubts regarding the above. One of the points is: $x_n$ is an arbitrary sequence so $(1)$ must not necessarily hold, must it? I would like to kindly request verification of the proof and/or point to its weak parts in case it's even valid. If not could you please suggest a valid way to prove the statement?
It is unclear (to me) how $(x_n)$ is chosen such that $(1)$ holds, or why $$ \lim_{n\to\infty} s(\delta_n) = \liminf_{n\to\infty} f(x_n) \text{ and } \limsup_{n\to\infty} f(x_n) = \lim_{n\to\infty}S(\delta_n) \, . $$
But the problem can be solved in a simpler way. $f$ is continuous at $x_0$, so for any $\epsilon > 0$ there is a $\delta_0 > 0$ such that $$ |x - x_0 | < \delta_0 \implies |f(x) - f(x_0)| < \epsilon \, . $$ It follows that for $0 < \delta < \delta_0$ $$ f(x_0) \le S(\delta) \le f(x_0) + \epsilon \\ f(x_0) \ge s(\delta) \ge f(x_0) - \epsilon $$ and therefore $$ 0 \le S(\delta) - s(\delta) \le 2 \epsilon \, . $$
Note that the reverse conclusion also holds: If $\lim_{\delta \to 0}(S(\delta) - s(\delta)) = 0$ then $f$ is continuous at $x_0$.