The Market's Split Is Hard to Beat

first welfare theorem · Pareto improvement · competitive equilibrium · utility comparison

Two households, A and B, trade wool (good 1) and apples (good 2). A owns endow_A = (e_{A1}, e_{A2}) and B owns endow_B; together they have X = e_{A1} + e_{B1} kg of wool and Y = e_{A2} + e_{B2} kg of apples. Their tastes are Cobb-Douglas, u_A = x^{a} y^{1-a} and u_B = x^{b} y^{1-b}, so at prices (1, p_2) (wool is the numeraire) a household with share s and income m, the value of its endowment, buys s\,m kg of wool and (1 - s)\,m / p_2 kg of apples.

The competitive equilibrium is the price p_2 at which these choices use up exactly X and Y. The first welfare theorem says the equilibrium allocation is Pareto efficient: no other split of X and Y makes one household better off without making the other worse off. Test it.

A town committee suggests other splits. Each proposal is A's bundle (x, y), with 0 \le x \le X and 0 \le y \le Y; B gets the rest, (X - x, Y - y). Compare each proposal with the equilibrium, household by household, counting two utilities as equal when |u - v| \le 10^{-9} \cdot \max(1, |u|, |v|):

  • "same": both households are equally well off;
  • "equilibrium better": in the equilibrium nobody is worse off and somebody is better off;
  • "proposal better": under the proposal nobody is worse off and somebody is better off;
  • "neither": one household prefers the equilibrium and the other the proposal.

Write welfare_check(a, b, endow_A, endow_B, proposals) that returns a tuple (p2, (uA, uB), verdicts): the equilibrium price, the two equilibrium utilities, and one verdict per proposal.

Examples

Input:  a = 0.4, b = 0.5, endow_A = (20, 0), endow_B = (0, 60),
        proposals = [(20, 0), (12, 20), (10, 30), (8, 30)]
Output: (0.4, (17.68107831, 18.97366596),
         ['equilibrium better', 'equilibrium better', 'neither', 'same'])
Explanation: in equilibrium A gets (8, 30) and B gets (12, 30). With no trade at all
both utilities are 0. Under (12, 20) A has 16.30 and B, with (8, 40), 17.89: both lose.
(10, 30) gives A more wool and B less: A gains, B loses. (8, 30) is the equilibrium itself.

Input:  a = 0.25, b = 0.75, endow_A = (6, 3), endow_B = (2, 9), proposals = [(6, 3), (4, 6)]
Output: (0.66666667, (6.17930143, 5.04537849), ['equilibrium better', 'equilibrium better'])

Constraints

  • answers are compared with a relative tolerance of 1e-6; do not round

Goals

  • Compute a two-person exchange equilibrium and each person's utility in it
  • Compare two allocations person by person: one Pareto-improves on the other, they are equal, or neither
  • Check the first welfare theorem numerically: no feasible split beats the equilibrium for both
Starting Python…