{
"cells": [
{
"cell_type": "markdown",
"id": "9911b5b7",
"metadata": {},
"source": [
"\n",
""
]
},
{
"cell_type": "markdown",
"id": "e3d8a6c5",
"metadata": {},
"source": [
"# Supply and Demand with Many Goods"
]
},
{
"cell_type": "markdown",
"id": "96b1dfd4",
"metadata": {},
"source": [
"## Overview\n",
"\n",
"In a [previous lecture](https://intro.quantecon.org/intro_supply_demand.html) we studied supply, demand\n",
"and welfare in a market with a single consumption good.\n",
"\n",
"In this lecture, we study a setting with $ n $ goods and $ n $ corresponding prices.\n",
"\n",
"Key infrastructure concepts that we’ll encounter in this lecture are\n",
"\n",
"- inverse demand curves \n",
"- marginal utilities of wealth \n",
"- inverse supply curves \n",
"- consumer surplus \n",
"- producer surplus \n",
"- social welfare as a sum of consumer and producer surpluses \n",
"- competitive equilibrium \n",
"\n",
"\n",
"We will provide a version of the [first fundamental welfare theorem](https://en.wikipedia.org/wiki/Fundamental_theorems_of_welfare_economics), which was formulated by\n",
"\n",
"- [Leon Walras](https://en.wikipedia.org/wiki/L%C3%A9on_Walras) \n",
"- [Francis Ysidro Edgeworth](https://en.wikipedia.org/wiki/Francis_Ysidro_Edgeworth) \n",
"- [Vilfredo Pareto](https://en.wikipedia.org/wiki/Vilfredo_Pareto) \n",
"\n",
"\n",
"Important extensions to the key ideas were obtained by\n",
"\n",
"- [Abba Lerner](https://en.wikipedia.org/wiki/Abba_P._Lerner) \n",
"- [Harold Hotelling](https://en.wikipedia.org/wiki/Harold_Hotelling) \n",
"- [Paul Samuelson](https://en.wikipedia.org/wiki/Paul_Samuelson) \n",
"- [Kenneth Arrow](https://en.wikipedia.org/wiki/Kenneth_Arrow) \n",
"- [Gerard Debreu](https://en.wikipedia.org/wiki/G%C3%A9rard_Debreu) \n",
"\n",
"\n",
"We shall describe two classic welfare theorems:\n",
"\n",
"- **first welfare theorem:** for a given distribution of wealth among consumers, a competitive equilibrium allocation of goods solves a social planning problem. \n",
"- **second welfare theorem:** An allocation of goods to consumers that solves a social planning problem can be supported by a competitive equilibrium with an appropriate initial distribution of wealth. \n",
"\n",
"\n",
"As usual, we start by importing some Python modules."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ae259bf7",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# import some packages\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from scipy.linalg import inv"
]
},
{
"cell_type": "markdown",
"id": "a287d21b",
"metadata": {},
"source": [
"## Formulas from linear algebra\n",
"\n",
"We shall apply formulas from linear algebra that\n",
"\n",
"- differentiate an inner product with respect to each vector \n",
"- differentiate a product of a matrix and a vector with respect to the vector \n",
"- differentiate a quadratic form in a vector with respect to the vector \n",
"\n",
"\n",
"Where $ a $ is an $ n \\times 1 $ vector, $ A $ is an $ n \\times n $ matrix, and $ x $ is an $ n \\times 1 $ vector:\n",
"\n",
"$$\n",
"\\frac{\\partial a^\\top x }{\\partial x} = \\frac{\\partial x^\\top a }{\\partial x} = a\n",
"$$\n",
"\n",
"$$\n",
"\\frac{\\partial A x} {\\partial x} = A\n",
"$$\n",
"\n",
"$$\n",
"\\frac{\\partial x^\\top A x}{\\partial x} = (A + A^\\top)x\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "0b5a41a9",
"metadata": {},
"source": [
"## From utility function to demand curve\n",
"\n",
"Our study of consumers will use the following primitives\n",
"\n",
"- $ \\Pi $ be an $ m \\times n $ matrix, \n",
"- $ b $ be an $ m \\times 1 $ vector of bliss points, \n",
"- $ e $ be an $ n \\times 1 $ vector of endowments, and \n",
"\n",
"\n",
"We will analyze endogenous objects $ c $ and $ p $, where\n",
"\n",
"- $ c $ is an $ n \\times 1 $ vector of consumptions of various goods, \n",
"- $ p $ is an $ n \\times 1 $ vector of prices \n",
"\n",
"\n",
"The matrix $ \\Pi $ describes a consumer’s willingness to substitute one good for every other good.\n",
"\n",
"We assume that $ \\Pi $ has linearly independent columns, which implies that $ \\Pi^\\top \\Pi $ is a positive definite matrix.\n",
"\n",
"- it follows that $ \\Pi^\\top \\Pi $ has an inverse. \n",
"\n",
"\n",
"We shall see below that $ (\\Pi^\\top \\Pi)^{-1} $ is a matrix of slopes of (compensated) demand curves for $ c $ with respect to a vector of prices:\n",
"\n",
"$$\n",
"\\frac{\\partial c } {\\partial p} = (\\Pi^\\top \\Pi)^{-1}\n",
"$$\n",
"\n",
"A consumer faces $ p $ as a price taker and chooses $ c $ to maximize the utility function\n",
"\n",
"\n",
"\n",
"$$\n",
"- \\frac{1}{2} (\\Pi c -b) ^\\top (\\Pi c -b ) \\tag{40.1}\n",
"$$\n",
"\n",
"subject to the budget constraint\n",
"\n",
"\n",
"\n",
"$$\n",
"p^\\top (c -e ) = 0 \\tag{40.2}\n",
"$$\n",
"\n",
"We shall specify examples in which $ \\Pi $ and $ b $ are such that it typically happens that\n",
"\n",
"\n",
"\n",
"$$\n",
"\\Pi c \\ll b \\tag{40.3}\n",
"$$\n",
"\n",
"This means that the consumer has much less of each good than he wants.\n",
"\n",
"The deviation in [(40.3)](#equation-eq-bversusc) will ultimately assure us that competitive equilibrium prices are positive."
]
},