I know that if $f$ and $g$ are both continuous then $f+g$ is continuous. I also know that there are discontinuous functions whose sum is continuous. However, I want to find two functions that are everywhere discontinuous, yet their sum is continuous. I can only come up with examples such as $f(x) = sgn x$, $g(x) =-sgn x$, but these only have one discontinuity point.
$f+g$ is continuous and $f$ and $g$ are everywhere discontinuous
functionsreal-analysis
Best Answer
Take
$$ f(x) = \left\{ \begin{array}{ll} 1 & \quad x \in \Bbb Q \\ 0 & \quad x \in \Bbb R \setminus \Bbb Q \end{array} \right. $$
and
$$ g(x) = \left\{ \begin{array}{ll} 0 & \quad x \in \Bbb Q \\ 1 & \quad x \in \Bbb R \setminus \Bbb Q \end{array} \right. $$