Demand Curves and Price Elasticity
Price goes up, demand goes down
The most fundamental relationship in pricing is the demand curve: as price increases, the quantity demanded typically decreases. This isn’t a law of physics — there are exceptions — but it holds remarkably well across most markets.
Formally, we can write a demand function:
\[ Q(p) = a - b \cdot p \]
where \(Q\) is quantity demanded, \(p\) is price, and \(a\), \(b\) are parameters that depend on the market. This linear form is a simplification, but it’s a useful starting point.
Price elasticity of demand
Not all products respond to price changes the same way. A 10% increase in the price of salt barely changes how much people buy. A 10% increase in the price of a luxury handbag might cut demand significantly.
Price elasticity of demand captures this:
\[ \epsilon = \frac{\% \Delta Q}{\% \Delta p} = \frac{dQ}{dp} \cdot \frac{p}{Q} \]
- \(|\epsilon| > 1\): elastic — demand is sensitive to price (luxury goods, entertainment)
- \(|\epsilon| < 1\): inelastic — demand is insensitive to price (necessities, utilities)
- \(|\epsilon| = 1\): unit elastic — a special case where revenue is maximized
Computing elasticity in Python
Let’s make this concrete with a quick example:
import numpy as np
import matplotlib.pyplot as plt
# Linear demand: Q = 100 - 2p
a, b = 100, 2
prices = np.linspace(1, 45, 200)
demand = a - b * prices
# Elasticity at each price point
elasticity = -b * prices / demand
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4))
ax1.plot(prices, demand, color="#4a6fa5", linewidth=2)
ax1.set_xlabel("Price ($)")
ax1.set_ylabel("Quantity demanded")
ax1.set_title("Demand Curve")
ax2.plot(prices, np.abs(elasticity), color="#c44e52", linewidth=2)
ax2.axhline(y=1, color="#999", linestyle="--", alpha=0.7)
ax2.set_xlabel("Price ($)")
ax2.set_ylabel("|Elasticity|")
ax2.set_title("Price Elasticity")
plt.tight_layout()
plt.show()Why elasticity matters for pricing
If demand is elastic, lowering your price increases revenue — you sell enough additional units to more than offset the lower price. If demand is inelastic, raising your price increases revenue — you lose few customers.
The revenue-maximizing price occurs at unit elasticity (\(|\epsilon| = 1\)). For our linear demand curve:
\[ p^* = \frac{a}{2b} \]
With \(a = 100\) and \(b = 2\), the optimal price is $25.
# Revenue = p * Q = p * (a - b*p)
revenue = prices * demand
optimal_price = a / (2 * b)
optimal_revenue = optimal_price * (a - b * optimal_price)
plt.figure(figsize=(6, 4))
plt.plot(prices, revenue, color="#4a6fa5", linewidth=2)
plt.axvline(x=optimal_price, color="#c44e52", linestyle="--", alpha=0.7)
plt.annotate(
f"p* = ${optimal_price:.0f}\nR* = ${optimal_revenue:.0f}",
xy=(optimal_price, optimal_revenue),
xytext=(optimal_price + 5, optimal_revenue - 100),
arrowprops=dict(arrowstyle="->", color="#666"),
fontsize=10,
)
plt.xlabel("Price ($)")
plt.ylabel("Revenue ($)")
plt.title("Revenue vs. Price")
plt.tight_layout()
plt.show()Beyond linear demand
Real-world demand curves are rarely linear. Common alternatives include:
- Log-linear: \(\ln Q = a - b \ln p\) (constant elasticity)
- Exponential: \(Q = a \cdot e^{-bp}\)
- Logistic: useful when demand saturates at high or low prices
The choice of functional form matters — it determines how your model extrapolates outside the observed data range.
Next up
In the next post, we’ll use these ideas to build a complete pricing optimization model: estimate a demand curve from data, find the optimal price, and handle constraints like inventory limits.