# function only contains jump discontinuity but is not piecewise continuous

Does there exists a function defined on $$[0,1] \rightarrow \mathbb{R}$$ such that it contains only jump discontinuity but it is not piecewise continuous?

Jump discontinuity at a point $$a$$ means $$lim_{x \rightarrow a^{-}}f(x)$$ and $$lim_{x \rightarrow a^{+}}f(x)$$ both exists but not equal

piecewise continuous means every finite subinterval only contains a finite number of discontinuous points and they are all jump discontinuity

My first thought is Dirichlet function and but it appears that it is not the function that I am looking for.....

OK, next thought - the function $$f(\frac pq)=\frac1q$$ and zero elsewhere. That's closer; it has limits of zero everywhere. But then each rational is a removable discontinuity, not a jump discontinuity. Closer, but still not it.

The next idea after that: let's build an increasing function with jumps at every rational. Let $$g$$ be an enumeration of the rationals; for each rational $$r$$, $$g(r)$$ is a different positive integer $$n$$. Then, define $$f(x) = \sum_{r\in\mathbb{Q},r\le x}\frac1{g(r)^2+g(r)}$$ Since $$\sum_n \frac1{n^2+n}$$ converges (to $$1$$), that sum is finite for every $$x$$.
Choose some arbitrary $$x$$ and $$\epsilon>0$$. Let $$n$$ be such that $$\epsilon\ge\frac1n$$. There are only finitely many values $$r_1,r_2,\dots,r_n$$ with $$g(r_i)\le n$$. If we choose $$\delta$$ such that $$(x,x+\delta)$$ contains none of these $$r_i$$, then for $$y\in (x,x+\delta)$$, $$f(y)-f(x)=\sum_{r\in\mathbb{Q},x From that, $$\lim_{y\to x^+}f(y)=f(x)$$ for all $$x$$. We have limits from the right.

For limits from the left, consider the variant function $$f^*(x)=\sum_{r\in\mathbb{Q},r< x}\frac1{g(r)^2+g(r)}$$ This $$f^*$$ is equal to $$f$$ except at the rationals, where $$f(r)-f^*(r)=\frac1{g(r)^2+g(r)}$$. Again, choose arbitrary $$x$$ and $$\epsilon>0$$, and let $$n$$ be such that $$\epsilon\ge \frac1n$$. Find $$\delta$$ such that $$(x-\delta,x)$$ contains none of the $$n$$ points $$r_i$$ with $$g(r_i)\le n$$. Then, for $$y\in (x-\delta,x)$$, $$f^*(x)-f(y) = \sum_{r\in\mathbb{Q},y\le r< x}\frac1{g(r)^2+g(r)} \le \sum_{j=n+1}^{\infty}\frac1{j^2+j}=\frac1{n+1}<\epsilon$$ From that, $$\lim_{y\to x^-}f(y) = f^*(x)$$ for all $$x$$, and we have limits from the left.

Of course, these limits $$\lim_{y\to x^+}f(y)=f(x)$$ and $$\lim_{y\to x^-}f(y) = f^*(x)$$ differ for every rational $$x$$, so there's a jump discontinuity at every rational.

With $$f$$ discontinuous at a dense set of points, it fails to be continuous on any interval, and can't be a piecewise continuous function. Done. We have our example.

I defined this as a function from $$\mathbb{R}$$ to $$\mathbb{R}$$, but it's easy to get a function on a smaller interval. Restricting $$f$$ works, as does using an enumeration of the rationals in that smaller interval.

$$f(x)=\sum_{k=1}^\infty 2^{-k} ( 2^kx-\lfloor 2^kx\rfloor)$$ has a jump discontinuity at every $$\frac{n}{2^k}$$ and it is continuous everywhere else

$$g(x)=\sum_{k=1}^\infty 2^{-k} ( \lfloor 2^kx\rfloor-2\lfloor 2^{k+1}x\rfloor)$$ is easier to see : if $$x \in [\frac{N}{2^k},\frac{N+1}{2^k}]$$ then $$g(x) = \frac{N}{2^k}+ O(2^{-k})$$