load(draw)$ 
set_draw_defaults(draw_realpart=false)$
fpprintprec:5$ ratprint:false$ kill(all)$

# Oligopoly

This chapter examines models that offer insights into the behavior of
oligopolists.

## Introduction and Overview

## The Cournot Model

## The Bertrand Model

Bertrand's model of duopoly treats each firm as taking the other's price,
not quantity, as given. The simplest Bertrand model is one in which two 
firms produce identical goods, so that a single price pertains at equilibrium.

We restate the demand for the product and the two sellers' marginal cost.

kill(all)$
p(x1,x2,A,B):= A + B*(x1 + x2)$
[mc1(x1,b1,c1) := b1 + c1*x1, mc2(x2,b2,c2):= b2+c2*x2]$
[A0:100,B0:-2,b10:5,c10:2,b20:10,c20:1]$
[p(x1,x2,A0,B0),mc1(x1,b10,c10),mc2(x2,b20,c20)]$

The demand and marginal revenue curves that face a seller are no 
longer continuous and differentiable functions. The if...then...else
statements below define the relevant functions.

p1(x1,A,B,p2):= if A+B*x1>p2 then p2 else A+B*x1$
mr1(x1,A,B,p2):=if A+B*x1>p2 then p2 else A+2*B*x1$
p2(x2,A,B,p1):= if A+B*x2>p1 then p1 else A+B*x2$
mr2(x2,A,B,p1):=if A+B*x2>p1 then p1 else A+2*B*x2$

Each firm reacts to whatever price the other firm charges. 
We begin by defining one such price pair, the prices that 
would result if each firm were the only firm in the industry.
Firm1 would produce x1 = 15.833 units and set p = 68.333. 
Likewise, x2 = 18.0 and p2 = 64.0.

Firm1: ["1", x10: float(rhs(solve(
  A0+2*B0*x1=b10+c10*x1,x1)[1])), p10:A0+B0*x10]$
Firm2: ["2",x20: float(rhs(solve(
  A0+2*B0*x2=b20+c20*x2,x2)[1])),p20:A0+B0*x20]$
matrix(["Firm","Monopoly x","Monopoly p"],Firm1,Firm2);

We begin to examine the price-setting process by evaluating the 
inverse demand and marginal revenue functions given this pair of prices.

p1(x1,A0,B0,p20);  mr1(x1,A0,B0,p20);
p2(x2,A0,B0,p10);  mr2(x2,A0,B0,p10);

When the demand curve is horizontal, p = mr. That is, each firm can sell
at the same price as the other firm. The kinks in the demand curves 
generate discontinuities in the marginal revenue curves.

The graph below shows that Firm1 has an incentive to 
reduce the price below $64 (mr > mc). This action shifts
the horizontal section of Firm2's demand curve downward so that,
over the relevant range mr is just under $64, which exceeds mc,
so Firm2 has an incentive to further reduce the price.

Firm1:gr2d(yrange=[-A0/10,max(p10,p20)+1],
xaxis=true,xlabel="x1",ylabel="$ per unit",key="mc1",
line_width=2,explicit(mc1(x1,b10,c10),x1,0,-A0/B0), 
color=black,key="p1",
explicit(p1(x1,A0,B0,p20),x1,0,-A0/B0 ),
color=red,key="mr1",
explicit(mr1(x1,A0,B0,p20),x1,x20,-A0/B0 ))$
Firm2:gr2d(yrange=[-A0/10,max(p10,p20)+1],
xaxis=true,xlabel="x2",ylabel="$ per unit",
line_width=2,key="mc2",
explicit(mc2(x2,b20,c20),x2,0,-A0/B0), 
color=black,key="p2",
explicit(p2(x2,A0,B0,p10),x2,0,-A0/B0 ),
color=red,key="mr2",
explicit(mr2(x1,A0,B0,p10),x1,x20,-A0/B0 ))$
wxdraw(Firm1,Firm2,columns=2,dimensions=[640,480])$

