Eklavya's Blog

Pricing Mechanisms and the Riemann-Stieltjes Integral

Imagine we are trying to sell a sack of rice. We want to make as much money from this sale as possible. What should we do? This is an important problem in the field of mechanism design, which is a part of game theory. I was studying this problem in a very simple setting, and came across some very interesting math while doing so. In this article, I will share my mathematical journey. I won't talk much about the mechanism design part to keep this article accessible to a broad audience.

Posted-Price Mechanisms

Let's consider the simplest case where there is exactly one person in the world who wants to buy what we're selling. One of the simplest and most obvious mechanisms is a posted-price mechanism. Here we set a price for the item. We then offer two options to the buyer:

  1. purchase: The buyer gets the item and pays us dollars.
  2. decline: The buyer doesn't get the item and we don't get any money.

We expect the buyer to pick the option that's more preferable to them. Specifically, the buyer has a value for the item. If , they will purchase it, otherwise they will decline.

If we knew , we would set the price as , so that we can earn as much money as possible. Unfortunately, we often do not know . But sometimes we know a probability distribution over (e.g., based on past data or experience), and we want to maximize the expected value of our revenue.

Let us take an example. Suppose is 2 with probability and 4 with probability .

  • If the price is more than 4, the buyer would not want to purchase, so our revenue would be .
  • If the price is at most 2, the buyer will definitely purchase, so our revenue would be .
  • If the price is more than 2 and at most 4, the buyer will purchase with probability , and our expected revenue would be .

If we set , our revenue would be , and it is easy to see that there is no other way to set the price such that the revenue is more than . Hence, is the optimal price and the optimal expected revenue is .

In general, our revenue is with probability and with probability . Hence, the expected value of our revenue is . We should set to a value such that this expression is maximized.

Truthful Single-Parameter Mechanisms

Now let's consider a totally different kind of mechanism, called a single-parameter mechanism. We give the buyer fraction of the good and charge them dollars. Here is called the allocation function and is called the revenue function. We require to be 0.

Now you may wonder, "To charge them dollars, we would need to know the value of . How would we know that?". That's a good question, but answering that is beyond the scope of this article. If you're curious, read Tim Roughgarden's lectures 3 and 5 on Algorithmic Game Theory [1]. For now, assume that we can know the value of if the mechanism is truthful, i.e., for every , we have where .

Observe that posted-price mechanisms can also be viewed as single-parameter mechanisms. If the item has price , then and . (Here is defined to be 1 if proposition is true and 0 if is false.) One can check that posted-price mechanisms are also truthful.

Now comes the main question: Are there truthful single-parameter mechanisms that can give us a larger expected revenue than posted price mechanisms? In other words, we want to find a mechanism such that is maximized. Here is a random variable from a known distribution.

An Informal Solution

I'll first solve this problem without regards to mathematical rigor. This will provide the necessary intuition. We will then look at how to formalize these arguments, and that's where things get really interesting if you like real analysis.

We first give a characterization of all truthful mechanisms.

Lemma 1: Mechanism is truthful iff is non-decreasing and

Proof. Suppose is truthful. Then, by definition, must be non-decreasing. By making get arbitrarily close to , we get (i.e., the derivative of at is ). implies . Hence, , and so, .

Now suppose is non-decreasing and . Then , so for any , we get

Now let's compute the expected revenue. Assume that the cumulative distribution of is and the probability density function of is , i.e., and .

Lemma 2: The expected revenue of a truthful mechanism is

Proof. First, using integration by parts, we get Then, (Here we swapped the integration order.)

Lemma 3: is a revenue-maximizing truthful mechanism iff and , where is the value for which is maximum.

(Does this solution look familiar? This is exactly the posted-price mechanism at price ! Hence, no truthful single-parameter mechanism does better than the best posted-price mechanism.)

Proof. We need to find a non-decreasing allocation function for which is maximized. This means for all and .

This is similar to the problem where we are given a vector and we must find a vector such that and is maximized. The solution is to find the index at which is maximum, i.e., for all , and then set . Then would equal .

We just carry over this idea from sums to integrals. We first find such that is maximized. Then we want to concentrate all the mass at , i.e., is extremely large and for all . This is the same as saying . Using Lemma 1, we get . Then the pair gives us the maximum revenue among all truthful single-parameter mechanisms.

Another result, which would be useful later, is that in truthful mechanisms, the revenue function is non-decreasing.

Lemma 4: If is a truthful mechanism, then is non-decreasing in .

Proof. Since is truthful, for all , we get Since is non-decreasing in truthful mechanisms, we get that for all . Hence, is non-decreasing.

Need for Mathematical Rigor

You may have noticed a lot of problems with the proofs above.

  • In Lemma 1's proof, we assumed that is well-defined, i.e., is differentiable at .
  • In Lemmas 2 and 3, we assumed that is differentiable. (But for posted-price mechanisms, we know that is not differentiable!)
  • We assumed that is a continuous random variable. What if is a discrete random variable, or it is neither discrete nor continuous?

