## Supply and Demand

Until recently, I thought I understood the concept of supply and demand functions pretty well: for each possible price of a good, we look at how much of the good consumers would collectively purchase if it was offered at that price, and how much of it producers would sell if offered that price for it. Sounds simple enough.

### Ambiguity

Problem is, the amount of something that a consumer will buy or that a producer will sell depends on more factors than just its price. So in order to determine how much of a good would be demanded or supplied in a counterfactual where its price changes, we also need to know about these other factors. You might want to let everything else stay the same, but this cannot be done. Changing the price of a good must come with some other changes as well. For instance, if the good has a substitute, then the price and quantity of the substitute cannot both stay the same when the price of the good changes.

So for supply and demand functions to be well-defined, we need a counterfactual model, which tells us what exactly is happening in the counterfactual where we set the price of a good and ask how much is demanded or supplied.

Given multiple goods (for simplicity, two goods, $x$ and $y$), we could consider joint supply and demand functions for them, which take as input a pair consisting of the price of the first good and the price of the second, and outputs a pair consisting of the quantities of each good supplied (for the supply function) or demanded (for the demand function) given those prices. So if $p_x$ and $p_y$ are the prices of $x$ and $y$, respectively, then $D(p_x,p_y)_x$ and $D(p_x,p_y)_y$ are the quantities demanded of $x$ and $y$, respectively, and $S(p_x,p_y)_x$ and $S(p_x,p_y)_y$ are the quantities supplied of $x$ and $y$, respectively. Given joint supply and demand functions, how should we extract supply and demand functions for each good individually? That is, how do we determine the demand function $D_x(p_x)$ and supply function $S_x(p_x)$ for the good $x$? To answer this question, we need to know what we mean by supply and demand functions, and answering this question provides similar information about what we mean by supply and demand functions as providing a counterfactual model does.

I'm going to make a couple simplifying assumptions for this discussion, not because they are true, but because they are convenient. First, producers and consumers are two entirely separate groups of people. Consumers don't get the money they spend on consumption by producing something, and producers don't spend the money they get for production on consuming anything else. Consumers just magically have money, and producers just hoard money so they can swim in it like Scrooge McDuck. Second, a system of equations has exactly one solution whenever I want it to.

Wikipedia suggests that in the counterfactuals considered for demand functions, prices of substitutes and complements should stay the same. This gives an answer to the question of how to extract individual demand functions from a joint demand function. Let $p_y^*$ be the equilibrium price of $y$ (i.e. the price such that there is some $p_x^*$ such that $D(p_x^*,p_y^*)=S(p_x^*,p_y^*)$). Then $D_x(p_x)=D(p_x,p_y^*)_x$. A counterfactual model to go along with this is that all producers disappear, and then a monopoly enters the market and offers to the consumers an unlimited supply of the same goods for the same prices that were being offered previously, except for the price of the good in question, which they change. The analogous assumption to make for supply functions is that the prices of other goods that the producers could be making instead (and any goods that can be most efficiently produced along with the good in question) stay the same. Then individual supply curves can be obtained from joint supply curves by $S_x(p_x)=S(p_x,p_y^*)_x$. And a counterfactual model is that all consumers disappear, and a monopsony enters the market and offers to purchase from the producers unlimited quantities of goods for the same prices the consumers were previously paying, except for the good in question, which they offer a difference price for.

End of story? No; there are other answers that could be given to these questions. You may have noticed that the counterfactual models I suggested were not especially realistic, which could be considered a drawback, so let's look at some other possibilities.

