# Points where function is continuous

I have a function that is defined as such,

$f(x)=x$, if x is rational, ie $x=\frac{p}{q}$ and $f(x)=1-x$, if x is irrational. What are all the points of continuity?

I would say that all the points of continuity are the points where $p\neq q$ since at any the limit of f(x) as x approaches 1 is 0, while the functional value of the limit of x, as x approaches 1 is 1. Since they do not agree, the function is discontinuous at any point $p=q$

Is that view correct?

-
When $p=q$, $x=1$. The representation of a rational as quotient of integers is immaterial to this problem. – Lubin Nov 27 '12 at 23:47

Note that every point is the limit of a rational sequence and an irrational sequence.

So $f$ is continuous at $x_0$ if and only if approximating by rational and irrational sequences give the same result.

So we have $r_n\to x_0$ which are all rationals and $y_n\to x_0$ which are all irrational, and we want: $$x_0=\lim_{n\to\infty} r_n = \lim_{n\to\infty} f(r_n) = f(x) = \lim_{n\to\infty} f(y_n) = \lim_{n\to y_n} (1-y_n)= 1 - \lim_{n\to y_n} y_n=1-x_0$$

Therefore we see that $f$ can be continuous at $x_0$ if and only if $x_0=1-x_0$, and so $x_0=\frac12$.

-

The only points where $f$ might be continuous is $x=1/2$. You can simply verify this straight forward by using your definition of continuity.

At all other point $f$ can't be continuous. Remember, that irrational and rational numbers both are dense in $\mathbb{R}$.

-