Sequence of continuous functions on $[0,1]$ pointwise converging to an unbounded function

continuityexamples-counterexamplespointwise-convergencesequence-of-function

I have spent a few hours trying to find an example of a sequence of continuous functions $f_n$ $[0,1]\rightarrow \mathbb{R}$ that pointwise converge to a function $f$: $[0,1]\rightarrow \mathbb{R}$ that is unbounded.

Attempt:
I have so far only managed to think of an example where $f_n:(0,1]\rightarrow \mathbb{R}$ when we define:
$$f_n = \frac{n}{nx+2}$$

This sequence converges to $f=\frac{1}{x}$, which is clearly not bounded on the interval.

Edit thanks to Olivier Moschetta

My issue is when $x=0$ the sequence does not pointwise converge to a function on $[0,1]$.

Can anyone help me fix this example?

Best Answer

It's pretty easy to "fix" your example. Define $f_n(x)=\frac{nx}{nx^2+2}$. At $x=0$ the sequence converges to $0$, at any other point to $\frac{1}{x}$.