# Maximum area of a fenced playpen on the side of a house.

Here's an interesting problem: you just got a really cute puppy, and you want it to have a large rectangular playpen to run around in. What's more, your neighbor just happened to have 100 feet of extra fencing, and decided to give it to you. You want one side of the playpen to be your house, and the other three sides must be surrounded by the fence. With only the 100 feet of fencing you got from your neighbor, what are the dimensions of the playpen?

This problem can be solved using simple algebra. Pretend that the width of the playpen is perpendicular to the house, and the length is parallel. Give variables to each: $x$ for the width, and $y$ for the length.

You have the two equations $2x+y=100$ and $x\cdot y=A$ where $A$ is the area of the pen. Solving for $y$ in the first equation, you get $y=100-2x$. Substituting $y$ into the second equation gives you $(100-2x)\cdot x=A$

To find the maximum value, we can first find the two x-intercepts: $(0,0)$ and $(50,0)$. The average of the x-values gives you the x-value of the vertex, which is $25$. Plugging this into the first equation, you get $y=50$.

So there you have it. The width of the playpen is 25, and the length is 50 for a maximum area of $25\cdot 50=1250$. But this wasn't my real question.

The situation above was of a rectangular playpen, but I'm wondering whether it's possible to find the maximum area of a playpen of any shape, but still with 100 feet of fencing. The side of the playpen that is formed by the wall must be at least 5 feet wide, in order to allow for movement between the house and the playpen (for both the owner and the puppy).

If you have a suggestion or partial answer, please feel free to post it as an answer. If you have a full answer, that's even better, but I'm just looking for pointers.

• I am not sure where the $5$ is supposed to be. If I forget about that, the best shape is a semicircle. And mostly they don't stay cute. Jun 1, 2015 at 6:35
• This is a variant on a coursework problem I did about 20 years ago (with just a fence of length $L$ in free space). If you break a regular polygon into $N$ wedges each wedge has an area given by $\frac{L^2}{4N^2 \tan(\pi/N)}$. The area enclosed tends to that of a circle of circumference L as the number of (straight) side increases. (A pointer to fit with answers you already have) Jun 1, 2015 at 11:12

If you reflect your fence over the wall (do this mentally, since you don't want the fence inside your house), and add that reflected fence to the original, you get a new area that is twice the original and is bounded purely by fencing.

A well-known result in the calculus of variations is that the maximum area enclosed by a given perimeter is realized by a circle. Therefore the maximum area on just one side of the wall is a semicircle.

So find the radius of the circle with perimeter $200$ (double the actual fence), find the area of the semicircle with that radius, and you are done, at least if the diameter of that semicircle is over $5$ (which it is).

• Similarly, if you know that the rectangle with the lowest perimeter-to-area ratio is the square, then you can also use this technique to solve the original problem, no algebra required. Jun 1, 2015 at 7:27
• What if the diameter of the semi-circle is larger than the length of the house? Jun 1, 2015 at 9:13
• great question Jared. and, are you allowed to make a circle, just touching the house? Jun 1, 2015 at 11:05
• @Jared Then the solution will be a circle's arc for which the wall is a chord. Jun 1, 2015 at 12:54

I am working on a similar optimisation problem

We know that the area of a rectangle is Area=length * width $A=xy$ and that the perimeter = 2*length + 2* width or $P=2x+2y$ since one of the lenghts is the wall of the house we have $P=x+2y=100$

Since there is a relation we rearrange $y=\frac{100-x}{2}$ and substitute this in $A$ thus we have $A=x\frac{100-x}{2}=50x-x^2$

We can asume that $A$ will have a maximum value at $\frac{dA}{dx}=0$

$\frac{dA}{dx}=-2x+50$ setting this to $0$ and solving for $x$ we find that $x=25$ since we substituted for $y$ we reverse the substitution and find the maximum area is $25*50=1250$ with length 50 and width 25.

Thus for any shape if you can find $A'(x)$ and set it to $0$ you should be able to find the optimised dimensions, it might be alot more difficult depending on the complexity $A(x)$