Even though the above proofs are wrong, I think the facts are still true, we just have to find proper proofs.

There is one more problems with the above proofs: we need to define integration appropriately.

High school math generally defines integrals like this: is defined to be , where is the anti-derivative of , i.e., for all . But this definition is problematic.

For posted-price mechanisms, . To compute , we must find . We can't use the high-school definition since there is no differentiable function whose derivative at is for all . Intuitively, should be , but this function is not differentiable at (the left derivative is 0 and the right derivative is 1).

We have used integrals extensively in the proofs above, but for them to make sense, we must first define integration appropriately. I had taken a course in real analysis at UIUC, so this wasn't hard for me: one can just use Darboux integrals or Riemann integrals here, and that would easily fix Lemma 1.

But fixing Lemmas 2 and 3 is really tough.

Preliminaries: sup and inf

If you have taken a course in real analysis, you can skip this section (and maybe the next one too). Otherwise, to understand the rest of the post, you must have a good grasp over infimum and supremum, which I will explain here.

Some sets do not have a minimum. E.g., the smallest element in the interval is 3, but does not have a smallest element. In situations where we require a set to have a minimum but it doesn't have one, we can generally use the infimum instead.

Let and . is called a lower bound on if for all . A number is called the greatest lower bound of (aka the infimum of , denoted as ) if for every lower bound of . E.g., the greatest lower bound of is 3.

Does every set have an infimum? If is empty, then no. But what if is non-empty? may not have any lower bound, e.g., the set . In that case we say that . But what if has a lower bound? Then yes, always has an infimum, and this is an axiom of real numbers: If a non-empty set of real numbers has a lower bound, then it has a greatest lower bound.

We can similarly define the least upper bound of , also called the supremum of , denoted as . If , then always exists: if has no upper bound, and is a real number otherwise.

Darboux Integrals and the Proof of Lemma 1

A standard way to define integration is through Darboux integrals. You will find this in many textbooks and lecture notes on real analysis [2].

For any integer , define as the set .

Definition 1 (Darboux integral):

  • Let be a function.
  • Let be a sequence of numbers where . The lower and upper Darboux sums of on , denoted by and , respectively, are defined as follows: If , then . Otherwise,
  • Let . Then is called the set of partitions of .
  • The lower and upper Darboux integrals of are
  • If , then is said to be Darboux integrable on , and we denote and by or .

Here are some useful properties of Darboux integrals of the function . Proofs can be found in standard texts on real analysis (e.g., [2]).

  1. .
  2. For , we have and .
  3. Suppose for all . Then .
  4. If is non-decreasing, then is integrable over .

Armed with these results, we are ready to prove Lemma 1 rigorously.

Proof of Lemma 1.
Suppose is non-decreasing and for all . We have to prove that is truthful. For any , we get Hence, is truthful.

Suppose is truthful. Then is non-decreasing, and for all , we have where .

Pick any . Let . Then for all , we get Hence, and Since , we get , and thus, . Hence, and .

Since is non-decreasing, is integrable over , and so, . Hence, for any , we have .

The Weighted Darboux Integral

Proving Lemma 2 is trickier. We need to somehow deal with in the lemma statement.

My original idea was to modify the Darboux integral. For any function and any non-decreasing function , to change to , in and , I changed to .

I initially thought that I had come up with a nice generalization of Darboux integrals, which I named weighted Darboux integrals, but I later realized that this idea has been studied before by Riemann and Stieltjes.

Definition 2 (Weighted Darboux integral):

  • Let be functions where is non-decreasing.
  • Let where . Then the lower and upper weighted Darboux sums of on with weight , denoted by and , respectively, are defined as follows: If , then . Otherwise,
  • Let . is called the set of partitions of .
  • The lower and upper weighted Darboux integrals of with weight are
  • If , then is said to be -Darboux integrable on , and we denote and by .
  • When is the identity function, we write and instead of and , respectively. If , we denote them by .

Once again, we can prove some simple properties for , where is non-decreasing:

  1. .
  2. For , we have and .
  3. Suppose for all . Then .

Unfortunately, every non-decreasing function may not be integrable now if the weight function is discontinuous.

Example 1:

  • Let for , , and for .
  • Let for and for .

Pick any partition . We now have two cases:

  1. for some . Then and .
  2. for some . Then and .

Hence, and , so is not -integrable over .

But why is this example concerning? We can prove that if either or is continuous, and is non-decreasing, then is -integrable, so in Lemma 1, is still well-defined.

However, I was thinking of using weighted Darboux integrals to define expected value. For a positive random variable with cumulative distribution function (i.e., ), one could define as

