find d with respect to w or find w with respect to d then sub it in the equation after that find the derivative and see the extreme max point I think the relation between them can given by

24 is the radius of the base of the cylinder

sub this in the equation of s

find the derivative of s to find the extreme value that will be w then sub it in this equation to find d

I wish that help