Sequence converging to $0$ - two variable function For $n\in\mathbb{N}$ define $g_n:[0,2]\rightarrow\mathbb{R}$ by
$$g_n(x)= \begin{cases} n^2x \ &\text{if } 0\le x<\frac{1}{n} \\
2n-n^2x\ &\text{if } \frac{1}{n}\le x<\frac{2}{n} \\
0\ &\text{if } \frac{2}{n}\le x\le 2 \end{cases} \text{.}$$
Show that for any $x\in [0,2], g_n(x)\rightarrow 0$ as $n\rightarrow\infty$.
I honestly had no idea what to do here. For the first part, I tried a sequences approach: $n^2x\rightarrow 0$ as $n\rightarrow\infty$ if for all $\varepsilon>0$ there is some $N_{\varepsilon}\in\mathbb{N}$ such that for any $n>N_{\varepsilon}$ we have $|n^2x|<\varepsilon$. If we choose $N_{\varepsilon}=\sqrt{n\varepsilon}$ then we have the required result. But this doesn't help really as it doesn't include the fact that $0\le x<\frac{1}{n}$. Any ideas?
 A: I assume that this is pointwise convergence and not uniform convergences (as that would be wrong).
The key is that the interval on which $g_n(x)=n^2x$ will become infinitely small. More mathematical:
Take some $\varepsilon>0$. We want to show that for every $x\in[0,2]$ there exists a $N\in\mathbb{N}$ s.t. $\forall n\geq N$: $g_n(x) < \varepsilon$.
For arbitrary $x$ we choose $N = \frac{2}{x}+1$ as we then get $x = \frac{2}{N-1}$ and for $n\geq N$ we have $\frac{2}{n} < \frac{2}{N-1}=x$ and therefore we always get $g_n(x)=0$.
Uniform convergence is not given as for every $\varepsilon>0$ and every $N\in\mathbb{N}$ we can take $x=\frac{\varepsilon}{N}$ and get $g_n(x)=n^2 \cdot \frac{\varepsilon}{N} \geq N^2 \cdot \frac{\varepsilon}{N} = \varepsilon N > \varepsilon$ for all $n\geq N$.
A: Note that $g_n(x) \ne 0$ only for $x \in (0,~ 2/n)$ ($P_1$) and $g_n(x) = 0$ otherwise. So, we need to deal only with the neighborhood of $x = 0^+$.
Take any small $\varepsilon > 0$. Assume $\color{red}{\text{there exists}}$ a point $x_0$ such that $x_0 < \varepsilon$ (very close to $0$) for which $g_n(x) \ne 0$ even if $n \to \infty$.
However, $2/n < \varepsilon$ for any $n > \lceil 2/\varepsilon\rceil$. Hence, according to $P_1$, we have $g_n(x) = 0$ $\color{blue}{\text{for all}}$ $x < 2/n <\varepsilon$.
Now since that $\color{red}{\text{red}}$ contradicts $\color{blue}{\text{blue}}$, we conclude that the assumption was wrong and therefore $\lim\limits_{n\to\infty} g_n(x) = 0$ as desired.
