Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that a continuous function maps compact sets into compact sets. My question now is, are there continuous functions $f:{\mathbb R}\rightarrow I$, with $I=[a,b]$ ($a\neq b$)?

share|cite|improve this question
Constant functions. – Quinn Culver Jul 31 '14 at 22:19
@QuinnCulver: Always the first functions anyone should check when testing out statements or looking for examples/counterexamples. We're on the same page with this. +1. – MPW Jul 31 '14 at 22:36
My guess, @Compa, is that you also want your function to be surjective. If so, you should add that criterion. – Quinn Culver Jul 31 '14 at 23:18
@QuinnCulver Thank you for your comment. Yeah, in fact I was trying to prove something else. I ended up asking this silly question, but it helped me anyway and I appreciate the willingness to help me. – Compa Aug 1 '14 at 0:48
up vote 6 down vote accepted

Take $f(x) = \sin x$. Then $f: \mathbb R \to [-1,1]$.

There are many other similar functions - for example $\frac 2 \pi \tan^{-1} x$ maps $\mathbb R \to (-1,1)$. The point is that whilst it is true that continuous functions take compact sets to compact sets, it is not generally true that the pre-image of a compact set is compact

share|cite|improve this answer
Thanks. Wait for 10 minutes for your check mark. – Compa Jul 31 '14 at 22:24
Wait--what? This is incorrect because $\tan x$ is unbounded. Hmm, maybe you mean $\tan^{-1} x$? – MPW Jul 31 '14 at 22:31
Of course. Typo corrected – Mathmo123 Jul 31 '14 at 22:33
Ok, yes, especially with the factor of $2/\pi$ out front, you really couldn't have meant anything else. I'll give you +1. – MPW Jul 31 '14 at 22:34

Any bounded continuous real-valued function can be scaled and shifted so that its image lies in any given interval of nonzero length.

For example, $f(x) = \tanh x$ maps $\mathbb R$ onto $(-1,1)$. Then $a+ \frac{b-a}{2}\cdot(1+f)$ maps $\mathbb R$ onto $(a,b)\subset [a,b]$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.