Solution (source code)

= Solution

The <intermediate value theorem> says that if $f:[a,b]\to\mathbb R$ is a <continuous function>, every value between $f(a)$ and $f(b)$ is attained at some point of $[a,b]$.

For a proof, endpoint values are immediate, and replacing $f$ by $-f$ reduces the remaining case to $f(a)<y<f(b)$. The set $S=\{x\in[a,b]:f(x)\le y\}$ is nonempty and bounded above; let $c=\sup S$ by the <least-upper-bound property>. <Continuity> and the strict endpoint inequalities ensure $a<c<b$: near $a$ there are points in $S$, and near $b$ there are none. If $f(c)>y$, <continuity> gives a neighborhood of $c$ containing no points of $S$, contradicting the defining approximation property of the <supremum>. If $f(c)<y$, <continuity> gives points to the right of $c$ still in $S$, contradicting its being an upper bound. Hence $f(c)=y$, proving the <intermediate value theorem>.

For the distance problem, define the <continuous function>
$$
d(x)=\sqrt{(x-a)^2+(f(x)-b)^2}.
$$
It satisfies $d(x)\ge|x-a|$, so it is a <coercive function>: $d(x)\to\infty$ as $|x|\to\infty$. Choose $R>|a|+d(0)+1$. Outside $[-R,R]$, the distance is greater than $d(0)$. On $[-R,R]$, the <extreme value theorem> gives a minimizer $x_0$, with $A=d(x_0)\le d(0)$. It is therefore a global minimizer and $A\ge0$.

For any $y>A$, choose $X>x_0$ so large that $d(X)>y$. Apply the <intermediate value theorem> to $d$ on $[x_0,X]$ to obtain a point whose distance is $y$. The distance $A$ itself is attained at $x_0$, and no smaller value is possible. This is the <range of a continuous coercive real function>. Thus \b[the distance set is exactly]
$$
\boxed{[A,\infty),\qquad A=\min_{x\in\mathbb R}\sqrt{(x-a)^2+(f(x)-b)^2}.}
$$
In particular $A=0$ precisely when the fixed point lies on the graph.