Proving a convex space is connected A set $C \subset R^n$ is convex if given any $x_1, x_2 \in C$, the line segment connecting $x_1$
and $x_2$ is contained in C. Show that any convex set $C \subset R^n$ must be connected.
I want to prove this by assuming that C is disconnected and finding a contradiction. I know that since C is disconnected this means it has a pair of nonempty open sets A and B which partition it. So then if I choose $x_1 \in A$ and $x_2 \in B$, the line segment connecting these two points is contained in C. My idea is to show that if the line segment is contained in C then this contradicts A and B both being open. Will this work? I can't find the right way to finish this proof.
 A: Assume a decomposition $C= A \cup B$ exists as you have described.  Define $f:C \to \Bbb R$ via $f(x) = 0~ \forall x \in A$ and $f(x)=1~ \forall x \in B$.  Then $f:C \to \Bbb R$ is continuous.  Define $g:[0, 1] \to C$ via $g(t)=tx_1+(1-t)x_2.$  Then $g$ is continuous, so $f \circ g:[0, 1] \to \Bbb R$ is also continuous.  But $f \circ g$ must be discontinuous because (among other things) it violates the Intermediate Value Theorem:  $f \circ g(0)=0, f \circ g(1)=1, \forall t \in (0, 1)~ f \circ g(t) \neq \frac{1}{2}.$  That's a contradiction, so there can be no such decomposition of $C$.
Edited to add:
To see that $f$ is continuous, choose $x \in C$.  Then $x \in A$ or $x \in B$.  Let's assume $x \in A$.  Because $A$ is open, there exists an open ball $U$ around $x$ such that $U \subseteq A$.  Then $\forall \epsilon \gt 0 \forall y \in U, |f(y)-f(x)| = 0 \lt \epsilon$, so $f$ is continuous at $x$.  But $x$ is arbitrary, so $f$ is continuous throughout $C$.
A: Consider $\sup \{t\in [0,1]: tx_2+(1-t)x_1 \in A \}$. Call this $a$. Using the fact that $sx_2+(1-s)x_1 \in A^{c}$ for all $s>a$  conclude that $ax_2+(1-a)x_1 \in B $. Now use the fact that $B$ is open to get the contradiction that $sx_2+(1-s)x_1 \in B$ for $s<a$ and sufficiently close to $a$ contradicting the definition of $a$. 
A: Hint: We can describe the line segment connecting $x_1$ and $x_2$ by the path $\alpha: [0,1] \to C$, where $\alpha(t) = (1-t)x_1 + tx_2$. Then since $[0,1]$ is connected, and $\alpha$ is continuous, $\alpha([0,1])$ - aka, the line segment connecting these two points - must also be connected. (Hopefully you can use paths, if not path-connectedness!)
Can you see where to go from there?
