Math Help - Interval and its image

1. Interval and its image

The question's like this：

Show that a nonempty set E of real numbers is an interval if and only if every continuous real-valued function on E has an interval as its image.

Thank you so much for helping me out!

2. Re: Interval and its image

The statement is an if and only if. So, first prove one direction, then the other. To prove the first direction, assume that E is an interval. Then show that it follows that every continuous real-valued function on E has an interval as its image.

Do you need help with that proof? To get you started: If the function is a constant function, then it is trivially true, as every constant $c$ can be expressed as the interval $$c,c$$.

Next, assume that every continuous real-valued function on E has an interval as its image. Try to prove that E is an interval. This should be trivial to prove. Hint: Let $f: E \to E$ be the identity function.