Let be a random variable that takes value with probability 1 (i.e., it's not random at all). Then its cumulative distribution function is from Example 1. Then one would expect to equal , which is , but the integral defining doesn't exist by Example 1.

Also, in Lemma 2, I want the integral to exist for all , but I can't think of a way of guaranteeing that (unless we change the definition of weighted Darboux integrals.)

A Second Attempt at Weighted Darboux Integrals

Let's try to define Darboux integrals again, but this time, we will explicitly take discontinuities into account.

Let be a non-decreasing function. For any , let , and for any , let .

One can easily show that for all , for all , and for all .

Definition 3 (Jump-aware weighted Darboux integral):

  • Let be functions where is non-decreasing.
  • Let where . Then the jump, lower, and upper weighted Darboux sums of on with weight , denoted by , , and , respectively, are defined as follows: If , then . Otherwise,
  • Let . is called the set of partitions of . The lower and upper weighted Darboux integrals of with weight are
  • If , then is said to be -Darboux integrable on , and we denote and by .

Most simple properties that one might expect weighted Darboux integrals to have, the jump-aware weighted Darboux integrals have them too. See my notes [4] for formal statements and proofs.

Additionally, one can show that all monotone functions are integrable in this model [4]. It also evaluates as in Example 1. So far, this new definition of weighted Darboux integrals seems to have fixed the problems that the previous definition had. Now let's get back to trying to formalize Lemma 2.

Formalizing Lemma 2

First, let's show that integration by parts holds in our model, because we use it in the first step of our proof. We would like to show that for two non-decreasing functions , we have Unfortunately, this isn't true, even when .

Example 2: Let if , , and for . Then one can show that , but .

Fortunately, I could prove that integration by parts holds if either or is continuous [4]. And in Lemma 2, we apply integration by parts on and , and is continuous. So things still work out (for now), and we get that for all .

First, we would like to ensure that is well-defined. Or at least, we want to ensure that exists for all , where is the cumulative distribution function of . This integral exists since is non-decreasing by Lemma 4.

Next, I wanted to prove that we can exchange the order of integration. But I couldn't prove it.

And then it struck me; Lemma 2 is wrong! Consider posted price mechanisms. There, the expected revenue is . But for all , evaluates to . Maybe we should use instead of in Lemma 2's statement, where ? (Note that for all and for all . , but is not defined.)

I discovered an edge case that was spoiling the definition of expected value. For a positive random variable , defining as , where seems to work fine, but if is non-negative, and can take a value of 0 with positive probability, then this definition doesn't work. We can fix it by adding the term to the integral, or we can define as , where .

With these fixes, Lemma 2 seems to be true for posted price mechanisms, i.e., for and , we get and for all .

However, Lemma 2 is still wrong. Consider a different mechanism: for any , define Then Suppose is with probability 1. Then . However, for any function and any , we have . For this integral to equal , we must have . Hence, we cannot have be or or anything independent of .

Fixing Lemma 2

We will soon see that Lemma 2 doesn't hold only if for some .

Let be a truthful mechanism. Then is non-decreasing and for all by Lemma 1. Let be a different allocation function. Note that is also non-decreasing. Let for all . Then is also a truthful mechanism by Lemma 1.

Lemma 5: for all .

Proof. . Let for all . We will show that for all , which would complete the proof.

Pick any . Let for . Then , and By making arbitrarily large, we can make infinitesimally small. Hence, . Hence, for all .

Lemma 6: Let and let . Then is right-continuous, i.e., for all .

Proof. Pick any . Then such that . Now, . Since we can make as small as we want, we get .

Lemmas 5 and 6 tell us that for every allocation function, there is a right-continuous allocation function whose revenue is greater or equal. Hence, from now on, we assume that the allocation function is right-continuous.

In my notes [4], I prove that the product of two bounded integrable functions is also integrable. Moreover, I prove the following result, that helps us do double integration.

Lemma 7: Let be non-decreasing functions and be right continuous, i.e., for all . Let for some such that . Let , where . (Then is monotonic by 's non-negativity, so is -integrable over .)

Let for all , and let . (Then is -integrable over , since is -integrable and is non-increasing.) Then .

Using Lemma 7, we get that if is truthful and is right-continuous, then the expected revenue is (Recall that is the cumulative distribution function of .) Hence, Lemma 2 holds after slight modification.

Lemma 3

Let's now get to Lemma 3.

Define . Then for any truthful mechanism where is right-continuous, we get

Hence, the expected revenue of any truthful mechanism is at most . Moreover, if is the posted-price mechanism with price , then , so the maximum revenue we can get using posted-price mechanisms is . Hence, posted-price mechanisms are optimal.

Conclusion

This took several days to figure out and almost drove me mad. The informal proof is so simple, yet the formal proof is so long and requires deep insight into real analysis.

References

  1. Tim Roughgarden. Twenty Lectures on Algorithmic Game Theory.
    Cambridge University Press, 2016, ISBN: 9781316781173.
    Link to free versions:
  2. David Galvin. Section 10: The Darboux Integral.
    Lecture notes for Math 10860 (Honors Calculus II) at the University of Notre Dame, Spring 2020.
  3. Joel Feldman. Lecture notes for Math 321 (Real Variables II),
    University of British Columbia, 2016.
  4. Eklavya Sharma. My notes on weighted Darboux integrals.