Setting the derivative to zero will give all relative maxima and minima for the function
bUT THIS MAY NOT HAVE ANY BEARING ON OUR PROBLEM. These points are both in the interval, but the endpoints could very well be what we are after. to find them
And you can see that the absolute max and min occur at the endpoints of the interval.
The key here is to know what the problem is asking, and then know what you need to use to solve it.