Suppose the government plans to tax or subsidize a good, and we want to know what effect this will have on the quantity of the good, the price paid by consumers, and the price received by the producers. The usual story for how to figure this out from supply and demand functions $S$ and $D$ is that, where $t$ is the amount of tax (or negative the amount of subsidy) on each unit of the good, if $p$ is the price paid by the consumer, then $p-t$ is the price received by the producer, and the quantity demanded is $D(p)$ and quantity supplied is $S(p-t)$; since quantities supplied and demanded must be equal, then we can just solve the equation $D(p)=S(p-t)$ for $p$ to get the price paid by the consumer, and the common value of $D(p)$ and $S(p-t)$ will be the quantity traded. What do we have to mean by supply and demand functions in order for this story to be correct? The counterfactual model here is clear: the government institutes a tax or subsidy of exactly the right amount so that the consumer/producer ends up paying/receiving a price equal to the input of the demand/supply function, respectively. In other words, $D(p)$ means quantity traded if the tax or subsidy is adjusted so that the price paid by consumers is $p$, and $S(p)$ means the quantity traded if the tax or subsidy is adjusted so that the price received by producers is $p$. To figure out the corresponding way to extract individual supply and demand functions from joint supply and demand functions, note that if the government taxes or subsidizes the good $x$ such that the price paid by consumers is $p_x^d$ and the price received by producers is $p_x^s$ (using superscripts as indices, not exponents), and $p_y$ is the price of the good $y$, then $S(p_x^s,p_y)=D(p_x^d,p_y)$, as these are the pairs consisting of quantities supplied of $x$ and $y$, and quantities demanded of $x$ and $y$, respectively. So $D_x(p_x)=D(p_x,p_y)_x$, where $(p_y,p_x^s)$ is the solution to $S(p_x^s,p_y)=D(p_x,p_y)$, and $S_x(p_x)=S(p_x,p_y)_x$, where $(p_y,p_x^d)$ is the solution to $S(p_x,p_y)=D(p_x^d,p_y)$.

Another possible counterfactual model is that a new agent enters the market and offers to buy or sell unlimited amounts of a good for a fixed price $p$, thus forcing $p$ to be the new market price. $D(p)$ is then the quantity purchased by the original consumers, and $S(p)$ is the quantity sold by the original producers. This happens, for example, with backing currency, where a government promises to sell as much of some good as anyone will buy at some fixed price, as a way of ensuring that money remains valuable. A related example is a fixed exchange rate, where a government pegs the price of its currency relative to a foreign currency at a fixed rate by exchanging the currencies in both directions at the pegged price with anyone who wants to trade them at that price, though this example is atypical in that the good being exchanged for money is also money. To figure out the way of extracting individual supply and demand functions from joint supply and demand functions corresponding to this counterfactual model, note that if the government pegs the price of a good $x$ but doesn't get involved in the market for another good $y$, then supply and demand for $y$ still must balance; that is, $D(p_x,p_y)_y=S(p_x,p_y)_y$, where $p_x$ is the pegged price of $x$ and $p_y$ is the market price of $y$. So the supply and demand functions for $x$ should be given by $D_x(p_x)=D(p_x,p_y)_x$ and $S_x(p_x)=S(p_x,p_y)_x$, where $p_y$ is such that $D(p_x,p_y)_y=S(p_x,p_y)_y$.

### Cases in which the appropriate notion of supply and demand functions is unclear

There are other situations that economists use supply and demand functions to describe, and each situation may need a different notion of what supply and demand functions mean, and the right way to define them for a given purpose might not always be obvious. For instance, suppose we want to predict the effects of price controls. This may only give meaning to the demand function on prices greater than or equal to the market price, and the supply function on prices less than or equal to the market price, since if supply and demand aren't equal due to price controls, then whichever one is smaller will determine the quantity traded, so it isn't clear that there's an objective way to say what the larger one should be.

Supply and demand functions are supposed to help us understand the effects of changes to supply or demand on price and quantity. The demand curve describes the set of (price, quantity) pairs that can be obtained by changes to how easy the good is to produce, and the supply curve describes the set of (price, quantity) pairs that can be obtained by changes to how desirable the good is. This is not completely well-specified, so what the supply and demand functions should be depends on which sorts of shocks should be considered to only affect demand for the good, or to only affect supply of the good. This isn't as straightforward as it might sound, since, for instance, two supply shocks might have different effects on demand because of having different effects on the market for a complement or substitute for the good; the supply shock can't have no effect on the market for the complement or substitute, because it affects the market for the original good, and the markets are linked, so some decision must be made about what assumptions to make about how a supply shock is supposed to affect the markets for other goods, which will depend on, for example, the extent to which the supply shock is due to producers leaving the market for a substitute or complement in order to produce the good in question instead, or vice-versa.

