Let #P# be the fixed perimeter of a rectangle with length #x# and height #y#, so that #P=2x+2y#. The area is #A=xy#. We can write this as a function of #x# by solving #P=2x+2y# for #y# and substituting: #P=2x+2y\Rightarrow 2y=P-2x\Rightarrow y=P/2-x#
#\Rightarrow A=f(x)=x(P/2-x)=(P/2)x-x^2# (for #0 < x < P/2#).
Don't be bothered by the fact that #P# is in this last equation. It's just a constant.
The derivative is #(dA)/dx=f'(x)=P/2-2x#. This is zero when #x=P/4# and, in fact, changes sign from positive to negative as #x# increases through #x=P/4#. By the First Derivative Test, this implies that #x=P/4# gives a local maximum value of the area #A=f(x)#. In fact, since #f# is quadratic, it's actually a global maximum.
When #x=P/4#, then #y=P/2-P/4=P/4# as well. This implies that the dimensions of the rectangle are all equal and it's actually a square. In other words, for all rectangles of a given perimeter #P#, the square of side length #P/4# has the greatest area.