a) A continuous function defined on an open interval with range equal to a closed interval.
My example: $f(x)=\frac{1}{2}\sin(4\pi x)+\frac{1}{2}$ on $(0,1)$ to $[0,1]$.
Note: I am not considering $\mathbb{R}$ an interval.
b) A continuous function defined on a closed interval with range equal to an open interval.
I think this is impossible if we exclude $\mathbb{R}$. Edit: we must also exclude unbounded intervals. By the Extreme Value Theorem, any continuous function on a compact set attains a maximum and a minimum. Yet, the set of the points in an open interval doesn't include its supremum and infimum, a contradiction.
c) A continuous function defined on an open interval with range equal to an unbounded closed set different from $\mathbb{R}$.
My example: $f(x)=\sqrt{|x|}$ on $\mathbb{R}$ to [0,$\infty$). Is there another function that works and has a different domain than $\mathbb{R}$?
d) A continuous defined on all of $\mathbb{R}$ with range equal to $\mathbb{Q}$.
I was thinking maybe map the natural numbers to $\mathbb{Q}$ and use the rest to "fill in the gaps." Evidently, I need most help with d).
Thanks in advance!
Best Answer
For a) I would just consider a constant function, $[a,a]$ is a closed interval. If you want an interval of positive length, $\sin$ or some variation (like yours) is the way to go. Personally I would prefer to adapt the domain to adding stuff and factors.
For b) your argument is correct for bounded intervals.
For c) you could do something with $x+\frac{1}{x}$.
For d) consider what the intermediate value theorem would mean for such a function.