# Thread: Continuity on rationals?

1. ## Continuity on rationals?

If $\displaystyle g:R \rightarrow R$ is continuous and $\displaystyle f:R \rightarrow R$ is such that f(x)=g(x) for all rational numbers x, is f continuos?

I'm not 100% sure about this because f is clearly continuos on the rationals, but what happens at the irrationals?

EDIT: Being slow today... consider g(x) = 1 (hence cts) and f(x) = 1 for x in Q, and 0 for x in R\Q. f(x) is discontinuous everywhere.

2. Let g(x) = 0 for all x and let f(x) = 0 when x is rational, f(x) = 1 when x is irrational. Clearly, f is not continuous.

On the other hand, if both f and g are continuous and f(x) = g(x) for all rational x, then f(x) = g(x) everywhere.

3. Originally Posted by emakarov
On the other hand, if both f and g are continuous and f(x) = g(x) for all rational x, then f(x) = g(x) everywhere.
How would I prove this bit?

4. Given any irrational, x, there exist a sequence of rationals, $\displaystyle \{r_i\}$ which converges to x. Since f is continuous, $\displaystyle f(x)= \lim_{i\to\infty} f(r_i)= \lim_{i\to\infty} g(r_i)= g(x)$ because g is continuous.

5. ## Re: Continuity on rationals?

An even more interesting scenario on the properties f(x) can have is the following :
Let g(x) = sin(x) which is continuous over R
Let f(x) = g(x) for x rational (f agrees with g at rationals)
= -g(x) for x irrational (reflection of graph of g along the X axis at irrational x values)
It is easy to prove that f(x) is continouus only at the points K*pi, K belonging to Integers
and discontinuous everywhere ! Similarly, we can construct counter-intuitive functions continuous, say at Integers and
discontinuous elsewhere ! The old classic ,Hobson's "Theory of Functions-I,II" would be an illuminating read !!!!