Tutorials › Real Analysis › Proof of Fermat’s Theorem

Differentiation · Tutorial 416 of 1000

Proof of Fermat's Theorem

See how the two-sided derivative limit and the sign change caused by negative denominators force the derivative to vanish at an interior local extremum.

Advanced 9 min read

What You'll Learn

  • Translate the local maximum and minimum conditions into inequalities for difference quotients.
  • Prove a sign-squeeze lemma for two-sided limits.
  • Use the lemma to prove Fermat’s Theorem for both local maxima and local minima.
  • Identify why dividing by a negative increment reverses an inequality.
  • Distinguish the theorem’s necessary condition from a sufficient test for an extremum.

From a Local Extremum to a Derivative Condition

In the previous tutorial, Fermat’s Theorem was stated as a necessary condition: if a function is differentiable at an interior point where it has a local maximum or minimum, then its derivative there is zero. Here we prove that claim directly from the definition of the derivative. The key is to compare difference quotients on the two sides of the point.

At a local maximum, nearby function values cannot exceed the value at the point. For positive increments, this makes the difference quotient nonpositive. For negative increments, the same change in function value is divided by a negative number, so the quotient is nonnegative. If the two-sided derivative exists, its limit must satisfy both inequalities. This sign squeeze is the central step of the proof.

A Sign-Squeeze Lemma for Limits

We first isolate the limit argument. It will let us move carefully from inequalities that hold on each side of zero to a conclusion about a two-sided limit.

Lemma (Two-Sided Sign Squeeze): Suppose \(q(h)\) is defined for all sufficiently small nonzero \(h\), and \(\lim_{h\to0}q(h)=L\). If \(q(h)\leq0\) for all sufficiently small positive \(h\), and \(q(h)\geq0\) for all sufficiently small negative \(h\), then \(L=0\).

Proof. First we show that \(L\leq0\). If instead \(L>0\), the definition of the limit with \(\varepsilon=L/2\) gives a \(\delta>0\) such that

$$ 0<|h|<\delta \quad\Longrightarrow\quad |q(h)-L|<\frac{L}{2}. $$

For positive \(h\) small enough that this limit condition and the assumed sign condition both hold, it follows that

$$ q(h)>L-\frac{L}{2}=\frac{L}{2}>0. $$

That contradicts \(q(h)\leq0\) for all sufficiently small positive \(h\). Thus \(L\leq0\). To show \(L\geq0\), suppose instead that \(L<0\), and use \(\varepsilon=-L/2>0\). For all sufficiently small nonzero \(h\),

$$ |q(h)-L|<\frac{-L}{2} \quad\Longrightarrow\quad q(h)<L+\frac{-L}{2}=\frac{L}{2}<0. $$

Taking \(h<0\) small enough also to satisfy the assumed sign condition contradicts \(q(h)\geq0\). Therefore \(L\geq0\) as well as \(L\leq0\), so \(L=0\). \(\square\)

The lemma needs a two-sided limit: the positive and negative increments provide the two opposite inequalities. A limit from only one side would yield only one of them and would not force the limit to equal zero.

Proof of Fermat’s Theorem

Recall that a local maximum at \(a\) means that \(f(x)\leq f(a)\) for all domain points \(x\) sufficiently close to \(a\); at a local minimum, the inequality is reversed. Since \(a\) is an interior point of the interval, both positive and negative sufficiently small increments keep \(a+h\) in the domain. This two-sided availability is essential.

