Problem about components in a compact Hausdorff space I have the following problem of general topology: In a compact Hausdorff space, define $x\sim y$ if for every continuous function $f:X\rightarrow\mathbb{R}$ with $f(x)=0$ and $f(y)=1$, there exists $w\in X$ such that $f(w)=1/2$. I need to prove that $\sim$ is an equivalence relation and the equivalence classes are the components. I have showed that $\sim$ is reflexive and symmetric, but I don't realize how to prove the transitive property.
Thank you!
 A: That $\sim$ is an equivalence relation is shown in freakish's answer.
If $x,y$ belong to the same component $C$ of $X$, then $x \sim y$ simply because each $f(C)$ is a connected subset of $\mathbb{R}$ containing $0,1$.
For the converse you have to consider quasicomponents. The quasicomponent of a point $x$ is the intersection of all closed-open sets containing $x$. For compact Hausdorff spaces quasicomponents agree with components. See e.g. Quasicomponents and components in compact Hausdorff space. 
If $x,y$ do not belong to the same component, they do not belong to the same quasicomponent. This means that not all closed-open sets can contain both $x,y$. W.lo.g. we may assume that there exists a closed-open $C$ such that $x \in C$, $y \notin C$. Define $f : X \to  \mathbb{R}$ by $f(a) = 0$ for $a \in C$ and $f(a) = 1$ for $a \in X \setminus C$. This is a continuous function not attaining the value $1/2$. Hence $x \not\sim y$.
Note that the above argument does not use the fact that $\sim$ is an equivalence relation. In fact, we have shown that $x \sim y$ iff $x,y$ belong to the same component of $X$ which implies that $\sim$ is an equivalence relation. However, or argument requires a compact Hausdorff $X$. freakish's proof is valid for any $X$.
A: Assume that $a\sim b$ and $b\sim c$. Assume that $a\nsim c$. So there is a continuous function $f:X\to\mathbb{R}$ such that $f(a)=0$ and $f(c)=1$ but $f(x)\neq 1/2$. Now consider $X_1=f^{-1}(-\infty, 1/2)$ and $X_2=f^{-1}(1/2, \infty)$. These are both open, nonempty and their union is $X$.
Assume that $b\in X_1$ and consider
$$h:(-\infty, 1/2)\cup (1/2,\infty)\to (-\infty, 1/2)\cup (1/2,\infty)$$
$$h(x)=\begin{cases}
0 &\text{if }x\in(-\infty, 1/2) \\
x &\text{otherwise}
\end{cases}$$
Obviously $h$ is continuous. Now consider $g=i\circ h\circ f$ where $i:(-\infty, 1/2)\cup (1/2,\infty)\to\mathbb{R}$ is the inclusion. It follows that
$$g(b)=h(f(b))=0\text{ since }f(b)\in(-\infty, 1/2)$$
$$g(c)=h(f(c))=h(1)=1$$
But $g$ doesn't have $1/2$ in its image by the construction. So $b\nsim c$ which is a contradiction.
For case $b\in X_2$ you just switch $h$ to be $1$ on $(1/2,\infty)$ and identity otherwise. Then you consider $g(b)$ and $g(a)$.
Both cases lead to contradiction which completes the proof. $\Box$
P.S. It doesn't seem that the assumption about $X$ being compact Hausdorff is necessary?
