Doubt regarding a question on continuity.

40 Views Asked by At

Suppose that $S$ is a non-empty subset of $\mathbb R$. Show that every continuous real function with domain $S$ has closed range if, and only if, $S$ is closed in $\mathbb R$.

The book of Searcoid asks us to prove it.It is true that if $S$ is not closed then there would exist a function $f(x)=x$ that is continuous on $S$ but $f(S)$ is not closed.But if $S$ is closed,what is the guarantee that $f(S)$ should be closed.Take the example $\arctan :[0,\infty)\to \mathbb R$,where $f(S)=[0,\pi/2)$ not closed.