A window has the shape of a rectangle of height $h$ surmounted by a semi-circle of radius $r$. The area of the window is given by $A = 2rh + \frac{1}{2}\pi r^{2}$
NOT drawn to scale.
If the perimeter of the window is constant, prove that the area is a maximum when $h$ and $r$ are equal.
My attempt:
Let $P$ be the perimeter of the window. i.e: $P = 2h +2r+ \pi r$ $$h = \frac{(P-2r-\pi r)}{2}$$ I substituted my $h$ value into the area equation given.
$$A = 2r(\frac{P-2r-\pi r}{2}) + \frac{1}{2} \pi r^{2}$$ $$ A = Pr -2r^{2} - \frac{1}{2} \pi r^{2}$$
The maximum value of $A$ given is when $A' = 0$
i.e: $P-4r-\pi r = 0$ $$ r = \frac{P}{\pi +4} $$ $$ h = \frac{P}{\pi + 4} $$ By the second derivative test, $A'' = -4 - \pi < o$, So I have proved that the area is maximum when $r$ and $h$ are equal.
Is this solution correct? I have a feeling that I did not finish it off correctly. I Would appreciate it if someone can elaborate on my solution.