Let and be supply and demand curves in terms of , where is the quantity.
Then we calculate the producer and consumer surplus by using the following formulas:
(producer surplus) =
(consumer surplus) =
Where and are equilibrium prices and quantity.