Theorem (Fermat’s Theorem): Let \(I\) be an interval, let \(a\) be an interior point of \(I\), and suppose \(f:I\to\mathbb{R}\) is differentiable at \(a\). If \(f\) has a local maximum or a local minimum at \(a\), then \(f'(a)=0\).

Proof. Define the difference quotient at \(a\) by

$$ q(h)=\frac{f(a+h)-f(a)}{h}, \qquad h\ne0, $$

for sufficiently small \(h\) with \(a+h\in I\). Differentiability at \(a\) says precisely that

$$ \lim_{h\to0}q(h)=f'(a). $$

Suppose first that \(f\) has a local maximum at \(a\). There is a \(\delta>0\) such that \(f(a+h)\leq f(a)\) whenever \(a+h\in I\) and \(|h|<\delta\). If \(0<h<\delta\), division by the positive number \(h\) preserves the inequality, giving \(q(h)\leq0\). If \(-\delta<h<0\), division by the negative number \(h\) reverses it, giving \(q(h)\geq0\). Thus the hypotheses of the Two-Sided Sign Squeeze Lemma hold. Since \(q(h)\to f'(a)\), the lemma gives \(f'(a)=0\).

Now suppose that \(f\) has a local minimum at \(a\). For some \(\delta>0\), we have \(f(a+h)-f(a)\geq0\) whenever \(a+h\in I\) and \(|h|<\delta\). For positive \(h\), division by \(h\) gives \(q(h)\geq0\); for negative \(h\), division by \(h\) gives \(q(h)\leq0\). Apply the lemma to \(-q(h)\): it is nonpositive for positive \(h\), nonnegative for negative \(h\), and has limit \(-f'(a)\). Hence \(-f'(a)=0\), so \(f'(a)=0\). Both cases prove the theorem. \(\square\)

Worked Examples: Seeing the Quotient Signs

Worked Example: A Quartic Local Maximum

Let \(f(x)=6-(x-2)^4\). Since \((x-2)^4\geq0\) for every real \(x\), we have \(f(x)\leq6=f(2)\). Thus \(2\) is a local maximum (in fact, an absolute maximum). For \(h\ne0\), the difference quotient at \(2\) is

$$ \frac{f(2+h)-f(2)}{h} =\frac{(6-h^4)-6}{h} =-h^3. $$

As \(h\to0\), \(-h^3\to0\), so \(f'(2)=0\). The sign pattern is also explicit: if \(h>0\), then \(-h^3<0\); if \(h<0\), then \(-h^3>0\). It is exactly the pattern used in the local-maximum proof.

Worked Example: A Quartic Local Minimum

Consider \(g(x)=(x+2)^4+1\). Since fourth powers are nonnegative, \(g(x)\geq1=g(-2)\) for every \(x\), so \(-2\) is a local minimum. Its difference quotient is

$$ \frac{g(-2+h)-g(-2)}{h} =\frac{(h^4+1)-1}{h} =h^3. $$

The limit of this quotient as \(h\to0\) is zero, and therefore \(g'(-2)=0\). For positive \(h\), the quotient is nonnegative; for negative \(h\), it is nonpositive. These are the reversed signs from the local-maximum case, as required for a minimum.

Worked Example: A Stationary Point That Is Not an Extremum

Let \(r(x)=(x-1)^5+4\). At \(x=1\), the difference quotient is

$$ \frac{r(1+h)-r(1)}{h} =\frac{(h^5+4)-4}{h} =h^4, \qquad h\ne0. $$

Since \(h^4\to0\), we have \(r'(1)=0\). But \(r(1+h)-r(1)=h^5\): this is positive when \(h>0\) and negative when \(h<0\). Every neighborhood of \(1\) therefore contains points with function values both above and below \(r(1)\). The point is neither a local maximum nor a local minimum. This example verifies that Fermat’s condition is necessary for an interior extremum, not sufficient.

Why the Sign Change Matters

The most common error in this proof is to use the local-maximum inequality and conclude that every nearby difference quotient is nonpositive. That conclusion overlooks the denominator. For a local maximum, the numerator \(f(a+h)-f(a)\) is nonpositive on both sides of \(a\), but division by \(h\) preserves the inequality for \(h>0\) and reverses it for \(h<0\). The two-sided derivative can be zero only because its limit must be compatible with both resulting signs.

The interior-point hypothesis ensures there are domain points on both sides close to \(a\). At an endpoint, the same two-sided argument is unavailable; a one-sided quotient can have a nonzero limit even when the endpoint is an extremum. Differentiability is also essential to this proof: without a two-sided derivative limit, the sign constraints on the quotients do not imply the existence of a derivative equal to zero.

Fermat’s Theorem is useful as a filter when locating extrema. At an interior point where a differentiable function attains a local extremum, the derivative must vanish. The theorem does not say that every point with zero derivative is an extremum, as the fifth-power example shows, and it does not eliminate endpoints or nondifferentiable points from consideration. Its strength lies in the exact implication its hypotheses justify.

Check Your Understanding

Use the sign argument and the examples to answer the following.

  1. At a local maximum, what signs must the difference quotient have for positive and negative increments? Explain why the signs differ.
  2. In the Two-Sided Sign Squeeze Lemma, why does a positive value of the limit contradict the sign condition for positive increments?
  3. For \(u(x)=9-(x-4)^2\), verify that \(4\) is a local maximum and compute the difference quotient there.
  4. Why does the Fermat proof require \(a\) to be an interior point of the domain interval?
  5. Give the conclusion Fermat’s Theorem supports when \(f'(a)=0\), and explain why that conclusion does not establish that \(a\) is a local extremum.