Peaks, Pits, and Passes: Exploring Maxima, Minima, and Saddle Points with SageMath
- Get link
- X
- Other Apps
๐ง♀️ Peaks, Pits, and Passes: Finding Maxima, Minima, and Saddle Points with SageMath

๐ Imagine This:
You’re hiking in the mountains. You reach the summit—no direction leads higher. That’s a maximum. Later, you descend into a valley where every direction goes uphill. That’s a minimum. Then you reach a mountain pass—a saddle point. You're high in one direction, but low in another. It’s a critical junction where the landscape twists.
In calculus, we use this intuition to analyze surfaces and optimize real-world systems—from minimizing energy usage in drones to maximizing profits in economics.
๐งญ Definitions First: Peaks, Pits, and Saddles
Let’s ground ourselves with some terminology:
- Local Maximum: A point where all nearby points have lower function values.
- Local Minimum: A point where all nearby points have higher function values.
- Saddle Point: A point where the function is neither a max nor min, but the gradient still vanishes.
๐ Connect to Visuals: Think of a landscape.
A peak curves down in all directions. A valley curves up. A saddle curves up in one direction and down in another. We’ll see this twist shortly!
๐งช Visualizing a Saddle in SageMath
Let’s bring this twisty terrain to life:

๐ช Imagine This: Picture a horse’s saddle—upward curve where you sit, downward along the horse’s spine. That’s what this surface resembles.
Your Turn:
Try Changing:the coefficients:
How does the shape stretch or compress?
๐งฎ Finding Critical Points
So how do we locate these peaks, pits, and passes?
We start by identifying critical points—where the gradient vanishes:
๐ง Imagine This: A ball resting on a hilltop or in a valley has no reason to roll—it’s flat! That’s what a gradient of zero looks like.
๐ง Second Derivative Test: Classifying the Landscape
Once we find flat spots, we ask: What kind of spot is it?
We use the Hessian matrix and its determinant
D = fxx fyy- (fxy)2
๐ช Think of Curvature: The determinant tells us about the overall "shape" of the curvature at the critical point.
Your Turn:
- D>0,fxx>0 : Local Minimum(Bowl-shaped)
- D>0,fxx< 0 : Local maximum (dome-shaped)
- D<0 : Saddle point (twisting curvature)
- x2,-y2 ,x , xy Can you design a surface with:
- A single local max
- Two local mins
- One saddle?
๐ Full Example: Let’s Analyze a Surface
๐ Visual Clue: Let’s plot it!

Point | fxx | fyy | D | Type |
---|---|---|---|---|
(0,0) | -6 | 6 | -36 | Saddle |
๐งญ Interpretation: The determinant tells us this is a saddle—the curvature bends in opposing directions.
๐ Real-World Applications
๐ง Engineering Design:
Maximize strength, minimize material usage. Peaks = stress points, pits = stability zones.
๐ค Machine Learning:
Minimize the loss function to optimize model predictions.
๐ก Drone Navigation:
Maximize camera coverage while minimizing power use.
๐ฐ Economics:
Maximize profit or minimize cost by analyzing cost/revenue surfaces.
๐งฌ Biology:
Predict population behavior by studying equilibrium points in dynamic models.
⚛️ Physics:
Particles settle into minima of potential energy—nature’s own optimization.
๐ง Reflect & Explore
๐ฏ Challenge: Try plotting this function:
Where are the saddle points? How would you classify them?
๐ Your Turn: Create your own landscape using polynomial functions. Try combining terms like:
๐ What's Next?
In our next post, we’ll explore how these ideas evolve in three dimensions—enter gradient descent, contour maps, and optimization with constraints. Get ready to solve real-world challenges using the power of calculus and SageMath!
Stay curious—and keep climbing!
!-- Script (placed once in head or before ) -->