Finding a closed subset in $\mathbb{R}^2$ such that its image is not closed in $\mathbb{R}$ I am trying to find an example of a subset $S\subset\mathbb{R}^2$ such that the image   $\pi_1$(S) is not closed in $\mathbb{R}$.
I define the image $\pi_1$ as:
$\pi_1 : \mathbb{R}^n \to \mathbb{R} $ given by $\pi_1(x) = x_1$
I've stared at this for far too long without coming up with anything remotely plausible, so I was wondering if anybody here could lend a hand.
 A: David Mitra has answered the question in a comment (which I upvoted), but it might be useful for you if I indicate how one might approach the problem, rather than just "seeing" the answer. I'd think about how one might prove that $\pi_1(S)$ is closed; the proof will fail, but how it fails will give a hint about a counterexample.
So suppose I try to prove that $\pi_1(S)$ is closed. I consider an arbitrary convergent sequence $(x_n)$ of points in $S$, and I try to show that the limit, say $q$, is also in $\pi_1(S)$.  By assumption, there is, for each $n$, some $y_n$ such that $(x_n,y_n)\in S$ (because that's what it means for $x_n$ to be in $\pi_1(S)$). I want to find some $r$ such that $(q,r)\in S$, so that I can conclude that $q\in\pi_1(S)$. Since $q$ is the limit of the sequence $(x_n)$, it is natural to try to find $r$ as the limit of the sequence $(y_n)$. Then $(q,r)$, being the limit of a sequence of points $(x_n,y_n)$ in $S$, would also be in $S$ because $S$ is closed.  That would finish the proof. The only remaining issue to make sure the sequence $(y_n)$ has a limit; if it does, the limit serves as $r$ and the proof is done.  But OOPS! an arbitrary sequence $(y_n)$ of real numbers needn't  have a limit.
I could get by without a genuine limit; an accumulation point (i.e. limit of some subsequence) would also serve my purpose as $r$. Unfortunately, even that might not exist; the sequence $(y_n)$ might diverge to $\infty$ (or to $-\infty$, or oscillate between them) and then I don't see any usable $r$.  So this attempted proof that $\pi_1(S)$ is closed has failed.
Fortunately, the failure shows me the path to a counterexample.  $S$ must contain a sequence $(x_n,y_n)$ such that the $x_n$'s converge to some $q$ but the $y_n$'s diverge to $\infty$ (or to $-\infty$, or $\dots$).  There are lots of ways to do that. One of the simplest is to take $x_n=\frac1n$, converging to $0$, and $y_n=n$, diverging to $\infty$. A natural $S$ that contains these is the graph in David Mitra's comment.  Alternatively, one could take $S$ to be the set consisting of only the specific pairs $(\frac1n,n)$ that we're actually using.  There are lots of other counterexamples, but they're all based on the same idea. (And most of them look more complicated to me.)
