Connectedness and compactness of a union of two sets Let:
$$A=\Big\{ (x,y) \in \mathbb R^2: 0 \le x \le 1, y=\frac{x-1}{n},\, n\in \mathbb N \Big\}$$
$$B=\Big\{ (x,y) \in \Bbb R^2: 0 \le x \le 1, y=\frac{x}{n},\, n\in \mathbb N \Big\}$$
Is $A \cup B$ connected? Is it compact?
At first sight the union of these sets looks to be connected but not compact, yet I struggle to prove it.
I tried to prove the connectedness by showing that $A \cup B$ cannot be divided into two open (closed), disjoint sets but I get lost when it comes down to making a rigid formula. Could anyone help me with it? 
 A: Let's first deal with the compactness. Looking at certain points on the $x$-axis, we see that $A\cup B$ is not closed in $\mathbb{R}^2$, hence it is not compact.
Regarding the connectedness, first note that both $A$ and $B$ are connected. If we had $A\cap B \neq \varnothing$, the connectedness of $A\cup B$ would follow from that. But $A\cap B = \varnothing$, so we need to argue differently. However, we can write
$$A\cup B = A_1 \cup B$$
with a connected $A_1 \supset A$ such that $A_1\cap B \neq \varnothing$. Then the general fact that the union of two connected sets with nonempty intersection is connected finishes the proof.
To find such an $A_1$, remember that if $E$ is connected, and $E \subset F \subset \overline{E}$, then $F$ is connected too.

 So one should look at $\overline{A}\cap B$.

A: A set is connected if and only if any continuous function mapping from this set to $\{0,1\}$ is a constant function. Since both $A, B$ are union of closed segments and connected at the point $(1,0)$ and $(0,0)$ respectively, a continuous function $f:A\cup B \rightarrow \{0,1\}$ must be constant on the two parts. By continuity, $f((0, -1/n))\rightarrow f((0,0))$ hence $f$ is constant on $A\cup B$.
