So you should get for the first derivative and for the second derivative. Setting the first derivative equal to zero and solving for x yields

.

We only care about the positive solution since we can't order a negative number of units. The positive solution corresponds to a local minimum, since when x is positive, the second derivative is just the product of a bunch of positive quantities (Q and s can't be negative given what they represent, and has the same sign as x) and is therefore positive. The negative solution doesn't make sense, but even if it did, it corresponds to a local maximum since the second derivative is negative if x is negative.

Quite often you can write the derivatives as the product of a bunch of quantities. If this is the case, determining the sign of the derivative is simply a matter of determining how many of those quantities are negative.

If you wanted to check all this, I'd make up values for Q, s, and r and plot the cost function. If, for example, you let , you'd expect to see a local min at and a local max at .