Proof that Functions with Zero Derivatives are Constant

If for some function $f$, we have $f'(x)=0$ for all $x$ in $(a,b)$, then $f(x)=c$ for some constant $c$.


Proof:

Let $x_1 \lt x_2$ be any two real values in $(a,b)$. Clearly, $f$ is differentiable on $[x_1,x_2]$ given that we know $f'(x)=0$ for all $x$ in this interval. But this means $f$ is continuous on $[x_1,x_2]$ and differentiable on $(x_1,x_2)$. Thus, the conditions of the mean value theorem are satisfied, with it concluding there is some $c$ in $(x_1,x_2)$ where

$$f'(c) = \frac{f(x_2)-f(x_1)}{x_2-x_1}$$

However, we know that $f'(c) = 0$, so multiplying both sides by $(x_2-x_1)$ leads to $f(x_2)-f(x_1) = 0$. Equivalently, $f(x_1) = f(x_2)$. As this is true for all $x_1 \lt x_2$ in $(a,b)$, it must be the case that $f(x)$ is constant on $(a,b)$.

Important Corollary:

If $f'(x) = g'(x)$ for all $x$ in $(a,b)$, then $f(x) - g(x) = c$ for some constant $c$.

To prove this, just apply the previous result to $F(x) = f(x)-g(x)$, noting that $F'(x) = f'(x) - g'(x) = 0$. So $F(x)$, and thus $f(x) - g(x)$, is constant.