At what points is the following function continuous?

Let $f$ be a function defined by

$$f =
\begin{cases} x && \text {if $x$ is irrational} \\0 && \text{if } x=0 \\p\sin \frac{p}{q} && \text{if } x \neq 0 \text{ is rational and } x= \frac{p}{q} \text{ is in lowest terms} \end{cases}$$

My thinking is that $f$ will be continuous only where $p\sin \frac{p}{q}$ is irrational, but I’m not sure what so say from there. Any suggestions?

Solutions Collecting From Web of "At what points is the following function continuous?"

  1. For $n\in Z^+$ we have $\gcd (n,n^2+1)=1$ so $f(n/(n^2+1))=n\sin (n/(n^2+1)).$ As $n\to \infty$ we have $n/(n^2+1)\to 0$ and $f(n/(n^2+1))=n\sin(n/(n^2+1) \to 1 \ne 0=f(0)$. So $f$ is discontinuous at $0.$

2.For $0\ne p\in Z,$ with $p\ne \pm 1,$ and $q\in Z^+$ with $\gcd (p,q)=1$ we have $\sin p/q\ne 0$ because $\pi \not \in Q.$ For $n\in Z^+$ let $x_n=p^{n+1}/(q p^n+1)$. Then $\gcd(p^{n+1}, q p^n+1)=1$ .As $n\to \infty$ we have $x_n\to p/q$ and $\sin x_n\to \sin p/q \ne 0$, but $|f(x_n)|=|p|^{n+1}\cdot |\sin x_n| \to \infty .$ So $f$ is discontinuous at $p/q.$

  1. For $0\ne q\in Z$ we have $|f( 1/q)|= |\sin 1/q| \ne 0.$ For $2\leq n\in Z$ we have $n q+1\ne 0$ and $\gcd (n, n q+1)=1 .$ As $n\to \infty$ we have $n/(n q+1)\to 1/q$ and $\sin (n/(n q+1)\to \sin 1/q\ne 0,$ but $|f(n/(n q+1)|=n |\sin (n/(n q+1)|\to \infty .$ So $f$ is discontinuous at $1/q.$

  2. From 2.and 3. we see that if $0\ne y\in Q$ then $f$ is unbounded on any nbhd of $y.$ So if $(y_n)_{n\in N}$ is a sequence of non-zero rationals converging to the irrational $x,$ then any nbhd $U$ of $x$ contains some $y_n,$ and $U$ is also a nbhd of $y_n,$ so $f$ is unbounded on $U$. So $f$ is discontinuous at $x.$

Hint: To be continuous you should ensured that $f(p/q)=p/q$, this is, $p \sin(p/q)=p/q$, this is, $\sin(p/q)=1/q$. In general, this is not true for any point $p/q$. Therefore, $f$ is not continuous in each point of $\mathbb{R}$.