### The Competitive Equilibrium

The result of the process whose first steps are indicated above 
is the competitive outcome. To see this, define the competitive 
outcome and confirm that, this outcome, neither firm gains
by changing its behavior.

The next cell defines the competitive supply expression, Xs.

solnx1: solve(mc1(x1,b1,c1)=p,x1);
solnx2: solve(mc2(x2,b2,c2)=p,x2);
Xs: rhs(solnx1[1])+rhs(solnx2[1]);

We derive the demand curve from the expression for the inverse demand curve
and set that expression, Xd, equal to Xs. The resulting price is $31.25.

print("The demand curve is ",Xd: rhs(solve(A+B*X = p,X)[1]))$
print("The expression for the competitive price is ",
       pcomp: float(rhs(solve(Xs=Xd,p)[1])))$  
print("The competitive price is ",
       pcomp0:subst([A=A0,B=B0,b1=b10,c1=c10,b2=b20,c2=c20],pcomp))$

TeX:
The cell below confirms that the quantity demanded equals the
quantity supplied.

matrix(["Demand price","Supply price"],
subst([A=A0,B=B0,b1=b10,c1=c10,b2=b20,c2=c20,p=pcomp0],
  [Xd,Xs]) );

The graph below replicates the previous one, except that the 
part of marginal revenue that corresponds to the downward-sloping
segment of each firm's demand curve is removed.

At this price level, both firms produce the quantity at which
mc = mr = p, so neither has an incentive to change the quantity sold. 

Firm1:gr2d(yrange=[-A0/10,max(p10,p20)+1],
 xaxis=true,xlabel="x1",ylabel="$ per unit",
 user_preamble="set key bottom left",
 line_width=2,key="mc1",explicit(mc1(x1,b10,c10),x1,0,-A0/B0), 
 key="p1",color=black,
 explicit(p1(x1,A0,B0,pcomp0),x1,0,-A0/B0 )/*, This comment deletes the mr
 color=red,key="mr1",
 explicit(mr1(x1,A0,B0,pcomp0),x1,x20,-A0/B0 )*/)$

Firm2:gr2d(yrange=[-A0/10,max(p10,p20)+1],
 xaxis=true,xlabel="x2",ylabel="$ per unit",
 line_width=2,key="mc2",
 explicit(mc2(x2,b20,c20),x2,0,-A0/B0), 
 color=black,key="p2",
 explicit(p2(x2,A0,B0,pcomp0),x2,0,-A0/B0 )
 /*,This command deletes the mrcolor=red,key="mr2",
explicit(mr2(x1,A0,B0,pcomp0),x1,x20,-A0/B0 )*/   )$

wxdraw(Firm1,Firm2,columns=2,dimensions=[640,480])$

Of all possible exogenous prices, p = 31.25 is the only one at which both 
firms' expectations are consistent with a cleared market. 

Neither firm has any reason to change its behavior. For both firms, mc = 
mr = p.

solnx1x2: float(solve([b10+c10*x1=pcomp0,b20+c20*x2=pcomp0],[x1,x2])[1]);
[x1comp0,x2comp0]:[rhs(solnx1x2[1]),rhs(solnx1x2[2])]$
Xcomp0 : x1comp0+x2comp0$   Xdemand0 : -(A0 -pcomp0)/B0$
matrix(["x1comp0","x2comp0","Xcomp0","Xdemand0"],[x1comp0,x2comp0,Xcomp0,Xdemand0]);

### An Alternative Specification

Assuming that each firm expects the other to match its price results in a 
model in which the price cannot reach the competitive level. To see why,
determine the elasticity of demand for each firm's product given this
assumption. The firm's revenue from a price change will be offset by two 
responses to the change: 
*market quantity demanded changes in the opposite direction, and 
*the quantity supplied by the other firm moves in the same direction as the 
price.  The value of the first factor is 1/B, and the value of the second 
is the inverse of the slope of the other firm's marginal cost curve.

