Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Suppose I am trying to corner the market on hotdogs in a small suburb. I have evidence which suggests that the volume of hotdogs sold in the city each day is fixed and inelastic. Furthermore, I have evidence which suggests the price of a hotdog follows the triangular distribution, with particular values for parameters a, b, and c that I have estimated from another source.

The CDF of my triangular distribution would tell me the probability of a random hotdog being less than a particular price. Alternatively, I can interpret this as the proportion of the hotdog trading volume I can acquire by being willing to purchase hotdogs at or below some price. For example if I would like to capture 70% of the hotdogs sold today, I could set CDF[x]==0.7 and compute x, the most expensive hotdog I need to buy.

However, most of the hotdogs that I buy are not the most expensive. And thus the relationship between dollars spent and market control remains somewhat elusive. If I have N dollars, what percentage of the hotdogs available for sale can I buy?

My attempt

I think I can get the relationship by inverting and integrating the CDF. Wikipedia gives the CDF for the triangular distribution. If I calculate the inverse, I get

$$ InvCDF(x) = \begin{cases} \sqrt{x (b-a) (c-a)}+a & 0\leq x\leq \frac{c-a}{b-a} \\ b-\sqrt{(1-x) (b-a) (b-c)} & 1\geq x>\frac{c-a}{b-a} \\ a & x<0 \\ b & x > 1 \\ \end{cases} $$

Then I can integrate each piece. It's hairy.

$ f1(x') = \int_0^{x'} \left(\sqrt{x (b-a) (c-a)}+a\right) \, dx = \frac{2}{3} x' \sqrt{x' (a-b) (a-c)}+a x' $

$ f2(x'') = \int_{\frac{c-a}{b-a}}^{x''} b - \sqrt{(-a + b) (b - c) (1 - x)]} dx = -\frac{-b \left(2 x'' \sqrt{(x''-1) (a-b) (b-c)}-2 \sqrt{(x''-1) (a-b) (b-c)}+2 \sqrt{(b-c)^2}+3 c\right)+a (x''-1) \left(2 \sqrt{(x''-1) (a-b) (b-c)}-3 b\right)+3 b^2 x''+2 c \sqrt{(b-c)^2}}{3 (a-b)} $

$ TotalCost[percentage] = volume * f1\left(\min \left(percentage,\frac{c-a}{b-a}\right)\right)+volume * f2\left(\max \left(percentage,\frac{c-a}{b-a}\right)\right) $

I have tested this equation with some known parameters, and it provides reasonable results. So assuming that I haven't make a mistake somewhere, this seems to be a closed-form solution that tells me given some percentage of the market, how much it would cost to capture that proportion. But I seem to be having trouble extending this to find the inverse: given some amount of money, what percentage of the market is capturable? And the solution that I do seem to have is very, very hairy, even in the forwards case.

I observe that a lot of my trouble seems to come from the piecewise nature of the triangular distribution. Perhaps there is a continuous approximation I could use instead that would be easier to work with?

share|improve this question

1 Answer 1

I'm having trouble making sense of your notation.

f1 and f2 are being integrated with respect to x' and x'' respectively, but you've also altered the free variable in the applicable part of InvCDF. I don't think you meant to do this, and it shouldn't produce the result you obtained. Consider $ F(x) = \int_0^{x} f(x) \, dx $ for the particular case $ F(3) $ (let f(3) = c an element of the reals). $ F(3) = \int_0^3 f(3) \, dx = \int_0^3 c \, dx = cx|_0^3 = c(3) - c(0) = 3 c $. This is clearly not what you intended. Perhaps you didn't mean to alter the free variable?

In your TotalCost formula, you use the term 'volume'. I think you mean 'Area', but of what?

Finally, you should note that the domain of f1 and f2 is continuous and well defined IFF x' = x'' = $ \frac {c-a} {b-a} $, which results in f2 = 0 (This follows from your piecewise definition of InvCDF). It seems odd to me that you would want discontinuity in your domain, as this would seem to imply declining to purchase some intermediary group of hotdogs. Also, I question if f2 is well defined for percentage < $ \frac {c-a} {b-a} $ (from your use in TotalCost), since the equation you're integrating is not applicable over the range of integration.

A quick note on your 'continuous approximation' request: Your request devolves to a method for converting splines to continuous functions, which isn't possible. There may be a function for your particular equation set, but I don't understand that well enough to speculate further.

share|improve this answer
You're correct that my notation was wrong. I've updated the question. Volume = total quantity of hotdogs available for purchase. I agree with your assessment about the domains of the two functions. I believe that the use of min/max should constrain their use to appropriate range for percentage [0-1]. –  Drew Jun 16 '13 at 21:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.