If $\{x_n\}$ is a sequence in an open interval and $f$ is continuous, must $\{f(x_n)\}$ have a convergent subsequence? What if the interval is closed? I seek to show whether the following statements are true or false:


*

*If $f$ is continuous on $(a,b)$ and $\{x_n\}$ is a sequence in $(a,b)$, then the sequence $\{f(x_n)\}$ has a convergent subsequence.

*If $f$ is continuous on $[a,b]$ and $\{x_n\}$ is a sequence in $(a,b)$, then the sequence $\{f(x_n)\}$ has a convergent subsequence.
My gut tells me one of them is true and the other false, but I'm not sure which. I think 2 is false and 1 is true? I can't really seem to explain why...
Thanks in advance.
 A: HINTS:


*

*Look at the sequence $\left\langle\frac1n:n\in\Bbb Z^+\right\rangle$ in $(0,1)$ and the function $f(x)=\frac1x$.

*If $f$ is continuous on $[a,b]$, then $f\big[[a,b]\big]$ is a closed interval $[c,d]$ in $\Bbb R$. What do you know about sequences in closed, bounded sets?
A: The first statement is false. Consider the case where $f(x)=\frac{1}{x}$, $(a,b)=(0,2)$, and $\{x_n\}=\{\frac{1}{n}\}$. Obviously, $\{f(x_n)\}=\{n\}$, which has no convergent subsequence. 
A: It's the other way around: 1. is false and 2. is true.
It's all about the endpoints. Imagine any continuous function that would go to $\pm\infty$ both in $a$ and in $b$. This is allowed for 1. but not allowed for 2. Now, if $x_n\to a$, then $f(x_n)$ will tend to $\pm\infty$, so it's not convergent.
A: If you suppose $f(x)=\frac{1}{x-a}$, and consider the sequence $x_n=a+\frac{1}{n}$, what happens to $f(x_n)$? Does it have a convergent subsequence?
On the other hand, since $[a,b]$ is compact and the continuous image of a compact set is compact, we know $f([a,b])$ is compact. Now we know any bounded sequence will have a convergent sequence, therefore $f(x_n)$ will have a convergent subsequence.
A: The second statement is true. This is because $[a,b]$ is compact, and $f$ is continuous, which implies that $f([a,b])$ is also compact. Hence, $f(\{x_n\})$ is a sequence in a compact set, which indicates that it has a convergent subsequence (compactness implies sequential compactness.)
