If $f: [a, b] \to \Bbb{R}$ is continuous and $f([a, b]) \supset [c, d]$, then there is an interval $[α, β] \subset [a, b]$ where $f([α, β]) = [c, d]$. I greatly appreciate any help in letting me know if I'm on the right track, what I got wrong etc.
Question: Suppose that $f: [a, b]\to \mathbb{R}$ is continuous and suppose that $f([a, b]) \supset [c, d]$. Show that there is an interval $[\alpha, \beta] \subset [a, b]$ such that $f([\alpha, \beta]) = [c,d]$.
Proof: Since $f([a, b]) \supset [c, d]$ there are two points $p, q \in [a, b]$ such that $f(p) = c$ and $f(q) = d$. For convenience, assume that $p < q$, the case where $p > q$ follows similar reasoning. Consider the interval $[p, q]$. Let $A$ be the set of all $s \in [p, q]$ such that $f(s) = c$ and let $B$ be the set of all $t \in [p, q]$ such that $ f(t) = d$. These sets are nonempty because we have $p \in A$ and $q \in B$.
Closed, bounded intervals in $\mathbb R$ have the least upper bound property, and because $A$ is bounded from above by $q$ it has a supremum which we will denote by $\sup(A) = \alpha$.
Likewise, $B$ has a greatest lower bound which we will denote by $\inf(B) = \beta$. Now consider the interval $[\alpha, \beta]$ and notice that for any point $r \in [\alpha, \beta]$ it must be the case that $f(r) \in [c, d]$. To see why, suppose $f(r) \notin [c, d]$, then either $f(r) < c$ or $f(r) > d$, assume $f(r) < c$. Then $f(r) < c < f(q)$, so by the Intermediate Value Theorem, there is a point $s \in (r, q)$ such that $f(s) = c$, which means $s \in A$, contradicting the fact that $\alpha$ is an upper bound on $A$.
It remains to be shown that $f(\alpha) = c$ and $f(\beta) = d$. For contradiction, suppose $f(\alpha) \neq c$, then by the above reasoning $\mathit c < \mathit f\,(\alpha) < d$. Let $\varepsilon = \mathit f\,(\alpha) - c$. By continuity of $\mathit f$ there is a $\delta$ such that $\mathit x \in (\mathit \alpha-\delta, \alpha+\delta)$ implies $\mathit f\, (x) \in (\mathit f\,(\alpha)-\varepsilon,\mathit f\,(\alpha)+\varepsilon)$
But this would imply $f(x) \in (c, f(\alpha) + \varepsilon)$, making $x$ a lower upper bound on $A$ than $\alpha$, a contradiction. The same reasoning implies that $f(\beta) = d$. Thus $f([\alpha, \beta]) = [c, d]$.
 A: You assumed that $\alpha < \beta$, which is not necessarily the case. Note that it is irrelevant to the fact that $p < q$, for example $f(x) = \cos(x)$, with $[p, q] = [-\pi, 2\pi]$; we have $\sup A = \pi$, and $\inf B = 0$.
We could deal with it iteratively: first take $\alpha_1 = \sup A$. We have $\alpha_1 < q$. Next define $B_1 = B \cap [\alpha_1, q]$ and then $[\alpha, \beta] = [\alpha_1, \inf B_1]$.
When you prove that $f(\alpha) = c$ you state that $x$ is a lower upper bound on $A$ than $\alpha$, which is only true if we take $x \in ( \alpha-\delta, \alpha)$. But such $x$ may not live in our domain (i.e. we could have $\alpha = p = a$, which would be problematic).
You could more simply show that $f(\alpha) = c$ and $f(\beta) = d$ directly. You could use continuity ($\alpha = \lim_{n\to\infty} a_n$ for some elements $a_n \in A$, so $f(\alpha) = f(a_n) = c$ for all $n$), or you could show that $A$ is closed and bounded (by $A = f^{-1}(c) \cap [a, b]$), $B$ similarly.
You could also articulate that $f([\alpha, \beta]) = [c, d]$, comes from intermediate value theorem, or contentedness (you proved $f([\alpha, \beta]) \subseteq [c, d]$, $f(\alpha) = c$ and $f(\beta) = d$ before).
