How to Find Local Max and Min of a Function

To find local maxima and minima of a function, you take the derivative, set it equal to zero, solve for x, and then test each solution to determine whether the function reaches a peak or a valley at that point. The entire process breaks down into two stages: finding candidate points (called critical points) and then classifying each one as a local max, local min, or neither.

Find the Critical Points

A critical point is an x-value where the derivative either equals zero or does not exist, provided the original function is defined there. These are the only places where a local maximum or minimum can occur. If f(c) exists and f'(c) = 0 or f'(c) is undefined, then x = c is a critical point.

The procedure is straightforward:

  • Differentiate. Find f'(x) using whatever rules apply (power rule, product rule, chain rule, etc.).
  • Set the derivative equal to zero. Solve f'(x) = 0 for x. These solutions are your stationary points.
  • Check where the derivative is undefined. Look for x-values where f'(x) involves division by zero, a negative number under a square root, or similar problems. Corners, cusps, and vertical tangent lines on a graph all signal points where f'(x) does not exist.
  • Verify each candidate is in the domain. A point where the derivative is undefined but the original function also doesn’t exist is not a critical point. For example, f(x) = 1/x has no derivative at x = 0, but f(0) doesn’t exist either, so x = 0 is not a critical point.

Ignore any complex numbers that appear when solving. You only care about real-number solutions.

The First Derivative Test

The first derivative test classifies a critical point by looking at whether the function is increasing or decreasing on either side of it. If the function switches from going up to going down, you have a local max. If it switches from going down to going up, you have a local min. If there’s no switch, the critical point is neither.

Here’s how to apply it step by step:

  • List your critical points along with any points where f itself is undefined. These values divide the number line into intervals.
  • Pick a test value in each interval. Plug that test value into f'(x). You only need to know the sign (positive or negative), not the exact number.
  • Read the sign pattern. A positive derivative means f is increasing on that interval. A negative derivative means f is decreasing.
  • Classify each critical point. If f’ goes from positive to negative at a critical point, that point is a local maximum. If f’ goes from negative to positive, it’s a local minimum. If the sign doesn’t change (positive to positive, or negative to negative), the point is neither.

One important detail: the function must actually be defined at the critical point for it to count as a local extremum. A sign change in the derivative doesn’t matter if the function has a hole or asymptote at that x-value.

Example Using the First Derivative Test

Suppose f(x) = x³ − 3x + 2. The derivative is f'(x) = 3x² − 3, which factors as 3(x − 1)(x + 1). Setting this equal to zero gives critical points at x = −1 and x = 1.

Now test the intervals. Pick x = −2 for the interval to the left of −1: f'(−2) = 3(4) − 3 = 9, which is positive (increasing). Pick x = 0 for the interval between −1 and 1: f'(0) = −3, which is negative (decreasing). Pick x = 2 for the interval to the right of 1: f'(2) = 9, positive (increasing).

At x = −1, the derivative goes from positive to negative, so f has a local maximum there. At x = 1, the derivative goes from negative to positive, so f has a local minimum there. Plugging back into the original function, the local max is f(−1) = 4 and the local min is f(1) = 0.

The Second Derivative Test

The second derivative test is a quicker alternative that works when you can easily compute f”(x). It only applies at stationary points, meaning points where f'(x) = 0 (not where f’ is undefined). The idea relies on concavity: if the curve is concave up at a stationary point, the point sits at the bottom of a bowl (local min). If the curve is concave down, the point sits at the top of a hill (local max).

The rules are simple:

  • If f”(c) > 0, the function is concave up at c, so x = c is a local minimum.
  • If f”(c) < 0, the function is concave down at c, so x = c is a local maximum.
  • If f”(c) = 0, the test is inconclusive. Fall back to the first derivative test.

Using the same example, f”(x) = 6x. At x = −1, f”(−1) = −6, which is negative, confirming a local maximum. At x = 1, f”(1) = 6, which is positive, confirming a local minimum. Same answers, less work.

The inconclusive case comes up more often than you might expect. For f(x) = x⁴, the critical point is x = 0, and both f”(0) = 0 and the second derivative test fail. But a quick sign chart of f'(x) = 4x³ shows negative to the left and positive to the right of zero, confirming a local min. Whenever the second derivative test gives you zero, switch to the first derivative test.

When to Check Non-Differentiable Points

Not every function has a nice smooth derivative everywhere. Absolute value functions, piecewise functions, and functions with roots in the denominator or under a radical often have corners, cusps, or vertical tangent lines where f'(x) doesn’t exist. These points are still critical points if the function itself is defined there, and they can absolutely be local maxima or minima.

For example, f(x) = |x| has no derivative at x = 0 because the graph makes a sharp corner. But f(0) = 0 exists, and the function decreases to the left and increases to the right, making x = 0 a local minimum. You can confirm this with test values in the first derivative test, treating the corner the same way you’d treat a stationary point.

Endpoints on a Closed Interval

If you’re working on a closed interval like [a, b], the endpoints deserve special attention. A function can have its highest or lowest value at an endpoint even though the derivative doesn’t change sign there in the usual way. Endpoints can be local extrema because the function simply stops, so there’s no “other side” to compare.

When your problem asks for extrema on a closed interval, evaluate f at every critical point inside the interval and at both endpoints. The largest value among them is the absolute (global) maximum, and the smallest is the absolute minimum. Local extrema at endpoints depend on whether the function is increasing or decreasing as it approaches the boundary. If f is decreasing as it hits the left endpoint, that endpoint is a local max. If f is increasing into the right endpoint, that endpoint is also a local max.

Choosing Between the Two Tests

Both the first and second derivative tests will give you the same classification at stationary points, so use whichever feels more efficient for the problem at hand. The second derivative test is faster when f”(x) is easy to compute and doesn’t equal zero at your critical points. The first derivative test is more versatile: it handles non-differentiable points, never gives an inconclusive result, and works in every situation. If you’re unsure which to use, the first derivative test is the safer default.

For multivariable functions (functions of x and y), the process extends to partial derivatives. You find points where both partial derivatives equal zero, then use a discriminant D = f_xx · f_yy − (f_xy)² to classify. If D > 0 and f_xx > 0, you have a local min. If D > 0 and f_xx < 0, you have a local max. If D < 0, the point is a saddle point. If D = 0, higher-order analysis is needed.