# Visualisation of Riemann-Stieltjes-Integrals

The Riemann-Stieltjes-Integral $\int_a^bf(x)dg(x)$ is a generalization of the Riemann Integral. It is e.g. heavily used as a starting point for stochastic integration. The approximating Riemann-Stieltjes sums are analog to the Riemann sums $\sum_{i=0}^{n-1}f(c_i)(g(x_{i+1})-g(x_i))$ where $c_i$ is in the $i$-th subinterval $[x_i,x_{i+1}]$.

The Riemann-sums can be very intuitively visualized by rectangles that approximate the area under the curve. See e.g. Wikipedia:Riemann sum

Unfortunately I cannot find respective intuitive visualizations of the Riemann-Stieltjes sums.
My question: Could anyone provide me with some literature, pictures, links, or esp. tools (e.g. Mathematica or even Excel) with which I could play around to get a similar intuition for this more general kind of integral.

-
You should think of dg as a kind of density; for example, you might imagine the plane to be a sheet whose density depends on the x-coordinate only and then the Riemann-Stieltjes integral is just the total weight of the area under a curve. –  Qiaochu Yuan Feb 7 '10 at 19:01

It's fairly easy to visualize the Riemann–Stieltjes integral $\int_a^b f(t)\,dg(t)$ [I changed the name of the integration variable for convenience below] if $f\ge0$ and $g$ is nondecreasing. Just draw the graph of the curve $(x,y)=(g(t),f(t))$. The integral is just the area below the curve. (Whenever $g$ makes a jump at some $t_0$, fill in the gap by setting $y=f(t_0)$ there.) The Riemann–Stieltjes sums are now easy to visualize as sums of areas of rectangles (details left as an exercise).

-
Thank you for this answer - it is very intuitive. On the other hand I still have a problem with it: When you e.g. have $\int t\ d(t^2)$ taking your method yields a Sqrt-Function. The area under a Sqrt is $2\ t^{3/2}\over 3$. On the other hand we know that $\int f(t)dg(t)=\int f(t)g'(t)dt$ which yields $2\ t^3\over 3$ as area - so something completely different. So where is my (presumably silly) error in reasoning: Please give me a hint how to solve this paradox. –  vonjd Feb 8 '10 at 7:09
You expressed the answer in different variables, that's why. The first method gives the curve $(x,y)=(t^2,t)$, or $y=x^{1/2}$ as you observed. Express your answer as $\frac{2}{3}x^{3/2}$ and think on the relation between $x$ and $t$ for a moment. –  Harald Hanche-Olsen Feb 8 '10 at 12:52
Sorry, but I still don't get it because the relationship between x and t seems to be quite straightfoward: They are equal, aren't they. One (your) answer is $y=x^{1/2}$ but the other one is $y=2x^2$ (the latter coming from pulling the $g(x)=x^2$ into the integral and thereby changing the $dg(x)$ to $dx$: the x in the integral is then multiplied by $g'(x)=2x$ to end with $2x^2$ in the integral. The area here therefore is ${2 x^3} \over3$. –  vonjd Feb 8 '10 at 14:54
The relationship between $x$ and $t$ is indeed straightforward: $x=t^2$ (also, $y=t$). Here $t$ is used to parametrize the curve. Substituting $x=t^2$ into the value of the integral $\frac{2}{3}x^{3/2}$ I get $\frac{2}{3}t^3$. Maybe you're confused because we haven't named the limits of integration? Say you want $\int_0^\tau t\,d(t^2)$. As $t$ runs from 0 to $\tau$, $x$ varies from $0$ to $\xi=\tau^2$. The integral is $\frac{2}{3}\tau^3=\frac{2}{3}\xi^{3/2}$. (This argument needs a drawing.) –  Harald Hanche-Olsen Feb 8 '10 at 16:09
See drawing here: math.ntnu.no/~hanche/tmp/2010-02-08_mo.pdf –  Harald Hanche-Olsen Feb 8 '10 at 16:21

Well the amusing example is fundamental to analytic number theory, because any sum of a smooth function can be written as a stieltjes integral. Here is a typical use: Say we want to estimate the $\sum_{p \leq x} f(p)$ where $f$ is a nice smooth, positive, decreasing function (say faster than $1/x$), and the summation is taken over the primes. Then by Stieltjes non-sense (this is essentially Ilya's example but slightly more elaborate): $\sum_{p \leq x} = \int_{3/2}^{x} f(t) \text{d}\pi(t)$ where $\pi(t)$ is the prime counting function. By using "integration by parts for Stieltjes integrals" the previous integral is equal to $f(x) \pi(x) - \int_{3/2}^{x} \pi(t) \text{d}f(t)$. When $f$ is a nice differentiable function we have that $\text{d}f(t) = f'(t) \text{d}t$. Thus the previous integral simply equals to $f(x) \pi(x) - \int_{3/2}^{x} \pi(t) f'(t) \text{d}t$. Now we know that $\pi(x) \sim \frac{x}{\log(x)}$ so putting this inside the integral and assuming that $f$ is not too bad (i.e let's say $f$ decreasing and in size about $1/x$, but not as small as to make our integral constant) we get that $$\sum_{p \leq x} f(p) \sim - \int_{3/2}^{x} \frac{t f'(t)}{\log(t)} \text{d}t$$ (the minus sign is there because we assume $f$ to be decreasing; in the increasing case the procedure described above doesn't work so well because the term $f(x)\pi(x)$ and the integral $\int_{3/2}^{x} \pi(t)f'(t) \text{d}t$ give a contribution of roughly equal size, so when we approximate $\pi(t)$ we are (usually) left only with the error term). If you take $f(x) = 1/x$ then a simple consequence of the above result is that $$\sum_{p \leq x} \frac{1}{p} \sim \log\log(x)$$. I hope this example was worthwhile... (I know you asked for visualization but I think this is a good example of actual use, maybe it will be helpful)

-

First of all, you can think of this integral using almost the same picture. The only difference is that instead of summing just the areas of the rectangles, you first multiply each area by $g(x_{i+1})-g(x_i)$ and then add.

The idea is that we no longer consider the real line as having the same "weight" everywhere; some parts are now "more important" than others. When we did usual integration, we assigned the the piece of the line between $x_i$ and $x_{i+1}$ the weight $x_{i+1}-x_i$, exactly proportional to its length. Now, instead, this same piece is given weight $g(x_{i+1})-g(x_i)$.

In particular, if we picked g so that $g(x)=x$ for all x, we would get the regular integral back. If g were constant, all integrals would become zero; no part of the real line would matter at all.

Final amusing example if g(x)=0 for $x \leq 0$ and g(x)=1 for $x > 0$, then no part of the line matters except the origin. For simplicity, suppose some $x_i=0$. Then, our Riemann-Stjeltes sum will be: $$\sum_{i=-n}^n f(x_i)\cdot \underbrace{(g(x_{i+1})-g(x_i))}_{\text{not 0 only if }x_i=0} = f(0)$$no matter what our step is. So, the integral of any function f will be f(0). (The function will need to be continuous for integrals to be well-defined, as always)

But, I think what you are really missing is the concept of a measure, at least an intuitive one. It takes a bit of work to learn, but makes understanding all kinds of integration much easier. My favorite source for this is the dirt-cheap book by Kolmogorov-Fomin (you'd need to look at the last couple of chapters, and to reference the first chapters episodically), but it would certainly require some time and might be more than you need. Ideally, just take a graduate-level (or similar) analysis course.

-