Optimization: Differentiability and Extrema