A window has the shape of a rectangle surmounted by an isosceles triangle. Determine the dimensions of the window, if its if its perimeter is to be at most $M$ and its area is to be maximized.
I have tried to solve it this way:
Let $y$ and $z$ be the height and width of the rectangle and let $x$ be the side of the isosceles triangle. The area will be maximum when the perimeter will be maximum. Now we need to maximize $${\text{Area}} = yz + \frac{1}{2}z\sqrt {{x^2} - \frac{1}{4}{z^2}} $$ subject to the constraint $${\text{Perimeter}} = 2x + 2y + z = M$$
We define the Lagrangian $$L = yz + \frac{1}{2}z\sqrt {{x^2} - \frac{1}{4}{z^2}} + \lambda (2x + 2y + z - M)$$ We get the following system $$\left\{ \begin{array}{l} \frac{{xz}}{{\sqrt {4{x^2} - {z^2}} }} + 2\lambda = 0\\ z + 2\lambda = 0\\ \frac{{2{x^2} - {z^2}}}{{2\sqrt {4{x^2} - {z^2}} }} + y + \lambda = 0\\ 2x + 2y + z = M \end{array} \right. \Leftrightarrow \left\{ \begin{array}{l} x = \frac{1}{3}\left( {2\sqrt 3 M - 3M} \right)\\ y = \frac{1}{6}\left( {3 - \sqrt 3 } \right)M\\ z = \left( {2 - \sqrt 3 } \right)M \end{array} \right.$$
Is this the correct result?