The implications for marginal revenue appear below, if we begin with the 
competitive price, $31.25. For each firm, $mr < mc$, so both each firm would 
gain from raising its price, even though the other would match the price increase.

Ep10: (1/B0-1/c20)*pcomp0/x1comp0$ mr10: 
pcomp0*(1+1/Ep10)$     
Ep20: (1/B0-1/c10)*pcomp0/x2comp0$ 
mr20: pcomp0*(1+1/Ep20)$    matrix(
 ["","Elasticity","mr"],["Firm1",Ep10,mr10],
 ["Firm2",Ep20,mr20]);

The cell below generalizes the expressions above, defining 
the two price elasticities and marginal revenue values in terms 
of price and the system's parameters. The table shows the values
given the parameter values used in this section.

[E1,E2] : [(1/B - 1/c2)*p/x1, (1/B - 1/c1)*p/x2]$
[mr1,mr2] : [p*(1+1/E1), p*(1 + 1/E2 )]$
[E10,E20,mr10,mr20]:subst([A=A0,B=B0,c1=c10,c2=c20],
   [E1,E2,mr1,mr2])$
matrix(["","Elasticity","Marginal Revenue"],
 ["Firm 1",E10,mr10],["Firm 2", E20,mr20]);

The next cell solves for p, x1, and x2.

solnx1x2p: solve([mr1=b1+c1*x1, mr2=b2+c2*x2,
   p=A+B*(x1+x2)],[p,x1,x2])[1];

TeX:
Substituting the parameter values into the solution defined above generates
a set of prices and quantities that are consistent with equilibrium. 

solnx1x2p0:float(subst([A=A0,B=B0,b1=b10,c1=c10,b2=b20,c2=c20],solnx1x2p));
[pBeq0,x1Beq0,x2Beq0] :[rhs(solnx1x2p0[1]), rhs(solnx1x2p0[2]), rhs(solnx1x2p0[3])]$

Given these values, elasticity and marginal revenue values are generated.

[E1Beq0,E2Beq0,mr10,mr20]:subst(
  [p=pBeq0,x1=x1Beq0,x2=x2Beq0,B=B0,c1=c10,c2=c20],
  [E10,E20,mr1,mr2]);

The values above appear in the table below along with each firm's
marginal cost. Each firm produces the value for which mr = mc.

[mc10: b10+c10*x1Beq0, mc20: b20+c20*x2Beq0]$
matrix(["E1Beq0","E2Beq0","mr10","mc10", "mr20","mc20"],
  [E1Beq0,E2Beq0,mr10,mc10, mr20,mc20]);

The graph represents these values. At p = $41.364, Firm1's and 
Firm2's mr values are shown by the + that appears where mc = mr.

Firm1:gr2d(yrange=[0,max(p10,p20)+1],
 xaxis=true,xlabel="x1",ylabel="$ per unit",
 line_width=2,key="mc1",
 explicit(mc1(x1,b10,c10),x1,0,-A0/B0), 
 color=black,key="p1",
 explicit(p1(x1,A0,B0,pBeq0),x1,0,-A0/B0 ),
 color=red, key="mr10",
 points_joined=true,line_type=dots,
 points([[x1Beq0,mr10],[0,mr10]]))$

Firm2:gr2d(yrange=[0,max(p10,p20)+1],
 xaxis=true,xlabel="x2",ylabel="$ per unit",
 line_width=2,key="mc2",
 explicit(mc2(x2,b20,c20),x2,0,-A0/B0), 
 color=black,key="p2",
 explicit(p2(x2,A0,B0,pBeq0),x2,0,-A0/B0 ),
 color=red,key="mr20",
 points_joined=true,line_type=dots,
 points([[x2Beq0,mr20],[0,mr20]]) )$

wxdraw(Firm1,Firm2,columns=2,dimensions=[640,400])$