Let R be the radius of the cylinder;
H be its height.
/|\ |\
| | \
| | \
|h |___\
| /|\| R |\
| H | | | \
\|/ \|/|___|__\
<------>
r
From similar triangles:
r R
- = ------- [1]
h h - H
The volume of the cylinder is
V = pi/3 * R^2 * H [2]
Use [1] to relate the two variables R and H
and maximise [2] by differentiating and
setting to zero, noting that r and h are constants.