A local minimum is the bottom of a valley: a point lower than everything immediately around it, though not necessarily the lowest point anywhere. The idea works the same whether the graph is a curve drawn on axes or a network of dots joined by lines, because in both cases “around it” just means a point’s neighbours. Spotting one valley is easy. Knowing it is the deepest valley is a different and often far harder problem.
What Counts as a Neighbour and Why It Decides Everything
A point is a local minimum if every neighbour has a value that is higher or equal to it.1PubMed Central. Random versus Deterministic Descent in RNA Energy Landscape Analysis Ties count, so a point sitting level with a neighbour can still qualify. The lowest point overall is called the global minimum, and every global minimum is also a local one. The reverse fails, though: a graph can have many local minima and only one lowest value.
Take a curve with two dips, one shallow and one deep. Both dip bottoms are local minima, but only the deeper dip is the global minimum.
What “neighbour” means depends on the kind of graph. On a curve drawn on axes, neighbours are the points just to the left and right. On a network, they are the points joined directly to a point by a line. In a list of data values, they are usually the entries just before and after. So the same point can be a local minimum under one definition of neighbour and not under another.
Some coding tasks widen the neighbourhood, for example two entries on each side of a list value, and a wider neighbourhood makes it harder for a point to qualify. Before hunting for minima, write down in one sentence who counts as a neighbour for your data, so every comparison uses the same rule.
How to Find a Local Minimum on a Curve or in Data
On a smooth curve, a local minimum sits where the slope is zero and changes from going down to going up. In calculus you set the derivative (the formula for slope) equal to zero and check which of those points are dips. A zero slope can also mark a peak or a brief flat spot, so the check on both sides matters.
Here is a worked case. Take y = x² − 4x. Its slope formula is 2x − 4, and setting that to zero gives x = 2 as the only candidate. Just left of 2 the slope is negative, and just right of 2 it is positive, so the curve falls and then rises: x = 2 is a dip. Putting x = 2 back into the original formula gives the height of the minimum, which is −4. A second check: test whether the curve bends upward at the zero-slope point. Upward bending means a dip, downward bending means a peak, and if there is no bending the test is inconclusive, so fall back on checking the slope on both sides.
If you only have a plotted curve, scan it from left to right and look for places where it stops falling and begins to rise. The bottom of each such turn is a candidate. It is a local minimum only if you can see the curve higher on both sides nearby, so a curve that simply keeps falling past a point has none there. Zoom in on a dip that looks flat at the bottom to tell a true turn from a stretch that only seems level.
For a short list of numbers, do the comparison by hand. Go through the list one value at a time and mark a value if it is lower than or equal to the values on both sides. Decide in advance how to treat the first and last values, since each has only one neighbour. Expect several marks in bumpy data.
Software does the same scan for you. In MATLAB, the islocalmin function marks local minima in data, available from release R2017b.2MathWorks MATLAB Answers. how to find local minima of a graph like shown in the figure? Another approach flips the data upside down and uses the findpeaks function, since the dips become peaks.2MathWorks MATLAB Answers. how to find local minima of a graph like shown in the figure?
Real measurements wobble, which creates tiny dips everywhere, and a plain scan will flag every one. Settings such as “MinPeakProminence” filter out tiny dips that are just noise.2MathWorks MATLAB Answers. how to find local minima of a graph like shown in the figure? Prominence is how far a dip stands below its surroundings. Smoothing the data first reduces false minima in the same way.
How to Find a Local Minimum on a Network Graph
Pick any point and look at its neighbours. If any neighbour is lower, move to it, ideally the lowest one. Repeat until no neighbour is lower, and you are standing on a local minimum. Each move strictly lowers the value, so in a finite network the walk cannot go on forever.
Which lower neighbour to move to is up to you. Taking the steepest drop each time is the usual choice. Taking any lower neighbour also works and can be faster per step. Different choices can land you in different minima, and none of them guarantees the lowest point overall.
Flat regions complicate the stop rule. A connected group of points that all share the same value forms a flat stretch.3Proceedings of the International Conference on Pattern Recognition Applications and Methods. A Step Towards Learning Contraction Kernels for Irregular Image Pyramid It counts as a minimum only if you cannot reach a lower point from it without first climbing.4Parallel Computing. Practical aspects Parallel watershed transformation algorithms for image segmentation So on a flat stretch you must check the edges of the whole group, not just one point, to know if it is a true minimum.
A plain “move if lower” rule stops at the first tie, because moving to an equal neighbour lowers nothing, and it may report a point that is not a true bottom. To handle it, collect the whole group of equal-valued connected points and look at every neighbour of the group. If any point outside the group is lower, step to it and continue the walk. If none is, the whole flat stretch is the minimum.
You can also skip the walk and test each point against all its neighbours. This finds every local minimum, not just one. It takes longer on huge networks but is simple to code, and it handles flat stretches well if you group equal neighbours first.
Why Downhill Searches Get Stuck and How Hard Finding One Can Be
A downhill walk has no way to see that a deeper valley lies over the next ridge. It only compares a point with its immediate neighbours. That is why its answer depends on where it starts, and why two runs from different starting points can finish at different heights and both be correct local minima.
Computer scientists group problems of finding a local minimum into a class where checking whether a point is a local minimum is quick.5Wikipedia. PLS (complexity) Finding such a point is a separate task from confirming one: checking looks only at a candidate’s neighbours, while finding may require a long chain of moves.
Some simple problems, such as splitting a network into two equal halves where no single swap of two points improves it, are among the hardest of this class.6SIAM Journal on Computing. Simple Local Search Problems that are Hard to Solve For one such network-splitting problem, the number of downhill steps can grow exponentially in the worst case, whatever rule picks the next step.7Computational Mathematics and Mathematical Physics. Genetic local search the graph partitioning problem under cardinality constraints This is a worst case, not what usually happens. When every connection has equal weight, the same downhill search finishes quickly.7Computational Mathematics and Mathematical Physics. Genetic local search the graph partitioning problem under cardinality constraints
Ways to Escape a Local Minimum and Reach a Lower One
The simplest fix is random restarts. Run the downhill walk from many random starting points and keep the lowest result found. More restarts raise the chance of hitting the deepest valley, and the runs are easy to do in parallel. If the lowest result shows up many times, that is encouraging, but it does not prove it is the lowest overall.
Another route is to accept uphill moves on purpose. Simulated annealing hunts for the lowest point by imitating a solid cooling slowly into its most stable state.8Statistical Science. Simulated Annealing Early on it sometimes accepts uphill moves, letting it climb out of shallow valleys, and it grows stricter as it “cools.” At each step it proposes a nearby move, and a move that lowers the value is always taken. A move that raises the value is taken only with some probability, which is higher when the rise is small and when the search is still “hot.” As the temperature falls, that probability shrinks toward zero, and the search behaves more and more like plain downhill walking.
Cooling speed is a trade-off. Cooling quickly makes the search settle fast but raises the chance it freezes in a shallow valley. Cooling slowly gives it more chances to escape early traps but costs more time. Try a fast schedule first, then slow it down if repeated runs end at clearly different heights. Quantum annealing goes further, using a quantum effect called tunnelling to pass through ridges between valleys, and it is being tested on route-planning problems.9arXiv. Quantum Annealing and Graph Neural Networks for Solving TSP with QUBO
The landscape itself shapes your chances. The basin of a minimum is the set of starting points whose downhill walk ends there. In one widely studied type of problem, deeper valleys tended to have larger basins.10arXiv. Local Optima Networks: A New Model of Combinatorial Fitness Landscapes Random restarts there often land in better valleys more than chance would suggest. Still, almost all points lay on basin edges, with less than 1% deep inside, so neighbouring basins are closely linked.10arXiv. Local Optima Networks: A New Model of Combinatorial Fitness Landscapes Sometimes a local minimum is good enough, since many real tasks only need a low value, not the lowest.
Where Local Minima Show Up in Real Maps and Images
A digital elevation map is a grid of heights, and a cell lower than all of its surrounding cells is a pit. Water running downhill reaches such a cell and has nowhere lower to go, so a flow model sees it as stuck.11Computers and Geosciences. Priority-Flood: An Optimal Depression-Filling and Watershed-Labeling Algorithm for Digital Elevation Models
Small pits often come from measurement noise, and filling them lets water-flow models run correctly. Real lakes and sinkholes are true minima worth keeping. One filling method floods the map inward from its edges, so every cell is guaranteed to drain.11Computers and Geosciences. Priority-Flood: An Optimal Depression-Filling and Watershed-Labeling Algorithm for Digital Elevation Models Each pit is filled up to the lowest point where it could spill out, though some real dips get filled in too. Another approach lowers a simulated water level within each depression to map pits nested inside larger pits, running about 150 times faster than an older contour method.12PubMed Central. Efficient Delineation of Nested Depression Hierarchy in Digital Elevation Models for Hydrological Analysis Using Level-Set Methods
Images use the same trick. Image tools split pictures into regions by treating brightness as height and flooding from each regional minimum, so each dip grows into one region.4Parallel Computing. Practical aspects Parallel watershed transformation algorithms for image segmentation

