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)=pq−C(q)\text{Profit}(q) = pq - C(q)

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

q∗=arg max⁡qProfit(q)q^* = \argmax_q \text{Profit}(q)

Note that q∗q^* 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 max⁡qConsumerBenefit(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(pq−C(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)∂q∣q=q∗,         p=∂U(q)∂q∣q=q∗∗p = \frac{\partial C(q)}{\partial q} \bigg|_{q=q^*},\,\,\,\,\,\,\,\,\, p = \frac{\partial U(q)}{\partial q} \bigg|_{q=q^{**}}