# Math Help - Optimization; cylinder inside sphere

1. ## Optimization; cylinder inside sphere

Find the dimensions(r and h) of the right circular cylinder of greatest Surface Area that can be inscribed in a sphere of radius R.

my work so far

$SA=2\pi r^2+2\pi rh$

$r^2 + (\frac{h}{2})^2 = R^2$

$h=2\sqrt{R^2-r^2}$

$SA=2\pi r^2+4\pi r\sqrt{R^2-r^2}$

$\frac{dSA}{dr}=4\pi r+4\pi (\sqrt{R^2-r^2}+\frac{-2r^2}{2\sqrt{R^2-r^2}})$

I tried setting that equal to zero, but I wasn't coming up with the right answer

The answer in the book(not mine): $r=\sqrt{\frac{5+\sqrt{5}}{10}}R$
$h=2\sqrt{\frac{5-\sqrt{5}}{10}}R$

Can anyone see my error, or did I make one?