# Profit Maximizing Quantity (Linear Demand)

Consider a situation of a monopolist facing a linear demand curve

\begin{align}
    D(p) &= a - b p
\end{align}

where $a, b > 0$.  The firm will produce exactly enough units of their product to meet the demand $D(p)$ and it costs them $c > 0$ to produce each unit of product.  The total profits the monopolist expects from choosing price $p>0$ is

\begin{align}
    \pi(p) &= (a - bp)p - c(a - bp) \\
    &= (p - c)(a - bp)
\end{align}

To identify the profit maximizing price we need to identify a local maximum consisting of a critical point, an $x^*$ that satisfies a first order condition $\frac{d\pi }{dp} (x^*) = 0$ and a second order condition $\frac{d^2 \pi}{d x^2}(x^*) < 0$.


```python
from sympy import *
init_printing()
```


```python
a, b, c, P = symbols('a b c P',
                     real=True,
                     positive=True,
                     finite=True)
demand = a - b * P
revenue = P * demand
cost = c * demand
profit = factor(revenue - cost)

Eq(Symbol('\pi(P)'), profit)
```


```python
# To satisfy the first order condition
# for a maximum we take the derivative
# of the profit function w.r.t. p
DP = profit.diff(P)
Eq(Symbol('\\frac{d \pi}{d p}'), DP)
```


```python
# Set the derivative equal to zero
# and solve for p.
P_star = solve(DP, P)[0]
Eq(Symbol('P^{*}(a,b,c)'), P_star)
```

Now that we have the price that satisfies the first order condition, we need to evaluate the second order condition wich is the second derivative of profit with respect to price and test its sign at the $p^*$.


```python
D2P = DP.diff(P)
D2P, D2P.is_negative
```




    (-2*b, True)



From the above sign we see that the second derivative is negative at all prices, so it is clearly going to be negative at any critical point we find.

356c9ddbe1bbac8e02ff463017d3a2b0be11893f
ipynb
Jupyter Notebook
assets/pdfs/math_bootcamp/notebooks/profit_max_linear_demand.ipynb
joepatten/joepatten.github.io
4b9acc8720f3a33337368fee719902b54a6f2f68
MIT
assets/pdfs/math_bootcamp/notebooks/profit_max_linear_demand.ipynb
joepatten/joepatten.github.io
4b9acc8720f3a33337368fee719902b54a6f2f68
MIT
2020-08-09T16:28:31.000Z
2020-08-10T14:48:57.000Z
assets/pdfs/math_bootcamp/notebooks/profit_max_linear_demand.ipynb
joepatten/joepatten.github.io
4b9acc8720f3a33337368fee719902b54a6f2f68
MIT
Qwen/Qwen-72B
1. YES
2. YES