How to maximize and minimize function

2025/10/25 Edited to