By Extreme Value Theorem on a Compact Interval, there exist points xmin,xmax∈[a,b] such that
f(xmin)≤f(x)≤f(xmax)for all x∈[a,b].
If f(xmin)=f(xmax), then every value of f on [a,b] is equal to this common value, so f is constant on [a,b]. Since a<b, choose any c∈(a,b). For every h with c+h∈[a,b] and h=0 one has
hf(c+h)−f(c)=0,
and therefore f′(c)=0.
Assume now that f(xmin)<f(xmax). Because f(a)=f(b), the points a and b cannot both realize the maximum and the minimum. More precisely, if xmax∈{a,b}, then f(xmax)=f(a)=f(b), so the strict inequality f(xmin)<f(xmax) forces xmin∈/{a,b}, hence xmin∈(a,b). Similarly, if xmin∈{a,b}, then xmax∈(a,b). Thus at least one of xmin or xmax lies in (a,b). At such a point f has a local extremum, so Fermat Stationary Point Criterion yields a point c∈(a,b) with f′(c)=0.