f'(x) has roots for x=1 and x=3, take -(x-1)*(x-3) for this. It is parabola branches down, i.e. it is positive between 1 and 3 (its roots) and negative outside. Great.

So f'(x) = -(x-1)*(x-3) = -x^2 + 4x - 3 and

f(x) = -(1/3)*x^3 + 2*x^2 - 3x + C (any C, I choose C=0).