Negative externalities of production are "the negative effects that are suffered by a third party when a good or service is produced." Market failure is "the failure of markets to produce at the point where community surplus (consumer surplus + producer surplus) is maximised." This point is where marginal social benefit (MSB) equals marginal social cost (MSC). Pollution-emitting firms create market failure because, when deciding how much to produce, they consider only their own private costs, such as wages, materials and energy. They do not pay for the damage their pollution causes to others, so they produce more than the socially optimal quantity.
Marginal private cost (MPC) is the cost to the firm of producing one more unit. Marginal social cost is "the extra cost to society of producing an additional unit of output, including both the private cost and the external costs." When a factory emits pollution into the air or a river, it imposes external costs on third parties who are not part of the transaction. Residents nearby may suffer from respiratory illnesses and need medical treatment, much of it paid for by public healthcare. Polluted rivers kill fish, harming fishing communities, and dirty air damages crops and buildings. Emissions of greenhouse gases contribute to climate change, which imposes costs on people all over the world and on future generations. None of these costs appears in the firm's accounts, because no one charges the firm for them. The cost of each unit to society is therefore its private cost plus its external cost, so MSC > MPC.
In Figure 1, the supply curve shows firms' private costs, S = MPC, because firms supply each unit as long as the price covers their own cost of producing it. MSC lies above MPC, and the vertical distance between the two curves is the external cost of each unit, the value of the damage caused by its pollution. Since there are no externalities in consumption, demand shows both marginal private and marginal social benefit, D = MPB = MSB. The free market reaches equilibrium where MPB = MPC, at quantity Qm and price Pm. The socially optimal output, however, is Qopt, where MSB = MSC. Because firms do not pay for the pollution they cause, the market price Pm is too low: it does not include the external cost, so consumers buy more of the good than they would if they paid its full cost to society.
For every unit between Qopt and Qm, the benefit to consumers, MSB, is enough to cover the firm's private cost, so the unit is produced. But once the external cost of pollution is included, its cost to society is higher than its benefit: MSC > MSB. Each of these units therefore reduces community surplus, because society gives up more, in the resources used to make it and the damage its pollution causes, than it gains from consuming it. The total loss of community surplus is the shaded triangle between MSC and MSB from Qopt to Qm, the deadweight loss (DWL). Too many resources are allocated to producing the good, and too much pollution is emitted. Part of the cost of production is shifted from the firm and its customers onto third parties, who bear it without being compensated. Because the market produces at Qm rather than where MSB = MSC, community surplus is not maximised, so pollution-emitting firms create market failure.