Suppose that $f : (X, \tau) → (Y, \sigma)$ is a map, that $X = A \cup B$, and that the two restrictions $f|_A: (A, \tau_A) → (Y, \sigma), \ f|_B: (B, \tau_B) → (Y, \sigma)$ are both continuous (on the subspaces). Show that
(i) if $A, B$ are both $\tau$-open, then f is continuous;
(ii) if $A$ is $\tau$-open and $B$ is $\tau$-closed, then it is not necessarily true that $f$ is continuous.
Answer:
(i) Suppose $Z\in \sigma$. Since the given restrictions are continuous, $f^{-1}|_A(Z) \subseteq A, \ f^{-1}|_B(Z) \subseteq B$ and $f^{-1}|_A(Z) \cup f^{-1}|_B(Z) \subseteq A \cup B = X.$
If that is true, where do we use the opennes of $A, B$? If not, how do I fix it?
(ii) Suppose $f(X)$ is $\sigma-$open. Then we want $X$ to be open for $f$ to be contiunous. But if $A = (0, 1), \ B = [1, 2]$, then $X$ is not open. Does that make sense?
Since $f|_A, f|_B$ are continuous, $f^{-1}|_A(Z)$ and $f^{-1}|_B(Z)$ are open, but not necessarily in $\tau$ - you only know $f^{-1}|_A(Z)$ is open in $\tau_A$ and $f^{-1}|_B(Z)$ is open in $\tau_B$. This is by definition of continuity.
If $A$ is open, then any set in $\tau_A$ is also in $\tau$, because by definition of $\tau_A$ a set in $\tau_A$ is the intersection of a set in $\tau$ with $A$, and the intersection of open sets (in $\tau$ in this case) is open (in $\tau$ in this case). Hence, if $A$ is open, $f|_A^{-1}(Z)$ is open in $\tau$. Similarly for $B$. Then $f^{-1}|_A(Z) \cup f^{-1}|_B(Z)$ is open (unions of open sets are open) and you are done (the union is $f^{-1}(Z)$ itself).
Note that (ii) requires you give an example of a function, not just of an $X$, $A$ and $B$. For $(ii)$, take the counterexample $X = \mathbb{R}, A = (-\infty, 0), B = [0, \infty)$ ($X$ has the standard topology). Then $A$ is open and $B$ closed. Take $f(x) = \begin{cases} x,\ x < 0 \\ x + 1, \ x \geq 0 \end{cases}$. From the calculus notion of continuity (which coincides with the abstract topological one), $f$ is continuous on $A$ and on $B$, but not on $X$.