Why Look Along Coordinate Directions?
A local maximum or minimum is a condition on the values of a function throughout a neighborhood, so it can initially seem to require checking infinitely many directions. A useful simplification is to examine the function along each coordinate direction separately. Each such restriction is a one-variable function, where a basic necessary condition for an extremum applies.
The conclusion is important but limited: if a differentiable function has a local extremum at an interior point, every component of its gradient must be zero. This condition can rule out extrema when the gradient is nonzero. By itself, however, it does not show that a point with zero gradient is an extremum.
We say \(f\) is differentiable at \(\mathbf{a}\) if its change near \(\mathbf{a}\) can be approximated by a linear map, with an error that is small compared with the distance from \(\mathbf{a}\). In coordinates, this means there is a linear map \(Df(\mathbf{a})\) such that
For a differentiable real-valued function, the gradient is the vector of its first partial derivatives:
The One-Variable Condition
First consider a differentiable function \(g\) of one real variable with a local extremum at \(t=0\). If \(0\) is a local maximum, then for sufficiently small \(h\), \(g(h)-g(0)\leq 0\). For positive and negative \(h\), division by \(h\) gives inequalities in opposite directions:
Since \(g'(0)\) exists, both one-sided difference quotients approach the same number. The limit from positive \(h\) cannot be positive, and the limit from negative \(h\) cannot be negative. Therefore their common limit is zero. For a local minimum the inequalities reverse, and the same reasoning again gives \(g'(0)=0\).
Fermat’s Necessary Condition in Several Variables
To use the one-variable result for \(f\), restrict \(f\) to a line through \(\mathbf{a}\) parallel to one coordinate axis. For each index \(i\), let \(\mathbf{e}_i\) be the vector with \(1\) in its \(i\)-th coordinate and \(0\) in every other coordinate. Define the restriction
Because \(\mathbf{a}\) is interior, \(\mathbf{a}+t\mathbf{e}_i\) remains in the domain for every sufficiently small \(t\). If \(f\) has a local maximum at \(\mathbf{a}\), then \(\phi_i\) has a local maximum at \(t=0\); if \(f\) has a local minimum there, then \(\phi_i\) has a local minimum at \(t=0\).
Differentiability of \(f\) gives the derivative of each restriction. In the linear approximation for \(f\), set \(\mathbf{h}=t\mathbf{e}_i\). The coefficient of \(t\) is \(Df(\mathbf{a})\mathbf{e}_i\), which is the \(i\)-th partial derivative. Thus \(\phi_i'(0)=\frac{\partial f}{\partial x_i}(\mathbf{a})\). Applying the one-variable condition to every coordinate restriction proves the result.
Proof by Coordinate Restrictions
For an arbitrary index \(i\), define \(\phi_i(t)=f(\mathbf{a}+t\mathbf{e}_i)\) for \(t\) near \(0\). Interiority ensures this restriction is defined on an interval containing \(0\).
If \(f\) has a local maximum or minimum at \(\mathbf{a}\), then \(\phi_i\) has the same type of local extremum at \(0\), because its values come from points in the neighborhood of \(\mathbf{a}\).
The restriction is differentiable, so Fermat’s one-variable condition gives \(\phi_i'(0)=0\).
By the definition of the coordinate restriction, \(\phi_i'(0)=\frac{\partial f}{\partial x_i}(\mathbf{a})\). Hence this partial derivative is zero.
The index \(i\) was arbitrary, so every component of \(\nabla f(\mathbf{a})\) is zero. Therefore \(\nabla f(\mathbf{a})=\mathbf{0}\).
The proof does not need to test every possible direction: checking the coordinate directions is enough to show that every partial derivative vanishes. The full differentiability assumption is a convenient sufficient condition for the restrictions to be differentiable and for their derivatives to agree with the corresponding partial derivatives.
Worked Examples
Worked Example: Checking the Condition at a Local Minimum
Consider \(f(x,y)=x^2+3y^2\) at \((0,0)\). Restrict to the two coordinate lines through this point:
Their derivatives are \(\phi_1'(t)=2t\) and \(\phi_2'(t)=6t\), so \(\phi_1'(0)=0\) and \(\phi_2'(0)=0\). Equivalently, \(\frac{\partial f}{\partial x}=2x\), \(\frac{\partial f}{\partial y}=6y\), and \(\nabla f(0,0)=(0,0)\).
To verify the extremum, observe that \(x^2\geq 0\) and \(3y^2\geq 0\), so \(f(x,y)\geq 0=f(0,0)\) everywhere. Equality holds at \((0,0)\). Thus the origin is a global, and therefore local, minimum, and the gradient satisfies the necessary condition.
Worked Example: Checking the Condition at a Local Maximum
Let \(f(x,y)=7-(x-1)^2-2(y+2)^2\), and consider the point \((1,-2)\). Write nearby points as \((1+s,-2+t)\). The coordinate restrictions are
Therefore \(\phi_1'(s)=-2s\), \(\phi_1'(0)=0\), and \(\phi_2'(t)=-4t\), \(\phi_2'(0)=0\). Directly, the partial derivatives are \(\frac{\partial f}{\partial x}=-2(x-1)\) and \(\frac{\partial f}{\partial y}=-4(y+2)\), giving \(\nabla f(1,-2)=(0,0)\).
Also, \((x-1)^2\geq 0\) and \(2(y+2)^2\geq 0\), so \(f(x,y)\leq 7=f(1,-2)\) for every \((x,y)\). Equality occurs at \((1,-2)\). This verifies the global, and hence local, maximum.
Worked Example: Ruling Out an Extremum with a Nonzero Gradient
Consider \(f(x,y)=x^2+y^2\) at \((1,0)\). Its partial derivatives are \(2x\) and \(2y\), so
The point is interior and the function is differentiable there. Fermat’s necessary condition therefore rules out both a local maximum and a local minimum at \((1,0)\). We can check the change along the \(x\)-axis directly: for \(0<\varepsilon<1\),
Both points can be made arbitrarily close to \((1,0)\) by taking \(\varepsilon\) arbitrarily small. One gives a larger function value and the other a smaller one, confirming that neither type of local extremum occurs there.
What the Condition Does—and Does Not—Say
The theorem gives a necessary condition: an interior local extremum of a differentiable function must have zero gradient. Its logical form is one-way. Finding \(\nabla f(\mathbf{a})\neq\mathbf{0}\) proves that \(\mathbf{a}\) is not an interior local extremum. Finding \(\nabla f(\mathbf{a})=\mathbf{0}\) does not, on its own, prove that \(\mathbf{a}\) is a local maximum or minimum.
For instance, for \(q(x,y)=x^2-y^2\), the gradient at \((0,0)\) is \((0,0)\). But along the \(x\)-axis, \(q(t,0)=t^2>0\) for nonzero \(t\), while along the \(y\)-axis, \(q(0,t)=-t^2<0\). There are values both above and below \(q(0,0)=0\) arbitrarily close to the origin. So a zero gradient alone does not establish an extremum. The theorem identifies points that remain possible candidates; additional reasoning is needed to determine what happens there.
Common Pitfall: Forgetting the Interior Assumption
The interior assumption cannot simply be dropped. A local extremum on the boundary of a domain may have a nonzero gradient. For example, let \(f(x,y)=x\) on the domain \(D=\{(x,y):x\geq 0\}\). Relative to this domain, \((0,0)\) is a local minimum: every point of \(D\) has \(f(x,y)=x\geq 0=f(0,0)\). Yet the ambient gradient is \(\nabla f(0,0)=(1,0)\), not \((0,0)\).
A mistaken application would say, “There is a local minimum, so Fermat’s condition forces \((1,0)=(0,0)\).” The error is that \((0,0)\) is not an interior point of \(D\); no open ball around it lies entirely in \(D\). In the missing direction \(x<0\), the function is outside the domain, so the two-sided one-variable difference-quotient argument does not apply. Always check both hypotheses: differentiability at the point and interiority in the domain.
Why the Coordinate Argument Is Useful
When looking for interior extrema of a differentiable function, the theorem reduces a necessary condition to a system of equations: set each partial derivative equal to zero. This can narrow down which points need further investigation. The condition alone does not classify those points, and it does not replace the checks on differentiability or domain. Its value is that it provides a rigorous first test: a nonzero partial derivative in even one coordinate direction rules out an interior local extremum.
Check Your Understanding
Use the one-variable restrictions and the hypotheses of the theorem to answer these questions.
- Why must the coordinate-line restriction \(\phi_i(t)=f(\mathbf{a}+t\mathbf{e}_i)\) have a local extremum at \(t=0\) when \(f\) has a local extremum at \(\mathbf{a}\)?
- For \(f(x,y)=x^2+4y^2\), compute the gradient at \((0,0)\) and state whether it is consistent with the necessary condition for a local minimum.
- If a differentiable function has gradient \((3,-1)\) at an interior point, what does Fermat’s condition allow you to conclude about local extrema there?
- Why does a zero gradient fail to prove that a point is a local maximum or minimum?
- In the domain \(\{(x,y):x\geq 0\}\), why does the one-variable proof of the condition fail at a point on the boundary \(x=0\)?