I’m on vacation this week and taking it easy, so I thought I would do a post that appealed both to gardeners and math afficionados. Here’s the problem we’re going to solve:
Suppose you buy 100 feet of wire fencing. What’s the largest rectangular area garden you can enclose with it? Forget for the moment that you might want to leave an opening for a gate.
This is the sort of problem that you might get in differential calculus in that you are trying to find the maximum of some function, namely, the area of the garden. We’re going to do it more geometrically however.
Let’s start with what we know:
If we call the width of the garden w and the length l, then the perimeter, or the distance around the garden, is 2 * w + 2 * l and this must equal 100. That is, if you add up the length of the front, back, and two sides of the garden and represent it in feet, then it should be the amount of fence we bought. So we have the equation:
2w + 2l = 100
The area of the garden is the length times the width. So if we call this A, we know that
A = lw
We can represent the first equation in terms of w:
2w + 2l = 100
2l = 100 – 2w
l = (100 – 2w)/2 = 50 – w
So we can now represent the A just in terms of w:
A = lw
A = (50 – w)w = 50w – w2
There are a couple of extreme cases we can see from this equation. If the width is zero, or w = 0, we don’t really have a rectanglar garden, we simply have the 100 feet of fence running in a straight line away from us. The area of this is 0.
Similarly, if the width is 50 then the length is 0, and we again have a straight length of fence extending left to right for 100 feet. The area is 0 again.
We’re not allowing the length or width to be negative, so we now know that our answer for optimizing the area will have each of the length and width somewhere between 0 and 50, but not including those values.
Let’s try a few numbers to get a feel for what is going on.
If w = 1, then l = 49 and the area is 49. The lengths are in feet and the area is in square feet.
If w = 5, then l = 45 and the area is 225.
If w = 10, then l = 40 and the area is 400.
If w = 20, then l = 30 and the area is 600.
So far the area is increasing as w gets bigger. However,
if w = 30, then l = 20 and the area is 600 again. Moreover,
if w = 40, then l = 10 and the area is 400 again, which is smaller than 600.
So for a while when w was increasing, the area increased, but then it appeared to top off and start getting smaller again. This happened somewhere between the width being 20 and its being 30. Incidentally,
if w = 25, then l = 25 and the area is 625.
If you try values of w that are slightly smaller or larger than 25, the area will be less than 625 square feet.
You can see what is happening in the graph to the right, courtesy of webgraphing.com. The area as a function of the width is a parabola. It reaches its maximum height when the width (and therefore also the length) is 25 feet.
So to answer our question, you should create a square garden with the width and the length being 25 feet. You will then get a garden with area 625 square feet.
Note that w and l are interchangeable and there is nothing special about either one in the sense that we know that one is bigger or smaller than the other. So we have some symmetry to this problem and it should not be a surprise that the rectangle turned out to be a square.
To solve this using calculus, take the derivate of A = 50w – w2 with respect to w to get 50 – 2*w. Set this equal to 0 and solve for w to get w = 25, the same as we observed above. You should check that this gives us a maximum value for the area and not a minimum, but otherwise you are done.
What about that gate? Well, you could make your life easier and just make your 25 by 25 garden and have, say, a 3 foot opening for the gate. If you really wanted to maximize the area and use every bit of fencing, just assume that the perimeter is 103 feet instead of 100. That is, you use the 100 feet of fence and allow 3 extra feet for the gate. You still want a rectangular garden, so now you have 2w + 2l = 103, and you maximize the area. That’s left as an exercise for the reader.
Note that I stipulated a rectangular garden. Could we get more area if we had a perfectly circular one? Using our first perimeter value of 100, note that is equal to the circumference. Given a radius r, the circumference of a circle is 2 * π * r where π is approximately 3.1415926. The area of the circle is π * r2. So solving the circumference equation for r we get
100 = 2 * π * r
or
50 / π = r
The area is then
A = π * r2 = π * (50/π)*2 = 2500/π
So the approximate area for our circular garden is 795.8 square feet, which is quite a bit larger than the rectangular maximum of 625.




