A function that is both continuous and discontinuous

168 Views Asked by At

I was asked to find a function that is continuous on Z but discontinuous on R\Z. as I'm new to continuity I want a feedback on the function I've created, and also tips on what to look for in these types of question!

$f: \mathbb{R}\to \mathbb{R}$ such that \begin{align} f(x) = \begin{cases} 1 & \text{if $x\notin \mathbb{Z}$} \\ \lfloor x \rfloor & \text{if $x \in \mathbb{Z}$} \end{cases} \end{align}

1

There are 1 best solutions below

4
On BEST ANSWER

Actually, the function is discontinuous at every integer other than $1$.

You can take, for instance,$$f(x)=\begin{cases}\sin(\pi x)&\text{ if }x\in\Bbb Q\\0&\text{ otherwise.}\end{cases}$$Can you check that it works?