Why is the union of non disjoint path connected sets path connected? If $X$ is a topological space, and $A, B\subset X$ are not disjoint and both path connected, it intuitively makes sense that $A\cup B$ is path connected: If, for $x_0\in A$ and $x_1\in B$ you take an $\tilde{x}\in A\cap B$ and continuous $\gamma_A:[0,1]\rightarrow A$ and $\gamma_B:[0,1]$ with $\gamma_A(0) = x_0, \gamma_A(1) = \tilde{x} = \gamma_B(0)$ and $\gamma_B(1) = x_1$, you can just take the function that sends $s$ to $\gamma_A(2s)$ for $s\leq \frac{1}{2}$ and $\gamma_B(2s-1)$ for $s\geq\frac{1}{2}$. (Basically, if we are looking at the non-trivial case where $x_0$ is in one of the sets and $x_1$ is in the other, you make a path by joining two continuous paths together, which you know exist because $A$ and $B$ are path connected).
Call this function $\gamma$, then $\gamma$ meets the requirements that $\gamma(0) = x_0, \gamma(1) = x_1$. Now we just need to verify that $\gamma$ is continuous. I'm trying to do so by looking at an open set $U\in\mathcal{T}_{A\cup B}$, and verifying that $\gamma^{-1}(U)$ is an open interval in $[0,1]$. However, this is where I'm stuck. I tried to work it from the angle that $U = U_1\cup U_2$ with $U_1\subset A, U_2\subset B$, but then I need $U_1$ and $U_2$ to be open, which I don't know how to prove.
Is this the way to go? Or is there a different way to approach the problem?
 A: So $\gamma$ is continuous if and only if it is seqentially continuous, as $[0,1]$ is a metric space. At $x\in [0,1/2)$ or $(1/2,1]$, we can simply use the continuity of $\gamma_A$ and $\gamma_B$ respectively. The only delicate point is $x_0=1/2$. For $x_n\longrightarrow (1/2)^-$, we have $\lim \gamma(x_n)=\lim \gamma_A(2x_n)=\gamma_A(1)=\tilde{X}$.And for $x_n\longrightarrow (1/2)^+$, we have $\lim \gamma(x_n)=\lim \gamma_B(2x_n-1)=\gamma_B(0)=\tilde{X}$. I only remains to convince yourself that this suffices for the general case $x_n\longrightarrow 1/2$ to hold, which can be done by considering the possibly finite subsequences $x_n^+$ and $x_n^-$ of all $x_n$ greater than $1/2$ and less than $1/2$ respectively.
Now this was a tedious argument and certainly not the way we should do that. Here is a more general, purely topological fact, which makes everything easier to write. And which is the real reason behind this. The key fact is that the closed sets of a topology induced by a topological set $X$ on a closed subset $F$ are precisely the closed sets of $X$ contained in $F$. Note that this is false in general if $F$ is not closed. See the remninder below.

Lemma: let $f:X\longrightarrow Y$ be a function between two topological spaces. If there exist two closed sets $F_1,F_2$ in $X$ such that $X=F_1\cup F_2$ and both $f_1:=f_{|F_1}$ and $f_2:=f_{|F_2}$ are continuous for the induced topology on $F_1$ and $F_2$ respectively, then $f$ is continuous.
Remark: the same fact holds if you replace closed by open. 

Proof: We will show that for every $F$ closed in $Y$, $f^{-1}(F)$ is closed in $X$, which is equivalent to the continuity of $f$. So take $F$ closed in $Y$ and observe
$$
f^{-1}(F)=f_1^{-1}(F)\cup f_2^{-1}(F).
$$
By assumption, each $f_j^{-1}(F)$ is closed in $F_j$ for the induced topology, i.e. there exists $G_j$ closed in $X$ such that $f_j^{-1}(F)=G_j\cap F_j$. Hence $f_j^{-1}(F)$ is a fortiori closed in $X$ and $f^{-1}(F)$ is the union of two closed sets, whence closed in $X$. QED.

Application: apply this to $f=\gamma$ on $X=[0,1]$ with $F_1=[0,1/2]$ and $F_2=[1/2,1]$.

Reminder: if $X$ is a topological space and $S$ is a subset of $X$. Then the topology induced by $X$ on $S$ is that where the open (resp. closed) sets all sets of the form $S\cap U$ (resp. $S\cap F$) for some $U$ open in $X$ (resp $F$ closed in $X$). These need not be open (resp. closed) in $X$ in general. As this would imply in particular that $S$ is open (resp. closed) in $X$.
For example, for $X=[0,1]$ and $S=[0,1/2)$, then $[0,1/2)$, like any $[1/2-1/n,1/2)$ is closed in $[0,1/2)$ for the induced toplogy. Indeed we can write $[1/2-1/n,1/2)=[0,1/2)\cap [1/2-1/n,1]$ as the intersection of $[0,1/2)$ by a closed set of $[0,1]$.
