Where the slope is zero
A smooth function can only peak or bottom out where it stops rising and falling, so the first move in any optimization is to set the derivative to zero. Points where are critical points. The derivative tells you they are flat; a second step tells you what kind of flat.
Suppose a desk can sell units at price , and producing them costs . Profit is
Then , which is zero at , and .
The first derivative test checks the sign of on either side: positive for , negative for , so profit climbs and then falls. That is a maximum. The second derivative test is faster: , so the curve bends down and the flat spot is a peak. In general at a critical point means a local minimum and means a local maximum.
When the test says nothing. Both and have , yet has a minimum at 0 while keeps rising through it. A point where changes sign, as does at 0, is an inflection point.
Two more checks catch most interview slips. A local extremum need not be the global one, and on a closed interval the endpoints are candidates too. The global answer is the best value among the critical points and the endpoints.