Sandwich rule for continuity Let $c ∈ X ⊆ R $ . Suppose that $f : X → \mathbb{R}$, $g : X → \mathbb{R}$, and $h : X → \mathbb{R}$ are functions such that $g(x) ≤ f(x) ≤ h(x)$ for all $x ∈ X$.
Suppose that $g$ and $h$ is continuous at $c$ and $g(c) = h(c).$
Question: Show that f is continuous at c.
Attempt:
I have started by writing down the following.
Let $\epsilon >0$. We know that $g$ is continuous hence we have $\delta_g$ such that
$|x-c|< \delta_g$ $\implies$ $|g(x)-g(c)|< \epsilon$.
We know that $h$ is continuous hence we have $\delta_h$ such that
$|x-c|< \delta_h$ $\implies$ $|h(x)-h(c)|< \epsilon$.
How do I connect $f$ to $h$ and $g$?

First note that setting $x=c$ in the inequality implies that $g(c) \le f(c) \le h(c) = g(c)$ and therefore $g(c) = f(c) = h(c)$.
For $\epsilon > 0$ you have found $\delta_g > 0$ and $\delta_h > 0$ such that
$$
|x-c|< \delta_g \implies |g(x)-g(c)| < \epsilon \implies g(x) > g(c) - \epsilon\\
|x-c|< \delta_h \implies  |h(x)-h(c)| < \epsilon \implies h(x) < h(c) + \epsilon
$$
Now set $\delta = \min(\delta_g, \delta_h)$. Then $|x-c| < \delta$ implies
$$
 f(c) - \epsilon = g(c) - \epsilon <  g(x) \le f(x)
$$
and
$$
 f(x) \le h(x) < h(c) + \epsilon =  f(c) + \epsilon 
$$
and therefore
$$
 f(c) - \epsilon < f(x) <  f(c) + \epsilon \iff |f(x) - f(c)| < \epsilon \, .
$$
