How do you find the optimal price for a good or service? Obviously, it depends what you mean by optimal. And pricing is a hugely complex problem. But if your goal is narrowly defined to maximize expected profit based on a discrete choice logit model, this page has an elegant new solution.

We present a simple analytic formula for the optimal price in a discrete choice pricing model. Here, the optimal price is the one that maximizes the expected revenue (or profit), balancing the revenue versus the likelihood of purchase. This formula allows the optimal price to be quickly calculated precisely for each individual customer, for further analysis and action.


Discrete choice models are commonly used in market research to model purchase behavior. There are many variations of the discrete choice models, but the central idea here is that the probability of purchase depends on the price:

  • R_i is the price, i.e. revenue received if an individual customer i makes a purchase.
  • Pr(R_i) is the probability that customer i purchases the product at that price.

  • So the expected revenue is the revenue given purchase times the likelihood of purchase:
    E[R_i] = R_i \cdot Pr(R_i)
    If the focus of the analysis is maximizing gross revenue, then R_i is the actual price paid by the customer. If instead, the focus is maximizing net revenue, then R_i is the marginal profit received after direct expenses (the actual price that the customer sees may be higher). Fixed costs, if any, are constant with respect to price, and so can be excluded from this analysis.

    Discrete Choice Logit Model

    In the discrete choice logit model, the likelihood of purchase depends on a latent construct "utility", using the non-linear logit transform:

    Pr(R_i) = \frac{1}{1 + e^{-u_i}}
    The utility can't be directly observed, but may be inferred statistically from observed behavior. Typically, utility is a modeled as a linear function of price and other product/customer attributes:

    u_i = \alpha - \beta * R_i


    • \alpha is the utility of the product if free, given all other product/consumer attributes.
    • \beta is decrease in product utility for each unit increase in price.

    The probability of purchase is thus a non-linear transform of price:

    Pr(R_i) = \frac{1}{1 + e^{-(\alpha - \beta R_i)}}

    The discrete choice logit model is often useful in practice as it can be estimated via logistic regression from customer data, either via controlled experiement or from purchase history.

    Optimal price

    The optimal price R_i^* is the price which maximizes expected revenue from that customer :

    E[R_i] = R_i \cdot \frac{1}{1 + e^{-(\alpha - \beta R_i)}}

    This is a non-linear function. To find the optimal price, the most common approach is to simply try a number of different prices, and choose the one that yields the highest expected revenue. Algorithms such as Binary Search and Newton-Raphson can speed that up.

    It turns out this function can be maximized analytically. Per algebraic derivation by our intern Liam C. Walsh, the optimal price (with respect to expected total revenue) is a simple formula in terms of the Lambert W function:

    R_i^* = \frac { W(e^{\alpha-1}) + 1 } {\beta}

    Lambert W

    The Lambert W function is rooted in physics and widely implemented, e.g. in Mathematica, Matlab. We've ported the algorithm in the GNU Scientific Library from C to Javascript and published it to the Protobi GitHub repo. The graphs below are dynamically calculated in your browser using this library.

    Below is a graph of W(e^{x}) vs.x. Note the graph is nearly linear for large values of \alpha (i.e. when demand is high at zero price) and approaches zero asymptotically for low values of \alpha (i.e. when demand is low even at zero price).

    Plot W(exp(x)) vs x...

    Probability of purchase vs price

    The graph below shows the probability of purchase versus price for differing values of \alpha from -4.0 (i.e. unlikely to purchase even if free) to 6.0 (i.e. certain to purchase if free and even up to substantial prices), and holding the price sensitivity constant at \beta = 0.008.

    These values are chosen so that the curves are interesting over a price range of $0 to $1,000. Actually, these are very representative of the range of individual customers' base utilities and price sensitivity in an actual purchase behavior dataset. The formula is generally applicable to any feasible values of alpha and beta.

    Each curve can represent an individual customer. Some customers may be more likely to purchase a product than others, given their unique preferences and attributes. In fact, the origin of this analysis was precisely to estimate optimal discount offerings for individual customers, and the range of values here is very illustrative of the actual data.

    The dots superimposed on the graph show probability of purchase at the optimal price R_i^*.

    Expected revenue vs price

    The graph below shows the expected revenue versus price over the same values of \alpha from -4.0 (i.e. unlikely to purchase even if free) to 6.0 (i.e. certain to purchase if free and even up to substantial prices), and again holding price senstivity constant at \beta = 0.008. The dots superimposed show the expected revenue at the optimal price.


    It's interesting to see that for customers with higher values of latent utility, higher prices are optimal. But for customers who are increasingly unlikely to purchase even if free, the optimal price approaches a lower bound well above free. In fact, the minimum bound on optimal price is a function strictly of the price sensitivity:

    R_i^* > \frac{1}{\beta} \forall \alpha

    Conceptually, the lower bound can be interpreted as the price equivalent to one unit of utility. So even if the customer doesn't want the product at all, it's still optimal to price it well above zero.

    It's also interesting to see that the expected revenue at the optimal price appears to be a linear function of the optimal price.


    We present here a simple formula for optimal price in a discrete choice logit pricing model. It is applicable to a wide range of pricing studies. With simple adjustments, it can be applied to modeling discount instead of price.

    It can accommodate complex models with nesting and interaction effects. For most effects, interactions and nesting that do not involve price will be compiled into the \alpha term and constant for any one customer. Similarly, where these interactions and nesting do affect price, the customer has an individual \beta term.

    It is especially useful where price (or conversely discount) can be applied at the individual customer level, such as with hierarchical Bayes choice models, as this can avoid the need for complex or time consuming optimizations.

    Realistically, this formula may have been independently derived many times by others (as the Lambert W function itself has been). This is one of those things where we couldn't find that result in prior art, and it turned out to be easier (and way more fun) to derive it ourselves than to keep searching. Let us know at if you find this useful or know of a prior link.


    R.M. Corless, G.H. Gonnet, D.E.G. Hare, D.M. Jeffrey and D. E. Knuth, "On Lambert's W Function", Technical Report CS-93-03, University of Waterloo, January 1993.