# Can a function with finite discontinuities be nicely approximated by a continuous function?

1) Can every discrete function be approximated (better: interpolated) by some continuous function? By discrete function, I mean: there are countably infinitely many elements in the domain, and for each number in the domain, the function assigns a single number in the range. By approximation (interpolation), I mean that all input-output results must be maintained in a new function. The new function must be an extension of the old function, that is, the old one is a restriction of the new to the original domain. We can think of the new function as the original function on a domain enlarged with uncountably infinitely many elements.

2) can a "almost-continuous" function with finite discontinuities be nicely approximated by some continous function? (for the domain defined by "almost-continuous" function) By "nicely approximated", I mean that as domain variable $x$ increases to infinity, a new function's range variance from original function's range never exceeds some given some number.

Edit: for 2), by discontinuity, I refine it to be jump(step) discontinuity. And yes, by finite discontinuities, I mean finite number of discontinuities.

And what happens for removable discontinuity?

I ask for real-number cases and complex-number cases.

Edit: Just discard "discrete" from 1) and replace discrete function with the one that starts from "by approximation, ..."

• For (1) I am not sure what you mean by a discrete function. For (2), I am guessing that you mean a "finite number of discontinuities". In this case I would think that $f(x)=\sin(1/x)$ if $x\neq 0$ $f(0)=0$ might be a counterexample. But of course this depends on what you mean by "nicely approximated". – Baby Dragon Apr 16 '13 at 3:00
• @BabyDragon Will my edit clarify..? – Differential Apr 16 '13 at 3:06
• Usually a subset, $S\subset\mathbb{R}$ is discrete means that for each $s\in S$ their is a sufficiently small number $\epsilon$such that the set $S\cap (s-\epsilon,s+\epsilon)$. Am I correct to think that a discrete function is a function $S\to\mathbb{R}$ such that S is discrete? – Baby Dragon Apr 16 '13 at 3:42
• @BabyDragon Just discard "discrete" and I defined what function I want to approximate. – Differential Apr 16 '13 at 8:31

Consider function $f: \mathbb{Q}\to\mathbb{R}$ defined such that $f(x)=1$ if $x$ is such that if it is written as a common fraction, $x=p/q$ with $(p,q)=1$, then $q$ is divisible by a prime number other than $2$ or $5$; and let $f(x)=0$ otherwise. (All I want to say is that $f(x)=1$ if $x$ has an infinite decimal expansion, and $f(x)=0$ if the decimal form of $x$ is finite.)
I claim that this $f$ takes the values $0$ and $1$ in any non-trivial interval (any interval with more than one point). This is easy. No matter how short the interval is, there will be a high power of both $1/2$ and $1/3$ such that those powers are smaller than the length of the interval, meaning that there will be an integer multiple of both $1/2^k$ and $1/3^l$ in that interval. On the first, $f$ takes the value $0$, on the second, it takes $1$.
This $f$ cannot be interpolated by a continuous function $g$, that is, there is no $g: \mathbb{R}\to\mathbb{R}$ such that the restriction of $g$ to $\mathbb{Q}$ is $f$. Just check the definition of continuity: if you pick $\varepsilon=1/2$, then for any $x\in\mathbb{Q}$ and any $\delta>0$, $g$ would need to take both $0$ and $1$ on $x$ and on some $x'\in ]x-\delta,x+\delta[\cap\mathbb{Q}$ to coincide with $f$, but in this case, $|g(x')-g(x)|>\varepsilon$.