Find a function with right and left limits on $[0,1]$ and discontinuities at $\{ \dfrac{1}{n} : n \in \mathbb{N} \}$. Find a function with right and left limits on $[0,1]$, wherever they are defined, and discontinuities at $\{ \dfrac{1}{n} : n \in \mathbb{N} \}$.
I have
$f: [0,1] \rightarrow \mathbb{R}$, defined by
$$f(x)=\begin{cases}
0 & x = \dfrac{1}{n} \textrm{ for } n \in \mathbb{N} \\
x & \textrm{otherwise} \end{cases}$$
Attempts:

*

*Let $x \in (0,1].$ Let $n \in \mathbb{N}$. Let $(x_m)$ be a sequence in $[0,1] \setminus \{x\}$ converging to $x$. We can find a neighbourhood $B$ of $x$ containing $x$ but no points of the form $\dfrac{1}{n}$. Then, since $(x_m) \rightarrow x$, there exists $N \in \mathbb{N}$ such that for any $n \geq N$, $x_n$ lies in $B$. Thus, for any $n \geq N$, $f(x_n)=x_n$. Thus $\displaystyle \lim_{m \rightarrow \infty}f(x_m)=x.$


*Let $n \in \mathbb{N}$. Set $c=\dfrac{1}{n}.$ Take $d = \dfrac{1}{n}-\dfrac{1}{n+1}$. Then for $|x-\dfrac{1}{n}|<d$, we have that $x \in \left(\dfrac{1}{n+1},\dfrac{2}{n}-\dfrac{1}{n+1}\right).$ Note that, for $n>1$, \begin{align*} &\dfrac{2}{n}-\dfrac{1}{n+1}< \dfrac{1}{n-1} \\
&\impliedby \dfrac{n+2}{n(n+1)} < \dfrac{1}{n-1} \\
&\impliedby (n-1)(n+2) < n(n+1) \\
&\impliedby n^2 + n - 2 < n^2 + n \\
&\impliedby -2 < 0.  \end{align*}
So for any $x \in [0,1]$ with $|x-c|<d$, $$|f(x) - \dfrac{1}{n}|<|\dfrac{1}{n}-\dfrac{1}{n+1}| < \max\{1/n,1/(n+1)\} = 1/n.$$ Stuck!
 A: You have a fine example here. You just need to clarify the details a little.
The crucial thing is that each $\frac{1}{n}$ is separated from $\frac{1}{n+1}$ and $\frac{1}{n-1}$ by some positive distance. This means for any $x\in (0,1]$, regardless of being some $\frac{1}{n}$ or not, there is a neighbourhood $B$ containing $x$ but containing no other point of the form $\frac{1}{n'}$ for $n'\in \mathbb{N}$. Thus for all points $y\in B$ (except $x$ itself in the case $x=\frac{1}{n}$), we have $f(y)=y$.
Therefore, any sequence $a_k$ that approaches $x$ from below (or above) eventually lies inside $B$. ie. for $k$ large enough we always have $f(a_k)=a_k$ and thus the sequence $f(a_k)$ approaches $x$ as well. This is exactly what it means for $f$ to have left (and right) limits everywhere on $(0,1]$.
The point $x=0$ is trickier, (since any neighbourhood around $0$ contains infinitely many points of the form $\frac{1}{n}$) but you can show that any sequence $a_k$ approaching $x$ from above also has $f(a_k)\rightarrow 0$, since once $a_k$ is within $\epsilon$ of $0$ we have $f(a_k)\leq \epsilon$.
And it is clear from all this that we have discontinuities at each $\frac{1}{n}$, since if $a_k\rightarrow\frac{1}{n}$ then $f(a_k)\rightarrow\frac{1}{n}$ yet $f(\frac{1}{n})=0\not=\frac{1}{n}$.
A: The function you defined works. In order to prove discontinuity, you have to think about the definition of discontinuity: We say a function $f:[0,1] \rightarrow \mathbb{R}$ is continuous if $\lim_{x \rightarrow c} f(x) = f(c)$.
Now take $c=\frac{1}{n}$ for any $n \in \mathbb{N}$. From the function you defined, $\lim_{x \rightarrow c} f(x) = c \neq 0 = f(c)$. In conclusion, the limit exists, but the function is discontinuous in those points.
