Sufficient condition for the union of connected sets to be also connected

In one of my Calculus exercises sets, I have to show that:

For an indexed family of connected sets $$(X)_a$$ with a non-empty intersection, their union is also connected.

My attempt :

Since each $$X_a$$ is connected, every continuous function $$f:X_a \rightarrow \{0,1\}$$ is constant. Now take $$a \in \cap X_a$$, now for every $$X_a$$ the value of $$f(X_a)$$ is constant and is actually equal to $$f(a)$$. So if $$x \in \cup X_a$$ then it belongs to a certain $$X_i$$ such that $$f(x)$$ is equal to $$f(a)$$, by the previous argument. So $$f:\cup X_a \rightarrow \{0,1\}$$ is constant.

I think my proof is missing something and I'm not quite sure if it actually proves the statement. Any recommendations or comment are welcome.

• It looks fine. What's your doubt? – José Carlos Santos Sep 19 at 14:56

Let $$f: \bigcup_{a \in A} X_a \to \{0,1\}$$ be continuous.
Pick $$p \in \bigcap_{a \in A}$$ which exists by assumption.
Now for any arbitrary $$a \in A$$: $$f\restriction_{X_a}: X_a \to \{0,1\}$$ is also continuous and hence constant, so $$x \in X_a \implies f(x)=f(p)$$. So for any $$x \in \bigcup_{a \in A} X_a$$ we also have $$f(x)=f(p)$$.
So $$f$$ is constant and so $$\bigcup_{a \in A} X_a$$ is connected, using the function characterisation.