Hello! Welcome to the fourth lesson in our module on Calculus for Optimization.
In our last lesson, we ventured into multivariable calculus, learning how to compute partial derivatives and the gradient. We discovered that the gradient vector, , points in the direction where a function increases the fastest. This is a powerful piece of information for optimization.
Before we use the gradient to optimize complex functions in machine learning, we're going to solidify our understanding of optimization in a simpler, one-dimensional setting. Today, we'll focus on finding the "peaks" and "valleys" of single-variable functions. This is a fundamental skill in calculus and will provide you with the core intuition needed for the more advanced optimization techniques you'll encounter in your GATE preparation.
Our learning outcome for this lesson is to find local maxima and minima of single-variable functions using derivative tests.
1. What are Maxima and Minima?
When we look at the graph of a function, we can often visually identify its highest and lowest points. In calculus, we give these points specific names:
- A local maximum is a point that is higher than all of its immediate neighbors. Think of it as the peak of a small hill.
- A local minimum is a point that is lower than all of its immediate neighbors. Think of it as the bottom of a small valley.
- A global (or absolute) maximum/minimum is the absolute highest or lowest point across the function's entire domain or a specified interval.
A function can have multiple local maxima and minima, but only one global maximum and one global minimum within a given interval.
To get a clear visual understanding of these concepts, let's watch a short video segment.
Maxima & Minima | GATE 2023 Engineering Mathematics | Free Online GATE Concept Class
This video from BYJU'S Exam Prep, designed for GATE preparation, provides an excellent graphical explanation of the difference between local and global maxima and minima.
Watch from 05:49 to 10:32. Pay close attention to how a single graph can contain several local 'peaks' and 'valleys', but only one overall highest and lowest point.
2. Finding Potential Maxima and Minima: Stationary Points
How can we find these peaks and valleys without looking at a graph? The key lies in the derivative.
Think about standing at the very top of a hill (a maximum) or the very bottom of a valley (a minimum). At that exact point, the ground is flat. The slope is zero. In calculus terms, this means the first derivative of the function is zero.
Points where the first derivative, , is equal to zero are called stationary points or critical points. These are our candidates for being local maxima or minima.
The procedure is:
- Given a function .
- Find its first derivative, .
- Set the derivative to zero: .
- Solve this equation for . The solutions are your stationary points.
Let's watch a quick example of finding these stationary points.
Differentiation (Maxima and Minima)
This video from '1st Class Maths' demonstrates the straightforward process of finding the coordinates of stationary points for a polynomial function.
Watch from 00:58 to 03:23. Notice how the process involves differentiating the function, setting the result to zero, and solving the resulting equation for the x-coordinates.
Once we have a stationary point, we need to determine if it's a maximum, a minimum, or something else. We have two main tools for this: the First Derivative Test and the Second Derivative Test.
3. The First Derivative Test
The first derivative doesn't just tell us where the slope is zero; its sign tells us if the function is increasing or decreasing.
- If , the function is increasing.
- If , the function is decreasing.
We can use this to classify our stationary points. Imagine moving along the x-axis and passing through a stationary point c:
- If the function was increasing () and then becomes decreasing (), you must have gone over a peak. So,
cis a local maximum. - If the function was decreasing () and then becomes increasing (), you must have passed through a valley. So,
cis a local minimum.

The following video segment explains this test and introduces a very useful technique called the "wavy curve method" for applying it, which is particularly handy for the polynomial functions you'll often see in the GATE exam.
Maxima & Minima | GATE 2023 Engineering Mathematics | Free Online GATE Concept Class
Let's return to the BYJU'S video. This part explains how to use the sign of the first derivative to classify stationary points and demonstrates a powerful method for doing so.
Watch from 17:10 to 24:55 to understand the theory behind the first derivative test. Then, watch from 31:11 to 43:28 to see a complete example worked out using the wavy curve method. This method helps you quickly determine the sign of the derivative in different intervals.
4. The Second Derivative Test: A More Direct Approach
Checking the sign of the first derivative on both sides of a point can sometimes be tedious. The Second Derivative Test is often a faster way to classify stationary points.
The second derivative, , tells us about the function's concavity.
- If , the function is concave up (shaped like a cup, U).
- If , the function is concave down (shaped like a frown, ∩).

Now, let's connect this to our stationary points. If we are at a stationary point (where ):
- If the function is concave down (), the point must be a local maximum.
- If the function is concave up (), the point must be a local minimum.
The Second Derivative Test Procedure:
- Find the stationary points by solving .
- Find the second derivative, .
- For each stationary point , evaluate .
- If , then is a local maximum.
- If , then is a local minimum.
- If , the test is inconclusive. You must use the First Derivative Test instead.
The case where might indicate a point of inflection, where the concavity changes but there is no maximum or minimum (e.g., the point for the function ).
To understand the logic behind the second derivative test, watch this short, clear explanation.
Differentiation (Maxima and Minima)
The '1st Class Maths' video provides a brilliant conceptual explanation for why the sign of the second derivative determines if a point is a maximum or a minimum by considering the 'rate of change of the gradient'.
Watch from 03:59 to 06:09. Focus on the intuition of how the gradient (slope) itself is changing as you pass through a maximum versus a minimum.
Test your understanding!
Let's find and classify the stationary points of the function .
- Find the first derivative, .
- Find the stationary points by solving .
- Find the second derivative, .
- Use the second derivative test to classify each stationary point.
Show answer
- Set .
The stationary points are and . - Test the points:
- At : . Since , the point is a local maximum.
- At : . Since , the point is a local minimum.
5. Finding Absolute Maxima and Minima in a Closed Interval
A very common type of problem in GATE and other exams is to find the absolute maximum and minimum values of a function on a closed interval, like .
The absolute extremum can occur either at one of the local extrema inside the interval or at the endpoints of the interval ( or ).
Procedure to find absolute extrema on :
- Find all stationary points of that lie within the interval .
- Make a list of candidate points: the stationary points from step 1, and the two endpoints and .
- Evaluate the function at every candidate point in your list.
- The largest value you find is the absolute maximum, and the smallest is the absolute minimum.
This method is foolproof. You don't even need the second derivative test here; you just compare the function values at the end.
Maxima and Minima for GATE Exam 2024
The article 'Maxima and Minima for GATE Exam 2024' from AlmaBetter outlines this exact procedure. Reading through it will solidify your understanding of how to tackle these common optimization problems.
Read the section titled 'Optimization Involving a Single Variable'. Pay close attention to the step-by-step procedure and the example of profit maximization, noting how they find critical points and also check the endpoints of the feasible domain.
Conclusion
Great job today! You've mastered a crucial piece of calculus that forms the bedrock of optimization theory.
Key Takeaways:
- Stationary points, where , are the candidates for local maxima or minima.
- The First Derivative Test checks the sign of around a stationary point to classify it (positive to negative = max; negative to positive = min).
- The Second Derivative Test uses the sign of at a stationary point for a more direct classification ( = max; = min).
- To find the absolute maximum/minimum on a closed interval , you must check the value of at both the internal stationary points and the endpoints and .
Preview of the Next Lesson:
Now that we are experts at finding the minimum of a one-dimensional function, we are ready to return to the multivariable world. In the next lesson, we will learn about gradient descent. This is the core algorithm used to train most machine learning models. It uses the gradient we learned about last lesson to iteratively "walk" down the surface of a high-dimensional cost function, taking steps in the direction of steepest descent to find a minimum, just as we did today using derivative tests.