Let (X,d) be a metric space. For each n $\epsilon$ N let $g_n$:X$\rightarrow$R be a continuous function. Let ($a_n$) be a sequence of positive real numbers such that the series $\sum_{n=1}^\infty a_n$ converges. Suppose that for a fixed M>0 we have |$g_n$(x)|$\leq$M$a_n$ for each x$\in$X and $n\in\mathbb{N}$. Show that the function g:X$\rightarrow$R defined by g(x)= $\sum_{n=1}^\infty g_n (x)$; x$\in $X is continuous.
This is a little different than Weierstrass M-test. I could not make the proof of Weierstrass M-test according to this question.