Say you run a small workshop that builds two things: tables and chairs. You've got limited wood, limited varnish, and limited hours in the day. Tables earn more profit per unit, but chairs use fewer resources. So how many of each should you build this week to make the most money?
That's an optimization problem, and it shows up everywhere. Airlines assigning planes to routes. Factories allocating machine time. Delivery companies routing trucks under fuel limits. Cloud providers splitting server capacity across customers. They all boil down to the same shape: maximize something, subject to limits.
There's a remarkably simple algorithm for problems like this, and it's been quietly running the world's logistics since 1947. It's called the simplex method. Let's build it from scratch.
What does "the best answer" even look like?
Let's put numbers on the workshop. A table earns 500. You'd think tables win then, but the constraints tell a different story.
The cutting machine can only prep enough wood for 4 tables a week. The varnish station can only finish 6 chairs a week. And assembly labor, shared between both products, caps out at 18 hours, where each table takes 3 hours and each chair takes 2.
We write this as: maximize (profit in hundreds of dollars), subject to , , , and , since you can't build a negative table.
Here's the geometric part. Every one of those constraints is a straight line, and a straight line splits the plane into two halves: the side that obeys the rule, and the side that breaks it.
Stack all five constraints together and you get the overlap of every "good side" at once, a single shape. That shape is called the feasible region. Every point inside it is a valid weekly plan. Every point outside breaks at least one rule.
Now the real question: which point in that shape earns the most money?
Rotate the profit direction and watch which corner wins. It is always a corner, never the middle.
Drag the angle and watch the winning corner jump around the shape. Notice something? The best point is never floating in the middle. It's always sitting exactly on a corner, no matter which direction "more profit" points.
That's not a coincidence, it's a theorem. Picture a straight ruler sliding across the shape, always pointed toward "more profit." As it slides forward, it touches less and less of the shape... until the very last touch is a single point. And because the shape is made of straight edges, that last point is always where two edges meet: a corner.
We call the corners vertices. And the rule we just found has a name: the optimal solution to a linear program always sits at a vertex of the feasible region.
Prove it to yourself
Don't take our word for it. Drag the dot anywhere inside the shape below, using our original profit rule (), and try to beat the corner at .
Drag the dot anywhere in the region and try to beat the corner. You can only ever match it.
You can get close. You can hug the edge that leads there. But you can't beat it, only match it exactly once you land on the corner. No matter where you start, the best move is always toward a vertex.
Could we just check every corner?
Here's a tempting shortcut. If the best answer always sits at a corner, why not list every corner, compute the profit at each, and pick the winner?
For our workshop, that's easy. Five corners, five calculations, done in seconds.
But real optimization problems don't have two variables and three constraints. Airlines schedule thousands of flights against hundreds of constraints. And the number of corners doesn't grow gently, it explodes.
Add constraints and watch how fast the corner count could explode in higher dimensions.
Slide the constraint count up and watch the corner tally on the right, computed as if this same shape lived in a six-variable world instead of two. Brute-force corner-checking works fine on paper. It falls apart the moment a real business problem walks in the door.
Simplex: hop, don't search
So here's the trick Dantzig found in 1947. You don't need to check every corner. You only need to visit the ones worth visiting.
Start at any corner. Look at each edge leading away from it. If an edge leads uphill, more profit, walk along it to the next corner. If every edge leads downhill, you've found the best one. Stop.
That's the whole algorithm. No searching the interior, no checking every vertex. Just corner, edge, corner, edge, until you're stuck at the top.
Watch simplex hop from corner to corner, always uphill, until no edge improves things.
Hit play and watch it run on our workshop problem. Three hops, from all the way to the optimal plan at : 2 tables and 6 chairs a week, for $3,600 in profit.
Why doesn't it get stuck on a false peak?
If you've ever done hill-climbing on a bumpy landscape, you know the danger. You can get trapped on a small hill, convinced you've found the top, while a bigger hill sits right next door.
Linear programming doesn't have that problem, and here's why: the feasible region is convex. Every straight line between two points inside it stays inside it. No dips, no bumps, no false summits, just one smooth shape with flat faces.
That means every uphill step really is progress toward the global best, never a trap. It's why simplex, unlike most optimization methods, can guarantee it found the actual best answer, not just a decent one.
Why this still matters
Dantzig built the simplex method to solve military logistics in the 1940s. Today it, and its modern descendants like interior-point methods, runs quietly behind airline crew scheduling, factory production planning, truck routing under fuel and time limits, and cloud servers splitting capacity across customers.
Every one of those is the same shape as our little workshop problem, just with thousands of variables and constraints instead of two. The corners are still where the answers hide. Simplex just knows how to find them fast.
The short version
A linear program asks you to maximize or minimize something under straight-line limits. Those limits carve out a shape called the feasible region, and the best answer always sits at one of its corners, never in the middle. Checking every corner works for small problems but explodes for big ones. The simplex method skips that by hopping from corner to corner, always uphill, stopping the moment no edge improves things. And because the shape is convex, that stopping point is guaranteed to be the true best answer.
All visualizations are interactive React components running entirely in your browser, using plain SVG and no chart libraries. The corner-hopping path in the simplex walker is precomputed from the same profit-maximizing workshop example used throughout the post.