
{
"cell_type": "markdown",
"id": "6a577071",
"metadata": {},
"source": [
"### Demand curve implied by constrained utility maximization\n",
"\n",
"For now, we assume that the budget constraint is [(40.2)](#equation-eq-old2).\n",
"\n",
"So we’ll be deriving what is known as a **Marshallian** demand curve.\n",
"\n",
"Our aim is to maximize [(40.1)](#equation-eq-old0) subject to [(40.2)](#equation-eq-old2).\n",
"\n",
"Form a Lagrangian\n",
"\n",
"$$\n",
"L = - \\frac{1}{2} (\\Pi c -b)^\\top (\\Pi c -b ) + \\mu [p^\\top (e-c)]\n",
"$$\n",
"\n",
"where $ \\mu $ is a Lagrange multiplier that is often called a **marginal utility of wealth**.\n",
"\n",
"The consumer chooses $ c $ to maximize $ L $ and $ \\mu $ to minimize it.\n",
"\n",
"First-order conditions for $ c $ are\n",
"\n",
"$$\n",
"\\frac{\\partial L} {\\partial c}\n",
" = - \\Pi^\\top \\Pi c + \\Pi^\\top b - \\mu p = 0\n",
"$$\n",
"\n",
"so that, given $ \\mu $, the consumer chooses\n",
"\n",
"\n",
"\n",
"$$\n",
"c = (\\Pi^\\top \\Pi )^{-1}(\\Pi^\\top b - \\mu p ) \\tag{40.4}\n",
"$$\n",
"\n",
"Substituting [(40.4)](#equation-eq-old3) into budget constraint [(40.2)](#equation-eq-old2) and solving for $ \\mu $ gives\n",
"\n",
"\n",
"\n",
"$$\n",
"\\mu(p,e) = \\frac{p^\\top ( \\Pi^\\top \\Pi )^{-1} \\Pi^\\top b - p^\\top e}{p^\\top (\\Pi^\\top \\Pi )^{-1} p}. \\tag{40.5}\n",
"$$\n",
"\n",
"Equation [(40.5)](#equation-eq-old4) tells how marginal utility of wealth depends on the endowment vector $ e $ and the price vector $ p $.\n",
"\n",
">**Note**\n",
">\n",
">Equation [(40.5)](#equation-eq-old4) is a consequence of imposing that $ p^\\top (c - e) = 0 $.\n",
"\n",
"We could instead take $ \\mu $ as a parameter and use [(40.4)](#equation-eq-old3) and the budget constraint [(40.6)](#equation-eq-old2p) to solve for wealth.\n",
"\n",
"Which way we proceed determines whether we are constructing a **Marshallian** or **Hicksian** demand curve."
]
},
{
"cell_type": "markdown",
"id": "03271dc7",
"metadata": {},
"source": [
"## Endowment economy\n",
"\n",
"We now study a pure-exchange economy, or what is sometimes called an endowment economy.\n",
"\n",
"Consider a single-consumer, multiple-goods economy without production.\n",
"\n",
"The only source of goods is the single consumer’s endowment vector $ e $.\n",
"\n",
"A competitive equilibrium price vector induces the consumer to choose $ c=e $.\n",
"\n",
"This implies that the equilibrium price vector satisfies\n",
"\n",
"$$\n",
"p = \\mu^{-1} (\\Pi^\\top b - \\Pi^\\top \\Pi e)\n",
"$$\n",
"\n",
"In the present case where we have imposed budget constraint in the form [(40.2)](#equation-eq-old2), we are free to normalize the price vector by setting the marginal utility of wealth $ \\mu =1 $ (or any other value for that matter).\n",
"\n",
"This amounts to choosing a common unit (or numeraire) in which prices of all goods are expressed.\n",
"\n",
"(Doubling all prices will affect neither quantities nor relative prices.)\n",
"\n",
"We’ll set $ \\mu=1 $."
]
},
{
"cell_type": "markdown",
"id": "0e0a2d13",
"metadata": {},
"source": [
"## Exercise 40.1\n",
"\n",
"Verify that setting $ \\mu=1 $ in [(40.4)](#equation-eq-old3) implies that formula [(40.5)](#equation-eq-old4) is satisfied."
]
},
{
"cell_type": "markdown",
"id": "19635733",
"metadata": {},
"source": [
"## Exercise 40.2\n",
"\n",
"Verify that setting $ \\mu=2 $ in [(40.4)](#equation-eq-old3) also implies that formula\n",
"[(40.5)](#equation-eq-old4) is satisfied.\n",
"\n",
"Here is a class that computes competitive equilibria for our economy."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8d63c921",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"class ExchangeEconomy:\n",
" \n",
" def __init__(self, \n",
" Π, \n",
" b, \n",
" e,\n",
" thres=1.5):\n",
" \"\"\"\n",
" Set up the environment for an exchange economy\n",
"\n",
" Args:\n",
" Π (np.array): shared matrix of substitution\n",
" b (list): the consumer's bliss point\n",
" e (list): the consumer's endowment\n",
" thres (float): a threshold to check p >> Π e condition\n",
" \"\"\"\n",
"\n",
" # check non-satiation\n",
" if np.min(b / np.max(Π @ e)) <= thres:\n",
" raise Exception('set bliss points further away')\n",
"\n",
"\n",
" self.Π, self.b, self.e = Π, b, e\n",
"\n",
" \n",
" def competitive_equilibrium(self):\n",
" \"\"\"\n",
" Compute the competitive equilibrium prices and allocation\n",
" \"\"\"\n",
" Π, b, e = self.Π, self.b, self.e\n",
"\n",
" # compute price vector with μ=1\n",
" p = Π.T @ b - Π.T @ Π @ e\n",
" \n",
" # compute consumption vector\n",
" slope_dc = inv(Π.T @ Π)\n",
" Π_inv = inv(Π)\n",
" c = Π_inv @ b - slope_dc @ p\n",
"\n",
" if any(c < 0):\n",
" print('allocation: ', c)\n",
" raise Exception('negative allocation: equilibrium does not exist')\n",
"\n",
" return p, c"
]
},
{
"cell_type": "markdown",
"id": "4e1f0b5a",
"metadata": {},
"source": [
"## Digression: Marshallian and Hicksian demand curves\n",
"\n",
"Sometimes we’ll use budget constraint [(40.2)](#equation-eq-old2) in situations in which a consumer’s endowment vector $ e $ is his **only** source of income.\n",
"\n",
"Other times we’ll instead assume that the consumer has another source of income (positive or negative) and write his budget constraint as\n",
"\n",
"\n",
"\n",
"$$\n",
"p ^\\top (c -e ) = w \\tag{40.6}\n",
"$$\n",
"\n",
"where $ w $ is measured in “dollars” (or some other **numeraire**) and component $ p_i $ of the price vector is measured in dollars per unit of good $ i $.\n",
"\n",
"Whether the consumer’s budget constraint is [(40.2)](#equation-eq-old2) or [(40.6)](#equation-eq-old2p) and whether we take $ w $ as a free parameter or instead as an endogenous variable will affect the consumer’s marginal utility of wealth.\n",
"\n",
"Consequently, how we set $ \\mu $ determines whether we are constructing\n",
"\n",
"- a **Marshallian** demand curve, as when we use [(40.2)](#equation-eq-old2) and solve for $ \\mu $ using equation [(40.5)](#equation-eq-old4) above, or \n",
"- a **Hicksian** demand curve, as when we treat $ \\mu $ as a fixed parameter and solve for $ w $ from [(40.6)](#equation-eq-old2p). \n",
"\n",
"\n",
"Marshallian and Hicksian demand curves contemplate different mental experiments:\n",
"\n",
"For a Marshallian demand curve, hypothetical changes in a price vector have both **substitution** and **income** effects\n",
"\n",
"- income effects are consequences of changes in $ p^\\top e $ associated with the change in the price vector \n",
"\n",
"\n",
"For a Hicksian demand curve, hypothetical price vector changes have only **substitution** effects\n",
"\n",
"- changes in the price vector leave the $ p^\\top e + w $ unaltered because we freeze $ \\mu $ and solve for $ w $ \n",
"\n",
"\n",
"Sometimes a Hicksian demand curve is called a **compensated** demand curve in order to emphasize that, to disarm the income (or wealth) effect associated with a price change, the consumer’s wealth $ w $ is adjusted.\n",
"\n",
"We’ll discuss these distinct demand curves more below."
]
},
{
"cell_type": "markdown",
"id": "18828359",
"metadata": {},
"source": [
"## Dynamics and risk as special cases\n",
"\n",
"Special cases of our $ n $-good pure exchange model can be created to represent\n",
"\n",
"- **dynamics** — by putting different dates on different commodities \n",
"- **risk** — by interpreting delivery of goods as being contingent on states of the world whose realizations are described by a *known probability distribution* \n",
"\n",
"\n",
"Let’s illustrate how."
]
},
{
"cell_type": "markdown",
"id": "a1e92922",
"metadata": {},
"source": [
"### Dynamics\n",
"\n",
"Suppose that we want to represent a utility function\n",
"\n",
"$$\n",
"- \\frac{1}{2} [(c_1 - b_1)^2 + \\beta (c_2 - b_2)^2]\n",
"$$\n",
"\n",
"where $ \\beta \\in (0,1) $ is a discount factor, $ c_1 $ is consumption at time $ 1 $ and $ c_2 $ is consumption at time 2.\n",
"\n",
"To capture this with our quadratic utility function [(40.1)](#equation-eq-old0), set\n",
"\n",
"$$\n",
"\\Pi = \\begin{bmatrix} 1 & 0 \\cr\n",
" 0 & \\sqrt{\\beta} \\end{bmatrix}\n",
"$$\n",
"\n",
"$$\n",
"e = \\begin{bmatrix} e_1 \\cr e_2 \\end{bmatrix}\n",
"$$\n",
"\n",
"and\n",
"\n",
"$$\n",
"b = \\begin{bmatrix} b_1 \\cr \\sqrt{\\beta} b_2\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"The budget constraint [(40.2)](#equation-eq-old2) becomes\n",
"\n",
"$$\n",
"p_1 c_1 + p_2 c_2 = p_1 e_1 + p_2 e_2\n",
"$$\n",
"\n",
"The left side is the **discounted present value** of consumption.\n",
"\n",
"The right side is the **discounted present value** of the consumer’s endowment.\n",
"\n",
"The relative price $ \\frac{p_1}{p_2} $ has units of time $ 2 $ goods per unit of time $ 1 $ goods.\n",
"\n",
"Consequently,\n",
"\n",
"$$\n",
"(1+r) := R := \\frac{p_1}{p_2}\n",
"$$\n",
"\n",
"is the **gross interest rate** and $ r $ is the **net interest rate**.\n",
"\n",
"Here is an example."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "23c8911a",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"beta = 0.95\n",
"\n",
"Π = np.array([[1, 0],\n",
" [0, np.sqrt(beta)]])\n",
"\n",
"b = np.array([5, np.sqrt(beta) * 5])\n",
"\n",
"e = np.array([1, 1])\n",
"\n",
"dynamics = ExchangeEconomy(Π, b, e)\n",
"p, c = dynamics.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price vector:', p)\n",
"print('Competitive equilibrium allocation:', c)"
]
},