I want to prove the following statement:
Let $f$ and $g$ be two real functions continuous in some interval $[a, b]$ and differentiable in $(a, b)$. If $f' = g'$, then $f(x) = g(x) + c$, where $c$ is a constant.
I thought I could argue like this: Consider $h(x) = f(x) - g(x)$. Knowing that $h' = 0$, we want to prove that $h$ is constant. Pick any $k \in (a,b)$, then $h'(k) = 0$. Therefore (and this is the part I'm not sure about), by Rolle's theorem we can find $d, e \in (a, b)$ such that $d < k < e$ and $h(d) = h(e)$. Since this must be true for any $d, e, k$, $h$ is a constant.
Is this a correct application of Rolle's theorem?