Applicationof first derivative of a function