
{
"cell_type": "markdown",
"id": "ef205f0b",
"metadata": {},
"source": [
"### Risk and state-contingent claims\n",
"\n",
"We study risk in the context of a **static** environment, meaning that there is only one period.\n",
"\n",
"By **risk** we mean that an outcome is not known in advance, but that it is governed by a known probability distribution.\n",
"\n",
"As an example, our consumer confronts **risk** means in particular that\n",
"\n",
"- there are two states of nature, $ 1 $ and $ 2 $. \n",
"- the consumer knows that the probability that state $ 1 $ occurs is $ \\lambda $. \n",
"- the consumer knows that the probability that state $ 2 $ occurs is $ (1-\\lambda) $. \n",
"\n",
"\n",
"Before the outcome is realized, the consumer’s **expected utility** is\n",
"\n",
"$$\n",
"- \\frac{1}{2} [\\lambda (c_1 - b_1)^2 + (1-\\lambda)(c_2 - b_2)^2]\n",
"$$\n",
"\n",
"where\n",
"\n",
"- $ c_1 $ is consumption in state $ 1 $ \n",
"- $ c_2 $ is consumption in state $ 2 $ \n",
"\n",
"\n",
"To capture these preferences we set\n",
"\n",
"$$\n",
"\\Pi = \\begin{bmatrix} \\sqrt{\\lambda} & 0 \\cr\n",
" 0 & \\sqrt{1-\\lambda} \\end{bmatrix}\n",
"$$\n",
"\n",
"$$\n",
"e = \\begin{bmatrix} e_1 \\cr e_2 \\end{bmatrix}\n",
"$$\n",
"\n",
"$$\n",
"b = \\begin{bmatrix} \\sqrt{\\lambda}b_1 \\cr \\sqrt{1-\\lambda}b_2 \\end{bmatrix}\n",
"$$\n",
"\n",
"A consumer’s endowment vector is\n",
"\n",
"$$\n",
"c = \\begin{bmatrix} c_1 \\cr c_2 \\end{bmatrix}\n",
"$$\n",
"\n",
"A price vector is\n",
"\n",
"$$\n",
"p = \\begin{bmatrix} p_1 \\cr p_2 \\end{bmatrix}\n",
"$$\n",
"\n",
"where $ p_i $ is the price of one unit of consumption in state $ i \\in \\{1, 2\\} $.\n",
"\n",
"The state-contingent goods being traded are often called **Arrow securities**.\n",
"\n",
"Before the random state of the world $ i $ is realized, the consumer sells his/her state-contingent endowment bundle and purchases a state-contingent consumption bundle.\n",
"\n",
"Trading such state-contingent goods is one way economists often model **insurance**.\n",
"\n",
"We use the tricks described above to interpret $ c_1, c_2 $ as “Arrow securities” that are state-contingent claims to consumption goods.\n",
"\n",
"Here is an instance of the risk economy:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "804daa5a",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"prob = 0.2\n",
"\n",
"Π = np.array([[np.sqrt(prob), 0],\n",
" [0, np.sqrt(1 - prob)]])\n",
"\n",
"b = np.array([np.sqrt(prob) * 5, np.sqrt(1 - prob) * 5])\n",
"\n",
"e = np.array([1, 1])\n",
"\n",
"risk = ExchangeEconomy(Π, b, e)\n",
"p, c = risk.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price vector:', p)\n",
"print('Competitive equilibrium allocation:', c)"
]
},
{
"cell_type": "markdown",
"id": "e0e3ec96",
"metadata": {},
"source": [
"### Exercise 40.3\n",
"\n",
"Consider the instance above.\n",
"\n",
"Please numerically study how each of the following cases affects the equilibrium prices and allocations:\n",
"\n",
"- the consumer gets poorer, \n",
"- they like the first good more, or \n",
"- the probability that state $ 1 $ occurs is higher. \n",
"\n",
"\n",
"Hints. For each case choose some parameter $ e, b, \\text{ or } \\lambda $ different from the instance."
]
},
{
"cell_type": "markdown",
"id": "d0fa75b8",
"metadata": {},
"source": [
"### Solution to[ Exercise 40.3](https://intro.quantecon.org/#sdm_ex3)\n",
"\n",
"First consider when the consumer is poorer.\n",
"\n",
"Here we just decrease the endowment."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b5f4666b",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"risk.e = np.array([0.5, 0.5])\n",
"\n",
"p, c = risk.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price vector:', p)\n",
"print('Competitive equilibrium allocation:', c)"
]
},
{
"cell_type": "markdown",
"id": "4c514403",
"metadata": {},
"source": [
"If the consumer likes the first (or second) good more, then we can set a larger bliss value for good 1."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3e2f3ae1",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"risk.b = np.array([np.sqrt(prob) * 6, np.sqrt(1 - prob) * 5])\n",
"p, c = risk.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price vector:', p)\n",
"print('Competitive equilibrium allocation:', c)"
]
},
{
"cell_type": "markdown",
"id": "99f74ecf",
"metadata": {},
"source": [
"Increase the probability that state $ 1 $ occurs."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1715069d",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"prob = 0.8\n",
"\n",
"Π = np.array([[np.sqrt(prob), 0],\n",
" [0, np.sqrt(1 - prob)]])\n",
"\n",
"b = np.array([np.sqrt(prob) * 5, np.sqrt(1 - prob) * 5])\n",
"\n",
"e = np.array([1, 1])\n",
"\n",
"risk = ExchangeEconomy(Π, b, e)\n",
"p, c = risk.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price vector:', p)\n",
"print('Competitive equilibrium allocation:', c)"
]
},
{
"cell_type": "markdown",
"id": "08a061c3",
"metadata": {},
"source": [
"## Economies with endogenous supplies of goods\n",
"\n",
"Up to now we have described a pure exchange economy in which endowments of goods are exogenous, meaning that they are taken as given from outside the model."
]
},