Prove that [0,1] is connected. I wrote a proof, and I just wanted to verify if it is correct.
Proof : Suppose not. Then, $[0,1] = U\cup V$ for $U$ and $V$ open in $[0,1]$ such that $U\cap V = \emptyset$. Let $0\in U$. Consider  $s= sup\{t \mid [0,t] \subset U\}$. Clearly, $s\in[0,1]$.
If $s\in U$, then since $U$ is open, $\exists \epsilon >0$ such that $B(s;\epsilon) \subset U$ . But then $s+\epsilon \in U$ , and $s+\epsilon > s$, contradicting the definition of $s$. So, $s \notin U$.
Then, $s\in V$. But again, since $V$ is open, $\exists \epsilon >0$  such that $B(s;\epsilon)\subset V$. But, since $s$ is the least upper bound of $U$, for this $\epsilon$, $\exists s_{1} \in U$ such that $s_{1} \in B(s;\epsilon)$. Then, $s_{1} \in U\cap V$, which contradicts the fact that $U$ and $V$ are disjoint.
So, our assumption is wrong and $[0,1]$ is connected.
 A: You're probably not looking for the answer still after a year, but for those who come across this in the future, it may be helpful. You are pretty much right about your proof, but here is a more formal way of writing it.
That is that "If $a<b$, then the subspace $[a,b]$ of $E^1$ is connected".
Let $a<b$ and let $[a,b]$ be a subspace of $R$ with the $E^{1}$ topology. For the sake of contradiction, assume that $[a,b]$ is not connected. Then $[a,b]= U \cup V$, where $U$ and $V$ are nonempty disjoint open sets in $[a,b]$. Without loss of generality we may assume that $b \in V$. Because $U$ is nonempty and bounded above (by $b$), the axiom of completeness states that $U$ has a least upper bound $s$. We will prove that $s$ is not an element of either $U$ or $V$, and this will yield a contradiction.
Suppose $s \in U$. Since $U$ is open, there exists an $\epsilon> 0$ such that $B_{\epsilon}(s) \subseteq U$. Thus, since $s+ \frac{\epsilon}{2} \in U$ and $s<s+ \frac{\epsilon}{2}$, there exists an element in $U$ that is greater than $s$. Therefore, $s$ is not an upper bound for $U$. This is a contradiction. Thus, $s \not \in U$. Now suppose $s \in V$. Then, because $V$ is open, there exists an $\epsilon>0$ such that $B_{\epsilon}(s) \subseteq V$. Then $s- \frac{\epsilon}{2}$ is an upper bound for $U$. But $s- \frac{\epsilon}{2}<s$, which is a contradiction because $s$ is the least upper bound for $U$. So $s \not \in V$. Thus, $s \not \in U \cup V$, which is a contradiction. Therefore, $[a,b]$ is connected.
A: Theorem
A topological space $X$ is connected iff every continuous function $f: X \to\{±1\}$ is a constant function.
Proof
Let $X$ be a connected space and  $f: X \to \{±1\}$ a continuous function. We want to show that $f$ is a constant function. If $f$ is non-constant, then it is onto. Let $A = f^{-1}(1)$ and $B = f^{-1}(-1)$. Then $A$ and $B$ are disjoint non-empty subsets of $X$ such that $A$ and $B$ are both open and closed subsets of $X$ and $X = A \cup B$. (Why?) This is a contradiction. Therefore $f$ is constant.
Conversely, let us assume that $X$ is not connected. Therefore there exist two disjoint proper non-empty subsets $A$ and $B$ in $X$ such that $A$ and $B$ are both open and closed in $X$ and $X = A \cup B$. Now we define a map $f: X \to \{±1\}$ as
$$f(x) =  \begin{cases} 1,& x\in A\\-1, & x \in B.\end{cases}$$
Then $f: X \to\{±1\}$ is a continuous non-constant function. (Why?) This completes the proof.
Now I am giving you a shorter proof of your problem.
Suppose $j$ is any interval
if  $f: J \to\{±1\}$ is an onto continuous function, then there exist
$x,y\in J$ such that $f(x) = -1$ and $f (y) = 1$. By the intermediate value theorem, there exists $z$ between $x$ and $y$ such that $f(z) = 0$, a contradiction to our assumption that $f$ takes only the values $\pm 1$. Hence no such $f$ exists and hence $J$ is connected. It follows that any interval is connected.
