Does there exist a discontinuous but bounded function? I am looking for an example of a discontinuous and bounded function $f:\mathbb{R} \to \mathbb{R}$ such that $\{(x,y):y=f(x)\}$ is a closed set in $\mathbb{R}^2$
I was thinking of the example $f(x)=[x]$ when $-2 < x<2$ and $f(x) = 2$ when $x \ge 2$ and $f(x)=-2$ when $x\le -2$.
I think this will work as $X=\mathbb{R}$ is a closed subse of $\mathbb{R}$ and $Y=\{-2,0,1,2\}$ is also a closed subset of $\mathbb{R}$. Then $X \times Y$is also a closed subset of $\mathbb{R}^2$.Some help is appreciated.
 A: There is no such $f$. If $f$ is bounded, then its image is contained in some $[a,b]$ interval, which is compact. In that situation the closed graph theorem tells us that closed graph is equivalent to being continuous. Well, to be 100% correct we would apply the theorem to the corestriction $f:\mathbb{R}\to[a,b]$, but then we reconstruct our original $f$ by composing that corestriction with the inclusion $[a,b]\to\mathbb{R}$.

I think this will work as $X=\mathbb{R}$ is a closed subse of $\mathbb{R}$ and $Y=\{-2,0,1,2\}$ is also a closed subset of $\mathbb{R}$. Then $X \times Y$is also a closed subset of $\mathbb{R}^2$.

Yes, $X\times Y$ is closed in $\mathbb{R}^2$. But that is not the graph $\{(x,y)\ |\ y=f(x)\}$ which is almost always a proper subset of $X\times Y$ (except the case when $f$ is constant). Based on how you described $Y$ I assume that by $[x]$ you mean the integer part (although $-1\in Y$ is missing). Then
$$\big(-1/n,f(-1/n)\big)=(-1/n,[-1/n])=(-1/n,-1)$$ converges to $(0,-1)$ but $f(0)=0$ and so $(0,-1)$ does not belong to the graph, i.e. the graph is not closed.
