Question 965885
{{{drawing(400,220,-18,18,-17.9,1.9,
red(rectangle(-15.8,0,15.8,-15.8)),
line(-18,0,18,0),locate(-9,1.4,building),
locate(-1,0,L-2x),locate(15.9,-7.5,x),
locate(-1,-15.8,L-2x),locate(-16.5,-7.5,x)
)}}} {{{L}}}= total length of fence (in yards), {{{A}}}= area in square yards,
{{{x}}}= length of each side of the fence directly attached to the building
 
If you are studying Calculus, you would want to use functions and derivatives to find the maximum of Area as a function of one of the measurements.

If you are not studying calculus, or learning how to use a graphing calculator, you need an easier solution:
The more common version of this type of problem, asks for the maximum area for a given total length of fence.
The general answer is that the best enclosure is always a double square,
meaning that the rectangular enclosure looks like two squares attached to the wall:
{{{drawing(400,220,-18,18,-17.9,1.9,
green(rectangle(-15.8,0,0,-15.8)),
green(rectangle(0,0,15.8,-15.8)),
line(-18,0,18,0),locate(-9,1.4,building),
locate(-10,0,x),locate(15.9,-7.5,x),
locate(9,0,x),locate(-16.5,-7.5,x),
locate(9,-15.8,x),locate(0,-7.5,x),locate(-10,-15.8,x)
)}}}
In other words, half of the length of the fence is the long side parallel to the building wall, 
the other half is used for the two sections of fence that connect that long side to the wall.
To prove that, you would write that {{{A=x(L-2x)}}}-->{{{A=-2x^2+Lx}}} ,
and realize that {{{A}}} is a quadratic function that graphs as a parabola,
and has a vertex/maximum for
{{{x=-L/(2(-2))}}}--->{{{x=L/4}}}-->{{{system(L=4x,L-2x=2x)}}}
That gives you the most efficient way to fence three sides of an enclosure,
yielding the maximum area for a given total length of fence:
{{{A[max]=(L-2x)(x)=(2x)(x)=2x^2=2(L/4)^2=L^2/8}}} or {{{A<=L^2/8}}} .
Obviously, {{{A[max]}}} increases with {{{L}}} (because {{{L>0}}} , of course).
So, if they just use {{{40}}} yards of fencing material, {{{L=40}}} ,
the largest rectangular are you can enclose is {{{200}}} square yards:
{{{A[max]=40^2/8=1600/8=200}}} .
They will need more fencing material.
If the parents use  {{{60}}} yards of fencing material, {{{L=60}}} ,
the largest rectangular are you can enclose is {{{450}}} square yards:
{{{A[max]=60^2/8=3600/8=450}}} .
They will need more fencing material.
What total length of fencing material will they need?
{{{A<=L^2/8}}} ---> {{{8A<=L^2}}} ---> {{{sqrt(8A)<=L}}}<--->{{{L>=2sqrt(2A)}}} .
For an area of {{{A=450}}} square yards, they will need at least
{{{L=2sqrt(2*500)=2sqrt(1000)=about 63.25}}} yards of fencing material,
and the dimensions of the enclosure will be
{{{x=L/4=2sqrt(1000)/4=sqrt(1000)/2=about}}}{{{highlight(15.81)}}} yards,
and {{{L-2x=2x=2(sqrt(1000)/2)=sqrt(1000)=about}}}{{{highlight(31.62)}}} yards.
 
IF YOU ARE STUDYING CALCULUS:
You would write {{{A}}} as a function of some measure,
and calculate the derivative.
For example, if we were to use as a variable {{{x}}}, the length of the parallel fence sides,
the length of the other side would be {{{500/x}}} ,
and the total length of fencing needed would be
{{{y=2x+500/x}}}
The derivative of that functions is
{{{dy/dx=2-500/x^2}}}<-->{{{dy/dx=(2x^2-500)/x^2}}} .
That derivative is zero when {{{2x^2-500=0}}} , for {{{system(x=sqrt(250),"'or",x=-sqrt(250))}}}
The derivative is negative (and the function decreases) for {{{-sqrt(250)<x<sqrt(250)}}} .
For {{{x>sqrt(250)}}} the derivative is positive and the function increases,
so the function has a maximum for {{{x=sqrt(250)}}} , which is about {{{15.81}}} .
That is the lengths of two of the sides of the fence.
The length of the other side of the fence is
{{{500/x=500/sqrt(250)=2sqrt(250)}}} , which is about {{{31.62}}} .