Maximum values can only occur at the endpoints or critical points. Try all these values and see which is biggest.