Skip to content

Finding Local Optima Explained (With Examples)

Calculus isn’t just about tracking motion; it is the ultimate mathematical tool for finding the best possible outcome. Whenever a business wants to maximize its profit, an engineer wants to minimize the material used to build a bridge, or a computer wants to find the most efficient route through a network, they are solving an optimization problem.

In calculus, we call these highest and lowest points on a graph local optima (which include local maxima and local minima). Because the derivative gives us a perfect formula for the slope of a curve, we can use it to pinpoint exactly where a graph peaks or bottoms out.

Here is exactly how to find local optima using the First Derivative Test, why setting the derivative to zero is the magic trick, and several examples of how to apply it.

How to Find a Local Optimum

Imagine hiking up a perfectly smooth mountain. As you climb, the slope is positive. The moment you cross the absolute peak and start walking down, the slope becomes negative. But what is the slope at the exact, frozen moment you are standing on the very top? It is completely flat. It is zero.

This observation gives us a foolproof algorithm for finding local optima:

  1. Find the derivative of the function, f'(x).
  2. Find the critical points by setting the derivative equal to zero (f'(x) = 0) and solving for x. (You also check where the derivative is undefined).
  3. Use the First Derivative Test to check the slope on either side of the critical point.
  • If the slope changes from positive to negative, you have found a local maximum (a peak).
  • If the slope changes from negative to positive, you have found a local minimum (a valley).
See also  Fundamental limit rules with funny intuition

5 Examples of Finding Local Optima

Let’s look at how to locate peaks and valleys in simple parabolas, complex curves, and functions with sharp corners.

Example 1: The Simple Parabola (Local Minimum)

Let’s find the local optimum of a basic quadratic function:

f(x) = x^2 - 4x + 3
Step 1: Find the derivative using the Power and Sum rules.

f'(x) = 2x - 4
Step 2: Set the derivative to zero to find the critical point.

2x - 4 = 0, i.e., 2x = 4 \implies x = 2
Step 3: Test a number on either side of x = 2 to see how the slope behaves.
Let’s test x = 1: f'(1) = 2(1) - 4 = -2 (Slope is negative; graph is falling).
Let’s test x = 3: f'(3) = 2(3) - 4 = 2 (Slope is positive; graph is rising).

Because the function falls, hits x = 2, and then rises, we have a local minimum at x = 2.

Example 2: The Cubic Curve (Max and Min)

Higher-powered functions often wave up and down, creating multiple optima.

f(x) = x^3 - 3x^2
Step 1: Find the derivative.

f'(x) = 3x^2 - 6x
Step 2: Set it to zero. Factoring makes this easy.

3x(x - 2) = 0

This gives us two critical points: x = 0 and x = 2.

Step 3: Test the intervals around these points (e.g., test -1, 1, and 3).
At x = -1: f'(-1) = 3(-1)^2 - 6(-1) = 9 (Rising).
At x = 1: f'(1) = 3(1)^2 - 6(1) = -3 (Falling).
At x = 3: f'(3) = 3(3)^2 - 6(3) = 9 (Rising).

At x = 0, the slope changes from positive to negative. Local maximum.
At x = 2, the slope changes from negative to positive. Local minimum.

Example 3: The Fake Peak (Inflection Point)

Not every critical point is a local optimum. Sometimes, a function flattens out but then continues going in the same direction.

f(x) = x^3
Find the derivative and set it to zero:

f'(x) = 3x^2 3x^2 = 0 \implies x = 0
Let’s test numbers on either side of our critical point x = 0.
Test x = -1: f'(-1) = 3(-1)^2 = 3 (Rising).
Test x = 1: f'(1) = 3(1)^2 = 3 (Rising).

Because the slope is positive on the left and positive on the right, it never actually dipped into a valley or crowned a peak. It simply leveled off for a fraction of a second before climbing again. This is called a saddle point, and there is no local optimum.

See also  Practical Applications of the Chain Rule in Calculus (With Examples)

Example 4: The Sharp Valley (Undefined Derivative)

Critical points occur where the derivative is zero, or where it is undefined. Let’s look at a function that creates a sharp cusp:

f(x) = x^{2/3}
Find the derivative:

f'(x) = \frac{2}{3}x^{-1/3} = \frac{2}{3\sqrt[3]{x}}
If you try to set this to zero, there is no solution (the numerator is always 2). However, if you plug in x = 0, you get division by zero. Therefore, x = 0 is a critical point because the derivative is undefined there.

Test the intervals:
Test a negative number: f'(-1) = -2/3 (Falling).
Test a positive number: f'(1) = 2/3 (Rising).

Even though the function is not smooth, it falls, hits a sharp point at x = 0, and rises again. There is a local minimum at x = 0.

Example 5: Endless Waves (Trigonometry)

Trigonometric functions like sine and cosine oscillate infinitely, creating endless peaks and valleys. Let’s find the optima of f(x) = \sin(x) on the interval [0, 2\pi].

Find the derivative:

f'(x) = \cos(x)
Set it to zero. Where does cosine equal zero on our interval?

x = \frac{\pi}{2} \text{ and } x = \frac{3\pi}{2}
Test the slopes on either side of these points.
Between 0 and \pi/2 (e.g., \pi/4), cosine is positive.
Between \pi/2 and 3\pi/2 (e.g., \pi), cosine is negative.
Between 3\pi/2 and 2\pi (e.g., 7\pi/4), cosine is positive again.

At x = \pi/2, the slope goes from positive to negative (local maximum).
At x = 3\pi/2, the slope goes from negative to positive (local minimum).

Optimization is the bridge between theoretical calculus and real-world application. Without the ability to find critical points and classify them as maxima or minima, modern machine learning algorithms wouldn’t be able to “learn” (which is essentially just minimizing an error function). Whether you are maximizing the fuel efficiency of a rocket or minimizing the surface area of a soda can to save aluminum, setting the first derivative to zero is the universal key to finding the best possible answer.


Discover more from Science Safari

Subscribe to get the latest posts sent to your email.

Leave a Reply

error: Content is protected !!