Optimization (Math)
posted by Tommy .
The mayor of a village wants to build a library of which the windows have a shape of a rectangle on top of a square. The total perimeter of each window is of P meters and varies depending on each windows size. Find the dimensions of the windows in terms of P, that maximizes the area of all the windows.
Because I can't draw on here, the perimeter I have is
6x + 2y = P
(3x for each of the squares sides, because the rectangle covers the last one, 2y for each of the rectangles sides, and the last 3x are the rectangles length, x being half the length of the rectangle, so 2x on top of the rectangle and 1x at the bottom, because the other x is the junction between the square and the rectangle.)

 
___
For the area, I found:
p = 6x +2y
y = (P6x)/2
so
A(x) = x^2 + 2x((P6x)/2)
now, I know I have to derive A(x)
but what I'm not sure is if the derivative of P will be 0, or do I simply leave P as it is?

sorry for the drawing, apparently it didn't work when I submitted the question!

A(x) looks good.
A(x) = x(P5x) = Px  5x^2
You can take the derivative if you want, getting
A' = P  10x
so, A' = 0 when x = P/10
Or, you can see that the roots of A(x) are 0 and P/5, making the max halfway between, or at x = P/10
y = (P6x)/2 = (PP/10)/2 = 9P/20 
Rats. y = (P6P/10)/2 = 4P/20 = P/5
But then, we knew that, since y=2x 
I understand now, thanks a lot steve!