# A sequence of continuous functions converging to a discontinuous function

Let $f:I\to \mathbb R$ be a function which is continuous in every points of the interval $I$ except of a finite number of discontinuities $c_1,...,c_n$. I would like to find a sequence of continuous functions $f_n:I\to \mathbb R$ such that $\lim f_n=f$ pointwise.

This question seems very difficult, maybe because this one is very general, I'm really stuck here, any help is welcome.

Thanks a lot

• For a problem like this, I think it's easiest to start with an example of such an $f$ (and keep it simple, say one discontinuity) and then come up with a series of continuous functions $f_n$ that make better and better approximations of $f$. Once you do this for an example, you have a better idea how to do it for any such $f$. – PersonX Feb 20 '13 at 13:39
• @ChrisPhan yes, I've already tried with one discontinuity, without any success – user42912 Feb 20 '13 at 13:40
• Do you have any more information on the discountinuities? – superAnnoyingUser Feb 20 '13 at 13:41
• @George no just the information I've already mentioned above. – user42912 Feb 20 '13 at 13:44
• The most annoying case is if you have a vertical asymptote $\{x=x_0\}$. Draw a picture. Use broken lines on $[x_0-1/n,x_0+1/n]$. Make it pass through $(x_0,f(x_0))$. Note the method of broken lines works in general. – Julien Feb 20 '13 at 13:44

## 2 Answers

Take $$f:[0,1]\rightarrow \mathbb{R}\\ f(x)=\left\{\begin{array}{rl} 0 & x\neq 1 \\ 1 & x=1\\ \end{array}\right.$$ And $$f_n=x^n$$ With scaling and piecewise definitions you can to this one for any countable set of $c_1,\dots ,c_n$ In general our function will look like $$f(x)=\left\{ \begin{array}{rl} 0 & x \neq c_i \forall i\\ 1 & \text{else} \\ \end{array}\right.$$ On $[c_i,c_{i+1}]$ we gonna have something like $$f_{ni}(x)=\left(\frac{c_2-x}{c_2-c_1}\right)^n +\left(\frac{x-c_1}{c_2-c_1}\right)^n$$

And all together we will have (with $I=[a,b]$) $$f_n(x)=\left\{ \begin{array}{rl} 0 & x\in [a,c_0)\\ f_{ni} & x \in [c_i,c_{i+1})\\ 0& x\in [c_n,b] \\ \end{array}\right.$$

Edit for a given function the idea is the following, as you only have finite $c_i$ you take with $$\varepsilon=\min_{1\leq i \leq n-1} \{d(c_i,c_{i+1})\}$$ which is the shortest distance between two points of incontinuousity. Edit we don't need Stone Weierstraß at all sry.
$[c_i+\frac{\varepsilon}{2n},c_{i+1}-\frac{\varepsilon}{2n}]$ we just take $f$ on the intervalls (the uniform convergence is trivial). So we only need to chose a secquence of function on $[c_i-\frac{\varepsilon}{2n},c_i+\frac{\varepsilon}{2n}]$. We will call them $s_{ni}$ (like spline).
We chose $$s_{ni}(x)= \left\{ \begin{array}{rl} f(c_i) + \frac{f\left(c_i-\frac{\varepsilon}{2n}\right)-f(c_i)}{\frac{\varepsilon}{2n}} \cdot (x-c_i) & x-c_i \leq 0\\ f(c_i)+\frac{f\left(c_i+\frac{\varepsilon}{2n}\right)-f(c_i)}{\frac{\varepsilon}{2n}}\cdot (x-c_i) & x-c_i >0 \end{array}\right.$$ Ok that one looks really complicated but all i am saying we make a line from the left end to the point we want to have $f(c_i)$ and another one to get a continuous function in all the intervall.

• The problem is $f$ is a general one, I'm not looking for an specific example, thank you – user42912 Feb 20 '13 at 13:37
• ah you didn't got the idea – Dominic Michaelis Feb 20 '13 at 13:38
• no, sorry. My problem is given a $f$ (could be any $f$ with the specifications above) I would like to find a $f_n$ such that $f_n$ goes to $f$. Did you follow me? – user42912 Feb 20 '13 at 13:42
• but thank you anyway for trying to help me. – user42912 Feb 20 '13 at 13:44
• yeah i did follow you i edited it, thought it would be homework so I didn't want to do everything – Dominic Michaelis Feb 20 '13 at 13:46

The general idea is best explained when there is only one discontinuity point:

Suppose $f$ is continuous for all $x\ne b$. Select two points $a<b$ and $c>b$. Define the function $g$ by setting $g(x) =f(x)$ for $x\notin (a,c)\setminus\{b\}$, and on $(a,c)\setminus\{b\}$, take the graph of $g$ to be piecewise linear. Do this is such a way that $g$ is continuous.

You should draw the picture here. You're just replacing the "discontinuous part" of the graph of $f$ with straight line segments; thus producing a continuous function that agrees with $f$ except on an interval of small length. For the pointwise convergence of the sequence to come, it is important to have $g(b)=f(b)$, here.

By selecting sequences $(a_n)$ and $(b_n)$ with $a_n\nearrow b$ and $c_n\searrow b$, and defining continuous functions $g_n$ as above, one obtains a sequence of continuous functions that converge pointwise to $f$.

If $f$ has finitely many points of discontinuity, $x_1$, $\ldots\,$, $x_k$, do the same thing:

For each $n$, select intervals $O_1$, $\ldots\,$, $O_k$, such that:

$\ \ \$1) The $O_i$ are pairwise disjoint.

$\ \ \$2) The sum of the lengths of the $O_i$ is at most $1/n$.

$\ \ \$3) For each $k$, $x_k$ is the midpoint of $O_k$.

Now define your $f_n$ appropriately.