Prove that the sets in $\mathbb{R}^n$ which are both open and closed are $\emptyset$ and $\mathbb{R}^n$ I know the sets which are both open and closed in $\mathbb{R}$ are $\emptyset,\mathbb{R}$. Now I consider  in $\mathbb{R}^n$.
Attempt at a Proof: 


*

*Suppose $A\neq\emptyset,\mathbb{R}^n$.

*If $q\in A$ then any line which through $q$ is contained in $A$.

*$A=\mathbb{R}^n$.


It's hints of my teachers but i don't have any ideal to solve. 
 A: A line is homeomorphic to  $\mathbb R  $...  so by what you know, the set $A\cap l=l $, where l is the line... (For  $A\cap l $ will be clopen in $l \equiv \mathbb R  $ ).
To finish,  if $A $ contains every line through  $q $, $A=\mathbb R^n $...
A: Since $\mathbb{R}^n$ is connected, $\emptyset$ and $\mathbb{R}^n$ itself are the only sets which are both closed and open. Otherwise $\mathbb{R}^n=A\cup\overline{A}$ would be the disjoint union of two nonempty open sets.
A: (1). Def'n. A space $S$ is  connected iff the only open-and-closed sunsets of $S$ are $\phi$ and $S.$ Equivalently $S$ is connected iff whenever $A,B$ are disjoint open subsets of $S$ and $A\cup B=S$ then (at least) one of $A,B$ must be empty. 
(2). A continuous image of a connected space is connected.Proof: Let $S$ be connected and let $f:S\to T$ be a continuous surjection. Let $A, B$ be disjoint open subsets of $T$ with $A\cup B=T.$ Then $f^{-1}A$ and $f^{-1}B$ are disjoint open subsets of $S$ whose union is $S,$ so one of $f^{-1}A,\; f^{-1}B$ is empty. Since $f$ is surjective we have $A=f(f^{-1}A)$ and $B=f(f^{-1}B),$ so one of $A,B$ is empty.
Corollary: $[0,1]$ is a connected space because it is a continuous image of the connected space $\Bbb R.$ For example let $f(x)=0$ for $x<0,$  and $f(x)=x$ for $0\leq x\leq 1,$ and $f(x)=1$ for $x>1.$ 
(3). Def'n. A space $S$ is path-connected (path-wise connected) iff for any $x,y \in S$ there is a continuous $g:[0,1]\to S$ with $g(0)=x$ and $g(1)=y.$
A path-connected space is connected. (The  converse does not hold.)  Proof by contradiction: Suppose $S$ is path-connected and $S=A\cup B$ where $A,B$ are disjoint open non-empty subsets of $S.$ Take $x\in A$ and $y\in B$ and a continuous $g: [0,1]\to S$  with $f(0)=x$ and $f(1)=y.$ Now $g$ is a continuous surjection to the sub-space $V=g([0,1])$ of the space $S,$ so $V$ is a continuous image of the connected space $[0,1]$, so $V$ is a connected space. But $V\cap A$ and $V\cap B$ are disjoint non-empty open subsets of the space $V$ and their union is $V,$  a contradiction. 
(4). For vectors $x,y \in \Bbb R^n$ with $1<n<\infty,$ for $t\in [0,1]$ let $g_{x,y}(t)=(1-t)x+ty.$ Then $g_{x,y}:[0,1]\to \Bbb R^n $ is continuous with $g_{x,y}(0)=x$ and $g_{x,y}(1)=y.$ So $\Bbb R^n$ is path-connected, hence connected, hence has no open-and-closed subsets except $\phi$ and $\Bbb R^n.$  
