Find the maximum and minimum value of function f (x) = - x ^ 2 + 2ax-1 on [0,2]

Find the maximum and minimum value of function f (x) = - x ^ 2 + 2ax-1 on [0,2]

f(x)=-(x-a)^2+a^2-1
When A2, Fmax = f (2) = 4a-5, Fmax = f (0) = - 1
When 0