
{
"cell_type": "markdown",
"id": "5df63144",
"metadata": {},
"source": [
"### Supply curve of a competitive firm\n",
"\n",
"A competitive firm that can produce goods takes a price vector $ p $ as given and chooses a quantity $ q $\n",
"to maximize total revenue minus total costs.\n",
"\n",
"The firm’s total revenue equals $ p^\\top q $ and its total cost equals $ C(q) $ where $ C(q) $ is a total cost function\n",
"\n",
"$$\n",
"C(q) = h ^\\top q + \\frac{1}{2} q^\\top J q\n",
"$$\n",
"\n",
"and $ J $ is a positive definite matrix.\n",
"\n",
"So the firm’s profits are\n",
"\n",
"\n",
"\n",
"$$\n",
"p^\\top q - C(q) \\tag{40.7}\n",
"$$\n",
"\n",
"An $ n\\times 1 $ vector of **marginal costs** is\n",
"\n",
"$$\n",
"\\frac{\\partial C(q)}{\\partial q} = h + H q\n",
"$$\n",
"\n",
"where\n",
"\n",
"$$\n",
"H = \\frac{1}{2} (J + J^\\top)\n",
"$$\n",
"\n",
"The firm maximizes total profits by setting **marginal revenue to marginal costs**.\n",
"\n",
"An $ n \\times 1 $ vector of marginal revenues for the price-taking firm is $ \\frac{\\partial p^\\top q}\n",
"{\\partial q} = p $.\n",
"\n",
"So **price equals marginal revenue** for our price-taking competitive firm.\n",
"\n",
"This leads to the following **inverse supply curve** for the competitive firm:\n",
"\n",
"$$\n",
"p = h + H q\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "1f78d4f3",
"metadata": {},
"source": [
"### Competitive equilibrium\n",
"\n",
"To compute a competitive equilibrium for a production economy where demand curve is pinned down by the marginal utility of wealth $ \\mu $, we first compute an allocation by solving a planning problem.\n",
"\n",
"Then we compute the equilibrium price vector using the inverse demand or supply curve."
]
},
{
"cell_type": "markdown",
"id": "19802c13",
"metadata": {},
"source": [
"#### $ \\mu=1 $ warmup\n",
"\n",
"As a special case, let’s pin down a demand curve by setting the marginal utility of wealth $ \\mu =1 $.\n",
"\n",
"Equating supply price to demand price and letting $ q=c $ we get\n",
"\n",
"$$\n",
"p = h + H c = \\Pi^\\top b - \\Pi^\\top \\Pi c ,\n",
"$$\n",
"\n",
"which implies the equilibrium quantity vector\n",
"\n",
"\n",
"\n",
"$$\n",
"c = (\\Pi^\\top \\Pi + H )^{-1} ( \\Pi^\\top b - h) \\tag{40.8}\n",
"$$\n",
"\n",
"This equation is the counterpart of equilibrium quantity [(6.3)](https://intro.quantecon.org/intro_supply_demand.html#equation-eq-old1) for the scalar $ n=1 $ model with which we began."
]
},
{
"cell_type": "markdown",
"id": "7b177be5",
"metadata": {},
"source": [
"#### General $ \\mu\\neq 1 $ case\n",
"\n",
"Now let’s extend the preceding analysis to a more\n",
"general case by allowing $ \\mu \\neq 1 $.\n",
"\n",
"Then the inverse demand curve is\n",
"\n",
"\n",
"\n",
"$$\n",
"p = \\mu^{-1} [\\Pi^\\top b - \\Pi^\\top \\Pi c] \\tag{40.9}\n",
"$$\n",
"\n",
"Equating this to the inverse supply curve, letting $ q=c $ and solving\n",
"for $ c $ gives\n",
"\n",
"\n",
"\n",
"$$\n",
"c = [\\Pi^\\top \\Pi + \\mu H]^{-1} [ \\Pi^\\top b - \\mu h] \\tag{40.10}\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "365d1693",
"metadata": {},
"source": [
"### Implementation\n",
"\n",
"A Production Economy will consist of\n",
"\n",
"- a single **person** that we’ll interpret as a representative consumer \n",
"- a single set of **production costs** \n",
"- a multiplier $ \\mu $ that weights “consumers” versus “producers” in a planner’s welfare function, as described above in the main text \n",
"- an $ n \\times 1 $ vector $ p $ of competitive equilibrium prices \n",
"- an $ n \\times 1 $ vector $ c $ of competitive equilibrium quantities \n",
"- **consumer surplus** \n",
"- **producer surplus** \n",
"\n",
"\n",
"Here we define a class `ProductionEconomy`."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3c71fbb6",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"class ProductionEconomy:\n",
" \n",
" def __init__(self, \n",
" Π, \n",
" b, \n",
" h, \n",
" J, \n",
" μ):\n",
" \"\"\"\n",
" Set up the environment for a production economy\n",
"\n",
" Args:\n",
" Π (np.ndarray): matrix of substitution\n",
" b (np.array): bliss points\n",
" h (np.array): h in cost func\n",
" J (np.ndarray): J in cost func\n",
" μ (float): welfare weight of the corresponding planning problem\n",
" \"\"\"\n",
" self.n = len(b)\n",
" self.Π, self.b, self.h, self.J, self.μ = Π, b, h, J, μ\n",
" \n",
" def competitive_equilibrium(self):\n",
" \"\"\"\n",
" Compute a competitive equilibrium of the production economy\n",
" \"\"\"\n",
" Π, b, h, μ, J = self.Π, self.b, self.h, self.μ, self.J\n",
" H = .5 * (J + J.T)\n",
"\n",
" # allocation\n",
" c = inv(Π.T @ Π + μ * H) @ (Π.T @ b - μ * h)\n",
"\n",
" # price\n",
" p = 1 / μ * (Π.T @ b - Π.T @ Π @ c)\n",
"\n",
" # check non-satiation\n",
" if any(Π @ c - b >= 0):\n",
" raise Exception('invalid result: set bliss points further away')\n",
"\n",
" return c, p\n",
"\n",
" def compute_surplus(self):\n",
" \"\"\"\n",
" Compute consumer and producer surplus for single good case\n",
" \"\"\"\n",
" if self.n != 1:\n",
" raise Exception('not single good')\n",
" h, J, Π, b, μ = self.h.item(), self.J.item(), self.Π.item(), self.b.item(), self.μ\n",
" H = J\n",
"\n",
" # supply/demand curve coefficients\n",
" s0, s1 = h, H\n",
" d0, d1 = 1 / μ * Π * b, 1 / μ * Π**2\n",
"\n",
" # competitive equilibrium\n",
" c, p = self.competitive_equilibrium()\n",
"\n",
" # calculate surplus\n",
" c_surplus = d0 * c - .5 * d1 * c**2 - p * c\n",
" p_surplus = p * c - s0 * c - .5 * s1 * c**2\n",
"\n",
" return c_surplus, p_surplus"
]
},
{
"cell_type": "markdown",
"id": "dd476aa2",
"metadata": {},
"source": [
"Then define a function that plots demand and supply curves and labels surpluses and equilibrium."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "049b034b",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"def plot_competitive_equilibrium(PE):\n",
" \"\"\"\n",
" Plot demand and supply curves, producer/consumer surpluses, and equilibrium for\n",
" a single good production economy\n",
"\n",
" Args:\n",
" PE (class): A initialized production economy class\n",
" \"\"\"\n",
" # get singleton value\n",
" J, h, Π, b, μ = PE.J.item(), PE.h.item(), PE.Π.item(), PE.b.item(), PE.μ\n",
" H = J\n",
"\n",
" # compute competitive equilibrium\n",
" c, p = PE.competitive_equilibrium()\n",
" c, p = c.item(), p.item()\n",
"\n",
" # inverse supply/demand curve\n",
" supply_inv = lambda x: h + H * x\n",
" demand_inv = lambda x: 1 / μ * (Π * b - Π * Π * x)\n",
"\n",
" xs = np.linspace(0, 2 * c, 100)\n",
" ps = np.ones(100) * p\n",
" supply_curve = supply_inv(xs)\n",
" demand_curve = demand_inv(xs)\n",
"\n",
" # plot\n",
" plt.figure()\n",
" plt.plot(xs, supply_curve, label='Supply', color='#020060')\n",
" plt.plot(xs, demand_curve, label='Demand', color='#600001')\n",
"\n",
" plt.fill_between(xs[xs <= c], demand_curve[xs <= c], ps[xs <= c], label='Consumer surplus', color='#EED1CF')\n",
" plt.fill_between(xs[xs <= c], supply_curve[xs <= c], ps[xs <= c], label='Producer surplus', color='#E6E6F5')\n",
"\n",
" plt.vlines(c, 0, p, linestyle=\"dashed\", color='black', alpha=0.7)\n",
" plt.hlines(p, 0, c, linestyle=\"dashed\", color='black', alpha=0.7)\n",
" plt.scatter(c, p, zorder=10, label='Competitive equilibrium', color='#600001')\n",
"\n",
" plt.legend(loc='upper right')\n",
" plt.margins(x=0, y=0)\n",
" plt.ylim(0)\n",
" plt.xlabel('Quantity')\n",
" plt.ylabel('Price')\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"id": "1aa59944",
"metadata": {},
"source": [
"#### Example: single agent with one good and production\n",
"\n",
"Now let’s construct an example of a production economy with one good.\n",
"\n",
"To do this we\n",
"\n",
"- specify a single **person** and a **cost curve** in a way that let’s us replicate the simple single-good supply demand example with which we started \n",
"- compute equilibrium $ p $ and $ c $ and consumer and producer surpluses \n",
"- draw graphs of both surpluses \n",
"- do experiments in which we shift $ b $ and watch what happens to $ p, c $. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "70da1ec6",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"Π = np.array([[1]]) # the matrix now is a singleton\n",
"b = np.array([10])\n",
"h = np.array([0.5])\n",
"J = np.array([[1]])\n",
"μ = 1\n",
"\n",
"PE = ProductionEconomy(Π, b, h, J, μ)\n",
"c, p = PE.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price:', p.item())\n",
"print('Competitive equilibrium allocation:', c.item())\n",
"\n",
"# plot\n",
"plot_competitive_equilibrium(PE)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d0fe85f2",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"c_surplus, p_surplus = PE.compute_surplus()\n",
"\n",
"print('Consumer surplus:', c_surplus.item())\n",
"print('Producer surplus:', p_surplus.item())"
]
},
{
"cell_type": "markdown",
"id": "0db6b64d",
"metadata": {},
"source": [
"Let’s give the consumer a lower welfare weight by raising $ \\mu $."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c0020446",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"PE.μ = 2\n",
"c, p = PE.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price:', p.item())\n",
"print('Competitive equilibrium allocation:', c.item())\n",
"\n",
"# plot\n",
"plot_competitive_equilibrium(PE)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2395a7ec",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"c_surplus, p_surplus = PE.compute_surplus()\n",
"\n",
"print('Consumer surplus:', c_surplus.item())\n",
"print('Producer surplus:', p_surplus.item())"
]
},
{
"cell_type": "markdown",
"id": "3663fe6e",
"metadata": {},
"source": [
"Now we change the bliss point so that the consumer derives more utility from consumption."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0cbca2a8",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"PE.μ = 1\n",
"PE.b = PE.b * 1.5\n",
"c, p = PE.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price:', p.item())\n",
"print('Competitive equilibrium allocation:', c.item())\n",
"\n",
"# plot\n",
"plot_competitive_equilibrium(PE)"
]
},
{
"cell_type": "markdown",
"id": "063ae845",
"metadata": {},
"source": [
"This raises both the equilibrium price and quantity."
]
},
{
"cell_type": "markdown",
"id": "a9577e2c",
"metadata": {},
"source": [
"#### Example: single agent two-good economy with production\n",
"\n",
"- we’ll do some experiments like those above \n",
"- we can do experiments with a **diagonal** $ \\Pi $ and also with a **non-diagonal** $ \\Pi $ matrices to study how cross-slopes affect responses of $ p $ and $ c $ to various shifts in $ b $ (TODO) "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1a28bba4",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"Π = np.array([[1, 0],\n",
" [0, 1]])\n",
"\n",
"b = np.array([10, 10])\n",
"\n",
"h = np.array([0.5, 0.5])\n",
"\n",
"J = np.array([[1, 0.5],\n",
" [0.5, 1]])\n",
"μ = 1\n",
"\n",
"PE = ProductionEconomy(Π, b, h, J, μ)\n",
"c, p = PE.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price:', p)\n",
"print('Competitive equilibrium allocation:', c)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b35c032b",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"PE.b = np.array([12, 10])\n",
"\n",
"c, p = PE.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price:', p)\n",
"print('Competitive equilibrium allocation:', c)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c9efeb46",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"PE.Π = np.array([[1, 0.5],\n",
" [0.5, 1]])\n",
"\n",
"PE.b = np.array([10, 10])\n",
"\n",
"c, p = PE.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price:', p)\n",
"print('Competitive equilibrium allocation:', c)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9289ec49",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"PE.b = np.array([12, 10])\n",
"c, p = PE.competitive_equilibrium()\n",
"\n",
"print('Competitive equilibrium price:', p)\n",
"print('Competitive equilibrium allocation:', c)"
]
},