[proofplan]
We prove each algebra operation directly from the $\varepsilon$-$\delta$ definition of continuity at $a$. Scalar multiplication and addition follow from the basic absolute-value identities and the triangle inequality. For products, we first use continuity at $a$ to get local boundedness of the factors, then split the product difference into two controlled errors. For quotients, continuity of $g$ keeps $g$ bounded away from $0$ near $a$, which gives continuity of the reciprocal; multiplying by $f$ then gives continuity of the local quotient.
[/proofplan]
[step:Prove scalar multiples are continuous at $a$]
Fix $c \in \mathbb{R}$, and define
\begin{align*}
h_c:X &\to \mathbb{R}
\end{align*}
by $h_c(x)=cf(x)$ for every $x \in X$.
If $c=0$, then $h_c(x)=0$ for every $x \in X$, so for every $\varepsilon>0$ and every $\delta>0$,
\begin{align*}
|h_c(x)-h_c(a)|=0<\varepsilon
\end{align*}
whenever $d_X(x,a)<\delta$. Thus $h_c$ is continuous at $a$.
Assume now that $c \ne 0$. Let $\varepsilon>0$ be given. Since $f$ is continuous at $a$, there exists $\delta>0$ such that, for every $x \in X$,
\begin{align*}
d_X(x,a)<\delta \implies |f(x)-f(a)|<\frac{\varepsilon}{|c|}.
\end{align*}
For such $x$,
\begin{align*}
|h_c(x)-h_c(a)|=|cf(x)-cf(a)|=|c|\,|f(x)-f(a)|<\varepsilon.
\end{align*}
Therefore $cf$ is continuous at $a$.
[/step]
[step:Prove sums are continuous at $a$]
Define
\begin{align*}
s:X &\to \mathbb{R}
\end{align*}
by $s(x)=f(x)+g(x)$ for every $x \in X$.
Let $\varepsilon>0$ be given. Since $f$ is continuous at $a$, there exists $\delta_f>0$ such that, for every $x \in X$,
\begin{align*}
d_X(x,a)<\delta_f \implies |f(x)-f(a)|<\frac{\varepsilon}{2}.
\end{align*}
Since $g$ is continuous at $a$, there exists $\delta_g>0$ such that, for every $x \in X$,
\begin{align*}
d_X(x,a)<\delta_g \implies |g(x)-g(a)|<\frac{\varepsilon}{2}.
\end{align*}
Define $\delta=\min\{\delta_f,\delta_g\}$. If $d_X(x,a)<\delta$, then both estimates hold, and the triangle inequality in $\mathbb{R}$ gives
\begin{align*}
|s(x)-s(a)|=|(f(x)-f(a))+(g(x)-g(a))|\le |f(x)-f(a)|+|g(x)-g(a)|<\varepsilon.
\end{align*}
Thus $f+g$ is continuous at $a$.
[/step]
[step:Obtain local bounds for $f$ and $g$ near $a$]
Since $f$ is continuous at $a$, applying continuity with tolerance $1$ gives a number $\rho_f>0$ such that, for every $x \in X$,
\begin{align*}
d_X(x,a)<\rho_f \implies |f(x)-f(a)|<1.
\end{align*}
Define $M_f=|f(a)|+1$. Then $d_X(x,a)<\rho_f$ implies
\begin{align*}
|f(x)|\le |f(a)|+|f(x)-f(a)|<M_f.
\end{align*}
Similarly, since $g$ is continuous at $a$, there exists $\rho_g>0$ such that, for every $x \in X$,
\begin{align*}
d_X(x,a)<\rho_g \implies |g(x)-g(a)|<1.
\end{align*}
Define $M_g=|g(a)|+1$. Then $d_X(x,a)<\rho_g$ implies
\begin{align*}
|g(x)|<M_g.
\end{align*}
[guided]
The product proof will require us to control terms such as $|f(x)|\,|g(x)-g(a)|$. Continuity of $g$ controls the second factor, but it does not by itself control $|f(x)|$. We therefore first extract a local bound from continuity.
Because $f$ is continuous at $a$, we may choose the particular tolerance $1$. Hence there exists $\rho_f>0$ such that
\begin{align*}
d_X(x,a)<\rho_f \implies |f(x)-f(a)|<1.
\end{align*}
For every such $x$, the triangle inequality gives
\begin{align*}
|f(x)|=|f(a)+(f(x)-f(a))|\le |f(a)|+|f(x)-f(a)|<|f(a)|+1.
\end{align*}
Thus, with $M_f=|f(a)|+1$, the function $f$ is bounded by $M_f$ on the ball $B(a,\rho_f)$.
The same argument applies to $g$. Since $g$ is continuous at $a$, there exists $\rho_g>0$ such that
\begin{align*}
d_X(x,a)<\rho_g \implies |g(x)-g(a)|<1.
\end{align*}
Setting $M_g=|g(a)|+1$, we obtain
\begin{align*}
|g(x)|\le |g(a)|+|g(x)-g(a)|<M_g
\end{align*}
whenever $d_X(x,a)<\rho_g$. These bounds are local; they are only needed near $a$, exactly where continuity at $a$ is tested.
[/guided]
[/step]
[step:Prove products are continuous at $a$]
Define
\begin{align*}
p:X &\to \mathbb{R}
\end{align*}
by $p(x)=f(x)g(x)$ for every $x \in X$.
Let $\varepsilon>0$ be given. Let $\rho_f>0$ and $M_f=|f(a)|+1$ be as in the previous step. Since $g$ is continuous at $a$, there exists $\eta_g>0$ such that, for every $x \in X$,
\begin{align*}
d_X(x,a)<\eta_g \implies |g(x)-g(a)|<\frac{\varepsilon}{2M_f}.
\end{align*}
Since $f$ is continuous at $a$, there exists $\eta_f>0$ such that, for every $x \in X$,
\begin{align*}
d_X(x,a)<\eta_f \implies |f(x)-f(a)|<\frac{\varepsilon}{2(|g(a)|+1)}.
\end{align*}
Define $\delta=\min\{\rho_f,\eta_f,\eta_g\}$. If $d_X(x,a)<\delta$, then $|f(x)|<M_f$, and
\begin{align*}
|p(x)-p(a)|=|f(x)g(x)-f(a)g(a)|.
\end{align*}
Adding and subtracting $f(x)g(a)$ inside the absolute value gives
\begin{align*}
|p(x)-p(a)|=|f(x)(g(x)-g(a))+g(a)(f(x)-f(a))|.
\end{align*}
Using the triangle inequality and multiplicativity of the absolute value,
\begin{align*}
|p(x)-p(a)|\le |f(x)|\,|g(x)-g(a)|+|g(a)|\,|f(x)-f(a)|.
\end{align*}
Therefore
\begin{align*}
|p(x)-p(a)|<M_f\frac{\varepsilon}{2M_f}+|g(a)|\frac{\varepsilon}{2(|g(a)|+1)}<\varepsilon.
\end{align*}
Thus $fg$ is continuous at $a$.
[/step]
[step:Find a neighbourhood on which $g$ is nonzero]
Assume $g(a)\ne 0$. Since $g$ is continuous at $a$, there exists $r_0>0$ such that, for every $x \in X$,
\begin{align*}
d_X(x,a)<r_0 \implies |g(x)-g(a)|<\frac{|g(a)|}{2}.
\end{align*}
For every $x \in B(a,r_0)$, the [reverse triangle inequality](/theorems/2300) gives
\begin{align*}
|g(x)|\ge |g(a)|-|g(x)-g(a)|>\frac{|g(a)|}{2}.
\end{align*}
In particular, $g(x)\ne 0$ for every $x \in B(a,r_0)$. Thus $B(a,r_0)$ is a neighbourhood of $a$ on which $g$ is nonzero.
[/step]
[step:Prove the reciprocal is continuous at $a$ on that neighbourhood]
Let $r_0>0$ be chosen as in the previous step, and define
\begin{align*}
u:B(a,r_0) &\to \mathbb{R}
\end{align*}
by $u(x)=1/g(x)$ for every $x \in B(a,r_0)$. The map is well-defined because $g(x)\ne 0$ on $B(a,r_0)$.
Let $\varepsilon>0$ be given. Since $g$ is continuous at $a$, there exists $\delta_g>0$ such that, for every $x \in X$,
\begin{align*}
d_X(x,a)<\delta_g \implies |g(x)-g(a)|<\frac{\varepsilon |g(a)|^2}{2}.
\end{align*}
Define $\delta=\min\{r_0,\delta_g\}$. If $x \in B(a,r_0)$ and $d_X(x,a)<\delta$, then the lower bound from the previous step gives $|g(x)|>|g(a)|/2$, and therefore
\begin{align*}
|u(x)-u(a)|=\left|\frac{1}{g(x)}-\frac{1}{g(a)}\right|=\frac{|g(x)-g(a)|}{|g(x)|\,|g(a)|}.
\end{align*}
Using $|g(x)|>|g(a)|/2$, we get
\begin{align*}
|u(x)-u(a)|<\frac{2|g(x)-g(a)|}{|g(a)|^2}<\varepsilon.
\end{align*}
Thus $1/g$ is continuous at $a$ as a function on $B(a,r_0)$ with the subspace metric.
[/step]
[step:Conclude every admissible local quotient is continuous at $a$]
Let $r>0$ be any radius such that $g(x)\ne 0$ for every $x \in B(a,r)$, and define
\begin{align*}
q:B(a,r) &\to \mathbb{R}
\end{align*}
by $q(x)=f(x)/g(x)$ for every $x \in B(a,r)$. We prove that this arbitrary admissible quotient map is continuous at $a$.
Let $r_0>0$ be the radius constructed above, and let
\begin{align*}
r_1=\min\{r,r_0\}.
\end{align*}
Define
\begin{align*}
u_1:B(a,r_1) &\to \mathbb{R}
\end{align*}
by $u_1(x)=1/g(x)$ for every $x \in B(a,r_1)$. Since $r_1\le r_0$, the previous step applies to the restriction of the reciprocal and proves that $u_1$ is continuous at $a$ on $B(a,r_1)$ with the subspace metric.
The restriction $f|_{B(a,r_1)}:B(a,r_1)\to\mathbb{R}$ is continuous at $a$ because the $\varepsilon$-$\delta$ condition for $f$ on $X$ restricts to points of $B(a,r_1)$. By the product argument already proved, applied in the [metric space](/page/Metric%20Space) $B(a,r_1)$, the map
\begin{align*}
q|_{B(a,r_1)}=f|_{B(a,r_1)}\,u_1:B(a,r_1)\to\mathbb{R}
\end{align*}
is continuous at $a$.
It remains to translate this continuity from the smaller ball back to the domain $B(a,r)$. Let $\varepsilon>0$ be given. Since $q|_{B(a,r_1)}$ is continuous at $a$, there exists $\delta_1>0$ such that, for every $x \in B(a,r_1)$,
\begin{align*}
d_X(x,a)<\delta_1 \implies |q(x)-q(a)|<\varepsilon.
\end{align*}
Define $\delta=\min\{r_1,\delta_1\}$. If $x \in B(a,r)$ and $d_X(x,a)<\delta$, then $x\in B(a,r_1)$, so the preceding implication gives $|q(x)-q(a)|<\varepsilon$. Hence $q:B(a,r)\to\mathbb{R}$ is continuous at $a$ for the arbitrary admissible radius $r$.
The constructed radius $r_0$ gives a neighbourhood of $a$ on which $g$ is nonzero, and the preceding paragraph proves the quotient conclusion for every radius satisfying the nonvanishing hypothesis.
[/step]