Define $g_{n},f_{n}:[0,1]\to \mathbb{R}$ by $g_n(x)=\left\{\begin{array}{ll}
2 n x & x \in\left[0, \frac{1}{2 n}\right) \\
-2 n\left(x-\frac{1}{n}\right) & x \in\left[\frac{1}{2 n}, \frac{1}{n}\right) \\
0 & x \in\left[\frac{1}{n}, 1\right]
\end{array} \quad \quad h_n(x)= \begin{cases}2 n^2 x & x \in\left[0, \frac{1}{2 n}\right) \\
-2 n^2\left(x-\frac{1}{n}\right) & x \in\left[\frac{1}{2}, \frac{1}{n}\right) \\
0 & x \in\left[\frac{1}{n}, 1\right]\end{cases}\right.$
Then $g_{n}\to 0$ while $h_{n}\to0.$
###### Sketch sequences
```run-python
import numpy as np
import matplotlib.pyplot as plt
def g(n, x):
if (x >= 0) and (x < 1 / (2 * n)):
return 2 * n * x
if (x >= 1 / (2 * n)) and (x < 1 / n):
return -2 * n * (x - 1 / n)
if (x >= 1 / n) and (x <= 1):
return 0
def h(n, x):
if (x >= 0) and (x < 1 / (2 * n)):
return 2 * (n ** 2) * x
if (x >= 1 / (2 * n)) and (x < 1 / n):
return -2 * (n ** 2) * (x - 1 / n)
if (x >= 1 / n) and (x <= 1):
return 0
n_values = [1, 2, 3, 5, 10]
step = 0.01
x = np.arange(0, 1, step)
figure, axis = plt.subplots(1, 2)
for i in n_values:
y1 = np.array([g(i, x_val) for x_val in x])
y2 = np.array([h(i, x_val) for x_val in x])
axis[0].plot(x, y1, label=f"n={i}")
axis[1].plot(x, y2, label=f"n={i}")
axis[0].set_title(r"$g_{n}
quot;)
axis[1].set_title(r"$h_{n}quot;)
axis[0].legend()
axis[1].legend()
plt.show()
```