[Math] Where is the flaw in the proof that the union of two continuous functions is continuous

proof-verificationreal-analysis

Problem.
Let $f:A\to\mathbb{R}$ be a continuous function on $A$ and $g:B\to\mathbb{R}$ be a continuous function on $B$ such that $A\cap B=\emptyset$. Let $h:A\cup B\to\mathbb{R}$ be defined by, $$h(x)=\begin{cases}f(x)& x\in A\\ g(x)& x\in B\end{cases}$$Is $h$ continuous on $A\cup B$?

Proof. Let $(x_n)_{n\ge1}$ be any sequence from $A\cup B$ converging to $c\in A\cup B$. Let us now form two subsequences of $(x_n)_{n\ge1}$, namely $(y_n)_{n\ge1}$ and $(z_n)_{n\ge1}$ such that $y_n\in A$ and $z_n\in B$ for all $n\in \mathbb{N}$.

Then clearly $(h(y_n))_{n\ge1}\to h(c)$ since $h(y_n)=f(y_n)$ for all $n\in\mathbb{N}$ and $(h(z_n))_{n\ge1}\to h(c)$ since $h(z_n)=g(y_n)$ for all $n\in\mathbb{N}$. Consequently $(h(x_n))_{n\ge1}\to h(c)$ and we are done.

But the problem is that when I told our professor about this proof he told me that there should be some other conditions. But the argument seems to work well. Where is the flaw (if any) in my argument?

Best Answer

As is often the problem in mathematical proofs, there's an issue immediately after you write "clearly"; you only know that $(h(y_n))_{n\geq0} = (f(y_n))_{n\geq0}$, and we don't necessarily know what $(f(y_n))_{n\geq0}$ converges to (if at all!). By saying $h(y_n) \to h(c)$, you implicitly said that $f(y_n) \to f(c)$ but what if $c \in B$ (or neither $A$ nor $B$)?

Related Question