Market equilibrium
[This essay is intended for students in my law and economics and my microeconomics class (for law students). Read this essay one time through, ignoring the queries that are interspersed. Go back to the queries after you feel you have understood the essay. The queries test whether you have understood enough to develop a richer understanding of the topic of the essay (market equilibrium). These instructions will also apply to future essays.
I have bolded certain words. These are terms that you should know going forward. If you do not understand them, ask your favorite foundational AI model about them.
I will post the python notebook that generates all the figures in this essay in case you are interested in reproducing them.]
Markets are an important tool to distribute a limited amount of a good amongst potential consumers of that good. For any given type of product or service, e.g., cars or dishes or legal services, that is in limited supply in the short run, markets “allocate” that supply to the users who value the product or service the most. This basic insight is why economists are obsessed with markets, and politicians and regulators are preoccupied with market failures.
While one can imagine a wide range of objectives one can have when distributing a scarce resource (e.g., being part of a social in-group, being part of a social out-group, having low income or consumption, being older, being local, etc.), one appealing objective is prioritizing those who actually value the good the most. The way markets measure value is the amount one is willing to pay to obtain a good. Although payment is typically in money, the money represents other consumption—because other goods are also allocated via markets. So value is actually measured in how much other consumption one is willing to sacrifice to obtain the relevant product or service. In sum, the market for a particular good allocates that good to those willing to sacrifice the most other consumption for that good.
Query: Imagine a world in which everyone waits in line for each good. Because the time in a day is limited, that means waiting in line for one good means not waiting in line for another good. So the cost of obtaining one good is not obtaining some other good. Compare this method of allocation–queuing–to allocation via monetary prices. Hint: Think about labor markets. Alternatively, think about the time of the seller. Or, think about consumption that takes time.
Prices
Prices are the mechanism that markets use to assign a good to the consumers who value it the most. They also ensure that the producers who supply a good are those that are able to do so at the least cost to consumers. If a carton of eggs costs $5, anyone who values the eggs more than $5 will buy the eggs; anyone who values them less than $5 will not buy the eggs. Likewise, any farm that can produce eggs for less than $5 will be able to supply eggs to consumers, and farms that cannot will not. This logic begins to give us intuition for why prices are a useful tool to separate out those who value a good more or produce a good for less. Before we discuss how markets set the price of eggs at $5, let’s talk a bit more about what prices are and do.
While we all take prices for granted, they are—honestly—somewhat magical. First, they are very efficient at conveying information. The price of a good is a number, denominated in some currency, that tells consumers whether they ought to buy a good, and producers whether they should supply a good. Just 1 number. It doesn't matter whether I am going to use eggs to make breakfast, and you are going to use eggs to make a cake. If the price is $5, either of us will only buy if the value of the eggs in breakfast or the eggs in cake is worth more than $5 to us. Likewise, it doesn't matter if a producer is located in the US or in Mexico, or whether it uses factory farming to mass produce eggs or is a small family farm. It will not supply eggs (including shipping costs) unless its costs per carton are less than $5. Once we have prices, we don’t need anything more to allocate goods.1
Second, a market sets a price without centralized control, without help from a divine entity or an alien race, even without ChatGPT or Claude! And it does so in a manner that ensures the price conveys how much the lowest cost producers can supply the good at, and how much the highest valued users are willing to pay for the good.
Finally, the price that a market sets has the valuable feature that it ensures there is no surplus of unsold goods, or consumers that demand the good but cannot obtain it. I.e., the market sets a price such that the total amount of a good that is demanded at the market price will equal the total amount that is supplied.
Equilibrium
To understand how a price achieves all these goals, let’s imagine ourselves in a market with multiple possible producers of eggs and multiple possible buyers of eggs. To make our analysis more concrete, suppose that farms can supply 1 carton of eggs per week at a cost of $1, 2 cartons at a cost of $2, and so on. Conversely, 9 consumers are willing to buy a carton of eggs per week at $1, 8 at $2, 7 at $3, and so on. (Assume each consumer buys just 1 carton per week.)2 I illustrate these demand and supply curves in the figure below.
As we shall see shortly, our argument will not depend on these particular numbers, so don’t get caught up contesting these specific numbers. All you need to appreciate is that these numbers paint particular supply and demand curves. I chose these numbers to make our math in the example easy: at any price, the sum of supply and demand is 10.
To see how a market sets a price, arbitrarily pick a price, say 3. (See the figure below.). At this price, producers will supply 3 cartons of eggs per week. But consumers will want 7. (See, the sum is 10!) But this means that there is excess demand: consumers want more eggs than producers supply. What if one farm increases price to 4? Some consumer will buy at that price because 6 people would purchase at a price of 4, more cartons than the other producers supply at 3. Other producers will realize that and match the first producer’s price of 4. But there will still be excess demand, because producers will supply 4 at a price of 4, but consumers want 6 at that price. But if the same process of changing price raises price to 5, producers can supply exactly the same amount consumers want: 5. So that price equates supply with demand—-no excess demand! What if we increase price to 6? Now farms want to supply 6, but consumers only want 4. We have the opposite problem as before: excess supply. So, the farm that risks raising its price from 5 to 6 will lose sales to other farms. Ultimately, whether you start with a price below or above 5, the price will adjust until it equates supply and demand, which happens at a price of 5.
Another way to reach the same conclusion is to focus on quantities rather than price. (See the figure below.) Start again at a price of 3. At that price, producers can afford to supply 3 cartons. But consumers are willing to pay 7 to get 3 cartons, meaning consumers are willing to pay more (7) than it costs (3) farms to supply 3 cartons. Surely there are more deals to be had! What if farms supply 4 cartons? Consumers are willing to pay 6 for 4 cartons, but it costs farms only 4 to produce them. Again, the gap in willingness to pay and cost to supply means there are more deals to be made. What if the quantity were 5? Now consumers would pay 5, exactly what it costs farms to produce eggs. There are no more deals to be had. This is an equilibrium. To reassure yourself, consider what happens if we wanted to increase quantity to 6. Then consumers are willing to pay 4, but supply costs producers 6. Producers lose 2 per trade. So they would not produce more than 5 cartons.
Ultimately, whether you reason using price increments or quantity increments, whether you start above the market clearing price of 5 or below it, you get to a price where supply equals demand and, equivalently, consumers’ willingness to pay for the last unit supplied is equal to the cost of production foe the last unit supplied. And this would be true whether we used the numbers in our example or some other demand and supply curve. All that is required is that demand slopes down, supply slopes up, and the two curves intersect at some positive quantity and price.
Query. Draw yourself supply and demand curves that use different numbers or are abstract (i.e., the y and x axes have no specific numbers) and walk through the logic of the each of the last 2 paragraphs to convince yourself that the market equilibrium is where the supply and demand curves intersect.
To fully appreciate the value of prices, it helps to compare them to alternatives. These include queuing in line, allocating to people in a social in-group, or prioritizing by attribute such as age or poverty.
If individuals are free to re-sell goods, however, goods will still be allocated by price. Why? Individuals who initially receive the good via a non-price allocation will re-sell to anyone with a higher willingness to pay for the good than them. The reason is that the re-seller gets more value from selling than by keeping the good, exactly what willingness to pay measures. In our egg example, if you get a carton of eggs and value it at 3, but I value it at 6, you will re-sell to me because you make $3 more. This process will continue until there is no one who does not possess the good but values it more than someone who has the good. At that point, there are no trades to be made. Whatever method—other than price—you use to initially allocate the good, secondary trades will ensure those who value a good the most possess it. The people who initially received the good when using a non-price allocation simply become the new sellers in a price allocation scheme.
The central difference between a system that allocates goods by price versus one that does not is who benefits from production. Suppose 3 cartons of eggs are made and a carton that cost 3 to make is initially given at cost to someone values it at 5 (e.g., because they were the first in line). That initial purchaser immediately makes a profit or surplus of 2 (5 - 3). At price 3, the demand curve tells us that the highest value consumers would pay at least 7. So the person who got it at 5—rather than the producer—-would be able to resell the carton for 7, obtaining an additional surplus of 2. To summarize, the initial consumer gets a surplus of 4 and the producer gets a profit of 0.
If we raise the price that the producer can sell to the initial consumer to be above 3, but less than the market price of 7 (with just 3 cartons supplied), the producer gets a bit more of the surplus, but less than the full gap between the value of the ultimate consumer and the cost of production (4). For producers who can produce eggs for less than 3, they would get some profits even if they had to sell at 3, but again not the full difference between the market price and their cost. More generally, with non-price allocation, the producer and initial consumer of a good split the difference between the market price and the cost of production. With price allocation, that difference goes entirely to the producer.
This lesson highlights the first problem with non-price allocations: there are insufficient incentives for production. We know that if farmers produce 5 cartons of eggs, the fifth carton costs exactly what the fifth consumer is willing to pay, i.e., it was a good trade for both parties. If eggs were allocated by the market, this trade would happen. But if instead it allocated by an alternative method that gave it to someone who valued it at less than 5, say 4, that person would get a profit of 1 dollar to a consumer who valued it at 5. Importantly, the producer would only get 4, even though its marginal cost is 5. Knowing this could happen, the potential producer of that fifth carton would simply not produce that carton. And a consumer who was willing to pay 5, and a producer who could supply eggs at 5, would not be able to trade. A deal that benefits each party would not occur.3
One might object: what if initial consumers could not resell goods to other consumers? The answer is that you would still have inadequate production. The thing that stopped the potential producer of the fifth carton from making it is not the fact that the initial consumer that obtained it valued the carton less than market price and made a profit from reselling, but that the producer did not receive 5 for that carton even though the marginal cost of that 5th carton was 5. In general, not allowing reselling of goods puts producers at least as much disadvantage as allowing reselling, with the result that not enough goods are produced.4
Query: Ask your favorite LLM what shadow prices are and how they differ from numeric prices. Also ask if they affect the efficiency of markets.
Query: Our numeric example used money for trade. What if people instead bartered for goods? Can bartering clear markets (i.e., equate supply and demand) if there are no transactions costs from bartering? Why do people prefer to transact with money?
Query: Why don’t we just have the government allocate eggs? It would tell farmers what to produce, and which consumers to give eggs to. If you can’t figure out the answer, or even if you can, ask your LLM about the socialist calculation problem. Follow-up by asking why Friedrich Hayek won the Nobel Prize in economics.
Query: Ask your LLM if there are algorithms that allocate goods as efficiently as markets.
To be fair, a price is one number, but for a specific time, duration and quality. A market’s price may change over time, e.g., the price of gas on December 1, 2024 may be different than on January 1, 2025. Moreover, because consumption is typically for a duration, like 1 gallon in a day, rather than 1 gallon over 1 month, the price also reflects that duration. I say 1 gallon in 1 day means if I buy a gallon of gas on December 1, 2024, I have to claim it on that day. I cannot buy a gallon on December 1 and pick it up on December 30. Finally, the price is particular to a specific good, delineated broadly by “quality”. E.g., there may be one price for 89 octane gas and another for 93 octane gas. Quality also includes location, so the price of gas in Chicago may be different than the price in Los Angeles.
I have taken the liberty of saying that it costs farms 3 to supply 3 cartons, 4 to supply 4 cartons, and so on. But because this is a supply curve, to be more precise I should say it costs 3 to supply the third carton, 4 to supply the 4th, and so on, because the supply curve traces out the marginal cost of producers as a group.
In addition, when I say consumers are willing to pay 7 for 3 cartons, and so on, I am conflating a demand curve where consumers are compensated for their expenditures on a good (i.e., they are given $7 back if they have to pay $7 for a good) with a demand curve when consumers are not compensated in this manner. In the former curve, a consumer’s budget and thus demand curves for other goods are unaffected by the expenditure. In the latter they are. Only the first demand curve, called a Hicksian demand curve, captures willingness to pay. The second, Marshallian demand curve underestimates willingness to pay.
If you make a full microeconomics course, you will learn these distinctions. But since our purpose is to introduce you to the basic intuition for markets, those details are unnecessary.
Technically, the producer of the fifth carton and the consumer of that carton, each gain nothing from the trade because they’re willingness to pay is equal to their cost. However, if we imagine that fractional cartons were allowed to be sold (i.e., individual eggs), then we could make the same statement about the 49th egg and both the producer and consumer would lose profits.
I say at least because, with re-selling you could have a valid objection that maybe the initial consumer of the 49th egg would make a deal with the producer of that egg (not just the final consumer of that egg) to produce it even though the marginal cost was greater than 4. But even this side deal would not get you every possible deal that would benefit producers and final consumer of eggs because each trade has a transaction cost, in general, any reselling involves more transactions and thus transactions costs.