# Weierstrass M-test proof?

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$\epsilon$X and n$\epsilon$N. Show that the function g:X$\rightarrow$R defined by g(x)= $\sum_n_=_1^\infty g_n (x)$; x$\epsilon$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.

-

Since $|g_n(x)|\leq Ma_n, \ \forall n \in \mathbb N, \ x \in X$ and because the series $\displaystyle{\sum_{n=0}^\infty Ma_n}$ converges, from Weierstrass M-test the series $\displaystyle{\sum_{n=0}^\infty g_n(x)}$ converges uniformly on X.
Is a property of uniformly convergence that if $(f_n)_{n\in\mathbb N}$ uniformly converges to $f$ on $X$ and $f_n$ is continuous on $X, \ \forall n \in \mathbb N$ then $f$ is continuous on $X$.
Therefore $\displaystyle{g(x)=\sum_{n=0}^\infty g_n(x)}$ is continuous on $X$.
Fix an $\epsilon > 0$ and an $x \in X$. Since $\sum_{n=1}^{\infty} Ma_n$ converges, find an $N$ so that $\sum_{n=N+1}^{\infty} Ma_n < \epsilon$. So $|g(x) - g(y)| = |\sum_{n=1}^{\infty}g_n(x) - g_n(y)| \le \sum_{n=1}^{N}|g_n(x) - g_n(y)| + 2\epsilon$. Find $\delta > 0$ small enough so that if $d(x,y) < \delta$, then $|g_j(X) - g_j(y)| < \frac{\epsilon}{N}$, for $j = 1, ..., N$. So we get an estimate of $3 \epsilon$, from which continuity follows.