The Fence Optimization Problem
Problem
You have 100 m of fence. What rectangle dimensions maximize the enclosed area?
Explanation
You're given a fixed length of fence and asked to enclose the largest possible rectangular area. The intuition might suggest a long thin rectangle gives "more land per fence" — but the math says the opposite: the square is always optimal. This is a classic application of single-variable optimization with a constraint.
The Physics — Just an Optimization
Let be one side of the rectangle and be the other. We have two equations:
- Constraint (fixed perimeter):
- Objective (maximize):
Substitute the constraint into the objective to get as a function of one variable. Then take the derivative, set it to zero, and solve.
Step-by-Step Solution
Given: Total perimeter .
Find: The dimensions that maximize the enclosed area.
Step 1 — Write the constraint and the objective.
Step 2 — Substitute the constraint into the objective.
Now is a function of a single variable , valid for .
Step 3 — Differentiate .
Step 4 — Set and solve.
Step 5 — Find the corresponding .
So the optimal rectangle has — it's a square.
Step 6 — Compute the maximum area.
Step 7 — Confirm it's a maximum (not a minimum) using the second derivative.
Since everywhere, the function is concave down. The critical point at is therefore a global maximum on . ✓
Step 8 — Compare with other shapes to feel the difference.
- A long thin rectangle : (35% smaller!)
- A medium rectangle :
- A square : ← maximum
- A long thin rectangle :
The further from a square you go, the worse you do — and the area falls off symmetrically on either side of (since is a downward parabola).
Answer: The optimal rectangle is a square with side length , giving a maximum area of . Of all rectangles with a fixed perimeter, the square encloses the most area.
Generalization
This result holds for any total perimeter : the optimum is always , with . For , that's . For , it would be , and so on. (And if you allow any shape, not just rectangles, the circle wins overall — but that requires multivariable calculus.)
Try It
- Slide the width widget — watch the rectangle reshape and the area number update.
- The graph below shows — a downward parabola with peak at .
- The HUD lights up "★ MAXIMUM" when you're at .
- Notice the symmetric falloff: , , etc.
Interactive Visualization
Parameters
Got your own math or physics problem?
Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.