Prove that if $F$ and $G$ are both continuous and $F(a)=G(a)$ then the function $H$ is continuous

Prove that if $$F:(−\infty,a]\rightarrow\mathbb{R}$$ and $$G:(a,\infty]\rightarrow\mathbb{R}$$ are both continuous and $$F(a) = G(a)$$ then the function $$H$$ defined by $$H(x) = \begin{cases} F(x) & \text{if x\leq a}\\ G(x) & \text{if x\geq a}\\ \end{cases}$$ is also continuous

My attempt:

Let $$a\in\mathbb{R}$$, consider the sequence of intervals $$[a, a + \frac{1}{n}]$$ for all $$n\in\mathbb{N}$$. Select a rational number $$x_n$$ from each interval and we will get a rational sequence $$\{x_n\}$$ which converges to a. Then $$F(x_n) = G(x_n)$$ for all $$n\in\mathbb{N}$$. Also by the continuity of $$F(x)$$ and $$G(x)$$, we have $$\lim_{n\rightarrow\infty}F(x_n)=\lim_{n\rightarrow a}F(x)=F(a)$$ and $$\lim_{n\rightarrow\infty}G(x_n)=\lim_{n\rightarrow a}G(x)=G(a)$$. Therefore, $$F(a)=G(a)$$, for all $$a\in\mathbb{R}$$.

• I don't understand your attempt at all. To be more precise: why do you choose the intervals? Why does it matter that $x_n$ are rational? Why $f(x_n)=g(x_n)$ (also you mean $F,G$ not $f,g$)? – Yanko Oct 21 '18 at 20:49
• I think you mean the intervals $[a, a + 1/n]$ instead. Although even with the correction, your proof doesn't work. You know that $F$ and $G$ are equal only at $a$. szw1710 gives a good argument to use, or at worst go back to the $\epsilon$-$\delta$ definition. – bitesizebo Oct 21 '18 at 20:51

It seems to me it is not needed to be so precise. We could say that one-sided limits at $$a$$ are equal to each other. Indeed, $$H(a-)=F(a-)=F(a)=G(a)=G(a+)=H(a+)$$. Of course $$H(a)=H(a-)=H(a+)$$. This gives continuity at $$a$$. $$H$$ is trivially continuous at any $$x_0\ne a$$.