#### Online math problems > Derivative > Basic examples > Solved exercises > Advanced math level > Solution 1.4

Maths, derivatives and optimization exercises - maximize the profit : how to convert an optimization math problem (profit maximization) into a system of n equations with n variables. You must maximize the Price function. To do so, find the x-value that makes the first derivative zero and second derivative negative (in order to select an x-value situated on a maximum, which means on the summit of the parabola).

### Derivative : solution exercise 1.4 (Advanced math level)

1.4 Optimization : Harvest your rice at the right time to maximize your profit

As you know, export rice price is on the rise : export rice prices have doubled between february 2007 and february 2008 to reach near historical levels with 40 eurocents/kg. Thus creating serious food problems in the many poor regions of the world. If a farmer harvests his rice today, he will get 1200 kg of rice for a market price of 40 eurocents/kg. However, if the farmer decides to wait to sell his rice, his harvest will gain 100 kg per week, wich is great! But the rice market price is falling and for each week he is waiting, the price is reduced by 2 eurocents/kg. When should our farmer harvest his rice to maximise his profit (maximum profit)?

The following table summarizes the situation: If the farmer waits 4 weeks to harvest his rice, he can earn a maximum profit, which means 51200 cents (or 512 Euros). But if he waits 5 weeks, he will earn only 51000 cents (or 510 Euros). Conclusion, over 4 weeks, the farmer's gain will be less and less from one week to the next one. Let us try to explain all this with a very nice system of equations :

Q(x) = Total harvest quantity (kg)

x = number of weeks waiting

Q(x) = 1200 kg + x . 100 kg/week

P1kg(x) = Price per kg

P1kg(x) = 40 cents - 2 cents . x

Ptotal(x) = Total harvest price

Ptotal(x) = Q(x) . P1kg(x)

= (1200 + 100x) . (40 - 2x)

= -200x2 + 1600x + 48000

We must now find the number of weeks the farmer has to wait before harvesting in order to maximize the function Ptotal(x). In other words, we must find the x-value that simultaneously makes the first derivative zero and the second derivative negative.

Reminder:

 How to find the x and y coordinates of an extrema ? Take the first derivative of the function set equal to zero and solve for x. In fact the x-value that makes the first derivative = zero is the x-coordinate of an extrema (minimum or maximum). If the second derivative of a function is positive, then the function is concave up, which means that the curve is curving upwards, like a smile (remember: when you are up, you smile). Hence a minimum implies a positive second derivative. While a negative second derivative implies a concave down curve, which means that the curve is curving downwards like a frowning face (remember: when you are down, you frown). Hence a maximum implies a negative second derivative. We are looking for the x-value that allows to have simultaneously ( Ptotal(x) ) ' = 0 and ( Ptotal(x) ) ' ' < 0. ( Ptotal(x) ) ' = (-200x2 + 1600x + 48000) ' = -400x + 1600 = 0

400x = 1600

x = 1600/400 = 4 weeks.

In our case we do not have to compute the second derivative because the function
Ptotal(x) = -200x2 + 1600x + 48000 is a quadratic equation (or second degree equation), thus it is a parabola. Moreover the factor of x2 is negative (its value is -200), which means that the parabola is concave down. Hence the extremum of that parabola is a maximum.

Conclusion: solving the equations system, we have confirmed what we had found with the table at the beginning of this page, the farmer must wait 4 weeks before harvesting and saling his rice in order to maximize his gain.