Economics

Supply and demand

Understanding supply and demand through the lens of optimization

Setup

Suppose there is a single company selling a single product and a single consumer buying that specific product. Can we understand how the market interaction works in this scenario? 1 Need a visual example in this post.

Supply as profit maximization

Let’s have

Then, the company’s profit is total price it sells at, minus total cost of production:

Profit(q)=pqC(q)\text{Profit}(q) = pq - C(q)

The company’s objective is to produce exactly that many units which maximizes its profit:

q=arg maxqProfit(q)q^* = \argmax_q \text{Profit}(q)

Note that qq^* is a function of price per unit item pp.

This is the supply curve: for every price pp how much should the company produce to maximize its profits?

Demand as utility maximization

In the same way, a consumer is trying to maximize the utility of the goods they buy. But what exactly is utility? Utility is a scoring function that tells the benefit of the bought goods for the consumer. 2 How should we quantify utility? An unanswered question for later.

So if we have a utility function U(q)U(q), then the consumer’s benefit is the utility minus the cost of buying the goods 3 The buying and selling of goods pqpq is the common part between the company and the consumer. :

ConsumerBenefit(q)=U(q)pq\text{ConsumerBenefit}(q) = U(q)-pq

The consumer’s objective (also a function of pp) is the maximize their own benefit:

q=arg maxqConsumerBenefit(q)q^{**} = \argmax_q \text{ConsumerBenefit}(q)

The is the demand curve: for every price pp how much should the consumer buy the maximize their benefit.

Market equilibrium

We know that:

If the system reaches an equilibrium, then the company and consumer are both maximizing their respective profit and benefit. That means:

q(pqC(q))q=q=0,q(U(q)pq)q=q=0\frac{\partial}{\partial q} \bigg(pq-C(q)\bigg)\bigg|_{q=q^*}=0,\,\,\,\,\,\,\,\,\,\, \frac{\partial}{\partial q} \bigg(U(q)-pq\bigg)\bigg|_{q=q^{**}}=0

This gives us:

p=C(q)qq=q,p=U(q)qq=qp = \frac{\partial C(q)}{\partial q} \bigg|_{q=q^*},\,\,\,\,\,\,\,\,\, p = \frac{\partial U(q)}{\partial q} \bigg|_{q=q^{**}}