Is it possible to prove $\forall x, f'(x)=g'(x) \implies g(x)=f(x)+C$?

The proof of

$$\forall x, g(x)=f(x)+C \implies g'(x)=f'(x)$$

is as follows

$$g'(x) = \lim\limits_{h \to 0} \frac{f(x+h)+C-f(x)-C}{h}$$ $$= \lim\limits_{h \to 0} \frac{f(x+h)-f(x)}{h}$$ $$=f'(x)$$

Is it possible to prove the converse $$\forall x, f'(x)=g'(x) \implies g(x)=f(x)+C$$

• Yes, simply integrate the equation from 0 to x. Commented May 14, 2022 at 23:22
• Hint: let $h(x)=g(x)-f(x)$. Then your assumptions tell us that $h'(x)=0$. Note that the claim is not true without more assumptions (like that the functions are differentiable on all of $\mathbb R$ or something like that).
– lulu
Commented May 14, 2022 at 23:23
• @lisyarus I forgot to make the disclaimer that I am studying Spivak's Calculus and am on the chapter on differentiation. I haven't seen integration yet. Maybe that's why one of the problems asks us to solve the $\forall x, g(x)=f(x)+C \implies g'(x)=f'(x)$ but not the converse.
– xoux
Commented May 14, 2022 at 23:25
• For instance, let $f(x)$ denote the function which is $0$ for $x\neq 0$ and undefined at $0$, and let $g(x)$ denote the function which is $-1$ for $x<0$ and $1$ for $x>0$ (and also undefined at $0$). Then $f'(x)=g'(x)=0$ for all $x$ for which the functions are defined, but there is no constant such that $f(x)=g(x)+C$.
– lulu
Commented May 14, 2022 at 23:35
• Is it the case then that to prove $\forall x, f'(x)=g'(x) \implies g(x)=f(x)+C$ we need more assumptions than to prove $\forall x, g(x)=f(x)+C \implies g'(x)=f'(x)$? $g(x)=f(x)+C$ is somehow a stronger claim than simply $g'(x)=f'(x)$?
– xoux
Commented May 14, 2022 at 23:41

After substracting, you are left to show that $$f' = 0 \implies f=C$$. Classically, this is proved with the help of the mean value theorem.

A comment suggests to use integration (and the fundamental theorem of calculus) to prove it. That might give you a circular argument, as there is a good chance the fact at hand is used in the proof of the fundamental theorem of calculus.

• In addition, not every function has a Riemann integrable derivative (see Volterra's function, en.wikipedia.org/wiki/Volterra%27s_function), so an integration-based argument will not work in general. Commented May 14, 2022 at 23:33
• Is the part $f'=0 \implies f=C$ correct? Don't you mean $h$ instead of $f$?
– xoux
Commented May 14, 2022 at 23:44
• I renamed it $f$, as is common in math proof-writing to reuse variable names when you reduce a theorem to another. But yes that's your $h$. Commented May 14, 2022 at 23:47

Following up on @lulu's comment.

If $$f$$ and $$g$$ are differentiable, then if $$h(x)=f(x)-g(x)$$ we have:

$$h'(x)=f'(x)-g'(x)=0$$ for all $$x$$.

Hence, $$h$$ is a constant function for all $$x$$ (proof of this statement is a straightforward use of mean value theorem between any two points $$x$$ and $$y$$).

$$h(x)=f(x)-g(x)=C$$ $$f(x)=g(x)+C$$

• Yes, but see my answer. Proving that $h=C$ if $h'=0$ is not completely trivial. Commented May 14, 2022 at 23:42