to find the max or minimum value of any function we need to find its derivatives , first of all you have to find the first derivative after that you put that first derivative equation equal to 0 and find the value of variable , then you take 2nd derivative and put that value in 2nd derivative equation , if you get >0 then its minimum and if it is <0 then you have maximum value