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.

  • 7
    $\begingroup$ Take $f$ any everywhere discontinuous and $g=-f$. $\endgroup$ – Wojowu Mar 2 at 14:25
  • 1
    $\begingroup$ Try Dirchilet type functions. $\endgroup$ – Dbchatto67 Mar 2 at 14:26


$$ f(x) = \left\{ \begin{array}{ll} 1 & \quad x \in \Bbb Q \\ 0 & \quad x \in \Bbb R \setminus \Bbb Q \end{array} \right. $$


$$ g(x) = \left\{ \begin{array}{ll} 0 & \quad x \in \Bbb Q \\ 1 & \quad x \in \Bbb R \setminus \Bbb Q \end{array} \right. $$


You only need to find a function $f$ that's discontinuous everywhere, since then you can take $g=-f$ and clearly $f+g=0$ will be continous.

Such a function can be found by taking $f(x)=1$ if $x$ is a rational number, and $f(x)=0$ otherwise.


To generate infinitely many examples, take $g = h - f$, where $h$ is a continuous function.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.