First of all, we are sure that the minimal and maximal values exist by Weierstrass theorem, since #f# is a continuous function over #[1,5]#, which is a compact set.
To answer, let's consider the derivative: since #f# is a polynomial, its derivative will be very simple to calculate: we'll need to use the linearity (the derivative of a sum is the sum of the derivatives; and if #k# is a constant, #(kf)'=k*f'#), which means that we can derivate one term at the time. As a general rule, we have #d/{dx} x^n=nx^{n-1}#.
This means that the derivative #f'# equals
#f'(x)=3x^2-12x+9#.
Let's study this derivative to find the minimum and maximum of #f#: #f'# is a parabola, which goes towards #+\infty# if #x\to \pm\infty#. Its zeroes are given by the formula
#x_{1,2}={-b\pm\sqrt{b^2-4ac}}/{2a}#, and are #1# and #3#. This means that the function is increasing before #x=1#, decreasing between #x=1# and #x=3#, and then again increasing after #x=3#. This means that #x=1# is a maximum, while #x=3# is a minimum.
Here's the graph, to let you visualize them: graph{x^3-6x^2+9x+4 [-8.71, 11.29, -0.74, 9.68]}