Hi Sona,
This is a tough problem that actually requires calculus to solve.
Assuming you don't know calculus, then you need to know that the shape of the maximum area of a rectangle is a square. Another way of saying that, is the width of the shape that produces the maximum area of a rectangle is equal to one fourth of the perimeter.
The problem says that one of the lengths is the side of the barn so no fencing is required on that side. Therefore you will have two widths and one length of fencing that add up to 200 feet.
One fourth of the perimeter = 50
The other width also equals 50. So the length of fencing = 200 - 50 - 50 = 100
So the area = 50 x 100 = 5000 square feet.
To convince yourself that this is the correct answer, you can add or subtract one foot from the width and come up with the appropriate length and multiply them and you'll find you get an area that is slightly less than 5000.