# $g$ and $h$ are continuous on $\mathbb R$ and $g(c) = h(c)$, prove that $f$ is continuous at $x=c$

Let $g:\mathbb R \to\mathbb R$ and $h:\mathbb R \to \mathbb R$ be continous functions with $g(c) = h(c)$.

Define $f:\mathbb R \to \mathbb R$ by

$$f(x)= g(x), x \in \mathbb Q \\ f(x)= h(x), x \in \mathbb R -\mathbb Q$$

Prove that $f$ is continuous at $x=c$.

Since $g$ is continuous, $\forall \epsilon>0,\exists \delta_1>0$ such that $|x-c|<\delta_1 \implies |g(x)-g(c)|<\epsilon$

Since $h$ is continuous, $\forall \epsilon>0,\exists \delta_2>0$ such that $|x-c|<\delta_2 \implies |h(x)-h(c)|<\epsilon$

I'm not quite sure how to continue from this.

I'm thinking of setting $\delta = \min \{\delta_1,\delta_2\}$.

I don't think left and right limits would work because of the domain of $g$ and $h$.

If $\delta = \min(\delta_1,\delta_2) > 0$ your argument shows $|g(x) - g(c)| < \epsilon$ and $|h(x) - h(c)| < \epsilon$ if $|x-c| < \delta$. So if $x$ is such that $|x-c| < \delta$ and $x$ is rational then $|f(x) - f(c)| = |g(x) - g(c)| < \epsilon$ and you can easily complete the rest.
• just to clarify the first inequality is $|g(x)-g(c)|<\epsilon$ right? and thanks for helping. just couldn't see this. – Danxe Aug 29 '16 at 5:20