On an open interval, the local maxima/minima of a differentiable function f will occur where f's derivative is 0. The only other places to check a closed interval for global maxima/minima (which means the largest/smallest value of f anywhere on that interval) be the endpoints of the interval.
So I would solve f'(x) = 0 on 0 <= x <= pi (might want to use the chain rule for the sin^2(x) part), then check whether the resulting solutions are maxima/minima. This can be done either using the second derivative test: if f''(x) is positive, then you have a local minimum; negative, you have a local maximum. Then find the largest/smallest of all these, and check at the endpoints to see if you get larger/smaller values.