# 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?

• The answer by @Pepito (complemented with my comment there) shows that $f$ is discontinous at nonzero rationals. For irrational $x$, if $\sin x\not=0$ then $f$ is discontinuous at $x$. Indeed if $p_n/q_n\to x$ then both $p_n\to\infty$ and $q_n\to\infty$ so $|p_n\sin(p_n/q_n)|\to\infty|\sin(x)|=\infty$. If $\sin x=0$ for irrational $x$ then $\sin(p_n/q_n)\to\sin(x)=0$ and $p_n\to\infty$ and this seems to need more consideration. When $x=0$ then take $p_n/q_n$ with $q_n=(p_n)^2+1$, then $p_n\sin(p_n/((p_n)^2+1))\to1\not=0$ so $f$ is discontinuous at $0$. – Mirko May 10 '16 at 3:59

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}$.
• your hint is more or less correct, but you could have elaborated. It shows $f$ is discontinuous at rational $p/q$ since you could take irrational $x_n\to p/q$, then if $f$ were continuous at $p/q$ we would have $f(p/q)=\lim_n f(x_n)=\lim_n x_n=p/q$, i.e. $f(p/q)=p/q$ which you correctly say but do not explain. Also, not clear what your hint suggests about continuity at irrational $x$ ($f$ will not be continuous but you did not seem to address that). – Mirko May 10 '16 at 3:24