
{
"cell_type": "markdown",
"id": "e036f06d",
"metadata": {},
"source": [
"### Digression: a supplier who is a monopolist\n",
"\n",
"A competitive firm is a **price-taker** who regards the price and therefore its marginal revenue as being beyond its control.\n",
"\n",
"A monopolist knows that it has no competition and can influence the price and its marginal revenue by\n",
"setting quantity.\n",
"\n",
"A monopolist takes a **demand curve** and not the **price** as beyond its control.\n",
"\n",
"Thus, instead of being a price-taker, a monopolist sets prices to maximize profits subject to the inverse demand curve\n",
"[(40.9)](#equation-eq-old5pa).\n",
"\n",
"So the monopolist’s total profits as a function of its output $ q $ is\n",
"\n",
"\n",
"\n",
"$$\n",
"[\\mu^{-1} \\Pi^\\top (b - \\Pi q)]^\\top q - h^\\top q - \\frac{1}{2} q^\\top J q \\tag{40.11}\n",
"$$\n",
"\n",
"After finding\n",
"first-order necessary conditions for maximizing monopoly profits with respect to $ q $\n",
"and solving them for $ q $, we find that the monopolist sets\n",
"\n",
"\n",
"\n",
"$$\n",
"q = (H + 2 \\mu^{-1} \\Pi^\\top \\Pi)^{-1} (\\mu^{-1} \\Pi^\\top b - h) \\tag{40.12}\n",
"$$\n",
"\n",
"We’ll soon see that a monopolist sets a **lower output** $ q $ than does either a\n",
"\n",
"- planner who chooses $ q $ to maximize social welfare \n",
"- a competitive equilibrium "
]
},
{
"cell_type": "markdown",
"id": "d386b34d",
"metadata": {},
"source": [
"### Exercise 40.4\n",
"\n",
"Please verify the monopolist’s supply curve [(40.12)](#equation-eq-qmonop)."
]
},
{
"cell_type": "markdown",
"id": "519d82ee",
"metadata": {},
"source": [
"### A monopolist\n",
"\n",
"Let’s consider a monopolist supplier.\n",
"\n",
"We have included a method in our `ProductionEconomy` class to compute an equilibrium price and allocation when the supplier is a monopolist.\n",
"\n",
"Since the supplier now has the price-setting power\n",
"\n",
"- we first compute the optimal quantity that solves the monopolist’s profit maximization problem. \n",
"- Then we back out an equilibrium price from the consumer’s inverse demand curve. \n",
"\n",
"\n",
"Next, we use a graph for the single good case to illustrate the difference between a competitive equilibrium and an equilibrium with a monopolist supplier.\n",
"\n",
"Recall that in a competitive equilibrium, a price-taking supplier equates marginal revenue $ p $ to marginal cost $ h + Hq $.\n",
"\n",
"This yields a competitive producer’s inverse supply curve.\n",
"\n",
"A monopolist’s marginal revenue is not constant but instead is a non-trivial function of the quantity it sets.\n",
"\n",
"The monopolist’s marginal revenue is\n",
"\n",
"$$\n",
"MR(q) = -2\\mu^{-1}\\Pi^{\\top}\\Pi q+\\mu^{-1}\\Pi^{\\top}b,\n",
"$$\n",
"\n",
"which the monopolist equates to its marginal cost.\n",
"\n",
"The plot indicates that the monopolist’s sets output lower than either the competitive equilibrium quantity.\n",
"\n",
"In a single good case, this equilibrium is associated with a higher price of the good."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9d37134f",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"class Monopoly(ProductionEconomy):\n",
" \n",
" def __init__(self, \n",
" Π, \n",
" b, \n",
" h, \n",
" J, \n",
" μ):\n",
" \"\"\"\n",
" Inherit all properties and methods from class ProductionEconomy\n",
" \"\"\"\n",
" super().__init__(Π, b, h, J, μ)\n",
" \n",
"\n",
" def equilibrium_with_monopoly(self):\n",
" \"\"\"\n",
" Compute the equilibrium price and allocation when there is a monopolist supplier\n",
" \"\"\"\n",
" Π, b, h, μ, J = self.Π, self.b, self.h, self.μ, self.J\n",
" H = .5 * (J + J.T)\n",
"\n",
" # allocation\n",
" q = inv(μ * H + 2 * Π.T @ Π) @ (Π.T @ b - μ * h)\n",
"\n",
" # price\n",
" p = 1 / μ * (Π.T @ b - Π.T @ Π @ q)\n",
"\n",
" if any(Π @ q - b >= 0):\n",
" raise Exception('invalid result: set bliss points further away')\n",
"\n",
" return q, p"
]
},