Let x and y be the sides of the rectangular corral. Therefore,
Area, A = x*y = xy
Additionally, let the side bordering the barn be x. Then,
Circumference, C = x+y+y = x+2y = 4000 ft => x = 4000 - 2y
Substituting for x in the area equation,
A = (4000-2y)y = 4000y - 2y^2
For maximum area, dA/dy = 0
Then,
dA/dy = 4000 - 4y = 0 => 4000 = 4y => y = 4000/4 = 1000 ft
And x = 4000 - 2y = 4000 - 2*1000 = 4000 - 2000 = 2000 ft
The dimensions of the corral are: 2000 ft by 1000 ft.
Area, A = xy = 2000*1000 = 2000,000 ft^2