You're hiking a winding trail, and you stop to catch your breath. Are you standing on top of a hill, at the bottom of a valley, or just on a flat stretch that keeps going the same direction either way?
From where you're standing, you honestly can't tell. Your feet only feel level ground. To know whether you're at a peak, a pit, or nothing special, you need more than "it's flat right here."
That's the entire problem this post solves. In calculus, that flat spot is called a critical point. Figuring out whether it's a peak, a valley, or neither is called classifying it.
A critical point is just a flat spot
Picture the graph of a function as a trail, elevation on the vertical axis, position on the horizontal one. Walk it left to right and at every point, the derivative tells you the steepness under your feet. Positive means you're climbing. Negative means you're descending. Zero means the ground is level.
A critical point is any where , or where the derivative doesn't exist at all (a sharp corner, like the bottom of a V). We'll stick to the smooth case here: .
Try the trail below. Drag the dot, or use the slider, and watch the tangent line tilt with it. Somewhere on this trail, that line goes dead level.
Drag the point along the trail, or use the slider. Find the spot where the tangent line goes level.
Keep going until the slope readout hits 0.000. You'll land on one of two spots, right around or . Those are the critical points of this particular trail. Finding them algebraically means solving , exactly what you just did by hand.
But flat doesn't always mean you found a hill or a valley
Here's the trap. Picture a staircase with one step that's unusually wide and flat. You don't climb up, pause, and walk back down. You cross it and keep climbing, same direction as before. For a moment your path was level, and then nothing changed.
That's a critical point too, since the slope did hit zero. But it's neither a peak nor a valley. It's just a flat pass-through. So "the slope is zero" only tells you where to look. It doesn't tell you what you're looking at. For that, you need one of two tests.
The first derivative test: check the slope on both sides
The idea is almost embarrassingly simple once you see it. At a true peak, you were climbing right before it and descending right after. At a true valley, it's the reverse: descending, then climbing. If the slope has the same sign on both sides, you never actually turned around. You just paused.
We write this as a rule: if changes from positive to negative at , then is a local maximum. If it changes from negative to positive, is a local minimum. No sign change, no extremum.
The visualizer below plots the trail on top and its slope, , right underneath. Green means climbing, rose means descending. Slide across and watch the bottom curve cross zero exactly where the top one goes flat.
Slide across the trail. Below, watch f prime of x cross zero exactly where the trail above goes flat.
Notice the two critical points click into a classification only once you've actually crossed them, positive-to-negative for the max, negative-to-positive for the min. That crossing is the whole test.
The second derivative test: feel the curve, not just the slope
There's a second way to classify a critical point, and it doesn't require checking both sides at all. It asks a different question: which way does the trail curve right at that point?
Think of the ground as a cup. If it curves like a bowl, concave up, it would hold water. You're in a valley. If it curves like a dome, concave down, water would spill right off. You're on a peak. The second derivative, , measures exactly this curvature.
Slide along the trail and watch which way the ground curves under your feet. That's the second derivative test.
We write the rule as:
Watch the little cup in the corner flip as you slide past , the inflection point where this trail's curvature switches from dome to bowl.
One catch: if , the test tells you nothing. The curvature could be flipping right at that point, or it could still be a max or min that just happens to have zero curvature there. When that happens, fall back to the first derivative test. It never fails, because it's checking the actual behavior of the slope instead of a single number.
Put it together: hunt down every critical point
Now let's run the whole pipeline on a few different trails, including the flat-trap case from earlier. Pick a shape, hit play, and watch the search unfold: find where , then classify each point as the marker reaches it.
Pick a trail, hit play, and watch the hunt for every flat spot, then see how each one gets classified.
The third trail, "The Flat Trap," is exactly the staircase we described earlier: . Its slope touches zero at but never actually goes negative on either side. The hunter correctly tags it NEITHER, because a slope of zero was never a guarantee of a hill or a valley. It was just a place worth checking.
A worked example, start to finish
Take , the trail from the first two visualizers, and solve it by hand.
Five lines, start to finish. Every critical point problem you'll meet follows this same shape: differentiate, solve for zero, then classify with either test.
The short version
A critical point is anywhere the slope of a function hits zero. You find those points by solving . But being flat doesn't automatically make a spot a peak or a valley, so you classify it one of two ways: check if the slope flips sign around it (first derivative test), or check which way the curve bends right there (second derivative test). A peak curves like a dome, a valley curves like a bowl, and a flat pass-through point is neither. Once you can find and classify critical points, you have the core move behind every optimization problem in calculus: finding the best possible anything always starts by finding where the slope goes flat, which is exactly what we build on in our post on optimization in math.
All visualizations are interactive React components running entirely in your browser. Every curve, slope, and classification is computed live from the actual derivative, not pre-rendered. No libraries beyond React.