# Is the product of continuous functions in a metric space continuous?

I have the following problem: Let $(X,d)$ be a metric space, and let $f, g: X \rightarrow \mathbb{R}$ be continuous functions. Prove that $f + g$ (sum) and $fg$ (product) are continuous.

I wrote the following proof for showing that the addition of $f$ and $g$ would be continuous: Let $x_0 \in X$, we will now show that $f + g$ is continuous on $x_0$. Let $f(x_0) = r$, $g(x_0) = s$. Let $\epsilon > 0$ be given. Then there exists $\delta_1 > 0$ such that if $d(x,x_0) < \delta_1$, $|f(x) - r| < \frac{\epsilon}{2}$. Similarly, there exists $\delta_2 > 0$ such that $d(x,x_0) < \delta_2$ implies that $|g(x) - s| < \frac{\epsilon}{2}$. Take $\delta = \min(\delta_1,\delta_2)$. Then if $d(x,x_0) < \delta$, $|(f(x) + g(x)) - (r +s)| \leq |f(x) - r| + |g(x) - s| < \frac{\epsilon}{2} + \frac{\epsilon}{2} = \epsilon$. Because we have shown that $f+g$ is continuous for every $x_0 \in X$, the function $f+g$ is continuous.

However, I'm not quite sure if I can use a similar method to show that the product of two continuous functions is continuous. When I try, I get into the position of trying to show that $d(x,x_0) < \delta$ implies $|fg - rs| < \epsilon$, and unlike in the case of addition the triangle inequality doesn't nicely take care of things. Am I on the right track, or should I be trying a totally different approach than from what I did for addition?

$$\vert f(x)g(x)-f(x_0)g(x_0) \vert \le \vert f(x)\vert \vert g(x)-g(x_0) \vert +\vert g(x_0)\vert \vert f(x)-f(x_0)\vert$$
I would make it simpler: consider the decomposition of $f+g$ as the composition: $$X\xrightarrow{\Delta} X\times X\xrightarrow{(f,\,g)} \mathbf R\times\mathbf R\xrightarrow{+} \mathbf R,$$ where $\Delta\colon x\mapsto (x;x)$ is the diagonal map, $(f,g)\colon (x,y)\mapsto(f(x),g(y))$ is the product (in the set theory sense) of $f$ and $g$, and $+$ is the addition map. All $3$ are continuous, hence their composition is continuous.
If you know the function $\operatorname{plus}$ is continuous from $\mathbb{R}^2$ to $\mathbb{R}$ (defined as $\operatorname{plus}(x,y) = x+y$, then continuity of $f+g$ follows: it's the composition $\operatorname{plus} \circ\,(f \triangle g)$, where $f \triangle g: X \rightarrow \mathbb{R}^2$ is defined by $(f \triangle g)(x) = (f(x), g(x))$, which is also continuous as both $f$ and $g$ are, using standard product topology properties.
The same idea works for multiplication: it suffices to show $\operatorname{mul}(x,y) = xy$ is continuous from $\mathbb{R}^2$ to $\mathbb{R}$.
Hint : $$fg - ab= a(g-b) + b(f-a) + (f-a)(g-a)$$