# Continuity on rationals?

• May 16th 2011, 02:48 AM
cana
Continuity on rationals?
If $g:R \rightarrow R$ is continuous and $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.
• May 16th 2011, 02:54 AM
emakarov
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.
• May 16th 2011, 03:07 AM
cana
Quote:

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?
• May 16th 2011, 03:55 AM
HallsofIvy
Given any irrational, x, there exist a sequence of rationals, $\{r_i\}$ which converges to x. Since f is continuous, $f(x)= \lim_{i\to\infty} f(r_i)= \lim_{i\to\infty} g(r_i)= g(x)$ because g is continuous.
• September 1st 2012, 08:52 AM
LASLESH
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 !!!!