Continuous function from R to a compact set

158 Views Asked by At

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$)?

2

There are 2 best solutions below

4
On BEST ANSWER

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

0
On

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]$