When markets are efficient, and when they fail

A market is allocatively efficient where marginal social benefit equals marginal social cost, which a competitive market reaches when private and social values agree; market failure is any case where the market's quantity differs from that, leaving deadweight loss.

From AP Microeconomics.