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!
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$.