The area of the field is:
A = (x + 20)y
The length of fence needed is:
x + y + x + 20
(remember that 20 ft are not needed because the building, and y ft are not needed because the river)
We have 1000 ft of fencing, then:
1000 = x + y + x + 20
1000 - 20 = 2x + y
980 = 2x + y
Isolating y from the preceding equation:
y = 980 - 2x
Substituting this into the area equation:
A = (x + 20)(980 - 2x)
Distributing:
At the maximum, the derivative of A with respect to x is zero, then:
Recalling the equation of y and substituting this result:
y = 980 - 2x
y = 980 - 2*235
y = 510
The dimensions are:
length: 255 ft (on the side without the building)
width: 510 ft