
{
"cell_type": "markdown",
"id": "05669852",
"metadata": {},
"source": [
"Define a function that plots the demand, marginal cost and marginal revenue curves with surpluses and equilibrium labelled."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c91dcf1e",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"def plot_monopoly(M):\n",
" \"\"\"\n",
" Plot demand curve, marginal production cost and revenue, surpluses and the\n",
" equilibrium in a monopolist supplier economy with a single good\n",
"\n",
" Args:\n",
" M (class): A class inherits class ProductionEconomy with monopoly\n",
" \"\"\"\n",
" # get singleton value\n",
" J, h, Π, b, μ = M.J.item(), M.h.item(), M.Π.item(), M.b.item(), M.μ\n",
" H = J\n",
"\n",
" # compute competitive equilibrium\n",
" c, p = M.competitive_equilibrium()\n",
" q, pm = M.equilibrium_with_monopoly()\n",
" c, p, q, pm = c.item(), p.item(), q.item(), pm.item()\n",
"\n",
" # compute\n",
"\n",
" # inverse supply/demand curve\n",
" marg_cost = lambda x: h + H * x\n",
" marg_rev = lambda x: -2 * 1 / μ * Π * Π * x + 1 / μ * Π * b\n",
" demand_inv = lambda x: 1 / μ * (Π * b - Π * Π * x)\n",
"\n",
" xs = np.linspace(0, 2 * c, 100)\n",
" pms = np.ones(100) * pm\n",
" marg_cost_curve = marg_cost(xs)\n",
" marg_rev_curve = marg_rev(xs)\n",
" demand_curve = demand_inv(xs)\n",
"\n",
" # plot\n",
" plt.figure()\n",
" plt.plot(xs, marg_cost_curve, label='Marginal cost', color='#020060')\n",
" plt.plot(xs, marg_rev_curve, label='Marginal revenue', color='#E55B13')\n",
" plt.plot(xs, demand_curve, label='Demand', color='#600001')\n",
"\n",
" plt.fill_between(xs[xs <= q], demand_curve[xs <= q], pms[xs <= q], label='Consumer surplus', color='#EED1CF')\n",
" plt.fill_between(xs[xs <= q], marg_cost_curve[xs <= q], pms[xs <= q], label='Producer surplus', color='#E6E6F5')\n",
"\n",
" plt.vlines(c, 0, p, linestyle=\"dashed\", color='black', alpha=0.7)\n",
" plt.hlines(p, 0, c, linestyle=\"dashed\", color='black', alpha=0.7)\n",
" plt.scatter(c, p, zorder=10, label='Competitive equilibrium', color='#600001')\n",
"\n",
" plt.vlines(q, 0, pm, linestyle=\"dashed\", color='black', alpha=0.7)\n",
" plt.hlines(pm, 0, q, linestyle=\"dashed\", color='black', alpha=0.7)\n",
" plt.scatter(q, pm, zorder=10, label='Equilibrium with monopoly', color='#E55B13')\n",
"\n",
" plt.legend(loc='upper right')\n",
" plt.margins(x=0, y=0)\n",
" plt.ylim(0)\n",
" plt.xlabel('Quantity')\n",
" plt.ylabel('Price')\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"id": "a3512f72",
"metadata": {},
"source": [
"#### A multiple good example\n",
"\n",
"Let’s compare competitive equilibrium and monopoly outcomes in a multiple goods economy."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "12491103",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"Π = np.array([[1, 0],\n",
" [0, 1.2]])\n",
"\n",
"b = np.array([10, 10])\n",
"\n",
"h = np.array([0.5, 0.5])\n",
"\n",
"J = np.array([[1, 0.5],\n",
" [0.5, 1]])\n",
"μ = 1\n",
"\n",
"M = Monopoly(Π, b, h, J, μ)\n",
"c, p = M.competitive_equilibrium()\n",
"q, pm = M.equilibrium_with_monopoly()\n",
"\n",
"print('Competitive equilibrium price:', p)\n",
"print('Competitive equilibrium allocation:', c)\n",
"\n",
"print('Equilibrium with monopolist supplier price:', pm)\n",
"print('Equilibrium with monopolist supplier allocation:', q)"
]
},
{
"cell_type": "markdown",
"id": "bb6b9d78",
"metadata": {},
"source": [
"#### A single-good example"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7ac3ac4b",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"Π = np.array([[1]]) # the matrix now is a singleton\n",
"b = np.array([10])\n",
"h = np.array([0.5])\n",
"J = np.array([[1]])\n",
"μ = 1\n",
"\n",
"M = Monopoly(Π, b, h, J, μ)\n",
"c, p = M.competitive_equilibrium()\n",
"q, pm = M.equilibrium_with_monopoly()\n",
"\n",
"print('Competitive equilibrium price:', p.item())\n",
"print('Competitive equilibrium allocation:', c.item())\n",
"\n",
"print('Equilibrium with monopolist supplier price:', pm.item())\n",
"print('Equilibrium with monopolist supplier allocation:', q.item())\n",
"\n",
"# plot\n",
"plot_monopoly(M)"
]
},
{
"cell_type": "markdown",
"id": "62fa51fd",
"metadata": {},
"source": [
"## Multi-good welfare maximization problem\n",
"\n",
"Our welfare maximization problem – also sometimes called a social planning problem – is to choose $ c $ to maximize\n",
"\n",
"$$\n",
"- \\frac{1}{2} \\mu^{-1}(\\Pi c -b) ^\\top (\\Pi c -b )\n",
"$$\n",
"\n",
"minus the area under the inverse supply curve, namely,\n",
"\n",
"$$\n",
"h c + \\frac{1}{2} c^\\top J c\n",
"$$\n",
"\n",
"So the welfare criterion is\n",
"\n",
"$$\n",
"- \\frac{1}{2} \\mu^{-1}(\\Pi c -b)^\\top (\\Pi c -b ) -h c \n",
" - \\frac{1}{2} c^\\top J c\n",
"$$\n",
"\n",
"In this formulation, $ \\mu $ is a parameter that describes how the planner weighs interests of outside suppliers and our representative consumer.\n",
"\n",
"The first-order condition with respect to $ c $ is\n",
"\n",
"$$\n",
"- \\mu^{-1} \\Pi^\\top \\Pi c + \\mu^{-1}\\Pi^\\top b - h - H c = 0\n",
"$$\n",
"\n",
"which implies [(40.10)](#equation-eq-old5p).\n",
"\n",
"Thus, as for the single-good case, with multiple goods a competitive equilibrium quantity vector solves a planning problem.\n",
"\n",
"(This is another version of the first welfare theorem.)\n",
"\n",
"We can deduce a competitive equilibrium price vector from either\n",
"\n",
"- the inverse demand curve, or \n",
"- the inverse supply curve "
]
}
],
"metadata": {
"date": 1712983678.4341943,
"filename": "supply_demand_multiple_goods.md",
"kernelspec": {
"display_name": "Python",
"language": "python3",
"name": "python3"
},
"title": "Supply and Demand with Many Goods"
},
"nbformat": 4,
"nbformat_minor": 5
}