Help with a simple trigonometry problem 
A decorative garden is to have the shape of a circular sector of
  radius $r$ and central angle $\theta$. If the perimeter is fxed in advance,
  what value of $\theta$ will maximize the area of the garden?

I've given it a go, but I don't think I really understand the problem. Here's my try: the area of a sector is $A=\frac{1}{2}r^2 θ$. The perimeter being fixed means that we can treat $r$ as a constant. We need to find the value of $\theta\in[0,2\pi]$ that maximizes $A$, but since $A$ is really just a line with a positive slope, that value is $2\pi$. Needless to say that isn't the right answer according to the solution manual. So, what am I doing wrong? Thanks. 
 A: Let $P$ be the perimeter and $S$ be an area of the garden.
Thus, $2r+\theta r=P$, which gives $r=\frac{P}{2+\theta}$ and by AM-GM we obtain:
$$S=\frac{1}{2}r^2\theta=\frac{P^2}{2}\cdot\frac{\theta}{4+4\theta+\theta^2}=\frac{P^2}{2}\cdot\frac{1}{\frac{4}{\theta}+\theta+4}\leq$$
$$\leq\frac{P^2}{2}\cdot\frac{1}{2\sqrt{\frac{4}{\theta}\cdot\theta}+4}=\frac{P^2}{16}.$$
The equality occurs for $\theta=2$.
A: *

*Compute the perimeter $P$: $P=2r+\theta r =r(2+ \theta)$

*Solve for r and replace r in the formula for the area: $A=\frac{1}{2} \theta (\frac{P}{2+\theta})^2$

*Find the $\theta$ which maximize the area: $\frac{d A}{d \theta}=0$. $\theta_{max}=2$.


If you are working with angles measured in degrees, instead of in radians, then you'll need to include a conversion factor.
A: For sector shaped area $A$ radius $r$
Lagrangian $A- \lambda  p $
$$ A= \frac12 r^2 \theta,\quad p = 2r + r \theta $$
$$ \dfrac{A_r}{A_\theta}=\dfrac{p_r}{p_\theta}$$
$$ \dfrac{r \theta}{r^2/2}=\dfrac{2+\theta}{r}$$
$$ \rightarrow \theta =2, A=r^2, p=4r$$
and
$$ p^2 = 16 A $$
