[proofplan]
Among all pairs $(p, q) \in A \times A$ with $F(p) = b_1$ and $F(q) = b_2$ (the endpoints of $B$), we select a pair minimising $|p - q|$. The interval $C$ between $p$ and $q$ then satisfies $F(C) \supset B$ by the Intermediate Value Theorem, and the minimality of $|p - q|$ excludes preimages of both $b_1$ and $b_2$ from the interior of $C$, which forces $F(C) \subset B$.
[/proofplan]
[step:Select a closest pair of preimages of $b_1$ and $b_2$ in $A$]
Write $A = [a_1, a_2]$ and $B = [b_1, b_2]$ with $b_1 \leq b_2$. Since $F \colon A \to \mathbb{R}$ is continuous and $B \subset F(A)$, the preimage sets
\begin{align*}
P_1 := \{x \in A : F(x) = b_1\}, \qquad P_2 := \{x \in A : F(x) = b_2\}
\end{align*}
are each non-empty (because $b_1, b_2 \in F(A)$) and compact (each is the intersection of a closed set with the compact interval $A$). The product $P_1 \times P_2$ is therefore a non-empty compact subset of $\mathbb{R}^2$. The continuous function $(p, q) \mapsto |p - q|$ attains its minimum on $P_1 \times P_2$ at some pair $(p^*, q^*)$. Define
\begin{align*}
C := [\min(p^*, q^*),\; \max(p^*, q^*)].
\end{align*}
Then $C \subset A$ (since $p^*, q^* \in A$ and $A$ is a closed interval), $F(p^*) = b_1$, and $F(q^*) = b_2$.
[guided]
The challenge is to find a subinterval $C \subset A$ that maps *exactly* onto $B$: we need both $F(C) \supset B$ (surjectivity) and $F(C) \subset B$ (no overshooting). Surjectivity is easy -- the Intermediate Value Theorem provides it whenever $C$ contains a preimage of $b_1$ and a preimage of $b_2$. The hard part is preventing $F$ from exceeding $B$ on the interior of $C$.
The key idea is to choose $C$ so that no interior point of $C$ maps to $b_1$ or $b_2$. Why does this help? If $F$ were to exceed $b_2$ at some interior point $x_0$ (say $F(x_0) > b_2$), then by the IVT applied on the sub-interval from an endpoint of $C$ (where $F = b_1$ or $F = b_2$) to $x_0$, the function $F$ would have to cross the value $b_2$ at some interior point -- creating an interior preimage of $b_2$, which we have excluded. Similarly, any excursion below $b_1$ would create an interior preimage of $b_1$.
How do we ensure no interior preimages of $b_1$ or $b_2$? By the closest-pair construction. The preimage sets $P_1 = \{x \in A : F(x) = b_1\}$ and $P_2 = \{x \in A : F(x) = b_2\}$ are non-empty (since $B \subset F(A)$) and compact (closed subsets of the compact interval $A$). The product $P_1 \times P_2$ is compact, so the continuous function $(p, q) \mapsto |p - q|$ attains its minimum at some pair $(p^*, q^*)$.
Setting $C = [\min(p^*, q^*), \max(p^*, q^*)]$: if some interior point $x_0 \in \operatorname{int}(C)$ satisfied $F(x_0) = b_1$, then $x_0 \in P_1$ and $|x_0 - q^*| < |p^* - q^*|$ (since $x_0$ is strictly between $p^*$ and $q^*$). This contradicts the minimality of $|p^* - q^*|$ over $P_1 \times P_2$. The same argument excludes interior preimages of $b_2$.
This is the elegant trick at the heart of the proof: the closest-pair condition is a geometric constraint that prevents boundary-value preimages from appearing in the interior, which in turn traps $F(C)$ inside $B$ by the IVT.
[/guided]
[/step]
[step:Verify that no interior point of $C$ maps to $b_1$ or $b_2$]
Suppose $x_0 \in \operatorname{int}(C)$ satisfies $F(x_0) = b_1$. Then $x_0$ is strictly between $p^*$ and $q^*$, so
\begin{align*}
|x_0 - q^*| < |p^* - q^*|.
\end{align*}
Since $x_0 \in A$ and $F(x_0) = b_1$, the pair $(x_0, q^*)$ lies in $P_1 \times P_2$ with strictly smaller distance than $(p^*, q^*)$. This contradicts the minimality of $|p^* - q^*|$.
An identical argument (replacing $b_1$ with $b_2$ and $p^*$ with $q^*$) shows that no $x_0 \in \operatorname{int}(C)$ satisfies $F(x_0) = b_2$.
Hence $F(x) \notin \{b_1, b_2\}$ for all $x \in \operatorname{int}(C)$.
[/step]
[step:Show $F(C) \supset B$ by the Intermediate Value Theorem]
The function $F$ is continuous on the closed interval $C$, and $F(p^*) = b_1$, $F(q^*) = b_2$ with $b_1 \leq b_2$. By the Intermediate Value Theorem, $F$ attains every value in $[b_1, b_2]$ on $C$. Hence $B \subset F(C)$.
[/step]
[step:Show $F(C) \subset B$ by combining the IVT with the exclusion from Step 2]
Suppose for contradiction that there exists $x_0 \in \operatorname{int}(C)$ with $F(x_0) \notin [b_1, b_2]$.
**If $F(x_0) > b_2$:** Since $F(p^*) = b_1 \leq b_2 < F(x_0)$ and $p^*$ is an endpoint of $C$ while $x_0 \in \operatorname{int}(C)$, the Intermediate Value Theorem applied to $F$ on the interval between $p^*$ and $x_0$ (which is contained in $C$) yields a point $x' $ strictly between $p^*$ and $x_0$ with $F(x') = b_2$. Since $x'$ lies strictly between two points of $C$ where one is an endpoint, $x' \in \operatorname{int}(C)$ and $F(x') = b_2$. This contradicts Step 2.
**If $F(x_0) < b_1$:** Since $F(q^*) = b_2 \geq b_1 > F(x_0)$ and $q^*$ is an endpoint of $C$ while $x_0 \in \operatorname{int}(C)$, the Intermediate Value Theorem on the interval between $x_0$ and $q^*$ yields $x' $ strictly between $x_0$ and $q^*$ with $F(x') = b_1$. Then $x' \in \operatorname{int}(C)$ and $F(x') = b_1$, contradicting Step 2.
Hence $F(x) \in [b_1, b_2]$ for all $x \in \operatorname{int}(C)$. Since $F(p^*) = b_1 \in B$ and $F(q^*) = b_2 \in B$, we conclude $F(C) \subset B$.
[guided]
We need to show $F(C) \subset B = [b_1, b_2]$, i.e., $F(x) \in [b_1, b_2]$ for every $x \in C$. The endpoints are fine: $F(p^*) = b_1 \in B$ and $F(q^*) = b_2 \in B$. The content is in showing no interior point of $C$ maps outside $B$.
Suppose for contradiction that $F(x_0) > b_2$ for some $x_0 \in \operatorname{int}(C)$. Consider the sub-interval from $p^*$ to $x_0$ (both in $C$). At $p^*$, $F(p^*) = b_1 \leq b_2 < F(x_0)$. By the Intermediate Value Theorem, there exists $x'$ strictly between $p^*$ and $x_0$ with $F(x') = b_2$. Since $x'$ lies strictly between an endpoint and an interior point of $C$, $x' \in \operatorname{int}(C)$. But this contradicts the exclusion from Step 2: no interior point of $C$ maps to $b_2$.
The case $F(x_0) < b_1$ is symmetric: the IVT on the sub-interval from $x_0$ to $q^*$ (where $F(q^*) = b_2 \geq b_1 > F(x_0)$) produces an interior point $x'$ with $F(x') = b_1$, contradicting Step 2.
The logic is an elegant "squeeze": $F$ takes the value $b_1$ at one endpoint of $C$ and $b_2$ at the other, and the closest-pair construction prevents $F$ from hitting either boundary value $b_1$ or $b_2$ at any interior point. This traps $F$ inside $[b_1, b_2]$ on the interior -- any excursion outside would force a crossing of a boundary value (by the IVT), which is forbidden.
Hence $F(x) \in [b_1, b_2] = B$ for all $x \in C$ (including the endpoints, where $F$ equals $b_1$ and $b_2$ respectively). Combined with $F(C) \supset B$ from the previous step, we conclude $F(C) = B$: the subinterval $C$ maps exactly onto $B$.
[/guided]
[/step]
[step:Conclude $F(C) = B$]
Combining $F(C) \supset B$ (Step 3) and $F(C) \subset B$ (Step 4), we have $F(C) = B$. The set $C = [\min(p^*, q^*), \max(p^*, q^*)]$ is a closed subinterval of $A$, completing the proof.
[/step]