We need the maximum of x*y if x+y=50.
y=50-x
Substitute in x*y and you get x*(50-x), or 50x-x^2.
Fermat's theorem says that for Maximum and Minimum values to exist, their derivatives must by 0:
d(50x-x^2)/dx=50-2x=0
2x=50
x=25
Since y=50-x, y=25
Since both x and y are the same, the shape is a square.