Constant Function on an Interval
A function f(x) is a constant function on an interval [a,b] if and only if it is differentiable on [a,b] and its first derivative is zero at every point in that interval. $$ \forall x \in [a,b] \:\:\:\:\: f'(x)=0 $$
This is known as the Characterization Theorem for Constant Functions.
A Practical Example
Consider the following constant functions:
$$ f(x) = 2 \\ g(x)=3 $$
For any value of x, f(x) is always equal to 2, and g(x) is always equal to 3.

The first derivatives of both f(x) and g(x) are zero:
$$ f'(x) = 0 \\ g'(x)=0 $$
In both cases, the derivative is zero because the derivative of a constant k is always zero:
$$ \frac{d k}{d x} = 0 $$
Proof and Explanation
1] A constant function has a first derivative equal to zero
Suppose we have a function f(x) that is constant throughout the interval [a,b]:
$$ f(x) = c $$
To find the derivative, we compute the limit of the difference quotient as h → 0 at any point x ∈ [a,b], which gives the first derivative of f(x):
$$ f'(x)= \lim_{h \rightarrow 0} \frac{f(x+h)-f(x)}{h} $$
Since f(x) is constant, we have:
$$ f(x)=c \\ f(x+h)=c $$
Substituting f(x) and f(x+h) with the constant c into the difference quotient gives:
$$ f'(x)= \lim_{h \rightarrow 0} \frac{f(x+h)-f(x)}{h} $$
$$ f'(x)= \lim_{h \rightarrow 0} \frac{c-c}{h} $$
$$ f'(x)= \lim_{h \rightarrow 0} \frac{0}{h} $$
Therefore, as h approaches zero, the limit remains zero:
$$ f'(x)= 0 $$
2] A function whose first derivative is zero is a constant function
If a function is differentiable on [a,b] and its derivative is zero at every point x in [a,b]:
$$ f'(x) = 0 $$
then it satisfies both monotonicity criteria:
$$ \begin{cases} f'(x) \ge 0 \\ f'(x) \le 0 \end{cases} $$
This means the function is simultaneously non-decreasing and non-increasing throughout [a,b].
Consider any point x > a within the interval:
$$ x > a $$
Then the function f(x) must satisfy both:
$$ \begin{cases} f(x) \ge f(a) \\ f(x) \le f(a) \end{cases} $$
The only possible solution to this system is:
$$ f(x) = f(a) $$
Therefore, at any point x > a, the function f(x) equals f(a).
This proves that a constant function has a zero derivative, and conversely, that a function whose derivative is zero is constant.
And so on.
