Continuous functions on disconnected sets

continuityfunctionsgeneral-topologyreal-analysis

I am having some problems solving the following exercise from a supplement to Rudin’s “Principle of Mathematical Analysis”:

“If $ \{ E_i \}_{i \in I} $ is a family of at least two pairwise disjoint subsets of a metric space X whose union is all of X, and such that every function $ f:X \rightarrow Y $ such that the restriction of $f$ to each $E_i$ is continuous, is itself continuous, then all $E_i$ are open.”

Any hint is highly appreciated!

EDIT

After some thought I found this solution:
"Suppose that $E_{i*}$ isn't open, then, by definition, there exists a point $x_0 \in E_{i*}$ such that every neighbourhood of $x_0$ contains at least a point of the X-complement of $E_{i*}$. Now, let $\{ x_n\}_{n \in \Bbb N}$ be the sequence of points of the X-complement of $E_{i*}$ such that $x_n$ is at a distance at most $\frac1n$ from $x_0$. Finally, define a function $f: X \rightarrow R$ such that $f(x) = 0, \forall x \notin E_{i*}$ and $f(x) = 1, \forall x \in E_{i*}$. Clearly this function is continuous on each set of the collection $\{ E_i \}_{i \in I}$, however, $f(x_n)$ can not approach 1 because it is constantly 0, thus contradicting the hypotesis"

Any proof-check/-review is welcome!

Best Answer

After some thought I found this solution: "Suppose that $E_{i*}$ isn't open, then, by definition, there exists a point $x_0 \in E_{i*}$ such that every neighbourhood of $x_0$ contains at least a point of the X-complement of $E_{i*}$. Now, let $\{ x_n\}_{n \in \Bbb N}$ be the sequence of points of the X-complement of $E_{i*}$ such that $x_n$ is at a distance at most $\frac1n$ from $x_0$. Finally, define a function $f: X \rightarrow R$ such that $f(x) = 0, \forall x \notin E_{i*}$ and $f(x) = 1, \forall x \in E_{i*}$. Clearly this function is continuous on each set of the collection $\{ E_i \}_{i \in I}$, however, $f(x_n)$ can not approach 1 because it is constantly 0, thus contradicting the hypotesis"

Related Question