TITLE: For any closed set $A$ of $\mathbb R$ , does there exists a function $f:\mathbb R \to \mathbb R$ such that, $f$ is discontinuous exactly on $A$?
QUESTION [5 upvotes]: For any closed set $A$ of $\mathbb R$ , does there exists a function $f:\mathbb R \to \mathbb R$ such that, $f$ is discontinuous at every point in $A$ but, is continuous at all other points ?

REPLY [2 votes]: It seemed to be popular enough in the comments so, 
You can consider a function defined as $f(x)=0$ for $x\in\mathbb{R}\setminus A$ and $f(x)=1$ if $x\in\mathbb{Q}\cap{A}$ and $f(x)=2$ if $x\in\mathbb{I}\cap{A}$. It will be continuous at each point $x_0$ outside of $A$ as it will be $0$ at an environment of $x_0$ (As $\mathbb{R}\setminus A$ is open), and obviously not continuous at $A$.