Prove that the function is continuous at n where n is an integer, but discontinuous elsewhere. I'm working on my self study again, and I'm given a function $f(x)=\sin\pi x$ , where $x$ is rational and $f(x) = 0$ when $x$ is irrational.
How do I prove that the function is continuous at $n$, where $n$ is an integer, but discontinuous elsewhere?
Geometrically I can see that this is true, since there is a "jump" in the function when $x$ is irrational
.
 A: Note the map $x\mapsto\sin\pi x$ is continuous.
If $x_0$ is no integer then $\sin(\pi x_0) \neq 0$. If $x_0$ is rational then let $(x_n)$ be a sequence of irrationals converging to $x_0$. Then  $(f(x_n))$ will converge to $0\neq f(x_0)$. If $x_0$ is irrational then let $(x_n)$ be a sequence of rationals converging to $x_0$. Then $(f(x_n))$ will converge to $\sin(\pi x_0) \neq 0=f(x_0)$. Conclusion: $f$ is not continuous at $x_0$.
If $x_0$ is an integer then $f(x_0)=0=\sin(\pi x_0)$. Now let $(x_n)$ be a sequence converging to $x_0$. Then $|f(x_n)|\leq|\sin(\pi x_n)|$ combined with the fact that sequence $(\sin(\pi x_n))$ converges to $\sin(\pi x_0)=0$ tells us that sequence $(f(x_n))$  converges to $0=f(x_0)$. Conclusion: $f$ is continuous at $x_0$.
A: HINT: Due to density of $\mathbb Q  $ and $\mathbb R\setminus \mathbb Q $ over  $\mathbb R$ we can always construct a sequence of rationals converging to an  irrational number & vice versa.Now use sequential criteria of continuity to get the answer.Hope it will help
A: Can you showo the following slightly more general result?
Let $$f(x)=\begin{cases}g(x)&\text{if $x\in\mathbb Q$}\\h(x)&\text{if $x\notin\mathbb Q$}\end{cases} $$
where $g,h$ are continuous on $\mathbb R$. Then $f$ is continuous at $a\in\mathbb R$ if and only if $g(a)=h(a)$. 
You may generalize even a bit more if you replace $\mathbb Q$ with a set $Q$ such both $Q$ and $\mathbb R\setminus Q$ are dense in $\mathbb R$.
