Here is a graph which may help you get insight into the issue of "unconstrained maximization", using calculus.
The function given in the equation below graphs out as the inverted U that is shown. The equation is similar to the kind which would apply for profits. For a profit function, the Y value would be profits and the X value would be quantity produced. The function reaches a maximum then falls. For a firm, as output increases profits will usually rise to a point then fall off as "too much" is produced.
As you probably know, we can find the quantity which maximizes a function (like maximum profits) by taking the first derivative of the function, and setting it equal to zero, then solving for Q (actually, X, here).
The first derivative (here it is f '(x) = -x + 800) gives the "marginal
function" which, furthermore, is the slope of the tangent to the curve.
The slope will be zero for a flat tangent and the flat tangent will identify
the top of the curve (the maximum). So we set the first derivative
equal to zero to find the quantity associated with highest profits.
We find that x=800, where x represents quantity produced.
If we substitute 800 into the function, we get 320,000, which, of course,
agrees with what the graph shows. So the profit is 320,000.
The other tangent drawn to the curve just serves to show that the tangent gives the slope of the curve at that point
.