Problem on continuous functions I am self-learning Real Analysis from the text, Understanding Analysis by Stephen Abbott. I'd like someone to verify my solution to exercise problem 4.3.6, and comment on whether my work checks out and if there are no technical mistakes. Also, any hints on how to proceed with (d)?

[Abbott, 4.3.6] Provide an example of each or explain why the request is impossible.
(a) Two functions $\displaystyle f$ and $\displaystyle g$, neither of which is continuous at $\displaystyle 0$, but such that $\displaystyle f( x) g( x)$ and $\displaystyle f( x) +g( x)$ are continuous at $\displaystyle 0$.
(b) A function $\displaystyle f( x)$ continuous at $\displaystyle 0$ and $\displaystyle g( x)$ not continuous at $\displaystyle 0$ such that $\displaystyle f( x) +g( x)$ is continuous at $\displaystyle 0$.
(c) A function $\displaystyle f( x)$ is continuous at $\displaystyle 0$ and $\displaystyle g( x)$ not continuous at $\displaystyle 0$, such that $\displaystyle f( x) \cdot g( x)$ is continuous at $\displaystyle 0$.
(d) A function $\displaystyle f( x)$ not continuous at $\displaystyle 0$ such that $\displaystyle f( x) +\frac{1}{f( x)}$ is continuous at $\displaystyle 0$.
(e) A function $\displaystyle f( x)$ not continuous at $\displaystyle 0$ such that $\displaystyle [ f( x)]^{3}$ is continuous at $\displaystyle 0$.

Solution.
(a) Consider
\begin{equation*}
\begin{array}{ c c }
f( x) & =\begin{cases}
x^{2} +3 & \text{if } x\neq 0\\
2 & \text{if } x=0
\end{cases}\\
g( x) & =\begin{cases}
x+2 & \text{if } x\neq 0\\
3 & \text{if } x=0
\end{cases}
\end{array}
\end{equation*}
Then, $\displaystyle \lim _{x\rightarrow 0}[ f( x) +g( x)] =\lim _{x\rightarrow 0}\left( x^{2} +x+5\right) =5$. Moreover, $\displaystyle f( 0) +g( 0) =5$. Also, $\displaystyle \lim _{x\rightarrow 0} f( x) \cdot g( x) =\lim _{x\rightarrow 0}\left( x^{2} +3\right)( x+2) =6$ and $\displaystyle f( 0) \cdot g( 0) =6$.
(b) This request is impossible. Assume that $\displaystyle f( x) +g( x)$ is continuous at $\displaystyle 0$ and $\displaystyle f( x)$ is continuous at $\displaystyle 0$. Therefore, $\displaystyle \lim _{x\rightarrow 0} f( x) +g( x) =f( 0) +g( 0)$ and $\displaystyle \lim _{x\rightarrow 0} f( x) =f( 0)$. So, $\displaystyle \lim _{x\rightarrow 0} g( x) =\lim _{x\rightarrow 0} f( x) +g( x) -f( x) =\lim _{x\rightarrow 0}( f( x) +g( x)) -\lim _{x\rightarrow 0} g( x) =f( 0) +g( 0) -f( 0) =g( 0)$. Consequently, $\displaystyle g( x)$ is continuous at $\displaystyle 0$.
(c) Consider $\displaystyle f( x) =x$, $\displaystyle g( x) =\frac{1}{x}$. Then, $\displaystyle f( x) \cdot g( x) =1$ which is continuous at $\displaystyle 0$.
(d) $\star$ TODO. I can't think of an example here.
(e) This request is impossible. Assume that $\displaystyle f( x)$ is not continuous at $\displaystyle 0$. So, there exists $\displaystyle \epsilon  >0$, for all $\displaystyle \delta  >0$, such that whenever $\displaystyle | x| < \delta $, we have $\displaystyle | f( x) -f( 0)|  >\epsilon $.
Consider the distance $\displaystyle \left| f( x)^{3} -f( 0)^{3}\right| =| f( x) -f( 0)| \cdot \left| f( x)^{2} -f( x) \cdot f( 0) +f( 0)^{2}\right| $.
\begin{equation*}
\begin{array}{ r l }
\left| f( x)^{3} -f( 0)^{3}\right|  & =| f( x) -f( 0)| \cdot \left| f( x)^{2} -f( x) \cdot f( 0) +f( 0)^{2}\right| \\
 & =| f( x) -f( 0)| \cdot \left| \left( f( x) -\frac{f( 0)}{2}\right)^{2} +\frac{3}{4} f( 0)^{2}\right| \\
 & \geq \frac{3}{4} f( 0)^{2} \cdot | f( x) -f( 0)| =\frac{3}{4} f( 0)^{2} \cdot \epsilon 
\end{array}
\end{equation*}
So, there exists an $\displaystyle \epsilon '=\frac{3}{4} f( 0)^{2} \cdot \epsilon $, for all $\displaystyle \delta  >0$, such that whenever $\displaystyle | x| < \delta $, we have $\displaystyle \left| f( x)^{3} -f( 0)^{3}\right|  >\epsilon '$.
Consequently, $\displaystyle [ f( x)]^{3}$ is not continuous at $\displaystyle 0$.
 A: (a) That's fine.
(b) That's also fine.
(c) Since $g$ is undefined at $0$, it's neither continuous nor discontinuous there. Take $f(x)=0$ and let $g$ be any function discontinuous at $0$.
(d) Take$$f(x)=\begin{cases}2&\text{ if }x\geqslant0\\\frac12&\text{ otherwise.}\end{cases}$$Then $f$ is discontinuous at $0$, but $f+\frac1f$ is constant.
(e) Simply use the fact that $x\mapsto\sqrt[3]x$ is continuous and that if a function $g$ is continuous at $a$ and a function $g$ is continuous at $f(a)$, then $g\circ f$ is also continuous at $a$.
A: (a) - (b) seem fine.
An easier example for (a) could be to take the function $f$ which is $1$ at rationals and $-1$ at irrationals and let $g = -f$. Then, the sum is identically $0$ and the product is identically $-1$.

(c) As the other answer points out, your function $g$ is not defined at $0$. Assign it any value at $0$ and then you are done.

For (e): You have negated the definition of continuity wrongly.
The correct thing would be the following: There exists $\epsilon > 0$ such that for all $\delta > 0$, there exists some $x$ with $|x| < \delta$ and $|f(x) - f(0)| \geqslant \epsilon$.
The conclusion is correct, however. Here's an alternate way of doing it: Use the fact that the function $x \mapsto \sqrt[3]{x}$ is continuous on $\Bbb R$ and that continuity behaves well with composition.

For (d): Here's one example.
Note that the equation $$t + \frac1t = 4$$
has two distinct positive solutions, say $t_1$ and $t_2$.
Define $$f(x) = \begin{cases} t_1 & x \in \Bbb Q, \\ t_2 & x \notin \Bbb Q. \end{cases}$$
($\Bbb Q$ is the set of rationals.)
Then, $f$ is not continuous at $0$. (Why?)
However, $$f(x) + \frac{1}{f(x)} = 4$$
for all $x \in \Bbb R$ and thus, the above is continuous at $0$.
