A market is perfectly competitive, with firms acting as price takers, when (1) buyers and sellers face no transactions costs, (2) products are homogeneous, and (3) there are many suppliers, each accounting for a small fraction of the overall supply of the good.
For many small firms to produce efficiently in a market, the efficient scale of production must be small compared to the overall size of the market, the total amount produced and consumed.
Market demand and market supply
The market demand for a product is the sum of the demands of all the individual consumers (or firms, in a factor market). The market demand curve is the horizontal sum of all the individual demand curves.
The market supply for a product is the sum of the supplies of all the individual sellers. The market supply curve is the horizontal sum of all the individual supply curves.
In the short run, the market supply curve includes the supply of all active firms; in the long run it includes the supply of all potential firms.
In the long run, many markets are characterized by free entry, because in the long run technology is freely available to anyone who wishes to start a firm and entry is unrestricted. When this is so, the long-run market supply curve is a horizontal line at the lowest average cost, ACmin.
Short-run and long-run competitive equilibrium
The equilibrium price equates demand and supply.
In a long-run competitive equilibrium with free entry: (1) the equilibrium price must equal ACmin; (2) firms must earn zero profit; and (3) each active firm must produce at its efficient scale of production.
The short-run effect of a change in demand or costs is determined using the short-run market supply curve
(which includes the supply of all active firms), while in the long run it is determined using the long-run market supply curve (which includes the supply of all potential firms).
When there is free entry in the long run, changes in demand have no effect on the price of the good in the long run, assuming input prices are fixed.
When a change in the demand for a good affects the price of an input, the good's price can change in the long run even when there is free entry.
Efficiency of perfectly competitive markets
The aggregate surplus from the production and consumption of a good equals consumers' total willingness to pay for the goods they consume less firms' total avoidable cost of producing those goods. It captures the net benefit created by the production and consumption of the good.
If an economic outcome maximizes aggregate surplus, then any alternative outcome that makes some members of society better off must make someone else worse off.
A perfectly competitive equilibrium results in the largest possible level of aggregate surplus.
There are three different ways to change consumption or production starting from a perfectly competitive equilibrium: (1) change who consumes the good; (2) change who produces the good; and (3) change the quantity of the good that is produced and consumed. Any of these changes will lower aggregate surplus.
Measuring surplus using market demand and supply curves
Whenever the units of a good are consumed by those individuals with the highest willingness to pay for them, we can measure consumers' total willingness to pay for the units they consume by the area under the market demand curve up to that quantity.
Whenever the units of a good are produced by the firms with the lowest avoidable cost of producing them, we can measure firms' total avoidable cost for the units they produce by the area under the market supply curve up to that quantity.
Under these conditions, we can use market demand and supply curves to measure aggregate surplus.Aggregate surplus equals the area between these curves up to the quantity produced and consumed. (If the quantity is above the efficient quantity, we subtract the area between the curves above the efficient quantity, where the willingness to pay is less than the avoidable cost of production.)
We can use the market demand curve to measure the (aggregate) consumer surplus from a good, which equals the total willingness to pay less total expenditure.
We can use the market supply curve to measure the (aggregate) producer surplus, which equals total revenue less firms' total avoidable costs of production.
Aggregate surplus equals the sum of consumer surplus and producer surplus.