When a firm sells a finite inventory over a finite horizon with stochastic demand, the optimal price rises as inventory depletes and drops sharply upon replenishment—producing the characteristic “sawtooth” pattern. This topic explores the foundational model of Gallego and van Ryzin (1994).
The Problem
Consider a firm that holds units of a perishable product and must sell them over a horizon of time periods. Customers arrive stochastically, and the probability that a customer purchases depends on the posted price. The firm can adjust the price at each time step but cannot produce additional inventory mid-horizon (except at scheduled replenishment times).
This setting arises in e-commerce flash sales, ride-sharing surge pricing, event ticketing, and cloud computing spot markets. The central question is: how should the price evolve over time as a function of remaining inventory and remaining time?
Unlike revenue management (which allocates capacity across fixed fare classes), dynamic pricing treats the price itself as the continuous control variable. Unlike markdown management (where prices can only decrease), dynamic pricing allows prices to move in either direction.
Mathematical Formulation
Demand Model
We model customer arrivals as a Poisson process with a price-dependent intensity. At price , the arrival rate is:
where is the base arrival rate (demand at price zero) and controls price sensitivity. This exponential specification ensures for all and gives a constant semi-elasticity: a one-unit increase in price always reduces the arrival rate by a factor of .
In discrete time, is interpreted as the probability that exactly one customer arrives and purchases in a single period (assuming the period is short enough that at most one arrival occurs).
Bellman Equation
Let denote the maximum expected revenue from time onward with units remaining. The dynamic programming recursion is:
with boundary conditions:
The first term in the Bellman equation is the expected payoff if a sale occurs: the firm collects price and continues with one fewer unit. The second term is the expected payoff if no sale occurs: the firm carries the same inventory into the next period.
The optimal price at state is:
The quantity is the opportunity cost of selling one unit—the marginal value of holding that unit for potential future sales. The optimal price balances the immediate revenue from a sale against this opportunity cost.
Structural Properties
1. Decreasing in inventory: for all . More inventory means lower prices.
2. Increasing as time elapses (for fixed inventory): when inventory remains constant. As the horizon shortens with unsold stock, the opportunity cost of a sale decreases, paradoxically suggesting lower prices—but combined with depleting inventory, prices typically rise.
These structural results mean that as inventory depletes during a selling cycle, prices rise monotonically. When new inventory arrives (replenishment), prices drop discontinuously. This creates the characteristic sawtooth shape in the price trajectory.
The Sawtooth Pattern
The sawtooth pattern emerges naturally from the interaction of two forces:
- Inventory depletion drives prices up. As units sell, remaining inventory becomes scarcer and more valuable. The opportunity cost rises, pushing the optimal price higher.
- Replenishment resets scarcity. When new inventory arrives, the system returns to a high-inventory state. The opportunity cost drops, and prices fall to attract demand and start the sell-through cycle again.
The resulting price path resembles a sawtooth wave: gradual upward slopes as inventory sells down, punctuated by sharp drops at replenishment events. This pattern is observable in ride-sharing surge pricing (where driver availability is the replenishable resource), e-commerce inventory cycles, and perishable goods pricing.
Interactive Explorer
The visualizations below implement the Gallego and van Ryzin dynamic pricing model. Adjust the parameters to observe how the optimal policy responds to changes in capacity, demand intensity, and replenishment timing.
Top panel: price trajectory over time. Bottom panel: inventory level. Observe how prices rise as inventory depletes and drop on replenishment. The simulation uses a seeded pseudo-random number generator for reproducibility.
Key Insights
- Scarcity drives prices. The optimal price is a decreasing function of remaining inventory. This is the fundamental mechanism behind surge pricing: when supply is constrained, the model recommends higher prices to ration demand.
- Dynamic pricing outperforms static pricing. The model shows that the optimal dynamic policy yields higher expected revenue than any fixed price, with the gap widening when demand is uncertain and capacity is tight.
- The opportunity cost is the key quantity. The optimal price is determined by the marginal value of inventory . Computing this value function is the computational core of the problem.
- Replenishment frequency shapes the pattern. More frequent replenishment leads to smaller sawtooth cycles with lower amplitude. In the limit of continuous replenishment, the price stabilizes at the static optimum.
- The model is computationally tractable. With periods, units, and 30 candidate prices, the state space has approximately 150,000 cells—solvable in milliseconds on modern hardware.
Extensions
- Continuous-time formulation. Gallego and van Ryzin (1994) originally posed the problem in continuous time with a Poisson arrival process. The continuous-time value function satisfies an ordinary differential equation whose solution provides upper bounds on the discrete-time model used here.
- Network dynamic pricing. When a firm sells multiple products that share inventory (e.g., airline network), the state space grows exponentially. Approximate dynamic programming and decomposition methods address this curse of dimensionality.
- Learning and exploration. When demand parameters are unknown, the firm faces a joint pricing-and-learning problem. Thompson sampling and upper confidence bound approaches adapt prices while estimating the demand curve.
- Strategic customers. If customers anticipate price changes, they may time their purchases strategically. Models that incorporate forward-looking customer behavior (Aviv and Pazgal (2008)) typically yield less aggressive price variation.
- Competition. When multiple firms dynamically price substitutable products, the problem becomes a differential game. Equilibrium prices depend on the number of competitors, their respective inventories, and the degree of product differentiation.
References
- Aviv, Y. & Pazgal, A. (2008). “Optimal Pricing of Seasonal Products in the Presence of Forward-Looking Consumers.” Manufacturing & Service Operations Management, 10(3), 339–359.
- Bitran, G. & Caldentey, R. (2003). “An Overview of Pricing Models for Revenue Management.” Manufacturing & Service Operations Management, 5(3), 203–229.
- den Boer, A. V. (2015). “Dynamic Pricing and Learning: Historical Origins, Current Research, and New Directions.” Surveys in Operations Research and Management Science, 20(1), 1–18.
- Gallego, G. & van Ryzin, G. (1994). “Optimal Dynamic Pricing of Inventories with Stochastic Demand over Finite Horizons.” Management Science, 40(8), 999–1020.
- Phillips, R. L. (2021). Pricing and Revenue Optimization, 2nd ed.. Stanford University Press.
- Talluri, K. T. & van Ryzin, G. J. (2004). The Theory and Practice of Revenue Management. Springer.
- Wittman, M. D. & Belobaba, P. P. (2019). “Dynamic Availability of Fare Products with Knowledge of Customer Context.” Journal of Revenue and Pricing Management, 18, 400–415.