Let $a,b\in\mathbb{R}$ and $aLet $a,b\in\mathbb{R}$ and $a<b$. Which of the following statement(s) is/are true?


*

*There exists a continuous function $f:[a, b]\rightarrow (a,b)$ such that $f$ is one-one.

*There exists a continuous function $f:[a,b]\rightarrow(a,b)$ such that $f$ is onto.

*There exists a continuous function $f:(a, b)\rightarrow[a,b]$ such that $f$ is one-one.

*There exists a continuous function $f:(a, b)\rightarrow[a,b]$ such that $f$ is onto.


I have found an example for option 4: take a compact subset $[c,d]$ of $[a,b]$, find a bijection $f : [c,d] \to [a,b]$, and then extend $f$ to have domain $(a, b)$.
Also 2 can not be correct, because a continuous function on a compact set has compact image.
How to eliminate the others?
 A: For 1) take any closed interval $[c,d]$ contained in $(a,b)$. Can you find  a homeomorphism from $[a,b]$ onto $[c,d]$? (There is one of the type $f(x)=\alpha x+\beta$). 
For 3) the identity function is an example. 
A: *

*Yes, can shrink the closed interval to fit in $(a,b)$.

*As $f$ is continuous we must have $f([a,b])$ closed and bounded i.e compact.

*Yes, the identity.

*Yes, we can use the following continuous surjection (there are plenty of others, too) $(0,1) \to [0,1]$, $x\mapsto \frac{1}{2}\sin (4\pi x) + \frac{1}{2}$. Then a continuous surjection 
$$(a,b)\to (0,1) \to [0,1] \to [a,b] $$
is straightforward to find.

A: Not if $f$ is not one-to-one then $f$ can "double up".  If $f$ is not onto it doesn't have to "hit them all".  Your argument that the image of a compact set must be compact is good... if the function isn't onto the codomain need not be the image!
1)$f:[a,b]\to (a,b)$ is continuous and one to one.  It seems we want be able to get close to $\lim_{x\to w}f(w) =a$ without some issue.  But we don't have to!
If it's not onto it needn't hit all points.
Let $a < c < d < e$.   Let $f(a) = c$ and $f(d) = b$ and all the other points just do a linear stretch.  That is for $a\le x \le b$ let $f(x) = (x-a)\frac {d-c}{b-a} + c$.  That's one-to-one.
2) If $f$ is onto then the image is the codomain and your argument that a continuous image of a compact set is compact is valid.  This is in essence the Extreme value system.  This can not be done.
3) $f:(a,b)\to [a,b]$ is one-to-one.  But it doesn't have to be onto.  So it doesn't have to hit them all.
Let $a< c< d< b$ and let those $x$ that are "close" to $a$ have $f(x)$ "close" to $c$ and those "close" to $b$ have $f(x)$ "close" to $c$ so the image of $f$ is $(c,d)$ and $f$ just stretches between the points.  Like the function in 1). 
That is for $a< x < b$ let $f(x) = (x-a)\frac {d-c}{b-a} + c$.  That's one-to-one.
(Hmmm.... even easier.... $f(x) = x$....The image is $(a,b)$.)
4) is different from $2$  A continuous function from a compact set must have a compact image, but a compact image needn't come from a compact set.  The function is onto but not one to one.  So for $f(w)=a$ we must have some $a< x< w$ where $f(x)$ is equal to some $f(y)$ for some $w< y$ but that's okay.
Let $a<c<d<b$ an let $f(c) =a$ and $f(d)=b$ and just stretch it out for the points between.  That is, for $c\le x\le d$ let $f(x) = (x-c)\frac {b-a}{d-c}$.  And for $x <  c$... welll do whatever you want.  Let $f(x)=a$ and for $x > d$ let $f(x)=b$.  Not one-to-one but onto.
