Proving continuity of piecewise function separated by rationals and irrationals

32 Views Asked by At

I want to prove where the function f(x)=x when x is rational and f(x)=2x-1 when x is irrational is continuous.

Clearly, it is only continuous when x=1. To show this, I proved $\lim_{x \to 1} f(x) = f(1) $ by considering the limit of both pieces.

To show f is discontinuous elsewhere, I am considering a sequence $ \ (r_n) $ ->x of rationals and a sequence $ \ (i_n) $ ->x of irrationals. But f($ \ r_n $) = $ \ (r_n) $ -> x and f($ \ i_n $) = 2$ \ (i_n) $ -1 -> 2x-1 and x only equals 2x-1 when x=1. Hence, f is discontinuous at all other points. Is this a proper way to justify discontinuity?