How to Maximize Profit with Derivatives
You can use calculus to maximize the total profit equation. Because total revenue and total cost are both expressed as a function of quantity, you determine the profitmaximizing quantity of output by taking the derivative of the total profit equation with respect to quantity, setting the derivative equal to zero, and solving for the quantity.
The market demand curve for the good your monopoly produces is
where q is the market and firm’s quantity demanded, and P is the market price in dollars.
Using the demand equation to derive total revenue as a function of q requires the following steps:

Add 200P to both sides of the demand equation.

Subtract q from both sides of the equation.

Divide both sides of the equation by 200.

To determine total revenue, multiply both sides of the demand equation by q.
This equation tells you how much total revenue equals given any value for quantity, q. Thus, total revenue is a function of q.
If your total cost equation is
total profit, ð, is determined by subtracting total cost from total revenue, or
After you have the total profit equation, the following steps enable you to determine the profitmaximizing quantity and price:

Take the derivative of the total profit equation with respect to quantity.

Set the derivative equal to zero and solve for q.
This is your profitmaximizing quantity of output.

Substitute the profitmaximizing quantity of 2,000 into the demand equation and solve for P.
Or you should set a price of $40 for the good.

Finally, total profit is determined by substituting 2,000 for q in the totalprofit equation.
Your total profit equals $18,000.