aadi.ink

A Tiny Discount Calculation

Keywords: #fun
December 23, 2024

Suppose there are tiered discount rates: say 10%10\% up to 50005000, 15%15\% above 5000.5000. Now suppose I need things that cost bb before any discount is applied. Assuming b<5000b < 5000, I get the 10% discount, having to pay 90%×b90\% \times b. Could I perhaps add some more items to be eligible for the 15% discount and still end up paying less than 90%×b90\% \times b?

4250<90%×b    b>42500.9=4722.2ˉ . 4250 < 90\%\times b \iff b > \frac{4250}{0.9} = 4722.\bar{2}\ .

This inequality means that for initial (undiscounted) amounts of 4722.224722.22 or higher, adding exactly enough to reach 5000 will give me more stuff while costing less than the original.

85%×(b+x)<90%×b    85%×x<5%×b    x<b17 85\% \times (b+x) < 90\% \times b \iff 85\%\times x < 5\% \times b \iff x < \frac b{17}5000b<x<b17. 5000 - b < x < \frac{b}{17}.

This makes sense – xx needs to be large enough to get to 50005000, but not too much so that we can actually save money.

Great! But there’s a slight issue. Not all discounts are like this, so how do I decide next time when there’s something else I want and the store is throwing a similar puzzle at me? Let’s generalise more! Let r1<r2r_1 < r_2 be the discount rates, tt be the threshold between them. Repeating the previous calculations:

(1r1)b>(1r2)(b+x)    (r2r1)b>(1r2)x(1-r_1)b > (1-r_2)(b+x) \iff (r_2-r_1) b > (1-r_2)x    x<b×r2r11r2. \iff x < b\times\frac{r_2-r_1}{1-r_2}.(r2r1)b>(1r2)x.(r_2-r_1)b > (1-r_2)x.

(r2r1)b(r_2-r_1)b is the extra savings on the original amount by getting the higher discount rate. That should be more than the amount we end up paying for the extra discount which is (1r2)x(1-r_2)x! I find it beautiful that all we did was start with a condition we want and then manipulate it to get a different but equivalent condition. This new condition somehow says more than the original. Seems so obvious now but somehow it wasn’t so obvious in the beginning – at least to me.

tb<x<b×r2r11r2    t<x+b<b×1r11r2. t-b < x < b \times \frac{r_2-r_1}{1-r_2}\iff t < x + b < b\times\frac{1-r_1}{1-r_2}.

Let’s flip sides: suppose I am a corporate salesperson and I don’t want the discounts to be such that people get more stuff and still for literally less money. Can I still have a tiered discount rate but make this impossible?

Putting this in terms of our earlier notation, we want (r2r1)b(1r2)x(r_2-r_1) b \le (1-r_2)x for all xx and all bb such that x+b>tx+b> t. But we have variables on both sides of this inequality (bb on the left, xx on the right) and hence no matter what r1,r2r_1, r_2 are, we can make xx really small, and bb really large to be able to satisfy this inequality. This is assuming 1r2>0,r2>r11-r_2 > 0, r_2 > r_1. If we make r2<r1r_2 < r_1 then the left side is always negative so this inequality always fails – so that’s one way to do what we want: reduce the discount offered for higher amounts spent. But that’s ridiculous, right? As a salesperson we want to encourage more expenditure. The next assumption to break is r2>1r_2 > 1 but that’s a discount rate of more than 100% – paying people for buying stuff will surely not help the profit margin.

What else could I do? Remember the last condition that was there just for completeness? Well, if that inequality exists, but no product (or combination of products) can actually cost enough to add up to a value between those two bounds (tbt-b and b×r2r11r2b\times \frac{r_2-r_1}{1-r_2}) then we can still advertise a sensible tiered discount but ensure that every upsell actually makes the company more money instead of less. The most straightforward way to go about this would be to restrict the discount such that it applies only to products above a certain price point, or only for certain combinations.

Let me try to make an example. Keeping numbers simple: r1=0,r2=0.25r_1 = 0, r_2 = 0.25. This reduces the condition to  tb<x<b3.\ t-b < x < \frac{b}{3}. Suppose all products cost 499 (or multiples of 499 like 999, 1499, etc.) but the threshold is t=1000.t=1000. bb can only be 0,499,9980, 499, 998 or 999999 before crossing the threshold. So b/3b/3 can be 0, 166, 3330, ~166, ~333. None of these are above the minimum 499499, so x<b/3x< b/3 is impossible! The only way to cross the threshold is to buy three things worth 499499 each, but then the 25% discount cuts down the price by 1/4, not 1/3. That verifies the example!