# Sequence of Functions Converging Pointwise to an Almost Everywhere Continuous Function

Suppose I have a function $$f:I \to \mathbb{R}$$ that is continuous at $$I$$, except at a finite number of points, for example $$\{ C_n; \enspace (n \le K) \in \mathbb{N} \}$$.

How can I build a sequence of continuous functions $$f_n :I \to \mathbb{R}$$ that converge pointwise to $$f$$?

My Idea, at first, was to take the Fourier series but I realized that it would not work because:

• I don't know what kind of discontinuity points I have;
• the Fourier series at discontinuity points converges to the mean value of the lateral limits, so we would not have pointwise convergence there.

Cut out a ball of radius $$\tfrac1n$$ around each discontinuity $$x_k$$ (assume $$n$$ is large enough that these balls are all disjoint). Then just define $$f_n$$ to agree with $$f$$ on the complement of the balls. On the ball around $$x_k$$, define $$f_n$$ to be linear so that it "spans the gap", i.e., connects the points $$(x_k-\tfrac1n,f(x_k-\tfrac1n))$$ and $$(x_k+\tfrac1n,f(x_k+\tfrac1n))$$.
It may be necessary to make two segments if the the linear part doesn't happen to agree with $$f$$ at $$x_k$$. But that's easy: first span the gap between $$(x_k-\tfrac1n,f(x_k-\tfrac1n))$$ and $$(x_k,f(x_k))$$, then span the gap between $$(x_k,f(x_k))$$ and $$(x_k+\tfrac1n,f(x_k+\tfrac1n))$$. This ensures that $$f_n(x_k)=f(x_k)$$ for all $$n$$ and $$k$$.
• Yes, I think that is the idea, but when we take $n \to \infty$ the coefficient of our lines would have an indetermination. Because for the coefficient we would have something like $\frac{f(x_k +\frac{1}{n}) - f(x_k)}{1/n}$. How can we deal with this?
• That doesn't matter. You asked for pointwise convergence, and this provides it. For any given $x\in\mathbb R$, it is true that $\lim\limits_{n\to\infty}f_n(x) = f(x)$ -- that's what pointwise convergence is. This is true whether or not it happens to be the case that $x$ is one of the $x_k$.