The area of the region bounded by the supply and demand curves and the price axis is used as an estimate of how much wealth is created by the market for the good (neglecting externalities). It isn't clear to me what way of defining supply and demand functions makes this the best metric, and it's not going to be perfect in any case, as it measures wealth in units of money, and the value of a certain amount of money to someone can vary depending on circumstances (for instance, on how much money they already have). Another problem is that areas of smaller regions in a supply and demand graph are used as measures of deadweight loss caused by market distorsions, but the nature of the market distorsion in question would require us to use one particular meaning of supply and demand functions in order to correctly describe the effects of the distorsion; if this meaning is not one for which area in the supply and demand graph accurately represents value, then accurately representing deadweight loss as the area of a region in a graph isn't possible.

### Example

A possible explanation for why these subtleties are not emphasized is that they don't make much difference in practice, as supply and demand functions tend to not depend too much on how exactly they're defined. But we can construct examples in which they are quite different.

Consider the supply function in the market for left shoes. Assume no one actually buys one shoe at a time, so no matter what the prices of left and right shoes are, the demand for each will be the same. Also assume that making left shoes and making right shoes is always equally easy for the producers, so they would shift entirely to producing just the more expensive chirality of shoe if the prices differed. That is, there is a demand function for pairs of shoes, $D_{pair}$, and the joint demand function for left shoes and right shoes is given by $D(p_{left},p_{right})=(D_{pair}(p_{left}+p_{right}),D_{pair}(p_{left}+p_{right}))$, since $p_{left}+p_{right}$ is the price of a pair of shoes. And there is a supply function for total shoes, $S_{shoes}$, and the joint supply function for left shoes and right shoes is given by $S(p_{left},p_{right})=(S_{shoes}(p_{left}),0)$ if $p_{left}>p_{right}$, $(0,S_{shoes}(p_{right})$ if $p_{right}>p_{left}$, and, if $p_{left}=p_{right}=p$, can be any $(q_{left},q_{right})$ such that $q_{left}+q_{right}=S_{shoes}(p)$ (if you don't like multi-valued functions, you can pretend we're working with a continuous approximation to this joint supply function).

The market prices for left shoes and for right shoes must be the same, since otherwise the producers would only make shoes of one chirality. Let $p^*$ be this market price for shoes, and now let's figure out the supply function $S_{left}$ for left shoes according to each of the three conventions I described in the section on possible answers.

If we are to assume that the prices of right shoes are constant, then $S_{left}(p_{left})=0$ for $p_{left}, and $S_{left}(p_{left})=S_{shoes}(p_{left})$ for $p_{left}>p^*$, since all production shifts to the more expensive chirality of shoe when we vary the price of left shoes.

If we assume that the government taxes or subsidizes left shoes such that the price received by the producer for left shoes is $p_{left}$, then the price received by the producer for right shoes must also be $p_{left}$, since consumers will still be buying both chirality of shoe, which means prices must adjust so that producers will still make both chiralities of shoe (this will mean that consumers will pay different prices for left and right shoes, with the difference being the amount of the tax or subsidy). So the producers will make $S_{shoes}(p_{left})$ shoes in total. Since the consumers will buy equal numbers of each, the producers must make equal numbers of each in order to sell them all, so $S_{left}(p_{left})=\frac{1}{2}S_{shoes}(p_{left})$.

If we assume a new agent offers to buy or sell unlimited numbers of left shoes for $p_{left}$, then again right shoes are going to end up going for the same price (except in the extreme cases where the original producers don't end up making any left shoes, or the original consumers don't end up buying any shoes, but let's suppose that doesn't happen). The original producers will supply $S_{shoes}(p_{left})$ shoes in total. The original consumers will buy $D_{pairs}(2p_{left})$ pairs of shoes. In particular, the original consumers will buy $D_{pairs}(2p_{left})$ right shoes, which is the same as the number of right shoes sold by the original producers, since the new agent does not buy or sell any right shoes. Thus, the original producers make $S_{left}(p_{left})=S_{shoes}(p_{left})-D_{pairs}(2p_{left})$ left shoes.

Of these three purported supply functions, the first is radically different from the others, in that the latter two are continuous (if $S_{shoes}$ and $D_{pairs}$ are), but the first is discontinuous at $p_{left}=p^*$. The relationship between the latter two supply functions for left shoes depends on the relationship between $S_{shoes}$ and $D_{pairs}$, but they certainly can be quite different.

One could argue that this example doesn't count, because a pair of perfect complements can just be considered a single good sold as a bundle (as left and right shoes typically are in practice). But complements that are not perfect complements also exist, and producers do sometimes have some ability to shift between markets, so approximate versions of this example should exist in real life.

### Joint supply and demand functions for infinitely many types of goods

We can, of course, consider joint supply and demand functions of arbitrarily many goods, instead of just two. For $n$ goods, $D(p_1,...,p_n)$ and $S(p_1,...,p_n)$ would be the $n$-tuples consisting of the quantities demanded or supplied of each good when $p_i$ is the price of the $i$th good. But sometimes goods can vary across a continuum of possibilities, and in such cases, it might not be appropriate to think of the market as just involving finitely many types of goods. For example, goods may vary by quality, with higher-quality goods being both more preferred by the consumers and harder to produce, and goods of different qualities substituting for each other. Or in the case of goods that can't easily be moved, like buildings, consumers may have preferences about their location, and location may affect how easily the goods can be produced. Quality and location can each be modeled as varying across a continuum of possibilities.

Where $X$ is some space of goods, prices can be represented as a function $p:X\rightarrow\mathbb{R}_+$, where $p(x)$ is the price of the good $x$. Quantity can be represented as a finite measure $\mu$ on $X$, where for $Y\subseteq X$, $\mu(Y)$ is the combined quantity of all goods in $Y$.

So, where $\mathbb{R}_+^X$ is the set of measurable functions $X\rightarrow\mathbb{R}_+$ and $M(X)$ is the set of finite measures on $X$, joint supply and demand functions for $X$ should be functions $S:\mathbb{R}_+^X\rightarrow M(X)$ and $D:\mathbb{R}_+^X\rightarrow M(X)$. The market equilibrium price function is the solution $p^*$ to $S(p^*)=D(p^*)$ ($S$ and $D$ should satisfy some conditions which should ensure that this exists), and the common value of $S(p^*)$ and $D(p^*)$ is the measure representing the market equilibrium quantities traded of types of goods in $X$.

In the recent UK general election, the proportion of the popular vote won by each party looked like this:

The proportion of the seats in the House of Commons won by each party looked like this:

You may notice that these two graphs look pretty different. The Conservative Party won a majority of the seats with only 37% of the vote. The Scottish National Party, due to its geographic concentration in Scotland, got a share of the seats in Parliament nearly double its share of the popular vote. In contrast, the Liberal Democratic Party got only 8 out of the 650 seats despite winning 8% of the popular vote, the Green Party got only 1 seat with 4% of the vote, and, most egregiously, the UK Independence Party got only 1 seat with 12% of the vote. While I have no objections to UKIP getting cheated out of political power, this does not seem like a fair and democratic outcome, and yet this sort of thing is an inevitable consequence of first-past-the-post elections for single-member legislative districts.

This sort of thing happens even with two party systems like in the US, where not only do third parties get completely shut out, the balance of power between the two major parties is also skewed: in 2012, the Republicans won a majority of seats in the House of Representatives, despite the Democrats winning more total votes. This has been widely attributed to Gerrymandering, but the fact that Democratic votes are more geographically concentrated than Republican votes contributes even more.

Proportional representation is an easy solution to this problem. One of the criticisms of proportional representation is that having representatives associated with a district ties them closer to the voters. There are variants of proportional representation that address this, but here I want to propose another one. But first, let's talk about random sampling.

Randomized Vote-Counting

If instead of counting every vote in an election, we randomly sampled some small fraction of the ballots and counted those, we would get the same result almost every time, with discrepancies being statistically possible only when the vote is very close (which seems fine to me; getting 50.1% of the vote does not seem to me to confer much more legitimacy than getting 49.9% of the vote does). While this might make elections slightly cheaper to administer, it would be a massive under-use of the power of randomization.

In California (and also, I am under the impression, in most other U.S. states, and many other countries), elections tend to include a massive profusion of state and local officials and ballot measures. Each of these individually requires a significant amount of research, so it is prohibitively time-consuming to adequately research every ballot question. When I vote, I usually feel like I did not have time to research most of the ballot questions enough to make an informed vote, and yet I suspect I still spend more time researching them than average.

My proposed solution to this is for each voter to be randomly assigned one ballot question that they get to vote on. When you only have one issue you can vote on, it is much easier to thoroughly research it. Thus this system should result in more informed voters.

People would likely object that this system is undemocratic, since not everyone gets to vote on each ballot question. But in fact, this system would probably end up being more democratic than the current one, since it would make voting easier and thus probably increase turnout, making the sample of people voting on each issue more representative of the electorate as a whole, even while comprising a smaller fraction of it. Some people might not vote because of being assigned to an issue that they are not interested in, but most such people probably wouldn't have voted on that issue anyway; I'd bet there would be significantly more people who would vote on an issue if it was the only one they could vote on, but wouldn't vote on it if they could vote on all of them. Furthermore, since people would have more time to research their ballot question, they would be less reliant on information shoved in their faces in the form of advertising, so this would decrease the influence of special interest groups in politics, arguably also making the system more democratic.

So far I've been suggesting that enough votes should be sampled that the outcome of each election is virtually guaranteed to be the same as it would be if all the votes were counted, with all the exceptions being when the vote is very close. But what happens when we don't sample enough votes for that? What if we take it all the way to the extreme and only sample one vote? This would not be appropriate for ballot measures or executive officials, but for electing the members of a legislature with a large number of single-member districts, this actually has some pretty nice properties.

Since each ballot is equally likely to be the one that gets counted, the probability of each candidate getting elected is proportional to the number of votes they get. Averaged over a large number of districts, this means that the number of legislators elected from each political party will be approximately proportional to the popular support for that party. Thus, this simulates proportional representation with single-member electoral districts.

This is very similar to a sortition, in which legislatures are a random sample of the population. The primary difference is that in a sortition, many of the people randomly selected to be legislators may have little interest in or ability for the job. However, in this system, someone would still have to demonstrate interest by running for election in order to be selected. To further discourage frivolous campaigns, costs could be imposed on the candidates, for instance by requiring them to gather signatures to qualify for the ballot, to ensure that no one gets elected who isn't serious about their intent to serve in the legislature.

A small further advantage of this system over a sortition is that it ensures that the legislators are evenly distributed geographically, so the variance of the number of seats won by each political coalition would be slightly smaller than it would be under completely random sampling.

Another advantage of my randomized system over first-past-the-post and proportional representation is that it avoids electoral paradoxes that plague deterministic systems. It avoids the Alabama and population paradoxes, which proportional representation is vulnerable to. There is also no incentive for tactical voting, since if your vote gets selected, the others do not constrain which candidates you can get elected. And there is no incentive for Gerrymandering, since the expected number of seats won by a party will be proportional to its vote count no matter how the districts are drawn, provided they all have equal numbers of voters.

A possible objection to this system is that candidates can get elected with support from only a small fraction of their constituents. But this does not seem that bad to me. Even under first-past-the-post, it is the norm for a large fraction of the constituents to vote against the winning candidate. Even in safe seats, the fraction of voters who vote against the winner is typically fairly significant (e.g., a third), and these voters never get the chance to be represented by their preferred candidate. Under the randomized system, any significant local coalition would get a chance of representation sometimes, and dominant coalitions would be represented most of the time. And if a party is dominant in a district, then even if the representative for that district ends up not being aligned with that party, there will likely be nearby districts that are represented by that party. For example, the San Francisco Bay Area is so dominated by Democrats that all of its members of the House of Representatives and the state legislature are Democrats, leaving the Bay Area Republicans unrepresented. Using the randomized system, a few Republicans would get elected in the Bay Area, so the constituency of Bay Area Republicans get their representation, and the Democrats in the districts that end up getting represented by Republicans would still have plenty of Democratic legislators in neighboring districts to represent their interests.

One significant disadvantage is that it would be difficult for legislators to accumulate much experience in the legislature, since they would have a significant chance of losing each re-election even if they have broad support in their district. Primarily for this reason, I think this randomized system is inferior to single transferable vote and party list proportional representation. But despite this, I still think it is not too terrible, and would be a significant improvement over the current system. Sometimes you can make the system more democratic by counting fewer votes.