How do I use proof by contradiction to show that the union of two connected sets is connected?
The statement as it is now is false.
Consider $\displaystyle A=[0,1]$ and $\displaystyle B=[2,3]$. $\displaystyle A$ and $\displaystyle B$ are clearly connected, but $\displaystyle A\cup B$ isn't.
You would have to assume that $\displaystyle A$ and $\displaystyle B$ are not disjoint, that is, $\displaystyle \exists~x$ such that $\displaystyle x\in A$ and $\displaystyle x\in B$.
Note: you need to assume (for instance) that the two connected subsets have a non-empty intersection.
Let $\displaystyle X,Y$ be connected sets such that $\displaystyle X\cap Y\neq\emptyset$. Assume by contradiction that $\displaystyle X\cup Y$ is disconnected. Then there would exist two disjoint non-empty open subsets $\displaystyle O_1,O_2$ of $\displaystyle X\cup Y$ such that $\displaystyle O_1\cup O_2=X\cup Y$ (nb: $\displaystyle O_1,O_2$ are open for the induced topology on $\displaystyle X\cup Y$). Let $\displaystyle U_1=O_1\cap X$, $\displaystyle U_2=O_2\cap X$. Then $\displaystyle U_1,U_2$ are disjoint open subsets of $\displaystyle X$ such that $\displaystyle U_1\cup U_2=X$. Similarly, we can define $\displaystyle V_1,V_2$ for $\displaystyle Y$. Since $\displaystyle X$ and $\displaystyle Y$ are connected, we must have either $\displaystyle U_1=\emptyset$ or $\displaystyle U_2=\emptyset$, and either $\displaystyle V_1=\emptyset$ or $\displaystyle V_2=\emptyset$. Each case leads to a contradiction. For instance, if $\displaystyle U_1=\emptyset$ and $\displaystyle V_1=\emptyset$, then $\displaystyle U_1\cup V_1=\emptyset$, whereas $\displaystyle U_1\cup V_1=O_1\neq\emptyset$. If $\displaystyle U_1=\emptyset$ and $\displaystyle V_2=\emptyset$, then $\displaystyle X\cap O_1=\emptyset$ and $\displaystyle Y\cap O_2=\emptyset$, hence $\displaystyle (X\cap Y)\cap(O_1\cup O_2)=\emptyset$ ($\displaystyle O_1,O_2$ are disjoint), which contradicts $\displaystyle X\cap Y\neq \emptyset$ since $\displaystyle O_1\cup O_2=X\cup Y$.
Because $\displaystyle U_1\subset O_1$, $\displaystyle U_2\subset O_2$, and $\displaystyle O_1,O_2$ are disjoint.
Because $\displaystyle X\subset X\cup Y = O_1\cup O_2$. You should draw a diagram if you don't get it. I just split $\displaystyle X$ into two parts according to the partition of $\displaystyle X\cup Y$. If $\displaystyle O_1,O_2$ cut $\displaystyle X\cup Y$ in two disjoint pieces, then their intersections with $\displaystyle X$ cut it also in two disjoint pieces.Also, you said
Then U_1,U_2 are disjoint open subsets of X such that U_1\cup U_2=X.
==
How do you know this fact that the union of U1 and U2 is X?
I did not. In fact, $\displaystyle U_1\cup U_2= X$, as results directly from the definitions of $\displaystyle U_1$ and $\displaystyle U_2$.
Which $\displaystyle S_1, S_2$ ?? Since you procede by contradiction, you must find a disconnection of either $\displaystyle X$ or $\displaystyle Y$, this would be the contradiction.Why isn't showing that the pair S1, S2 isn't a disconnection sufficient?