If you have a function y = f(x), then this function tells you how y changes when you vary x. Now, the operation of differentiation tells you more: the rate at which y changes when you vary x.
To get the expression for the area...
Let y be the length of the garden. The sum of the two sides of the garden is therefore 2y, and so the length of fence at the far end of the garden must be 80-2y. Area = length x width so A = y(80-2y).
So this function tells you how the area of the garden changes as you vary the length of the garden. By inspecting this equation, you can see that if you start with y=0 and increase it by a metre each time, A will go through the following values:
y*(80-y) = A
0*80 = 0
1*78 = 78
2*76 = 152
5*70 = 350
10*60 = 600
20*40 = 800
30*20 = 600
35*10 = 350
40*0 = 0
(if y>40, this produces negative areas which you can ignore)
So you can see that the area first increases and then decreases and y is varied. The maximum value of the area will be when A switches from increasing to decreasing. This is where differentiation comes in.
If the derivative dA/dy is positive, then A is increasing. If dA/dy is negative then A is decreasing. So the point at which it switches from increasing to decreasing is where dA/dy = 0.
So, find dA/dy.
A = 80y - 2y^2 (multiply each term by the power of y then lower the power by one)
dA/dy = 80 - 4y
Set this equal to zero to find the point at which the function changes from increasing to decreasing...
dA/dy = 0
80 - 4y = 0
4y = 80
y = 20
So the value of y at which the area stops increasing and starts decreasing (when the derivative of A with respect to y is zero), is 20.
So we know the maximum area occurs when y = 20.
Maximum area = y(80-2y) when y = 20
A(max) = 20*(80-2*20)
A(max) = 20*(40)
A(max) = 800m^2
Which is the highest value we happened across when doing the trials earlier.