# $f + g$ if $f$ is differentiable but $g$ is undifferentiable

I'm reading through Spivak and a remark he makes puzzles me

If we consider $$f(x) = \begin{cases} x^3 \sin \dfrac{1}{x}, &x \neq 0\\[5pt] 0, & x = 0 \end{cases}$$

Then $$f'(x) = \begin{cases} 3x^2 \sin \dfrac{1}{x} - x \cos \dfrac{1}{x}, &x \neq 0 \\ 0, &x = 0 \end{cases}$$

In this case $$f'$$ is continuous at $$0$$, but $$f''(0)$$ does not exist (because the expression $$3x^2 \sin \dfrac{1}{x}$$ is differentiable at 0 but the expression $$-x \cos \dfrac{1}{x}$$ is not).

Specifically, the 'because'. Does he mean to say that if $$f$$ is differentiable but $$g$$ is undifferentiable, then $$f + g$$ is likely or certainly to be undifferentiable? Or was he just being a bit careless with his wording, and referring only to this particular example?

• If $f$ and $f+g$ are differentiable at $a$, then $g=(f+g)-f$ is also differentiable at $a$. – Randall Mar 18 at 15:04
• "undifferentiable" ? – Yves Daoust Mar 18 at 15:05

As user @Randall already points out, if $$f$$ and $$f+g$$ are differentiable at a point $$a$$, then $$g=(f+g)-f$$ is also differentiable at $$a$$. In particular, it's enough that Spivak points out one of the terms is differentiable at $$0$$ while the other is not; this guarantees the sum of the terms is not differentiable.
• I'm sorry, but I don't follow the arguement. I'm not supposing $f + g$ is differentiable; I'm just suppose $f$ is and $g$ is not. – user_hello1 Mar 18 at 15:19
• @user_hello1 I see what you mean. The conclusion by Clayton (I think) is that when you know that the result is differentiable at $x_0$, then both $f$ and $g$ are at $x_0$. – Andreas Mastronikolis Mar 18 at 15:22
• @user_hello1: Correct. Since $f$ is differentiable at $0$ and $g$ is not differentiable at $0$, then $f+g$ cannot be differentiable at $0$; if $f+g$ were differentiable, then we'd also have $(f+g)-f$ differentiable, which is a contradiction since we know $g$ is not differentiable at $0$. – Clayton Mar 18 at 15:23
• @user_hello1 hmmm. I don't think so. Consider $f(x)=|x|$ and $g(x)= -|x|$. The function addition $f+g$ gives 0 everywhere (and it is differentiable). However, $f$ and $g$ were not. Thus, the statement '$f+g$ is differentiable if and only if $f$ AND $g$ are differentiable' is not true in general. – Andreas Mastronikolis Mar 18 at 15:29
• @user_hello1: Not quite, as tempting as it might be to think that; in fact, all we can say is that if $f+g$ is differentiable, then $f$ and $g$ are both differentiable or both nondifferentiable (consider a nondifferentiable function $h$; then $(f+h)-h$ is differentiable, but neither of the individual terms will be differentiable). – Clayton Mar 18 at 15:30