# continuity of real valued functions at irrational points

Let $$f\colon \mathbb{R} \to \mathbb{R}$$ be a function dfined by $$f(x) = \begin{cases} 0,\quad x\not\in \mathbb{Q}\\ \frac{p}{p+1}, \quad x=\frac{p}{q} \end{cases}$$ Where is $$f$$ continuous?

I know that a function cannot be continuous and non constant at just the set of rationals but i am unable to prove its continuity at the irrational points.

• p and q are integers and g.c.d(p,q)=1 – Souvik Deb Apr 17 at 18:07

Presumably when you say the rational $$x = p/q$$ you mean $$p$$ and $$q$$ are integers and $$p/q$$ is in lowest terms, and $$p \ge 0$$ (you need to allow $$p$$ or $$q$$ to be negative to allow negative rationals, but your formula would be undefined if $$p=-1$$).
It is not continuous anywhere. In any nonempty open interval there are both rational and irrational numbers; at an irrational $$x$$ you have $$f(x)=0$$ and at a nonzero rational $$y = p/q$$ you have $$f(y) = p/(p+1) \ge 1/2$$.
When $$x$$ is rational, $$f(x)=\frac{p}{p+1}>0$$. However, there exists irrational numbers $$x_0$$ arbitrarily close to $$x$$ where $$f(x)=0$$, hence $$f$$ is discontinuous at rational points.
When $$x$$ is irrational, $$f(x)=0$$. However, there exists rational numbers $$x_0=\frac pq$$ that are arbitrarily close to $$x$$ where $$f(x_0) = \frac{p}{p+1} \geq \frac 12$$, hence $$f$$ is discontinuous at irrational points.