← All MathIsland labs
maxOptimization Lab

Queen Dido, who enclosed the most land she could with a single oxhide.

You have 20m of fence for a rectangular field — which shape encloses the most?

The best point hides where the slope is zero — optimization.

Experiment

Hands-on experiment

Predict first — you build a rectangular field with 20m of fence. Which shape encloses the most?

Change the width

Choose width w and the height (10−w) follows automatically. The perimeter stays 20m.

width w2

16

area · 2 × 8

0510
Read more — why it exists · insights · common mistakes · formulasExpand ▾

Why

Why does this exist?

Maximum profit, minimum cost, shortest time, least material — most questions in life and industry are 'find the best point'. You can't try everything; a systematic method was needed.

The key is a property of summits: at the top, no direction goes uphill — the slope is zero. So inspect only the points where the derivative vanishes, and you have all the candidates.

That idea promoted the derivative from 'rate calculator' to 'optimum detector'. Logistics routes, wing design, AI training (minimizing loss) — modern optimization is this principle, extended.

Insight

Insights from the video

At the summit, no direction is uphill.

This obvious-sounding observation is the cornerstone of optimization theory. The moment 'find the peak' becomes 'solve slope = 0', search becomes computation.

Nature already solves optimization.

Soap bubbles minimize surface area into spheres; light refracts along the fastest path (Fermat's principle); honeycomb hexagons minimize material — optimization is nature's language.

Misconception

Common misconceptions

Slope zero always means a maximum.

It could be a minimum, or a momentary flat (saddle). Zero slope only nominates candidates — for a maximum, the slope must flip from + to − around the point.

To enclose more, make one side as long as possible.

With a fixed perimeter, lengthening one side shortens the other — a trade-off. 9×1=9 is less than half of 5×5=25. In most real problems the optimum is a balance point, not an extreme.

Formula

Writing it as math

What the fence experiment revealed, in mathematical language.

The fence problem's function

Choose width w and the height 10−w follows. Area becomes a function of w — step one of optimization is writing the goal as a function.

The optimality condition

At a summit (or valley floor) the tangent is horizontal — slope zero. A'(w) = 10−2w = 0 gives w = 5: the square wins.

Certifying a maximum

Uphill turning into downhill marks a maximum. The sign change is what distinguishes maxima, minima, and saddles.

In Real Life

Where you meet it in real life

Pricing

Raise the price and per-unit profit grows but sales shrink. Finding the peak of revenue = price × quantity — airline and hotel dynamic pricing is exactly this computation.

Logistics and routing

Delivery routes, warehouse placement — write the cost function, find its minimum. Optimization algorithms design hundreds of millions of deliveries daily.

Training AI

Training a model IS finding the minimum of a loss function. With millions of dimensions, equations can't be solved directly — you walk down the slope instead: gradient descent.

Nature's optimizations

Soap bubbles (minimal surface), refraction (minimal time), honeycombs (minimal material) — many laws of nature read 'minimize something'.

Try Yourself

Test yourself

Q1What's the largest rectangle you can enclose with 40m of fence?Show answer ▾

Width + height = 20, so A(w) = w(20−w); A'(w) = 20−2w = 0 gives w = 10 — a 10×10 square, 100m². For a fixed perimeter, the answer is always the square.

Q2f(x) = x² has slope zero at x=0. Maximum or minimum?Show answer ▾

The slope flips from − to + (downhill → uphill) — a minimum. Zero slope only nominates; the sign change decides.

Q3At $5 you sell 50 units, and each $1 increase loses 5 sales. What price maximizes revenue?Show answer ▾

R(p) = p × (50 − 5(p−5)) = p(75−5p); R' = 75−10p = 0 → p = 7.5 — $7.50 is optimal. Higher isn't better; there's a balance point.

Try answering yourself before revealing it — getting it wrong is where learning starts.

Connection

Concepts connect

Previous concept

d/dx

Derivatives

You must know how to measure slope before hunting for 'slope zero'.

← Derivatives lab

Leads to next

Gradient Descent

With millions of variables, no human solves f'=0 — walking downhill one step at a time is AI's answer.

Go to the Gradient Descent lab →

Related

Labs worth exploring together

Related lab

d/dx

Derivatives

The slope-measuring tool — optimization is the derivative's biggest job.

Go to the Derivatives lab →

Related lab

Quadratic Functions

The fence problem's curve is a parabola — its vertex is the optimum.

Go to the Quadratic Functions lab →