Find a closed, bounded subset $A$ of $\Bbb Q$ and a continuous function $f : A →\Bbb R$ such that $f$ is not bounded

Note: $\Bbb Q$ is the set of all rationals.

My Solution:

$A=\{x:x\in\Bbb Q, 1\leq x\leq2\}$. Clearly $A$ is bounded below by $1$ and bounded above by $2$. Also $A$ is closed since it contains its limit points. Define $f : A →\Bbb R$ such that $f(x)=\frac1{x-1}$. $f(x)$ is not bounded at $x=1$ but I am unsure about its continuity at $x=1$. Does the right continuity at $x=1$ alone ensure the function is continuous?

What is more important is the question that how does this not violate the theorem that the image of a compact set is compact under a continuous function. Since $A$ is compact (any open cover of $A$ has a finite subcover), the images of $A$ under $f$ must also form a compact set which implies that the image set is closed and bounded, contradiction.

  • $\begingroup$ Your function isn't defined at $x = 1$, so there is no continuity here. Also you need left continuity as well. $\endgroup$
    – IAmNoOne
    Nov 10, 2014 at 23:55
  • $\begingroup$ Thanks, I was also thinking of the same. Do you have any other suggestion as how to choose the function? $\endgroup$ Nov 10, 2014 at 23:56

1 Answer 1


Unfortunately, that doesn't work, since $f$ is not defined at $1$ or at $2.$ However, you have the right general idea. Instead, you can pick some irrational number $\beta$ with $1<\beta<2,$ and let $f(x)=\frac1{x-\beta}.$

Alternately, proceed more or less as you have, but instead, let $A:=\{x\in\Bbb Q:\alpha\le x\le\beta\}$ for some irrational $\alpha,\beta$ with $\alpha<\beta,$ then put $f(x)=\frac1{(x-\alpha)(x-\beta)}.$ $A$ turns out to be closed, and clearly bounded, and the rest is fairly straightforward.

As a side note, $\Bbb Q$ (with the usual metric) is a good example of a metric space in which "closed and bounded" need not imply "compact," the demonstration of which is (I suspect) more or less the point of this exercise.

  • $\begingroup$ But what about my other question? how does this not violate the theorem that the image of a compact set is compact under a continuous function? $\endgroup$ Nov 10, 2014 at 23:59
  • $\begingroup$ @Martin, because your $A$ isn't compact to begin with. $\endgroup$
    – IAmNoOne
    Nov 11, 2014 at 0:01
  • $\begingroup$ @Martin See the last sentence of this answer. $\endgroup$ Nov 11, 2014 at 0:01
  • 1
    $\begingroup$ Simply put, because closed and bounded subsets of $\Bbb Q$ need not be compact. For example, we can cover the set $A$ from your post with open sets of the form $$\left(0,\sqrt{2}-\frac1{n+1}\right)_{\Bbb Q}\cup\left(\sqrt{2}+\frac1{n+1},3\right)_{\Bbb Q}$$ for $n\ge 1.$ However, this has no finite subcover. $\endgroup$ Nov 11, 2014 at 0:04
  • $\begingroup$ @Martin: Another way to see it is to choose a sequence of distinct rationals from $A$ that converges to $\sqrt{2}$ in $\Bbb R.$ This sequence has no subsequence that converges in $A$, and so $A$ is not compact. $\endgroup$ Nov 11, 2014 at 0:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .