Can a function $f : \mathbb{Q} \to \mathbb{Q}$ that is continuous on an interval $[a,b]$ not be bounded on $[a,b]$? I'm asking this because in Spivak's Calculus, the "Boundedness Theorem", which states that any real-valued function that is continuous on a closed interval is bounded on that interval, is proved using the properties of real numbers. However, I cannot think of a counterexample in which it fails for rationals.
2026-04-04 17:45:46.1775324746
On
Is a continuous function $f : \mathbb{Q}\to\mathbb{Q}$ always bounded on a closed interval?
448 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
5
On
Define $f\colon \mathbb{Q}\to \mathbb{Q}$ by
$$f(x) = \begin{cases} 1 &, x \leqslant 0 \\ 1 &, x > \pi^{-1} \\ k &, \pi^{-1} - \pi^{-k} < x < \pi^{-1} - \pi^{-k-1},\end{cases}$$
where $k\in \mathbb{N}\setminus \{0\}$. Since the jumps of $f$ are at the irrational points $\pi^{-1} - \pi^{-k},\, k \geqslant 2$ and at $\pi^{-1}$, $f$ is continuous, and $f$ is unbounded on $[0,1]\cap\mathbb{Q}$.
Perhaps a simpler example than the one given by Daniel,
$$f(x)=\frac1{x^2-2}$$
It is not hard to show that this function is continuous on every rational number (simply note that it is continuous on $\Bbb R\setminus\{\pm\sqrt2\}$ and so its restriction is continuous). But it is not bounded on the interval $[1,2]$.