Supply and Demand: Consumer Surplus¶
GOALS:
- Understand concepts of consumer and producer surplus
- Use definite integrals to solve problems involving consumer and producer surplus
Economists will often refer to supply and demand curves.
A supply curve is a cost of production function that relates some quantity of goods to a price that attracts this amount at market.
A demand curve is a function that relates a quantity of goods to a price that the market would be cleared of that quantity.
For example, suppose we have a supply curve \(S\) as:
and a demand curve \(D\) of:
We can plot these as follows.
In [12]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import sympy as sy
In [2]:
def S(q):
return (q**2)
def D(q):
return (q - 20)**2
q = np.linspace(0, 16, 1000)
In [4]:
plt.figure(figsize = (10,6))
plt.plot(q, S(q), label = "Supply Curve")
plt.plot(q, D(q), label = "Demand Curve")
plt.title("Supply and Demand")
plt.legend(frameon = False)
plt.xlabel("Quantity $q$")
plt.ylabel("Price")
Out[4]:
Text(0,0.5,'Price')
Equilibrium Price¶
Where the Supply and Demand curves intersect, we have the equilibrium price for the good under consideration. In order to find this value, we need to solve the equation:
We can use Sympy to accomplish this with the Eq
and Solve
commands.
In [5]:
q = sy.Symbol('q')
eq = sy.Eq(S(q), D(q))
sy.solve(eq)
Out[5]:
[10]
In [6]:
S(10)
Out[6]:
100
Now, we can update our plot to include this point and add some text and
an arrow pointing to the equilibrium point using the matplotlib’s
annotate
function. The draws an arrow with some text to a point on
the graph.
In [11]:
fig = plt.figure(figsize= (14, 8))#create figure and reset q to be numbers
q = np.linspace(0, 16, 1000)
ax = fig.add_subplot(111)
plt.plot(q, S(q), label = "Supply Curve")#plot supply, demand, and equilibrium points
plt.plot(q, D(q), label = "Demand Curve")
plt.plot(10, 100, 'o', markersize = 14)
plt.title("Supply and Demand")#add titles and legend
plt.legend(frameon = False)
plt.xlabel("Quantity $q$")
plt.ylabel("Price")
#ax = plt.axes()#add arrow with annotation
ax.annotate('Equilibrium at (10, 100)', xy=(10,100), xytext=(10, 250), arrowprops=dict(facecolor='black'))
Out[11]:
Text(10,250,'Equilibrium at (10, 100)')
Price Discrimination¶
Price discrimination refers to the different prices that different consumers are willing to pay for the same product. For example, some people may be willing to pay $16 for a six pack of beer while others would refuse. In order to address different consumers, a corporation might do something like market the same beer under a different logo and name in different kinds of stores.
If the goods producer is able to determine this perfectly, they will have achieved perfect price discrimination. The beer example demonstrates only a partial price discrimination. An example of perfect price discrimination might be a pay what you want approach where each consumer determine their own price for a good.
In a partial price discrimination scenario, we would have a picture like our step functions, where the width of each rectangle represents a quantity of a good and the height represents the price that this amount of goods sells for.
Let’s visualize the Partial and Perfect Price discrimination situation where we have \(\Delta q = 1\).
In [7]:
q = np.arange(0, 16, 1)
In [8]:
plt.figure(figsize = (8, 5))
plt.bar(q, D(q), alpha = 0.1, width = 1)
plt.title("Partial Price Discrimination")
plt.xlabel("Quantity of good $q$")
plt.ylabel("Price of good $p$")
ax = plt.axes()
ax.annotate('sell $\Delta q$ at price $p$', xy=(4, D(4)), xytext=(10, 250), arrowprops=dict(facecolor='black'))
Out[8]:
<matplotlib.text.Annotation at 0x113a79710>
The area of one of the rectangles then represents the revenue to the producer. Consider the first rectangle. Here, we have 1 unit of a good and sell this at $400. Similarly, we sell a second unit of this good for $300. From these sales we would have mad $700 in total.
Perfect Price Discrimination would be modeled by the continuous case and the Revenue by the Definite Integral.
In [9]:
q = np.linspace(0, 16, 1000)
plt.figure(figsize = (9, 6))
plt.plot(q, D(q))
plt.fill_between(q, D(q), alpha = 0.1)
plt.title("Perfect Price Discrimination")
plt.xlabel("Quantity of good $q$")
plt.ylabel("Price of good $p$")
ax = plt.axes()
ax.annotate('Area Under Curve is Revenue \n$\int_0^{16}D(q) dq$', xy=(4, D(4)), xytext=(10, 250), arrowprops=dict(facecolor='black'))
Out[9]:
<matplotlib.text.Annotation at 0x113328f98>
The Consumer Surplus¶
When a marketplace finds consumers paying the same price for a good, we are at the equilibrium price. Here, if you think about moving backwards from equilibrium, the price of the good rises, its suppy falls, and there are fewer transactions. Another way to interpret the area under the Demand curve, is as the value to consumers.
If there is a difference between this value and what the consumers end up paying, we have a consumer surplus. This is represented graphically as the area determined by the rectangle formed by the equilibrium price. The difference between the area under the Demand curve and this rectangle is the consumer surplus.
In [10]:
plt.figure(figsize = (12,7))
plt.plot(q, D(q))
plt.plot(q, S(q))
plt.fill_between(q, D(q), 100, where = (D(q) > 100), color = 'green', alpha = 0.5, hatch = '-')
plt.fill_between(q, 100, where = (q<10), alpha = 0.3, hatch = '|')
plt.title("Consumer Surplus")
plt.xlabel("Quantity of good $q$")
plt.ylabel("Price of good $p$")
ax = plt.axes()
ax.annotate('Consumer Surplus', xy=(4, 200), xytext=(8, 300), arrowprops=dict(facecolor='black'))
ax.annotate('Total Revenue', xy = (5, 50), xytext = (12,100), arrowprops=dict(facecolor='black'))
Out[10]:
<matplotlib.text.Annotation at 0x113f01320>
This would be determined by the area under the Demand Curve, but above the horizontal line formed by the equlibrium price(\(p^\star\)). Thus, we can represent this with the definite integral:
Example¶
Suppose the supply curve is approximated by the function
and the demand curve by the function
for \(0 \leq q \leq 65,000\). Determine the equilibrium price and Consumer Surplus.
PROBLEMS¶
For the problems below, find the equilibrium price and quantity and the consumer surplus for the gien supply and demand functions. Assume price is in dollars per unit and quantity is in units.
Problem 2:
Problem 3:
Problem 4:
Problem 5: Discrimination by consumers means buying each additional unit \((\Delta q_i)\) at cost (which is \(S(q_i)\). Total revenue now become equal to this since
Make an argument that this represenets the cost to the producers of the goos sold on the market. Thus arguing that the area below the equilibruim price line and above the supply curve, \(p = S(q)\) on producers in a competitive market, the producer’s surplus. Make a visualization of this concept. Give the integral formula for the producer’s surplus. Calculate the producer’s surplus for each of the problems 1 - 4.